summaryrefslogtreecommitdiff
path: root/hw
AgeCommit message (Collapse)AuthorFilesLines
2012-09-14srp: Don't use QEMU_PACKED for single elements of a structured typeStefan Weil1-4/+4
QEMU_PACKED results in a MinGW compiler warning when it is used for single structure elements: warning: 'gcc_struct' attribute ignored Using QEMU_PACKED for the whole structure avoids the compiler warning without changing the memory layout. Signed-off-by: Stefan Weil <sw@weilnetz.de> Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
2012-09-13uhci: Don't queue up packets after one with the SPD flag setHans de Goede1-1/+4
Don't queue up packets after a packet with the SPD (short packet detect) flag set. Since we won't know if the packet will actually be short until it has completed, and if it is short we should stop the queue. This fixes a miniature photoframe emulating a USB cdrom with the windows software for it not working. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-09-13usb-redir: Revert usb-redir part of commit 93bfef4cHans de Goede1-5/+3
Commit 93bfef4c6e4b23caea9d51e1099d06433d8835a4 makes qemu-devices which report the qemu version string to the guest in some way use a qemu_get_version function which reports a machine-specific version string. However usb-redir does not expose the qemu version to the guest, only to the usbredir-host as part of the initial handshake. This can then be logged on the usbredir-host side for debugging purposes and is otherwise completely unused! For debugging purposes it is important to have the real qemu version in there, rather then the machine-specific version. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-09-13usb-redir: Add chardev open / close debug loggingHans de Goede1-0/+6
Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-09-13usb-redir: Add support for migrationHans de Goede1-3/+346
Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-09-13usb-redir: Store max_packet_size in endp_dataHans de Goede1-1/+3
So that we've a place to migrate it to / from to allow restoring it after migration. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-09-13usb-redir: Add an already_in_flight packet-id queueHans de Goede1-0/+43
After a live migration, the usb-hcd will re-queue all packets by walking over the schedule in the guest memory again, but requests which were encountered on the migration source before will already be in flight, so these should *not* be re-send to the usbredir-host. This patch adds an already in flight packet ud queue, which will be filled by the source before migration and then moved over to the migration dest, any async handled packets are then checked against this queue to avoid sending the same packet to the usbredir-host twice. Signed-off-by: Hans de Goede <hdegoede@redhat,com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-09-13usb-redir: Change cancelled packet code into a generic packet-id queueHans de Goede1-31/+71
Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-09-13ehci: Walk async schedule before and after migrationHans de Goede1-0/+28
Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-09-13ehci: Don't set seen to 0 when removing unseen queue-headsHans de Goede1-6/+18
When removing unseen queue-heads from the async queue list, we should not set the seen flag to 0, as this may cause them to be removed by ehci_queues_rip_unused() during the next call to ehci_advance_async_state() if the timer is late or running at a low frequency. Note: 1) This *may* have caused the instant unlink / relinks described in commit 9bc3a3a216e2689bfcdd36c3e079333bbdbf3ba0 2) Rather then putting more if-s inside ehci_queues_rip_unused, this patch instead introduces a new ehci_queues_rip_unseen function. 3) This patch also makes it save to call ehci_queues_rip_unseen() multiple times, which gets used in the folluw up patch titled: "ehci: Walk async schedule before and after migration" Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-09-13hw/qxl: support client monitor configuration via deviceAlon Levy1-0/+79
Until now we used only the agent to change the monitor count and each monitor resolution. This patch introduces the qemu part of using the device as the mediator instead of the agent via virtio-serial. Spice (>=0.11.5) calls the new QXLInterface::client_monitors_config, which returns wether the interrupt is enabled, and if so and given a non NULL monitors config will generate an interrupt QXL_INTERRUPT_CLIENT_MONITORS_CONFIG with crc checksum for the guest to verify a second call hasn't interfered. The maximal number of monitors is limited on the QXLRom to 64. Signed-off-by: Alon Levy <alevy@redhat.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-09-13qxl: add trace-event for QXL_IO_LOGAlon Levy1-0/+1
Signed-off-by: Alon Levy <alevy@redhat.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-09-13hw/qxl: tracing fixesAlon Levy1-3/+5
Add two new trace events: qxl_send_events(int qid, uint32_t events) "%d %d" qxl_set_guest_bug(int qid) "%d" Change qxl_io_unexpected_vga_mode parameters to be equivalent to those of qxl_io_write for easier grouping under a single systemtap probe. Change d to qxl in one place. Signed-off-by: Alon Levy <alevy@redhat.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-09-12ahci: properly reset PxCMD on HBA resetJason Baron1-1/+1
While testing q35, I found that windows 7 (specifically, windows 7 ultimate with sp1 x64), wouldn't install because it can't find the cdrom or disk drive. The failure message is: 'A required cd/dvd device driver is missing. If you have a driver floppy disk, CD, DVD, or USB flash drive, please insert it now.' This can also be reproduced on piix by adding an ahci controller, and observing that windows 7 does not see any devices behind it. The problem is that when windows issues a HBA reset, qemu does not reset the individual ports' PxCMD register. Windows 7 then reads back the PxCMD register and presumably assumes that the ahci controller has already been initialized. Windows then never sets up the PxIE register to enable interrupts, and thus it never gets irqs back when it sends ata device inquiry commands. This change brings qemu into ahci 1.3 specification compliance. Section 10.4.3 HBA Reset: " When GHC.HR is set to '1', GHC.AE, GHC.IE, the IS register, and all port register fields (except PxFB/PxFBU/PxCLB/PxCLBU) that are not HwInit in the HBA's register memory space are reset. " I've also re-tested Fedora 16 and 17 to verify that they continue to work with this change. Signed-off-by: Jason Baron <jbaron@redhat.com> Acked-by: Alexander Graf <agraf@suse.de> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2012-09-12ide: Fix error messages from static code analysis (no real error)Stefan Weil1-9/+2
Report from smatch: hw/ide/core.c:1472 ide_exec_cmd(423) error: buffer overflow 'smart_attributes' 8 <= 29 hw/ide/core.c:1474 ide_exec_cmd(425) error: buffer overflow 'smart_attributes' 8 <= 29 hw/ide/core.c:1475 ide_exec_cmd(426) error: buffer overflow 'smart_attributes' 8 <= 29 ... The upper limit of 30 was never reached because both for loops terminated when 'smart_attributes' reached end of list, so there was no real buffer overflow. Nevertheless, changing the code not only fixes the error report, but also reduces the size of smart_attributes and simplifies the for loops. Signed-off-by: Stefan Weil <sw@weilnetz.de> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2012-09-12ATAPI: STARTSTOPUNIT only eject/load media if powercondition is 0Ronnie Sahlberg1-0/+6
The START STOP UNIT command will only eject/load media if power condition is zero. If power condition is !0 then LOEJ and START will be ignored. From MMC (sbc contains similar wordings too) The Power Conditions field requests the block device to be placed in the power condition defined in Table 558. If this field has a value other than 0h then the Start and LoEj bits shall be ignored. Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2012-09-12ehci: Don't process too much frames in 1 timer tick (v2)Hans de Goede1-0/+14
The Linux ehci isoc scheduling code fills the entire schedule ahead of time minus 80 frames. If we make a large jump in where we are in the schedule, ie 40 frames, then the scheduler all of a sudden will only have 40 frames left to work in, causing it to fail packet submissions with error -27 (-EFBIG). Changes in v2: -Don't hardcode a maximum number of frames to process in one tick, instead: -Process a minimum number of frames to ensure we do eventually catch up -Stop (after the minimum number) when the guest has requested an irq Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-09-12ehci: Fix interrupts stopping when Interrupt Threshold Control is 8Hans de Goede1-1/+1
If Interrupt Threshold Control is 8 or a multiple of 8, then s->usbsts_frindex can become exactly 0x4000, at which point (s->usbsts_frindex > s->frindex) will never become true, as s->usbsts_frindex will not be lowered / reset in this case. This patch fixes this. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-09-12ehci: switch to new-style memory opsGerd Hoffmann1-89/+84
Also register different memory regions for capabilities, operational registers and port status registers. Create separate tracepoints for operational regs and port status regs. Ditch a bunch of sanity checks because the memory core will do this for us now. Offloading the byte, word and dword access handling to the memory core also has the side effect of fixing ehci register access on bigendian hosts. Cc: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-09-12qxl: better cleanup for surface destroyUri Lublin1-0/+1
Add back a call to qxl_spice_destroy_surface_wait_complete() in qxl_spice_destroy_surface_wait(), that was removed by commit c480bb7da465186b84d8427e068ef7502e47ffbf It is needed to complete surface-removal cleanup, for non async. For async, qxl_spice_destroy_surface_wait_complete is called upon operation completion. Signed-off-by: Uri Lublin <uril@redhat.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-09-12usb-host: allow emulated (non-async) control requests without USBPacketGerd Hoffmann1-1/+1
xhci needs this for USB_REQ_SET_ADDRESS due to the way usb addressing is handled by the xhci hardware. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-09-12qxl: Ignore set_client_capabilities pre/post migrateHans de Goede1-0/+5
The recent introduction of set_client_capabilities has broken (seamless) migration by trying to call qxl_send_events pre (seamless incoming) and post (*) migration, triggering the following assert: qxl_send_events: Assertion `qemu_spice_display_is_running(&d->ssd)' failed. The solution is easy, pre migration the guest will have already received the client caps on the migration source side, and post migration there no longer is a guest, so we can simply ignore the set_client_capabilities call in both those scenarios. *) Post migration, so not fatal for to the migration itself, but still a crash Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-09-12qxl: dont update invalid areaDunrong Huang1-0/+7
This patch fixes the following error: $ ~/usr/bin/qemu-system-x86_64 -enable-kvm -m 1024 -spice port=5900,disable-ticketing -vga qxl -cdrom ~/Images/linuxmint-13-mate-dvd-32bit.iso (/home/mathslinux/usr/bin/qemu-system-x86_64:10068): SpiceWorker-CRITICAL **: red_worker.c:4599:red_update_area: condition `area->left >= 0 && area->top >= 0 && area->left < area->right && area->top < area->bottom' failed Aborted spice server terminates QEMU process if we pass invalid area to it, so dont update those invalid areas. Signed-off-by: Dunrong Huang <riegamaths@gmail.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-09-12spice: switch to queue for vga mode updatesGerd Hoffmann1-3/+3
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-09-11VGA: Flush coalesced MMIO on related MMIO/PIO accessesJan Kiszka5-0/+15
In preparation of stopping to flush coalesced MMIO unconditionally on vmexits, mark VGA MMIO and PIO regions as synchronous /wrt coalesced MMIO and flush the buffer explicitly on PIO accesses that do not use generic memory regions yet. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
2012-09-11xhci: allow bytewise capability register readsGerd Hoffmann1-1/+3
Some guests need this according to Alejandro Martinez Ruiz <alex@securiforest.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-09-11xhci: kill xhci_mem_{read,write} dispatcher functionsGerd Hoffmann1-65/+75
... and register subregions instead, so we offload the dispatching to the the memory subsystem which is designed to handle it. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-09-11xhci: support multiple interruptersGerd Hoffmann1-5/+1
Everything is in place, flip the big switch now and enable support for multiple interrupters. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-09-11xhci: pick target interrupterGerd Hoffmann1-6/+16
Pick the correct interrupter when queuing an event. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-09-11xhci: prepare xhci_runtime_{read,write} for multiple interruptersGerd Hoffmann1-43/+57
Prepare xhci runtime register access function for multiple interrupters. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-09-11xhci: add XHCIInterrupterGerd Hoffmann1-147/+160
Move all state belonging to the (single) interrupter into a separate struct. First step in adding support for multiple interrupters. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-09-11xhci: move register update into xhci_intr_raiseGerd Hoffmann1-9/+5
Now that we have a separate function to raise an IRQ we can move some comon code into the function. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-09-11xhci: add msix supportGerd Hoffmann1-1/+46
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-09-11xhci: rework interrupt handlingGerd Hoffmann1-14/+33
Split xhci_irq_update into a function which handles intx updates (including lowering the irq line once the guests acks the interrupt) and one which is used for raising an irq only. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-09-11xhci: fix & cleanup msi.Gerd Hoffmann1-18/+9
Drop custom write_config function which isn't needed any more. Make the msi property a bit property so it accepts 'on' & 'off'. Enable MSI by default. TODO: add compat property to disable on old machine types. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-09-11usb-storage: usb3 supportGerd Hoffmann1-3/+43
Add usb3 descriptors to usb-storage, so it shows up as superspeed device when connected to xhci. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-09-11usb3: bos decriptorGerd Hoffmann3-0/+140
Add support for creating BOS descriptor and device cappability descriptors. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-09-11usb3: superspeed endpoint companionGerd Hoffmann3-20/+62
Add support for building superspeed endpoint companion descriptors, create them for superspeed usb devices. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-09-11usb3: superspeed descriptorsGerd Hoffmann2-1/+10
Add superspeed descriptor entry to USBDesc, advertise superspeed support when present. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-09-11xhci: update port handlingGerd Hoffmann1-40/+97
This patch changes the way xhci ports are linked to USBPorts. The fixed 1:1 relationship between xhci ports and USBPorts is gone. Now each USBPort represents a physical plug which has usually two xhci ports assigned: one usb2 and ond usb3 port. usb devices show up at one or the other, depending on whenever they support superspeed or not. This patch also makes the number of usb2 and usb3 ports runtime configurable by adding 'p2' and 'p3' properties. It is allowed to have different numbers of usb2 and usb3 ports. Specifying p2=4,p3=2 will give you an xhci adapter which supports all speeds on physical ports 1+2 and usb2 only on ports 3+4.
2012-09-11xhci: update register layoutGerd Hoffmann1-8/+13
Change the register layout to be a bit more sparse and also not depend on the number of ports. Useful when for making the number of ports runtime-configurable.
2012-09-11xhci: fix runtime write tracepointGerd Hoffmann1-1/+1
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-09-11xhci: add trace_usb_xhci_ep_set_dequeueGerd Hoffmann1-1/+1
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-09-11xhci: trace cc codes in cleartextGerd Hoffmann1-1/+47
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-09-11xhci: iso xfer supportGerd Hoffmann1-16/+101
Add support for iso transfers. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-09-11xhci: implement mfindexGerd Hoffmann1-7/+46
Implement mfindex register and mfindex wrap event. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-09-11xhci: move device lookup into xhci_setup_packetGerd Hoffmann1-36/+38
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-09-11xhci: drop bufferingGerd Hoffmann1-114/+71
This patch splits the xhci_xfer_data function into three. The xhci_xfer_data function used to do does two things: (1) copy transfer data between guest memory and a temporary buffer. (2) report transfer results to the guest using events. Now we three functions to handle this: (1) xhci_xfer_map creates a scatter list for the transfer and uses that (instead of the temporary buffer) to build a USBPacket. (2) xhci_xfer_unmap undoes the mapping. (3) xhci_xfer_report sends out events. The patch also fixes reporting of transaction errors which must be reported unconditinally, not only in case the guest asks for it using the ISP flag. [ v2: fix warning ] Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-09-11xhci: rip out background transfer codeGerd Hoffmann1-219/+4
original xhci code (the one which used libusb directly) used to use 'background transfers' for iso streams. In upstream qemu the iso stream buffering is handled by usb-host & usb-redir, so we will never ever need this. It has been left in as reference, but is dead code anyway. Rip it out. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-09-11usb-audio: fix usb versionGerd Hoffmann1-1/+1
usb-audio is a full speed (1.1) device, but bcdUSB claims it is usb 2.0. Fix it. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>