summaryrefslogtreecommitdiffstats
path: root/hw/usb
Commit message (Collapse)AuthorAgeFilesLines
* net: introduce qemu_get_queue()Jason Wang2013-02-011-5/+5
| | | | | | | | | To support multiqueue, the patch introduce a helper qemu_get_queue() which is used to get the NetClientState of a device. The following patches would refactor this helper to support multiqueue. Signed-off-by: Jason Wang <jasowang@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* usb: add usb-bot device (scsi bulk-only transport).Gerd Hoffmann2013-01-221-15/+79
| | | | | | | Basically the same as usb-storage, but without automatic scsi device setup. Also features support for up to 16 LUNs. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* ohci: add missing breakGerd Hoffmann2013-01-221-0/+1
| | | | Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* Revert "usb-storage: Drop useless null test in usb_msd_handle_data()"Gerd Hoffmann2013-01-221-1/+1
| | | | | | | | | | | This reverts commit a1cbfd554e11bb8af38c2f3e1f1574bf4c563cd2. Test isn't useless. scsi_req_enqueue() may finish the request (will actually happen for requests which don't trigger any I/O such as INQUIRY), then call usb_msd_command_complete() which in turn will set s->req to NULL after unref'ing it. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* usb: Fix compilation for MinGW (regression)Stefan Weil2013-01-191-1/+1
| | | | | | | | 84f2d0ea added an argument to function usb_host_info. The stub function must match the declaration in usb.h. Signed-off-by: Stefan Weil <sw@weilnetz.de> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* HMP: add QDict to info callback handlerWenchao Xia2013-01-173-3/+3
| | | | | | | | | This patch change all info call back function to take additional QDict * parameter, which allow those command take parameter. Now it is set to NULL at default case. Signed-off-by: Wenchao Xia <xiawenc@linux.vnet.ibm.com> Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
* usb-storage: Drop useless null test in usb_msd_handle_data()Markus Armbruster2013-01-161-1/+1
| | | | | | | | | | scsi_req_new() never returns null, and scsi_req_enqueue() dereferences the pointer, so checking for null is useless. Spotted by Coverity. Signed-off-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* Merge remote-tracking branch 'kraxel/usb.76' into stagingAnthony Liguori2013-01-143-8/+31
|\ | | | | | | | | | | | | | | | | | | | | | | * kraxel/usb.76: usb-host: Initialize dev->port the obviously safe way usb-host: Drop superfluous null test from usb_host_auto_scan() ehci: Assert state machine is sane w.r.t. EHCIQueue xhci: nuke transfe5rs on detach xhci: call xhci_detach_slot on root port detach too xhci: create xhci_detach_slot helper function Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
| * usb-host: Initialize dev->port the obviously safe wayMarkus Armbruster2013-01-141-1/+1
| | | | | | | | | | | | | | | | | | | | Coverity worries the strcpy() could overrun the destination. It can't, because the source always points to usb_host_scan()'s auto port[], which has the same size. Use pstrcpy() anyway, to hush the checker. Signed-off-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
| * usb-host: Drop superfluous null test from usb_host_auto_scan()Markus Armbruster2013-01-141-1/+1
| | | | | | | | | | | | | | | | | | | | Coverity points out that port is later passed to usb_host_open(), which dereferences it. It actually can't be null: it always points to usb_host_scan()'s auto port[]. Drop the superfluous port == NULL test. Signed-off-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
| * ehci: Assert state machine is sane w.r.t. EHCIQueueMarkus Armbruster2013-01-141-0/+4
| | | | | | | | | | | | | | | | | | Coverity worries the EHCIQueue pointer could be null when we pass it to functions that reference it. The state machine ensures it can't be null then. Assert that, to hush the checker. Signed-off-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
| * xhci: nuke transfe5rs on detachGerd Hoffmann2013-01-141-1/+7
| | | | | | | | Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
| * xhci: call xhci_detach_slot on root port detach tooGerd Hoffmann2013-01-141-0/+1
| | | | | | | | Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
| * xhci: create xhci_detach_slot helper functionGerd Hoffmann2013-01-141-6/+18
| | | | | | | | Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* | build: remove CONFIG_SMARTCARDPaolo Bonzini2013-01-121-1/+1
|/ | | | | | | The passthru smartcard does not have the shared library dependency, build it unconditionally. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
* Make all static TypeInfos constAndreas Färber2013-01-1016-21/+21
| | | | | | | | | | | | | | | | | | | | | | | Since 39bffca2030950ef6efe57c2fac8327a45ae1015 (qdev: register all types natively through QEMU Object Model), TypeInfo as used in the common, non-iterative pattern is no longer amended with information and should therefore be const. Fix the documented QOM examples: sed -i 's/static TypeInfo/static const TypeInfo/g' include/qom/object.h Since frequently the wrong examples are being copied by contributors of new devices, fix all types in the tree: sed -i 's/^static TypeInfo/static const TypeInfo/g' */*.c sed -i 's/^static TypeInfo/static const TypeInfo/g' */*/*.c This also avoids to piggy-back these changes onto real functional changes or other refactorings. Signed-off-by: Andreas Färber <afaerber@suse.de> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* uhci: stop using portio listsGerd Hoffmann2013-01-081-76/+30
| | | | Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* usbredir: Add support for buffered bulk input (v2)Hans de Goede2013-01-086-19/+2706
| | | | | | | | | | | | | | | | | | | | | | | | Buffered bulk mode is intended for bulk *input* endpoints, where the data is of a streaming nature (not part of a command-response protocol). These endpoints' input buffer may overflow if data is not read quickly enough. So in buffered bulk mode the usb-host takes care of the submitting and re-submitting of bulk transfers. Buffered bulk mode is necessary for reliable operation with the bulk in endpoints of usb to serial convertors. Unfortunatelty buffered bulk input mode will only work with certain devices, therefor this patch also adds a usb-id table to enable it for devices which need it, while leaving the bulk ep handling for other devices unmodified. Note that the bumping of the required usbredir from 0.5.3 to 0.6 does not mean that we will now need a newer usbredir release then qemu-1.3, .pc files reporting 0.5.3 have only ever existed in usbredir builds directly from git, so qemu-1.3 needs the 0.6 release too. Changes in v2: -Split of quirk handling into quirks.c Signed-off-by: Hans de Goede <hdegoede@redhat.com>
* usb/ehci: Add SysBus EHCI device for Exynos4210Andreas Färber2013-01-072-0/+17
| | | | | | | | | It uses a different capsbase and opregbase than the Xilinx device. Signed-off-by: Liming Wang <walimisdev@gmail.com> Signed-off-by: Andreas Färber <andreas.faerber@web.de> Cc: Igor Mitsyanko <i.mitsyanko@samsung.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* usb/ehci: Move capsbase and opregbase into SysBus EHCI classAndreas Färber2013-01-072-2/+26
| | | | | | | This allows specific derived models to use different values. Signed-off-by: Andreas Färber <andreas.faerber@web.de> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* usb/ehci: Clean up SysBus and PCI EHCI splitAndreas Färber2013-01-073-24/+60
| | | | | | | | | | | | | | | | SysBus EHCI was introduced in a hurry before 1.3 Soft Freeze. To use QOM casts in place of DO_UPCAST() / FROM_SYSBUS(), we need an identifying type. Introduce generic abstract base types for PCI and SysBus EHCI to allow multiple types to access the shared fields. While at it, move the state structs being amended with macros to the header file so that they can be embedded. The VMSTATE_PCI_DEVICE() macro does not play nice with the QOM parent_obj naming convention, so defer that cleanup. Signed-off-by: Andreas Färber <andreas.faerber@web.de> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* xhci: call set-address with dummy usbpacketGerd Hoffmann2013-01-071-1/+6
| | | | | | | | | Due to the way devices are addressed with xhci (done by hardware, not the guest os) there is no packet when invoking the set-address control request. Create a dummy packet in that case to avoid null pointer dereferences. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* usb-redir: Add debugging to bufpq save / restoreHans de Goede2013-01-071-3/+11
| | | | | Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* usbredir: Add usbredir_init_endpoints() helperHans de Goede2013-01-071-9/+13
| | | | | Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* usbredir: Verify we have 32 bits bulk length cap when redirecting to xhciHans de Goede2013-01-071-0/+2
| | | | | | | | | The xhci-hcd may submit bulk transfers > 65535 bytes even when not using bulk-in pipeling, so usbredir can only be used in combination with an xhci hcd if the client has the 32 bits bulk length capability. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* usbredir: Add ep_stopped USBDevice methodHans de Goede2013-01-071-0/+9
| | | | | | | | To ensure that interrupt receiving is properly stopped when the guest is no longer interested in an interrupt endpoint. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* usbredir: Add USBEP2I and I2USBEP helper macrosHans de Goede2013-01-071-3/+7
| | | | | Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* usbredir: Add an usbredir_stop_ep helper functionHans de Goede2013-01-071-22/+19
| | | | | Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* usb: Add an usb_device_ep_stopped USBDevice methodHans de Goede2013-01-075-5/+60
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Some usb devices (host or network redirection) can benefit from knowing when the guest stops using an endpoint. Redirection may involve submitting packets independently from the guest (in combination with a fifo buffer between the redirection code and the guest), to ensure that buffers of the real usb device are timely emptied. This is done for example for isoc traffic and for interrupt input endpoints. But when the (re)submission of packets is done by the device code, then how does it know when to stop this? For isoc endpoints this is handled by detecting a set interface (change alt setting) command, which works well for isoc endpoints. But for interrupt endpoints currently the redirection code never stops receiving data from the device, which is less then ideal. However the controller emulation is aware when a guest looses interest, as then the qh for the endpoint gets unlinked (ehci, ohci, uhci) or the endpoint is explicitly stopped (xhci). This patch adds a new ep_stopped USBDevice method and modifies the hcd code to call this on queue unlink / ep stop. This makes it possible for the redirection code to properly stop receiving interrupt input (*) data when the guest no longer has interest in it. *) And in the future also buffered bulk input. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* usb: Fix usb_ep_find_packet_by_idHans de Goede2013-01-071-1/+1
| | | | | | | | usb_ep_find_packet_by_id mistakenly only checks the first packet and if that is not a match, keeps trying the first packet! This patch fixes this. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* hid: Change idle handling to use a timerHans de Goede2013-01-071-5/+3
| | | | | | | | This leads to cleaner code in usb-hid, and removes up to a 1000 calls / sec to qemu_get_clock_ns(vm_clock) if idle-time is set to its default value of 0. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* uhci: Maximize how many frames we catch up when behindHans de Goede2013-01-071-0/+8
| | | | | | | | If somehow we've gotten behind a lot, simply skip ahead, like the ehci code does. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* uhci: Limit amount of frames processed in one goHans de Goede2013-01-071-16/+27
| | | | | | | | | | | | | | | | | Before this patch uhci would process an unlimited amount of frames when behind on schedule, by setting the timer to a time already past, causing the timer subsys to immediately recall the frame_timer function gain. This would cause invalid cancellations of bulk queues when the catching up processed more then 32 frames at a moment when the bulk qh was temporarily unlinked (which the Linux uhci driver does). This patch fixes this by processing maximum 16 frames in one go, and always setting the timer one ms later, making the code behave more like the ehci code. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* uhci: Add a QH_VALID defineHans de Goede2013-01-071-4/+5
| | | | | | | Rather then using the magic 32 value in various places. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* uhci: Fix pending interrupts getting lost on migrationHans de Goede2013-01-071-1/+2
| | | | | Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* uhci: Fix 1 ms delay in interrupt reporting to the guestHans de Goede2013-01-071-11/+13
| | | | | | | | | | | | Re-arrange how we process frames / increase frnum / report pending interrupts, to avoid a 1 ms delay in interrupt reporting to the guest. This increases the packet throughput for cases where the guest submits a single packet, then waits for its completion then re-submits from 500 pkts / sec to 1000 pkts / sec. This impacts for example the use of redirected / virtual usb to serial convertors. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* ehci: Don't call commit_irq after raising PCDHans de Goede2013-01-071-2/+0
| | | | | | | | ehci_raise_irq(s, USBSTS_PCD), gets applied immediately so there is no need to call commit_irq after it. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* ehci: Further speedup rescanning if async schedule after raising an interruptHans de Goede2013-01-071-1/+4
| | | | | | | | | | | | | | | | | | | I tried lowering the time between raising an interrupt and rescanning the async schedule to see if the guest has queued a new transfer before, but that did not have any positive effect. I now believe the cause for this is that lowering this time made it more likely to hit the 1 ms interrupt threshold penalty for the next packet, as described in my "ehci: Use uframe precision for interrupt threshold checking" commit. Now that we do interrupt threshold handling with uframe precision, futher lowering this time from .5 to .25 ms gives an extra 15% improvement in speed (MB/s) reading from a simple USB-2.0 thumb-drive. While at it also properly set the int_req_by_async flag for short packet completions. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* ehci: Use uframe precision for interrupt threshold checking (v2)Hans de Goede2013-01-071-23/+47
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Before this patch, the following could happen: 1) Transfer completes, raises interrupt 2) .5 ms later we check if the guest has queued up any new transfers 3) We find and execute a new transfer 4) .2 ms later the new transfer completes 5) We re-run our frame_timer to write back the completion, but less then 1 ms has passed since our last run, so frindex is not changed, so the interrupt threshold code delays the interrupt 6) 1 ms from the re-run our frame-timer runs again and finally delivers the interrupt This leads to unnecessary large delays of interrupts, this code fixes this by changing frindex to uframe precision and using that for interrupt threshold control, making the interrupt fire at step 5 for guest which have low interrupt threshold settings (like Linux). Note that the guest still sees the frindex move in steps of 8 for migration compatibility. This boosts Linux read speed of a simple cheap USB thumb drive by 6 %. Changes in v2: -Make the guest see frindex move in steps of 8 by modifying ehci_opreg_read, rather then using a shadow variable Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* ehci: Verify a queue's ep direction does not changeHans de Goede2013-01-072-0/+20
| | | | | | | | | | | | | ehci_fill_queue assumes that there is a one on one relationship between an ep and a qh, this patch adds a check to ensure this. Note I don't expect this to ever trigger, this is just something I noticed the guest might do while working on other stuff. The only way this check can trigger is if a guest mixes in and out qtd-s in a single qh for a non control ep. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* ehci: Add an ehci_get_pid helper functionHans de Goede2013-01-071-16/+16
| | | | | Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* ehci: Verify qtd for async completed packetsHans de Goede2013-01-071-14/+1
| | | | | | | | Remove the short-circuiting of fetchqtd in fetchqh, so that the qtd gets properly verified before completing the transaction. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* ehci: writeback_async_complete_packet: verify qh and qtdHans de Goede2013-01-071-0/+14
| | | | | Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* ehci: Move get / put_dwords upwardsHans de Goede2013-01-071-42/+42
| | | | | | | No other changes. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* ehci: Verify guest does not change the token of inflight qtd-sHans de Goede2013-01-071-6/+4
| | | | | | | | | | | | This is not allowed, except for clearing active on cancellation, so don't warn when the new token does not have its active bit set. This unifies the cancellation path for modified qtd-s, and prepares ehci_verify_qtd to be used ad an extra check inside ehci_writeback_async_complete_packet(). Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* ehci: Add ehci_verify_qh and ehci_verify_qtd helper functionsHans de Goede2013-01-071-16/+35
| | | | | Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* ehci: Add a ehci_writeback_async_complete_packet helper functionHans de Goede2013-01-071-11/+17
| | | | | | | | | Also drop the warning printf, which was there mainly because this was an untested code path (as the previous bug fixes to it show), but that no longer is the case now :) Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* usb/redirect.c: unbreak compilation due to include/char/char.hAlon Levy2012-12-281-0/+1
| | | | | | | | | | | | | Broken since: commit 927d4878b0ff319ed87fed9363f314613b0a5ed9 Author: Paolo Bonzini <pbonzini@redhat.com> Date: Mon Dec 17 18:20:05 2012 +0100 softmmu: move remaining include files to include/ subdirectories Signed-off-by: Alon Levy <alevy@redhat.com> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* softmmu: move remaining include files to include/ subdirectoriesPaolo Bonzini2012-12-192-2/+2
| | | | Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
* softmmu: move include files to include/sysemu/Paolo Bonzini2012-12-198-10/+10
| | | | Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
OpenPOWER on IntegriCloud