summaryrefslogtreecommitdiffstats
path: root/hw/usb/hcd-xhci.c
Commit message (Collapse)AuthorAgeFilesLines
* xhci: add sanity checks to xhci_lookup_uportGerd Hoffmann2014-11-111-0/+9
| | | | | | | | Also catch xhci_lookup_uport failures in post_load. https://bugzilla.redhat.com/show_bug.cgi?id=1074219 Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* xhci: add property to turn on/off streams supportGerd Hoffmann2014-10-281-3/+12
| | | | | | | | | | | | streams support in usb-redir and usb-host works only with recent enough versions of the support libraries (libusbredir and libusbx). Failure mode is rather unelegant: Any stream usb transfers will throw stall errors. Turning off support for streams in the xhci host controller will work better as the guest can figure beforehand that streams are not going to work. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Reviewed-by: Hans de Goede <hdegoede@redhat.com>
* xhci: remove dead codeGerd Hoffmann2014-10-151-6/+0
| | | | | Reported-by: Dr. David Alan Gilbert <dgilbert@redhat.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* usb: tag xhci as hotpluggableGerd Hoffmann2014-09-231-1/+0
| | | | Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* xhci PCIe endpoint migration compatibility fixDr. David Alan Gilbert2014-09-101-1/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add back the PCIe config capabilities on XHCI cards in non-PCIe slots, but only for machine types before 2.1. This fixes a migration incompatibility in the XHCI PCI devices caused by: 058fdcf52cdbf57b67e7 - xhci: add endpoint cap on express bus only Note that in fixing it for compatibility with older QEMUs, it breaks compatibility with existing QEMU 2.1's on older machine types. The status before this patch was (if it used an XHCI adapter): machine type | source qemu any pre-2.1 - FAIL any 2.1... - PASS With this patch: machine type | source qemu any pre-2.1 - PASS pre-2.1 2.1... - FAIL 2.1 2.1... - PASS A test to trigger it is to add '-device nec-usb-xhci,id=xhci,addr=0x12' to the command line. Cc: qemu-stable@nongnu.org Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com> Acked-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* usb: add usb host adapters exit traceGonglei2014-08-291-0/+2
| | | | | Signed-off-by: Gonglei <arei.gonglei@huawei.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* usb-xhci: add exit functionGonglei2014-08-291-0/+36
| | | | | | | clean up xhci resource when xhci pci device exit. Signed-off-by: Gonglei <arei.gonglei@huawei.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* Revert "xhci: Fix number of streams allocated when using streams"Gerd Hoffmann2014-08-291-1/+1
| | | | | | | | This reverts commit d063c3112c4cd23a479ee18720c2bd119da2d315. "2 << x" is the same as "2 ^ (x + 1)", so the old code is correct. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* xhci: use (1u << i)Gerd Hoffmann2014-08-291-2/+2
| | | | | Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
* xhci: fix debug print compiling errorGonglei2014-08-291-3/+3
| | | | | | | | after commit 003e15a180373048f0c1f4df0bfe303746eb2676 the DPRINTF will broke compiling, adjust its location. Signed-off-by: Gonglei <arei.gonglei@huawei.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* vmstate_xhci_event: fix unterminated field listLaszlo Ersek2014-07-221-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | "vmstate_xhci_event" was introduced in commit 37352df3 ("xhci: add live migration support"), and first released in v1.6.0. The field list in this VMSD is not terminated with the VMSTATE_END_OF_LIST() macro. During normal use (ie. migration), the issue is practically invisible, because the "vmstate_xhci_event" object (with the unterminated field list) is only ever referenced -- via "vmstate_xhci_intr" -- if xhci_er_full() returns true, for the "ev_buffer" test. Since that field_exists() check (apparently) almost always returns false, we almost never traverse "vmstate_xhci_event" during migration, which hides the bug. However, Amit's vmstate checker forces recursion into this VMSD as well, and the lack of VMSTATE_END_OF_LIST() breaks the field list terminator check (field->name != NULL) in dump_vmstate_vmsd(). The result is undefined behavior, which in my case translates to infinite recursion (because the loop happens to overflow into "vmstate_xhci_intr", which then links back to "vmstate_xhci_event"). Add the missing terminator. Signed-off-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Amit Shah <amit.shah@redhat.com> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> Cc: qemu-stable@nongnu.org Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
* xhci: order superspeed ports firstGerd Hoffmann2014-06-021-8/+37
| | | | Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* xhci: make port reset trace point more verboseGerd Hoffmann2014-06-021-1/+1
| | | | Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* xhci: add xhci_get_flagGerd Hoffmann2014-05-261-2/+7
| | | | Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* xhci: add endpoint cap on express bus onlyGerd Hoffmann2014-05-261-2/+4
| | | | Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* xhci: child detach fixGerd Hoffmann2014-05-261-1/+1
| | | | | | | | | | | xhci_child_detach() zaps the wrong slot when unplugging a device connected via usb-hub: Instead of the device's slot the slot of the usb-hub is used. Fix it. https://bugzilla.redhat.com/show_bug.cgi?id=1075846 Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Reviewed-by: Gonglei <arei.gonglei@huawei.com>
* xhci: use DPRINTF() instead of fprintf(stderr, ...)Gerd Hoffmann2014-02-181-45/+45
| | | | | | So we don't spam stderr with (guest-triggerable) messages by default. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* xhci: switch debug printf to tracepointGerd Hoffmann2014-02-181-3/+1
| | | | Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* xhci iso: allow for some latencyGerd Hoffmann2014-02-181-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>
* xhci iso: fix time calculationGerd Hoffmann2014-02-181-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>
* xhci: fix overflow in usb_xhci_post_loadGerd Hoffmann2014-02-181-1/+1
| | | | | | | Found by Coverity. Reported-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* qdev:pci: refactor PCIDevice to use generic "hotpluggable" propertyIgor Mammedov2014-02-101-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>
* xhci: Call usb_device_alloc/free_streamsHans de Goede2013-11-261-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>
* xhci: add support for suspend/resumeGerd Hoffmann2013-11-261-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>
* xhci: Add a few missing checks for disconnected devicesHans de Goede2013-11-261-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>
* Merge remote-tracking branch 'kraxel/usb.91' into stagingAnthony Liguori2013-10-311-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>
| * usb-hcd-xhci: Update endpoint context dequeue pointer for streams tooHans de Goede2013-10-221-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>
| * usb-hcd-xhci: Report completion of active transfer with CC_STOPPED on ep stopHans de Goede2013-10-221-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>
| * usb-hcd-xhci: Remove unused cancelled member from XHCITransferHans de Goede2013-10-221-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>
| * usb-hcd-xhci: Remove unused sstreamsm member from XHCIStreamContextHans de Goede2013-10-221-9/+0
| | | | | | | | | | Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* | Merge remote-tracking branch 'mst/tags/for_anthony' into stagingAnthony Liguori2013-10-311-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>
| * hw: set interrupts using pci irq wrappersMarcel Apfelbaum2013-10-141-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>
* | xhci: Fix memory leak on xhci_disable_epHans de Goede2013-09-191-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>
* | xhci: Add xhci_epid_to_usbep helper functionHans de Goede2013-09-191-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>
* | xhci: Init a transfers xhci, slotid and epid member on epctx allocHans de Goede2013-09-191-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>
* | xhci: Fix number of streams allocated when using streamsHans de Goede2013-09-191-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>
* Merge remote-tracking branch 'kraxel/usb.88' into stagingAnthony Liguori2013-09-031-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>
| * xhci: reset port when disabling slotGerd Hoffmann2013-09-021-0/+1
| | | | | | | | | | Cc: qemu-stable@nongnu.org Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
| * xhci: emulate intr endpoint intervals correctlyGerd Hoffmann2013-09-021-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>
| * xhci: fix endpoint interval calculationGerd Hoffmann2013-09-021-1/+1
| | | | | | | | | | Cc: qemu-stable@nongnu.org Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
| * xhci: add port to slot_address tracepointGerd Hoffmann2013-09-021-1/+1
| | | | | | | | Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
| * xhci: add tracepoint for endpoint state changesGerd Hoffmann2013-09-021-0/+19
| | | | | | | | Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
| * xhci: remove leftover debug printfGerd Hoffmann2013-09-021-2/+0
| | | | | | | | Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* | usb: Pass size to usb_bus_new()Andreas Färber2013-08-301-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>
* aio / timers: Switch entire codebase to the new timer APIAlex Bligh2013-08-221-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>
* xhci: implement warm port resetGerd Hoffmann2013-08-081-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>
* xhci: fix segfaultGerd Hoffmann2013-08-011-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>
* xhci: handle USB_RET_IOERRORGerd Hoffmann2013-07-301-0/+1
| | | | | | | https://bugzilla.redhat.com/show_bug.cgi?id=980377 Cc: qemu-stable@nongnu.org Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* devices: Associate devices to their logical categoryMarcel Apfelbaum2013-07-291-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>
* usb/hcd-xhci: QOM parent field cleanupAndreas Färber2013-07-231-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>
OpenPOWER on IntegriCloud