summaryrefslogtreecommitdiffstats
path: root/hw/usb/hcd-ehci.c
Commit message (Collapse)AuthorAgeFilesLines
...
* ehci: fix td writebackGerd Hoffmann2012-07-091-2/+4
| | | | | | | | Only write back the dwords the hc is supposed to update. Should not make a difference in theory as the guest must not touch the td while it is active to avoid races. But it is still more correct. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* ehci: fix ehci_qh_do_overlayGerd Hoffmann2012-07-091-19/+18
| | | | | | | Use ehci_flush_qh to make sure we touch inly the fields the hc is allowed to touch. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* usb: Convert usb_packet_{map, unmap} to universal DMA helpersDavid Gibson2012-06-271-2/+2
| | | | | | | | | | | | | | | | | | | | | | | The USB UHCI and EHCI drivers were converted some time ago to use the pci_dma_*() helper functions. However, this conversion was not complete because in some places both these drivers do DMA via the usb_packet_map() function in usb-libhw.c. That function directly used cpu_physical_memory_map(). Now that the sglist code uses DMA wrappers properly, we can convert the functions in usb-libhw.c, thus conpleting the conversion of UHCI and EHCI to use the DMA wrappers. Note that usb_packet_map() invokes dma_memory_map() with a NULL invalidate callback function. When IOMMU support is added, this will mean that usb_packet_map() and the corresponding usb_packet_unmap() must be called in close proximity without dropping the qemu device lock - otherwise the guest might invalidate IOMMU mappings while they are still in use by the device code. Signed-off-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* ehci: tracing improvementsGerd Hoffmann2012-06-201-2/+5
| | | | Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* ehci: add live migration supportGerd Hoffmann2012-06-201-6/+56
| | | | Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* ehci: rework frame skippingGerd Hoffmann2012-06-071-15/+10
| | | | | | | Move the framecount check out of the loop and use the new ehci_update_frindex function to skip frames if needed. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* ehci: adaptive wakeup rate.Gerd Hoffmann2012-06-071-18/+39
| | | | | | | | | | | | | | | | Adapt the frame timer sleeps according to the actual needs. With the periodic schedule being active we'll have to wakeup 1000 times per second and go check for work. In case only the async schedule is active we can be more lazy though. When idle ehci will increate the sleep time step by step, so qemu has to wake up less frequently. When we'll see transactions on the bus or the guest fiddles with the schedule enable/disable bits we'll return to a 1000 Hz wakeup rate and full speed. With both schedules disabled we stop wakeups altogether. This patch also drops the freq property (configures wakeup rate manually) which is obsoleted by this patch. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* ehci: create ehci_update_frindexGerd Hoffmann2012-06-071-12/+23
| | | | | | Factor out code from ehci_frame_timer. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* ehci: remove unused attach_poll_counterGerd Hoffmann2012-06-071-2/+0
| | | | Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* ehci: fix halt status handlingGerd Hoffmann2012-06-071-15/+24
| | | | | | | | | | | | | When the enable bits for controller / async schedule / periodic schedule change just make sure we kick the frame timer and let ehci_advance_periodic_state and ehci_advance_async_state handle the controller state changes. This will make ehci set USBSTS_HALT when the controller shutdown is actually done, once both schedules are in inactive state and the USBSTS_PSS and USBSTS_ASS bits are clear. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* ehci: update status bits in ehci_set_stateGerd Hoffmann2012-06-071-4/+10
| | | | | | | Update the status register in the ehci_set_state function, to make sure the guest-visible register is in sync with our internal schedule state. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* ehci: add ehci_*_enabled() helpersGerd Hoffmann2012-06-071-6/+21
| | | | | | | Add helper functions to query whenever the async / periodic schedule is enabled or not. Put them into use too. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* ehci: fix resetGerd Hoffmann2012-06-071-4/+6
| | | | | | | Check for the reset bit first when processing USBCMD register writes. Also break out of the switch, there is no need to check the other bits. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* ehci: kick async schedule on wakeupGerd Hoffmann2012-06-071-0/+2
| | | | | | | Kick async schedule when we get a wakeup notification from a usb device. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* ehci: schedule async bh on async packet completionGerd Hoffmann2012-06-071-0/+4
| | | | | | | When a packet completes which happens to be part of the async schedule kick the async bottom half for processing, Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* ehci: move async schedule to bottom halfGerd Hoffmann2012-06-071-1/+10
| | | | | | | This way we can kick the async schedule independant from the periodic frame timer. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* ehci: add async field to EHCIQueueGerd Hoffmann2012-06-071-43/+49
| | | | | | | | Keep track whenever a EHCIQueue is part of the async or periodic schedule. This way we don't have to pass around the async flag everywhere but can look it up from the EHCIQueue struct when needed. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* ehci: tweak queue initializationGerd Hoffmann2012-06-071-4/+4
| | | | | | | Little tweak for the queue initialization, set the QH address in the allocation function. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* ehci: add queuing supportGerd Hoffmann2012-06-071-9/+51
| | | | | | | | | Add packet queuing. Follow the qTD chain to see if there are more packets we can submit. Improves performance on larger transfers, especially with usb-host, as we don't have to wait for a packet to finish before sending the next one to the host for processing. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* ehci: move ehci_flush_qhGerd Hoffmann2012-06-071-17/+18
| | | | | | | Move ehci_flush_qh() function up in the source code. No code change. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* ehci: cache USBDevice in EHCIQueueGerd Hoffmann2012-06-071-12/+19
| | | | | | | Keep a USBDevice pointer in EHCIQueue so we don't have to lookup the device on each usb packet submission. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* ehci: make ehci_execute work on EHCIPacket instead of EHCIQueueGerd Hoffmann2012-06-071-13/+9
| | | | | | | This way it is possible to use ehci_execute to submit others than the first EHCIPacket of the EHCIQueue. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* ehci: add EHCIPacketGerd Hoffmann2012-06-071-77/+157
| | | | | | | | | | Add a separate EHCIPacket struct and move fields over from EHCIQueue. Preparing for supporting multiple packets per queue being in flight at the same time. No functional changes yet. Fix some codestyle issues along the way. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* fix some common typosJim Meyering2012-05-141-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | These were identified using: http://github.com/lyda/misspell-check and run like this to create a bourne shell script using GNU sed's -i option: git ls-files|grep -vF .bin | misspellings -f - |grep -v '^ERROR:' |perl \ -pe 's/^(.*?)\[(\d+)\]: (\w+) -> "(.*?)"$/sed -i '\''${2}s!$3!$4!'\'' $1/' Manually eliding the FP, "rela->real" and resolving "addres" to address (not "adders") we get this: sed -i '450s!thru!through!' Changelog sed -i '260s!neccessary!necessary!' coroutine-sigaltstack.c sed -i '54s!miniscule!minuscule!' disas.c sed -i '1094s!thru!through!' hw/usb/hcd-ehci.c sed -i '1095s!thru!through!' hw/usb/hcd-ehci.c sed -i '21s!unecessary!unnecessary!' qapi-schema-guest.json sed -i '307s!explictly!explicitly!' qemu-ga.c sed -i '490s!preceeding!preceding!' qga/commands-posix.c sed -i '792s!addres!address!' qga/commands-posix.c sed -i '6s!beeing!being!' tests/tcg/test-mmap.c Also, manually fix "arithmentic", spotted by Peter Maydell: sed -i 's!arithmentic!arithmetic!' coroutine-sigaltstack.c Signed-off-by: Jim Meyering <meyering@redhat.com> Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
* usb-ehci: Ensure frindex writes leave a valid frindex valueHans de Goede2012-04-261-0/+4
| | | | | | | | | | | | frindex is a 14 bits counter, so bits 31-14 should always be 0, and after the commit titled "usb-ehci: frindex always is a 14 bits counter" we rely on frindex always being a multiple of 8. I've not seen this in practice, but theoretically a guest can write a value >= 0x4000 or a value which is not a multiple of 8 value to frindex, this patch ensures that things will still work when that happens. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* usb-ehci: add missing usb_packet_init() callGerd Hoffmann2012-04-261-0/+1
| | | | Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* usb-ehci: remove hackGerd Hoffmann2012-04-261-18/+0
| | | | | | | | | To answer the question in the comment removed by this patch: I think this was needed because several places in the ehci emulation did not check the T bit of link entries correctly and thus might have followed invalid references. See commit 2a5ff735dc1074171a0cbb1dc228d6d6e907f571 Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* usb-ehci: drop assert()Gerd Hoffmann2012-04-171-1/+0
| | | | | | | | | | Not sure what the purpose of the assert() was, in any case it is bogous. We can arrive there if transfer descriptors passed to us from the guest failed to pass sanity checks, i.e. it is guest-triggerable. We deal with that case by resetting the host controller. Everything is ok, no need to throw a core dump here. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* usb-ehci: Drop unused sofv valueHans de Goede2012-04-171-8/+0
| | | | | | | | The sofv value only ever gets a value assigned and is never used (read) anywhere, so we can just drop it. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* usb-ehci: frindex always is a 14 bits counterHans de Goede2012-04-171-2/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | frindex always is a 14 bits counter, and not a 13 bits one as we were emulating. There are some subtle hints to this in the spec, first of all "Table 2-12. FRINDEX - Frame Index Register" says: "Bit 13:0 Frame Index. The value in this register increments at the end of each time frame (e.g. micro-frame). Bits [N:3] are used for the Frame List current index. This means that each location of the frame list is accessed 8 times (frames or micro-frames) before moving to the next index. The following illustrates values of N based on the value of the Frame List Size field in the USBCMD register. USBCMD[Frame List Size] Number Elements N 00b 1024 12 01b 512 11 10b 256 10 11b Reserved" Notice how the text talks about "Bits [N:3]" are used ..., it does NOT say that when N == 12 (our case) the counter will wrap from 8191 to 0, or in otherwords that it is a 13 bits counter (bits 0 - 12). The other hint is in "Table 2-10. USBSTS USB Status Register Bit Definitions": "Bit 3 Frame List Rollover - R/WC. The Host Controller sets this bit to a one when the Frame List Index (see Section 2.3.4) rolls over from its maximum value to zero. The exact value at which the rollover occurs depends on the frame list size. For example, if the frame list size (as programmed in the Frame List Size field of the USBCMD register) is 1024, the Frame Index Register rolls over every time FRINDEX[13] toggles. Similarly, if the size is 512, the Host Controller sets this bit to a one every time FRINDEX[12] toggles." Notice how this text talks about setting bit 3 when bit 13 of frindex toggles (when there are 1024 entries, so our case), so this indicates that frindex has a bit 13 making it a 14 bit counter. Besides these clear hints the real proof is in the pudding. Before this patch I could not stream data from a USB2 webcam under Windows XP, after this cam using a USB2 webcam under Windows XP works fine, and no regressions with other operating systems were seen. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* usb-ehci: fix ehci_child_detachGerd Hoffmann2012-04-171-1/+0
| | | | | | | | | | Looks like a cut+paste bug from ehci_detach. When the device itself is detached from a ehci port (ehci_detach op) we have to clear the device pointer for the companion port too. When a device gets removed from a downstream port of a usb hub (ehci_child_detach op) the ehci port where the usb hub is plugged in is not affected. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* usb-ehci: drop unused isoch_pause variableHans de Goede2012-03-131-5/+1
| | | | | Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* usb: the big renameGerd Hoffmann2012-03-131-0/+2345
Reorganize usb source files. Create a new hw/usb/ directory and move all usb source code to that place. Also make filenames a bit more descriptive. Host adapters are prefixed with "hch-" now, usb device emulations are prefixed with "dev-". Fixup paths Makefile and include paths to make it compile. No code changes. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
OpenPOWER on IntegriCloud