summaryrefslogtreecommitdiff
path: root/hw/usb/hcd-xhci.c
AgeCommit message (Collapse)AuthorFilesLines
2014-02-18xhci: use DPRINTF() instead of fprintf(stderr, ...)Gerd Hoffmann1-45/+45
So we don't spam stderr with (guest-triggerable) messages by default. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2014-02-18xhci: switch debug printf to tracepointGerd Hoffmann1-3/+1
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2014-02-18xhci iso: allow for some latencyGerd Hoffmann1-1/+1
Allow the scheduled transfer time be a bit behind, to compensate for latencies. Without this xhci will wait way to often for the mfindex wraparound, assuming the scheduled time is in the future just because qemu is a bit behind in processing the iso transfer requests. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2014-02-18xhci iso: fix time calculationGerd Hoffmann1-2/+2
Frameid specifies frames not microframes, so we need to shift it to get the microframe index. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2014-02-18xhci: fix overflow in usb_xhci_post_loadGerd Hoffmann1-1/+1
Found by Coverity. Reported-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2014-02-10qdev:pci: refactor PCIDevice to use generic "hotpluggable" propertyIgor Mammedov1-1/+1
Get rid of PCIDevice specific PCIDeviceClass.no_hotplug and use generic DeviceClass.hotpluggable field instead. Signed-off-by: Igor Mammedov <imammedo@redhat.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2013-11-26xhci: Call usb_device_alloc/free_streamsHans de Goede1-0/+117
Note this code is not as KISS as I would like, the reason for this is that the Linux kernel interface wants streams on eps belonging to one interface to be allocated in one call. Things will also work if we do this one ep at a time (as long as all eps support the same amount of streams), but lets stick to the kernel API. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2013-11-26xhci: add support for suspend/resumeGerd Hoffmann1-0/+8
The OS can ask the xhci controller to save and restore its internal state, which is used by the OS when the system is suspended and resumed. This patch handles writes to the save + restore bits in the command register. Only thing it does is updating the restore error bit in the status register to signal an error on restore. The guest OS should do a full reinitialization after resume then. This is the minimal patch which gets S3 going with xhci. Implementing full save/restore support is TBD. https://bugzilla.redhat.com/show_bug.cgi?id=1012365 Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2013-11-26xhci: Add a few missing checks for disconnected devicesHans de Goede1-2/+11
One of the reworks of qemu's usb core made changes to usb-port's disconnect handling. Now ports with a device will always have a non 0 dev member, but if the device is not attached (which is possible with usb redirection), dev->attached will be 0. So supplement all checks for dev to also check dev->attached, and add an extra check in a path where a device check was completely missing. This fixes various crashes (asserts triggering) I've been seeing when xhci attached usb devices get disconnected at the wrong time. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2013-10-31Merge remote-tracking branch 'kraxel/usb.91' into stagingAnthony Liguori1-24/+26
* kraxel/usb.91: usb-hcd-xhci: Update endpoint context dequeue pointer for streams too usb-hcd-xhci: Report completion of active transfer with CC_STOPPED on ep stop usb-hcd-xhci: Remove unused cancelled member from XHCITransfer usb-hcd-xhci: Remove unused sstreamsm member from XHCIStreamContext usb-host-libusb: Detach kernel drivers earlier usb-host-libusb: Configuration 0 may be a valid configuration usb-host-libusb: Fix reset handling Message-id: 1382620267-18065-1-git-send-email-kraxel@redhat.com Signed-off-by: Anthony Liguori <anthony@codemonkey.ws>
2013-10-31Merge remote-tracking branch 'mst/tags/for_anthony' into stagingAnthony Liguori1-5/+2
pci, pc, acpi fixes, enhancements This includes some pretty big changes: - pci master abort support by Marcel - pci IRQ API rework by Marcel - acpi generation support by myself Everything has gone through several revisions, latest versions have been on list for a while without any more comments, tested by several people. Please pull for 1.7. Signed-off-by: Michael S. Tsirkin <mst@redhat.com> # gpg: Signature made Tue 15 Oct 2013 07:33:48 AM CEST using RSA key ID D28D5469 # gpg: Can't check signature: public key not found * mst/tags/for_anthony: (39 commits) ssdt-proc: update generated file ssdt: fix PBLK length i386: ACPI table generation code from seabios pc: use new api to add builtin tables acpi: add interface to access user-installed tables hpet: add API to find it pvpanic: add API to access io port ich9: APIs for pc guest info piix: APIs for pc guest info acpi/piix: add macros for acpi property names i386: define pc guest info loader: allow adding ROMs in done callbacks i386: add bios linker/loader loader: use file path size from fw_cfg.h acpi: ssdt pcihp: updat generated file acpi: pre-compiled ASL files acpi: add rules to compile ASL source i386: add ACPI table files from seabios q35: expose mmcfg size as a property q35: use macro for MCFG property name ... Message-id: 1381818560-18367-1-git-send-email-mst@redhat.com Signed-off-by: Anthony Liguori <anthony@codemonkey.ws>
2013-10-22usb-hcd-xhci: Update endpoint context dequeue pointer for streams tooHans de Goede1-2/+8
With streams the endpoint context dequeue pointer should point to the dequeue value for the currently active stream. At least Linux guests expect it to point to value set by an set_ep_dequeue upon completion of the set_ep_dequeue (before kicking the ep). Otherwise the Linux kernel will complain (and things won't work): xhci_hcd 0000:00:05.0: Mismatch between completed Set TR Deq Ptr command & xHCI internal state. xhci_hcd 0000:00:05.0: ep deq seg = ffff8800366f0880, deq ptr = ffff8800366ec010 Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2013-10-22usb-hcd-xhci: Report completion of active transfer with CC_STOPPED on ep stopHans de Goede1-8/+18
As we should per the XHCI spec "4.6.9 Stop Endpoint". Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2013-10-22usb-hcd-xhci: Remove unused cancelled member from XHCITransferHans de Goede1-5/+0
Since qemu's USB model is geared towards emulated devices cancellation is instanteneous, so no need to wait for cancellation to complete, as such there is no wait for cancellation code, and the cancelled bool as well as the bogus comment about it can be removed. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2013-10-22usb-hcd-xhci: Remove unused sstreamsm member from XHCIStreamContextHans de Goede1-9/+0
Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2013-10-14hw: set interrupts using pci irq wrappersMarcel Apfelbaum1-5/+2
pci_set_irq and the other pci irq wrappers use PCI_INTERRUPT_PIN config register to compute device INTx pin to assert/deassert. An irq is allocated using pci_allocate_irq wrapper only if is needed by non pci devices. Removed irq related fields from state if not used anymore. Signed-off-by: Marcel Apfelbaum <marcel.a@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2013-09-19xhci: Fix memory leak on xhci_disable_epHans de Goede1-0/+5
The USBPacket-s in the transfers need to be cleaned up so that the memory allocated by the iovec in there gets freed. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2013-09-19xhci: Add xhci_epid_to_usbep helper functionHans de Goede1-10/+22
And use it instead of prying the USBEndpoint out of the packet struct in various places. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2013-09-19xhci: Init a transfers xhci, slotid and epid member on epctx allocHans de Goede1-3/+3
Transfers are part of an epctx, which is part of a slot, which is part of a xhci. Transfers cannot dynamically be moved from one epctx to another, so once created their xhci, slotid and epid are constant, so lets set these up at creation time, rather then re-initializing them with the same value each time a transfer gets submitted. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2013-09-19xhci: Fix number of streams allocated when using streamsHans de Goede1-1/+1
According to the xhci spec the total number of streams is 2 ^ (MaxPStreams + 1), and this is also how the Linux xhci driver uses this field. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2013-09-03Merge remote-tracking branch 'kraxel/usb.88' into stagingAnthony Liguori1-11/+59
# By Gerd Hoffmann (10) and Marcel Apfelbaum (1) # Via Gerd Hoffmann * kraxel/usb.88: usb/dev-hid: Modified usb-tablet category from Misc to Input Revert "usb-hub: report status changes only once" usb-hub: add tracepoint for status reports usb: parallelize usb3 streams uas: add property for request logging xhci: reset port when disabling slot xhci: emulate intr endpoint intervals correctly xhci: fix endpoint interval calculation xhci: add port to slot_address tracepoint xhci: add tracepoint for endpoint state changes xhci: remove leftover debug printf Message-id: 1378117055-29620-1-git-send-email-kraxel@redhat.com Signed-off-by: Anthony Liguori <anthony@codemonkey.ws>
2013-09-02xhci: reset port when disabling slotGerd Hoffmann1-0/+1
Cc: qemu-stable@nongnu.org Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2013-09-02xhci: emulate intr endpoint intervals correctlyGerd Hoffmann1-7/+37
Respect the interval for interrupt endpoints, so we don't finish transfers as fast as possible but at the rate configured by the guest. Fixes guest deadlocks triggered by interrupt storms. Cc: Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2013-09-02xhci: fix endpoint interval calculationGerd Hoffmann1-1/+1
Cc: qemu-stable@nongnu.org Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2013-09-02xhci: add port to slot_address tracepointGerd Hoffmann1-1/+1
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2013-09-02xhci: add tracepoint for endpoint state changesGerd Hoffmann1-0/+19
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2013-09-02xhci: remove leftover debug printfGerd Hoffmann1-2/+0
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2013-08-30usb: Pass size to usb_bus_new()Andreas Färber1-1/+1
To be passed to qbus_create_inplace(). Use DEVICE() cast to avoid a direct parent field access. Reviewed-by: Wenchao Xia <xiawenc@linux.vnet.ibm.com> Signed-off-by: Andreas Färber <afaerber@suse.de>
2013-08-22aio / timers: Switch entire codebase to the new timer APIAlex Bligh1-13/+13
This is an autogenerated patch using scripts/switch-timer-api. Switch the entire code base to using the new timer API. Note this patch may introduce some line length issues. Signed-off-by: Alex Bligh <alex@alex.org.uk> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2013-08-08xhci: implement warm port resetGerd Hoffmann1-2/+11
Without this patch windows can't do port resets for usb3 devices. https://bugzilla.redhat.com/show_bug.cgi?id=949514 Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2013-08-01xhci: fix segfaultGerd Hoffmann1-3/+2
Guest trying to reset a endpoint of a disconnected device resulted in xhci trying to dereference uport while being NULL, thereby crashing qemu. Fix that by adding a check. Drop unused dev variable while touching that code bit. Cc: qemu-stable@nongnu.org Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2013-07-30xhci: handle USB_RET_IOERRORGerd Hoffmann1-0/+1
https://bugzilla.redhat.com/show_bug.cgi?id=980377 Cc: qemu-stable@nongnu.org Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2013-07-29devices: Associate devices to their logical categoryMarcel Apfelbaum1-0/+1
The category will be used to sort the devices displayed in the command line help. Signed-off-by: Marcel Apfelbaum <marcel.a@redhat.com> Message-id: 1375107465-25767-4-git-send-email-marcel.a@redhat.com Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2013-07-23usb/hcd-xhci: QOM parent field cleanupAndreas Färber1-35/+48
Replace direct uses of XHCIState::pci_dev with QOM casts and rename it to parent_obj. Acked-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com> Signed-off-by: Andreas Färber <afaerber@suse.de>
2013-07-23usb/hcd-xhci: QOM Upcast SweepPeter Crosthwaite1-7/+14
Define and use standard QOM cast macro. Remove usages of DO_UPCAST() and direct -> style upcasting. Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com> [AF: Dropped usb_xhci_init() DeviceState argument and renamed variable] Signed-off-by: Andreas Färber <afaerber@suse.de>
2013-07-04hw/[u-x]*: pass owner to memory_region_init* functionsPaolo Bonzini1-6/+6
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2013-07-04memory: add owner argument to initialization functionsPaolo Bonzini1-6/+6
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2013-06-03xhci: add live migration supportGerd Hoffmann1-1/+163
With all preparing pieces in place we can finally drop in the vmstate structs and the postload function. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2013-06-03xhci: add xhci_init_epctxGerd Hoffmann1-18/+25
Factor out endpoint context initialization to a separate function. xhci live migration will need that too, in post_load. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2013-06-03xhci: add xhci_alloc_epctxGerd Hoffmann1-11/+21
Factor out endpoint context allocation to a separate function. xhci live migration will need that too, in post_load. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2013-06-03xhci: add XHCISlot->addressedGerd Hoffmann1-0/+3
Preparing for live-migration support, post_load will need that. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2013-05-07xhci: handle USB_RET_BABBLEGerd Hoffmann1-0/+5
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2013-04-23xhci: remove XHCIRing->base (unused)Gerd Hoffmann1-3/+1
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2013-04-16xhci: fix address deviceGerd Hoffmann1-0/+4
Zero-initialize the set-address dummy USBPacket, also add buffer to avoid sanity checks triggering. https://bugzilla.redhat.com/show_bug.cgi?id=929019 Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2013-04-16xhci: use slotid as device addressGerd Hoffmann1-22/+3
Is good enougth for unique device addresses and avoids the need for any state for device addressing. Makes live migration support easier. Also makes device->slot lookups trivial. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2013-04-16xhci: fix portsc writesGerd Hoffmann1-7/+35
Check for port reset first and skip everything else then. Add sanity checks for PLS updates. Add PLC notification when entering PLS_U0 state. This gets host-initiated port resume going on win8. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2013-04-16xhci: add xhci_cap_writeGerd Hoffmann1-0/+7
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2013-04-16xhci: remove leftover debug printfGerd Hoffmann1-1/+0
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2013-04-03xhci: zap unused name fieldGerd Hoffmann1-1/+0
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2013-04-03xhci: remove unimplemented printfsGerd Hoffmann1-13/+9
Replace them with a tracepoint, so they don't spam stderr by default. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>