aboutsummaryrefslogtreecommitdiff
path: root/hw
AgeCommit message (Collapse)Author
2012-11-16ehci: handle dma errorsGerd Hoffmann
Starting with commit 1c380f9460522f32c8dd2577b2a53d518ec91c6d dma transfers can actually fail. This patch makes ehci keep track of the busmaster bit in pci config space, by setting/clearing the dma_context pointer. Attempts to dma without context will result in raising HSE (Host System Error) interrupt and stopping the host controller. This patch fixes WinXP not booting with a usb stick attached to ehci. Root cause is seabios activating ehci so you can boot from the stick, and WinXP clearing the busmaster bit before resetting the host controller, leading to ehci actually trying dma while it is disabled. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-11-16ehci: keep the frame timer running in case the guest asked for frame list ↵Gerd Hoffmann
rollover interrupts Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-11-16ehci: Don't verify the next pointer for periodic qh-s and qtd-sHans de Goede
While testing the move to async packet handling for interrupt endpoints I noticed that Windows-XP likes to play tricks with the next pointer for periodic qh-s, so we should not fail qh / qtd verification when it changes. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-11-16ehci: Better detection for qtd-s linked in circlesHans de Goede
Windows links interrupt qtd-s in circles, which means that when interrupt endpoints return USB_RET_ASYNC, combined with the recent "ehci: Retry to fill the queue while waiting for td completion" patch, we keep adding the tds to the queue over and over again, as we detect the circle from fill_queue, but we call it over and over again ... This patch fixes this by changing the circle detection to also detect circling into tds already queued up previously. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-11-16ehci: Fixup q->qtdaddr after cancelling an already completed packetHans de Goede
This avoids the q->qtdaddr == p->qtdaddr asserts we have triggering, when a queue contains multiple completed packages when we cancel the queue. I triggered this with windows7 + async interrupt endpoint handling (*) + not detecting circles in ehci_fill_queue() properly, which makes the qtd validation in ehci_fill_queue fail, causing cancellation of the queue on every mouse event ... *) Which is not going upstream as it will cause loss of interrupt events on migration. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-11-16ehci: Don't access packet after freeing itHans de Goede
ehci_state_writeback() will free the packet, so we should not access the packet after calling ehci_state_writeback(). Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-11-16usb: host-linux: Ignore parsing errors of the device descriptorsJan Kiszka
The Linux is more tolerant here as well: Just stop parsing the device descriptors when an error is detected but do not reset what was found so far. This allows to run buggy devices with partially invalid descriptors. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-11-16usb-host: scan for usb devices when the vm startsGerd Hoffmann
Commit a844ed842d9a9d929645c09ae0f52f753d7a02e0 leads to usb-host detecting devices not right after qemu startup because the guest isn't running yet. Instead they are found on the first of the regular usb device poll runs. Which is too late for seabios to see them, so booting from usb sticks fails. Fix this by adding a vm state change handler which triggers a device scan when the vm is started. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-11-16usb: Fix (another) bug in usb_packet_map() for IOMMU handlingDavid Gibson
Elements in qemu SGLists can cross IOMMU page boundaries. So, in commit 39c138c8420f51a7da7b35233a8d7400a0b589ac "usb: Fix usb_packet_map() in the presence of IOMMUs", I changed usb_packet_map() to split up each SGList element on IOMMU page boundaries and each resulting piece of qemu's memory space separately to the iovec the usb code uses internally. That was correct in concept, but the patch has a bug. The 'base' variable correctly steps through the dma address of each piece, but then we call the dma_memory_map() function on the base address of the whole SGList element every time. This patch fixes at least one problem using XHCI on the pseries guest machine. It didn't affect OHCI because that doesn't use usb_packet_map(). In theory it also affects EHCI, but we haven't observed that in practice. I think the transfers were small enough on EHCI that they never crossed an IOMMU page boundary in practice. Signed-off-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-11-16fix live migrationGerd Hoffmann
Commit 1c380f9460522f32c8dd2577b2a53d518ec91c6d breaks live migration. DMA stops working for ehci (and probably for any pci device) after restoring the guest because the bus master region never gets enabled. Add code doing that after loading the pci config space from vmstate. Cc: Avi Kivity <avi@redhat.com> Cc: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-11-15mips/malta: fix CBUS UART interrupt pinAurelien Jarno
According to the MIPS Malta Developement Platform User's Manual, the i8259 interrupt controller is supposed to be connected to the hardware IRQ0, and the CBUS UART to the hardware interrupt 2. In QEMU they are both connected to hardware interrupt 0, the CBUS UART interrupt being wrong. This patch fixes that. It should be noted that the irq array in QEMU includes the software interrupts, hence env->irq[2] is the first hardware interrupt. Cc: Ralf Baechle <ralf@linux-mips.org> Reviewed-by: Eric Johnson <ericj@mips.com> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2012-11-14Merge remote-tracking branch 'awilliam/tags/vfio-pci-for-qemu-1.3.0-rc0' ↵Anthony Liguori
into staging vfio-pci: KVM INTx accel & common msi_get_message * awilliam/tags/vfio-pci-for-qemu-1.3.0-rc0: vfio-pci: Use common msi_get_message vfio-pci: Add KVM INTx acceleration linux-headers: Update to 3.7-rc5 Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2012-11-14Merge remote-tracking branch 'bonzini/scsi-next' into stagingAnthony Liguori
* bonzini/scsi-next: virtio-scsi: use dma_context_memory dma: Define dma_context_memory and use in sysbus-ohci megasas: Correct target/lun mapping scsi-disk: flush cache after disabling it megasas: do not include block_int.h scsi: remove superfluous call to scsi_device_set_ua virtio-scsi: factor checks for VIRTIO_SCSI_S_DRIVER_OK when reporting events scsi: do not return short responses for emulated commands Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2012-11-14Merge remote-tracking branch 'kraxel/usb.70' into stagingAnthony Liguori
* kraxel/usb.70: ehci: fix migration xhci: Fix some DMA host endian bugs usb/combined-packet: Move freeing of combined to usb_combined_packet_remove() xhci: Add support for packets with both data and an error status ehci: Add support for packets with both data and an error status ehci: Get rid of the magical PROC_ERR status usb-redir: Allow packets to have both data and an error-status usb: split packet result into actual_length + status Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2012-11-14Merge remote-tracking branch 'spice/spice.v63' into stagingAnthony Liguori
* spice/spice.v63: spice: fix initialization order pflib: unused, remove it. spice: switch to pixman qxl: call dpy_gfx_resize when entering vga mode qxl: fix cursor reset hw/qxl: qxl_send_events: nop if stopped hw/qxl: guest bug on primary create with stride %4 != 0 Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2012-11-13vfio-pci: Use common msi_get_messageAlex Williamson
We can get rid of our local version now that a helper exists. Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
2012-11-13vfio-pci: Add KVM INTx accelerationAlex Williamson
This makes use of the new level irqfd support enabling bypass of qemu userspace both on INTx injection and unmask. This significantly boosts the performance of devices making use of legacy interrupts (ex. ~60% better netperf TCP_RR scores for an e1000e assigned to a Linux guest and booted with pci=nomsi). This also avoids flipping mmaps on and off to simulate EOIs, so greatly improves performance of device access in addition to interrupt latency. Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
2012-11-12virtio-scsi: use dma_context_memoryPaolo Bonzini
Until address_space_rw was introduced, NULL was accepted as a placeholder for DMA with no IOMMU (to address_space_memory). This does not work anymore, and dma_context_memory needs to be specified explicitly. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-11-12dma: Define dma_context_memory and use in sysbus-ohciPeter Maydell
Define a new global dma_context_memory which is a DMAContext corresponding to the global address_space_memory AddressSpace. This can be used by sysbus peripherals like sysbus-ohci which need to do DMA. In particular, use it in the sysbus-ohci device, which fixes a segfault when attempting to use that device. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
2012-11-12megasas: Correct target/lun mappingHannes Reinecke
The structure to reference a logical drive has an unused field, which can be used to carry the lun ID. This enabled seabios to establish the proper target/LUN mapping. Cc: Paolo Bonzini <pbonzini@redhat.com> Cc: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Hannes Reinecke <hare@suse.de> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-11-12scsi-disk: flush cache after disabling itPaolo Bonzini
SBC says that "if an application client changes the WCE bit from one to zero via a MODE SELECT command, then the device server shall write any data in volatile cache to non-volatile medium before completing the command". Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-11-12megasas: do not include block_int.hPaolo Bonzini
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-11-12scsi: remove superfluous call to scsi_device_set_uaPaolo Bonzini
Suggested by Laszlo Ersek. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-11-12virtio-scsi: factor checks for VIRTIO_SCSI_S_DRIVER_OK when reporting eventsPaolo Bonzini
Suggested by Laszlo Ersek. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-11-12scsi: do not return short responses for emulated commandsPaolo Bonzini
The inquiry command, for the case of VPD=1, was returning short responses; the number of returned bytes was just the number of bytes in the request, without padding to the specified allocation length with zero bytes. This is usually harmless, but it is a violation of the SCSI specification. To fix this, always pad with zero bytes to r->cmd.xfer in scsi_disk_emulate_command, and return at most r->buflen bytes (the size of the buffer for command data) rather than at most buflen bytes (the number of bytes that was filled in). Before this patch, "strace sg_inq -p0x83 /dev/sda" would report a non-zero resid value. After this patch, it reports resid=0. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-11-10sun4c: remove unused functionsBlue Swirl
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2012-11-10m48t59: remove unused m48t59_set_addrBlue Swirl
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2012-11-10vmware_vga: Add back some info in local state partially reverting aa32b38cBALATON Zoltan
Keep saving display surface parameters at init and using these cached values instead of getting them when needed. Not sure why this is needed (maybe due to the interaction with the vga device) but not doing this broke the Xorg vmware driver at least. Signed-off-by: BALATON Zoltan <balaton@eik.bme.hu> Tested-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2012-11-10kvmvapic: Fix TB invalidation after instruction patchingJan Kiszka
Since 0b57e287, cpu_memory_rw_debug already triggers a TB invalidation. As it doesn't (and cannot) set is_cpu_write_access=1 but "consumes" the currently executed TB, the tb_invalidate_phys_page_range call from patch_instruction didn't work anymore. Fix this by open-coding the required bits to restore the CPU state from the current TB position before patching and resume execution on the patched instruction afterward. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Tested-by: Hervé Poussineau <hpoussin@reactos.org> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2012-11-09ehci: fix migrationGerd Hoffmann
Commit 5010d4dc618b6b8e7c21129c487c06f6493f71fc reorganized vmstate to split core + pci, but got two little details wrong. Fix them. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-11-09xhci: Fix some DMA host endian bugsDavid Gibson
The xhci device does correct endian switches on the results of some DMAs but not all. In particular, there are many DMAs of what are essentially arrays of 32-bit integers which never get byteswapped. This causes them to be interpreted incorrectly on big-endian hosts, since (as per the xhci spec) these arrays are always little-endian in guest memory. This patch adds some helper functions to fix these bugs. This may not be all the endian bugs in the xhci code, but it's certainly some of them and the Linux guest xhci driver certainly gets further with these fixes. Signed-off-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-11-08usb/combined-packet: Move freeing of combined to usb_combined_packet_remove()Hans de Goede
Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-11-08xhci: Add support for packets with both data and an error statusHans de Goede
Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-11-08ehci: Add support for packets with both data and an error statusHans de Goede
Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-11-08ehci: Get rid of the magical PROC_ERR statusHans de Goede
Instead make ehci_execute and ehci_fill_queue return the again value. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-11-08usb-redir: Allow packets to have both data and an error-statusHans de Goede
Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-11-08usb: split packet result into actual_length + statusHans de Goede
Since with the ehci and xhci controllers a single packet can be larger then maxpacketsize, it is possible for the result of a single packet to be both having transferred some data as well as the transfer to have an error. An example would be an input transfer from a bulk endpoint successfully receiving 1 or more maxpacketsize packets from the device, followed by a packet signalling halt. While already touching all the devices and controllers handle_packet / handle_data / handle_control code, also change the return type of these functions to void, solely storing the status in the packet. To make the code paths for regular versus async packet handling more uniform. This patch unfortunately is somewhat invasive, since makeing the qemu usb core deal with this requires changes everywhere. This patch only prepares the usb core for this, all the hcd / device changes are done in such a way that there are no functional changes. This patch has been tested with uhci and ehci hcds, together with usb-audio, usb-hid and usb-storage devices, as well as with usb-redir redirection with a wide variety of real devices. Note that there is usually no need to directly set packet->actual_length form devices handle_data callback, as that is done by usb_packet_copy() Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-11-05spice: fix initialization orderGerd Hoffmann
Register displaychangelistener last, after spice is fully initialized, otherwise we may hit NULL pointer dereferences when qemu starts calling our callbacks. Commit e250d949feb1334828f27f0d145c35f29c4b7639 triggers this bug. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-11-05qxl: call dpy_gfx_resize when entering vga modeGerd Hoffmann
When entering vga mode the display size likely changes, notify all displaychangelisteners about this. Probably went unnoticed for a while as one if the first things the guest does after leaving qxl native mode and entering qxl vga mode is to set the vga video mode. But there is still a small window where qemu can operate on stale data, leading to crashes now and then. https://bugzilla.redhat.com/show_bug.cgi?id=865767 Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-11-05qxl: fix cursor resetGerd Hoffmann
When resetting the qxl cursor notify the qemu displaystate too. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-11-05hw/qxl: qxl_send_events: nop if stoppedAlon Levy
Added a trace point for easy logging. RHBZ: https://bugzilla.redhat.com/show_bug.cgi?id=870972 Signed-off-by: Alon Levy <alevy@redhat.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-11-05hw/qxl: guest bug on primary create with stride %4 != 0Alon Levy
Due to usage of pixman for rendering on all spice surfaces we have pixman's requirement that the stride be word aligned. A guest not honoring that can crash spice and qemu with it due to failure to create a surface (in spice-server). Avoid this early on in primary surface creation and offscreen surface creation. Recently windows guests got odd width support which triggers a non word aligned primary surface in 16bit color depth. Off screen surfaces have always been word aligned, but doesn't hurt to check them here too. Signed-off-by: Alon Levy <alevy@redhat.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-11-03vmware_vga: Allow simple drivers to work without using the fifoBALATON Zoltan
Postpone stopping the dirty log to the point where the command fifo is configured to allow drivers which don't use the fifo to work too. (Without this the picture rendered into the vram never got to the screen and the DIRECT_VRAM option meant to support this case was removed a year ago.) Signed-off-by: BALATON Zoltan <balaton@eik.bme.hu> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2012-11-03vmware_vga: Return a value for FB_SIZE before the device is enabledBALATON Zoltan
According to the documentation drivers using this device should read FB_SIZE before enabling the device to know what memory to map. This would not work if we return 0 before enabled. The docs also mention reading SVGA_REG_DEPTH but not writing it. (Only SVGA_REG_BITS_PER_PIXEL can be written but we don't really support that either.) Signed-off-by: BALATON Zoltan <balaton@eik.bme.hu> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2012-11-03vmware_vga: Remove duplicated info from local stateBALATON Zoltan
Removed info from vmsvga_state that is available from elsewhere and thus was duplicated here unnecessarily. Signed-off-by: BALATON Zoltan <balaton@eik.bme.hu> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2012-11-03vmware_vga: Coding style cleanupBALATON Zoltan
Fix coding style as suggested by checkpatch.pl Signed-off-by: BALATON Zoltan <balaton@eik.bme.hu> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2012-11-03Merge branch 'trivial-patches' of git://github.com/stefanha/qemuBlue Swirl
* 'trivial-patches' of git://github.com/stefanha/qemu: pc: Drop redundant test for ROM memory region exec: make some functions static target-ppc: make some functions static ppc: add missing static vnc: add missing static vl.c: add missing static target-sparc: make do_unaligned_access static m68k: Return semihosting errno values correctly cadence_uart: More debug information Conflicts: target-m68k/m68k-semi.c
2012-11-02xenfb: fix build breakage caused by console cleanup seriesGerd Hoffmann
Console cleanup series renamed dpy_resize and dpy_update all over the tree, but hw/xenfb.c was forgotten. Update it too so it builds again. Reported-by: Jan Kiszka <jan.kiszka@web.de> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2012-11-01Merge remote-tracking branch 'kraxel/usb.69' into stagingAnthony Liguori
* kraxel/usb.69: (31 commits) usb-redir: Allow redirecting super speed devices to high speed controllers usb-redir: Allow to attach USB 2.0 devices to 1.1 host controller usb-redir: Use reject rather the disconnect on bad ep info usb-redir: Add an usbredir_setup_usb_eps() helper function usb-redir: Add support for input pipelining usb-redir: Add support for 32 bits bulk packet length combined-packet: Add a workaround for Linux usbfs + live migration usb: Add packet combining functions uhci: Don't crash on device disconnect uhci: Add a uhci_handle_td_error() helper function usb/ehci-pci: add helper to create ich9 usb controllers usb/ehci-pci: add ich9 00:1a.* variant usb/ehci-pci: dynamic type generation uhci: add ich9 00:1a.* variants uhci: stick irq routing info into UHCIInfo too. uhci: dynamic type generation xilinx_zynq: add USB controllers usb/ehci: add sysbus variant usb/ehci: split into multiple source files usb/ehci: Guard definition of EHCI_DEBUG ... Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2012-11-01pc: Drop redundant test for ROM memory regionJan Kiszka
Just a few lines above, we already initialize rom_memory accordingly. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>