Statistics
| Branch: | Revision:

root / hw / usb / hcd-ehci.c @ f487b677

History | View | Annotate | Download (73.8 kB)

# Date Author Comment
f487b677 07/04/2013 06:42 pm Paolo Bonzini

dma: keep a device alive while it has SGLists

Reviewed-by: Anthony Liguori <>
Signed-off-by: Paolo Bonzini <>

cc8d6a84 06/24/2013 09:33 am Kuo-Jung Su

usb/hcd-ehci: Replace PORTSC macros with variables

Replace PORTSC macros with variables which could then be
configured in ehci_xxxx_class_init(...)

Signed-off-by: Kuo-Jung Su <>
Signed-off-by: Andreas Färber <>
Signed-off-by: Gerd Hoffmann <>

08f4c90b 06/24/2013 09:23 am Andreas Färber

usb/hcd-ehci-sysbus: Convert to QOM realize

The SysBus qdev initfn merely calls SysBusDeviceClass::init, so we can
replace it with a realizefn already. This avoids getting into any initfn
ambiguity with the upcoming Faraday EHCI implementation.

Rename internal usb_ehci_initfn() to usb_ehci_realize() to allow to...

d4614cc3 06/24/2013 09:23 am Andreas Färber

usb/hcd-ehci: Split off instance_init from realize

This makes the mem MemoryRegion available to derived instance_inits.

Keep the bus in realize for now since naming breaks in instance_init.

Signed-off-by: Andreas Färber <>
Signed-off-by: Gerd Hoffmann <>

df32fd1c 06/20/2013 05:39 pm Paolo Bonzini

dma: eliminate DMAContext

The DMAContext is a simple pointer to an AddressSpace that is now always
already available. Make everyone hold the address space directly,
and clean up the DMA API to use the AddressSpace directly.

Reviewed-by: Peter Maydell <>...

e449f26b 04/23/2013 09:43 am Hans de Goede

ehci_free_packet: Discard finished packets when the queue is halted

With pipelining it is possible to encounter a finished packet when cleaning
the queue due to a halt. This happens when a non stall error happens while
talking to a real device. In this case the queue on the usb-host side will...

8550a02d 02/19/2013 01:30 pm Gerd Hoffmann

usb-core: usb3 streams

This patch adds support for usb3 streams to the usb subsystem core.
This is just adding a streams field / parameter in a number of places.

Signed-off-by: Gerd Hoffmann <>

cc8d2b65 01/14/2013 01:47 pm Markus Armbruster

ehci: Assert state machine is sane w.r.t. EHCIQueue

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 <>...

f79738b0 01/07/2013 01:57 pm Hans de Goede

usb: Add an usb_device_ep_stopped USBDevice method

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...

f881c8d3 01/07/2013 01:57 pm Hans de Goede

ehci: Add a ehci_writeback_async_complete_packet helper function

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 <>...

c6432634 01/07/2013 01:57 pm Hans de Goede

ehci: Add ehci_verify_qh and ehci_verify_qtd helper functions

Signed-off-by: Hans de Goede <>
Signed-off-by: Gerd Hoffmann <>

d066c57b 01/07/2013 01:57 pm Hans de Goede

ehci: Verify guest does not change the token of inflight qtd-s

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...

190d8492 01/07/2013 01:57 pm Hans de Goede

ehci: Move get / put_dwords upwards

No other changes.

Signed-off-by: Hans de Goede <>
Signed-off-by: Gerd Hoffmann <>

2b3de6ad 01/07/2013 01:57 pm Hans de Goede

ehci: writeback_async_complete_packet: verify qh and qtd

Signed-off-by: Hans de Goede <>
Signed-off-by: Gerd Hoffmann <>

e3fdfd48 01/07/2013 01:57 pm Hans de Goede

ehci: Verify qtd for async completed packets

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 <>
Signed-off-by: Gerd Hoffmann <>

51e0c5d0 01/07/2013 01:57 pm Hans de Goede

ehci: Add an ehci_get_pid helper function

Signed-off-by: Hans de Goede <>
Signed-off-by: Gerd Hoffmann <>

bbbc39cc 01/07/2013 01:57 pm Hans de Goede

ehci: Verify a queue's ep direction does not change

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...

9359a58b 01/07/2013 01:57 pm Hans de Goede

ehci: Use uframe precision for interrupt threshold checking (v2)

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...

52c15e59 01/07/2013 01:57 pm Hans de Goede

ehci: Further speedup rescanning if async schedule after raising an interrupt

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...

4a9ef2c0 01/07/2013 01:57 pm Hans de Goede

ehci: Don't call commit_irq after raising PCD

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 <>
Signed-off-by: Gerd Hoffmann <>

80826240 12/04/2012 03:41 pm Hans de Goede

ehci: Lower timer freq when the periodic schedule is idle

Lower the timer freq if no iso schedule packets complete for 64 frames in
a row.

We can safely do this, without adding latency, because:
1) If there is isoc traffic this will never trigger
2) For async handled interrupt packets (only usb-host), the completion handler...

30d68cf6 11/16/2012 12:27 pm Hans de Goede

ehci: Don't access packet after freeing it

ehci_state_writeback() will free the packet, so we should not access
the packet after calling ehci_state_writeback().

Signed-off-by: Hans de Goede <>
Signed-off-by: Gerd Hoffmann <>

ff80ce59 11/16/2012 12:27 pm Hans de Goede

ehci: Fixup q->qtdaddr after cancelling an already completed packet

This avoids the q->qtdaddr == p->qtdaddr asserts we have triggering, when
a queue contains multiple completed packages when we cancel the queue.

I triggered this with windows7 + async interrupt endpoint handling (*)...

601a2347 11/16/2012 12:27 pm Hans de Goede

ehci: Better detection for qtd-s linked in circles

Windows links interrupt qtd-s in circles, which means that when interrupt
endpoints return USB_RET_ASYNC, combined with the recent
"ehci: Retry to fill the queue while waiting for td completion" patch,
we keep adding the tds to the queue over and over again, as we detect the...

2c7b15c1 11/16/2012 12:27 pm Hans de Goede

ehci: Don't verify the next pointer for periodic qh-s and qtd-s

While testing the move to async packet handling for interrupt endpoints I
noticed that Windows-XP likes to play tricks with the next pointer for
periodic qh-s, so we should not fail qh / qtd verification when it changes....

40862309 11/16/2012 12:27 pm Gerd Hoffmann

ehci: keep the frame timer running in case the guest asked for frame list rollover interrupts

Signed-off-by: Gerd Hoffmann <>

55903f1d 11/16/2012 12:27 pm Gerd Hoffmann

ehci: handle dma errors

Starting with commit 1c380f9460522f32c8dd2577b2a53d518ec91c6d dma
transfers can actually fail. This patch makes ehci keep track
of the busmaster bit in pci config space, by setting/clearing the
dma_context pointer. Attempts to dma without context will result...

e696b1da 11/08/2012 07:41 pm Hans de Goede

ehci: Add support for packets with both data and an error status

Signed-off-by: Hans de Goede <>
Signed-off-by: Gerd Hoffmann <>

9a77a0f5 11/08/2012 07:41 pm Hans de Goede

usb: split packet result into actual_length + status

Since with the ehci and xhci controllers a single packet can be larger
then maxpacketsize, it is possible for the result of a single packet
to be both having transferred some data as well as the transfer to have...

01e26b0e 11/08/2012 07:41 pm Hans de Goede

ehci: Get rid of the magical PROC_ERR status

Instead make ehci_execute and ehci_fill_queue return the again value.

Signed-off-by: Hans de Goede <>
Signed-off-by: Gerd Hoffmann <>

5010d4dc 11/01/2012 02:10 pm Peter Crosthwaite

usb/ehci: seperate out PCIisms

Seperate the PCI stuff from the EHCI components. Extracted the PCIDevice
out into a new wrapper struct to make EHCIState non-PCI-specific. Seperated
tho non PCI init component out into a seperate "common" init function.

Signed-off-by: Peter Crosthwaite <>...

569c7fc8 11/01/2012 02:10 pm Peter Crosthwaite

usb/ehci: Guard definition of EHCI_DEBUG

Guard against re-definition of EHCI_DEBUG. Allows for turning on of debug info
from configure (using --qemu-extra-cflags="-DEHCI_DEBUG=1") rather than source
code hacking.

Signed-off-by: Peter Crosthwaite <>...

0bf96f94 11/01/2012 02:10 pm Gerd Hoffmann

usb/ehci: split into multiple source files

Signed-off-by: Gerd Hoffmann <>

27a11324 11/01/2012 02:10 pm Peter Crosthwaite

usb/ehci: parameterise the register region offsets

The capabilities register and operational register offsets can vary from one
EHCI implementation to the next. Parameterise accordingly.

Signed-off-by: Peter Crosthwaite <>
Signed-off-by: Gerd Hoffmann <>

7ae6ce02 11/01/2012 02:10 pm Peter Crosthwaite

usb/ehci: Abstract away PCI DMA API

Pull the DMAContext for the PCI DMA out at device init time and put it into
the device state. Use dma_memory_read/write() instead of pci specific versions.

Signed-off-by: Peter Crosthwaite <>...

0cae7b1a 10/25/2012 10:08 am Hans de Goede

usb: Move clearing of queue on halt to the core

hcds which queue up more then one packet at once (uhci, ehci and xhci),
must clear the queue after an error which has caused the queue to halt.

Currently this is handled as a special case inside the hcd code, this...

6ba43f1f 10/25/2012 10:08 am Hans de Goede

usb: Move short-not-ok handling to the core

After a short-not-ok packet ending short, we should not advance the queue.
Move enforcing this to the core, rather then handling it in the hcd code.

This may result in the queue now actually containing multiple input packets...

a6fb2ddb 10/25/2012 10:08 am Hans de Goede

usb: Add an int_req flag to USBPacket

Signed-off-by: Hans de Goede <>
Signed-off-by: Gerd Hoffmann <>

aaac7434 10/25/2012 10:08 am Hans de Goede

usb: Enforce iso endpoints never returing USB_RET_ASYNC

ehci was already testing for this, and we depend in various places
on no devices doing this, so lets move the check for this to the
usb core.

Signed-off-by: Hans de Goede <>
Signed-off-by: Gerd Hoffmann <>

549a3c3d 10/25/2012 10:08 am Hans de Goede

ehci: Get rid of packet tbytes field

This field is used in some places to track the tbytes field of the token, but
in other places the field is used directly, use it directly everywhere for
consistency.

Signed-off-by: Hans de Goede <>...

cf08a8a1 10/25/2012 10:08 am Hans de Goede

ehci: Set int flag on a short input packet

According to 4.15.1.2 an interrupt must be raised when a short packet
is received. If we don't do this it may take a significant time for
the guest to notice a short trasnfer has completed, since only the last td...

0262f65a 10/25/2012 10:08 am Hans de Goede

ehci: Improve latency of interrupt delivery and async schedule scanning

While doing various performance tests of reading from USB mass storage devices
I noticed the following::
1) When an async handled packet completes, we don't immediately report an
interrupt to the guest, instead we wait for the frame-timer to run and...

44272b0f 10/25/2012 10:08 am Hans de Goede

ehci: Speed up the timer of raising int from the async schedule

Often the guest will queue up new packets in response to a packet, in the
async schedule with its IOC flag set, completing. By speeding up the
frame-timer, we notice these new packets earlier. This increases the...

e3a36bce 10/25/2012 10:08 am Hans de Goede

ehci: Detect going in circles when filling the queue

For ctrl endpoints Windows (atleast Win7) creates circular td lists, so far
these were not a problem because we would stop filling the queue if altnext
was set. Since further patches in this patchset remove the altnext check this...

b4ea8664 10/25/2012 10:08 am Hans de Goede

ehci: Retry to fill the queue while waiting for td completion

If the guest is using multiple transfers to try and keep the usb bus busy /
used at maximum efficiency, currently we would see / do the following:

1) submit transfer 1 to the device
2) submit transfer 2 to the device...

36dfe324 10/25/2012 10:08 am Hans de Goede

usb: Add USB_RET_ADD_TO_QUEUE packet result code

This can be used by usb-device code which wishes to process an entire endpoint
queue at once, to do this the usb-device code returns USB_RET_ADD_TO_QUEUE
from its handle_data class method and defines a flush_ep_queue class method...

a8170e5e 10/23/2012 04:58 pm Avi Kivity

Rename target_phys_addr_t to hwaddr

target_phys_addr_t is unwieldly, violates the C standard (_t suffixes are
reserved) and its purpose doesn't match the name (most target_phys_addr_t
addresses are not target specific). Replace it with a finger-friendly,...

cae5d3f4 09/26/2012 10:24 am Hans de Goede

ehci: Fix interrupt packet MULT handling

There are several issues with our handling of the MULT epcap field
of interrupt qhs, which this patch fixes.

1) When we don't execute a transaction because of the transaction counter
being 0, p->async stays EHCI_ASYNC_NONE, and the next time we process the...

8f5457eb 09/13/2012 10:50 am Hans de Goede

ehci: Don't set seen to 0 when removing unseen queue-heads

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()...

ceab6f96 09/13/2012 10:50 am Hans de Goede

ehci: Walk async schedule before and after migration

Signed-off-by: Hans de Goede <>
Signed-off-by: Gerd Hoffmann <>

3e4f910c 09/12/2012 09:09 am Gerd Hoffmann

ehci: switch to new-style memory ops

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...

ffa1f2e0 09/12/2012 09:09 am Hans de Goede

ehci: Fix interrupts stopping when Interrupt Threshold Control is 8

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....

8f74ed1e 09/12/2012 09:09 am Hans de Goede

ehci: Don't process too much frames in 1 timer tick (v2)

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...

66f092d2 09/11/2012 08:42 am Hans de Goede

Revert "ehci: don't flush cache on doorbell rings."

This reverts commit 9bc3a3a216e2689bfcdd36c3e079333bbdbf3ba0, which got
added to fix an issue where the real, underlying cause was not stopping
the ep queue on an error.

Now that the underlying cause is fixed by the "usb: Halt ep queue and...

dafe31fc 09/11/2012 08:42 am Hans de Goede

ehci: Validate qh is not changed unexpectedly by the guest

-combine the qh check with the check for devaddr changes
-also ensure that p gets set to NULL when the queue gets cancelled on
devaddr change, which was not done properly before this patch

Signed-off-by: Hans de Goede <>

522079dd 09/11/2012 08:42 am Hans de Goede

ehci: Update copyright headers to reflect recent work

Update copyright headers to reflect all the work Gerd and I have been doing
on the EHCI emulation.

Signed-off-by: Hans de Goede <>

0e795352 09/11/2012 08:42 am Hans de Goede

ehci: Properly cleanup packets on cancel

Signed-off-by: Hans de Goede <>

4b63a0df 09/11/2012 08:42 am Hans de Goede

ehci: Properly report completed but not yet processed packets to the guest

Reported packets which have completed before being cancelled as such to the
host. Note that the new code path this patch adds is untested since it I've
been unable to actually trigger the race which needs this code path....

616789cd 09/11/2012 08:42 am Gerd Hoffmann

ehci: check for EHCI_ASYNC_FINISHED first in ehci_free_packet

Otherwise we'll see the packet free twice in the trace log even though
it actually happens only once.

Signed-off-by: Gerd Hoffmann <>

5c514681 09/11/2012 08:42 am Gerd Hoffmann

ehci: trace guest bugs

make qemu_queue_{cancel,reset} return the number of packets released,
so the caller can figure whenever there have been active packets even
though there shouldn't have been any. Add tracepoint to log this.

Signed-off-by: Gerd Hoffmann <>

1defcbd1 09/11/2012 08:42 am Gerd Hoffmann

ehci: add doorbell trace events

Signed-off-by: Gerd Hoffmann <>

3a8ca08e 09/11/2012 08:42 am Hans de Goede

ehci: Add some additional ehci_trace_guest_bug() calls

Signed-off-by: Hans de Goede <>
Signed-off-by: Gerd Hoffmann <>

ef5b2344 09/11/2012 08:42 am Hans de Goede

ehci: Fix memory leak in handling of NAK-ed packets

Currently each time we try to execute a NAK-ed packet we redo
ehci_init_transfer, and usb_packet_map, re-allocing (without freeing) the
sg list every time.

This patch fixes this, it does this by introducing another async state, so...

eff6dce7 09/11/2012 08:42 am Hans de Goede

ehci: Handle USB_RET_PROCERR in ehci_fill_queue

USB_RET_PROCERR can be triggered by the guest (by for example requesting more
then BUFFSIZE bytes), so don't assert on it.

Signed-off-by: Hans de Goede <>
Signed-off-by: Gerd Hoffmann <>

cf1f8169 09/11/2012 08:42 am Hans de Goede

ehci: Correct a comment in fetchqtd packet processing

Since my previous comment said "Should never happen", I tried changing the
next line to an assert(0), which did not go well, which as the new comments
explains is logical if you think about it for a moment....

45b339b1 09/11/2012 08:42 am Hans de Goede

usb: controllers do not need to check for babble themselves

If an (emulated) usb-device tries to write more data to a packet then
its iov len, this will trigger an assert in usb_packet_copy(), and if
a driver somehow circumvents that check and writes more data to the...

adf47834 08/31/2012 04:47 pm Hans de Goede

ehci: Fix interrupt endpoints no longer working

One of the recent changes (likely the addition of queuing support) has broken
interrupt endpoints, this patch fixes this.

Signed-off-by: Hans de Goede <>

287fd3f1 08/31/2012 04:47 pm Gerd Hoffmann

ehci: handle TD deactivation of inflight packets

Check the TDs of inflight packets, cancel
packets in case the guest clears the active bit.

Signed-off-by: Gerd Hoffmann <>

574ef171 08/31/2012 01:02 pm Hans de Goede

ehci: simplify ehci_state_executing

ehci_state_executing does not need to check for p->usb_status == USB_RET_ASYNC
or USB_RET_PROCERR, since ehci_execute_complete already does a similar check
and will trigger an assert if either value is encountered.

USB_RET_ASYNC should never be the packet status when execute_complete runs...

c7cdca3b 08/31/2012 01:02 pm Gerd Hoffmann

ehci: add ehci_cancel_queue()

Factor out function to cancel all packets of a queue.
No behavior change.

Signed-off-by: Gerd Hoffmann <>

a1c3e4b8 08/31/2012 12:58 pm Hans de Goede

ehci: Schedule async-bh when IAAD bit gets set

After the "ehci: Print a warning when a queue unexpectedly contains packets
on cancel" commit. Under certain reproducable conditions I was getting the
following message: "EHCI: Warning queue not empty on queue reset"....

53dd6f70 08/31/2012 12:58 pm Hans de Goede

ehci: Remove unnecessary ehci_flush_qh call

ehci_qh_do_overlay() already calls ehci_flush_qh() before it returns, calling
it twice is useless.

Signed-off-by: Hans de Goede <>
Signed-off-by: Gerd Hoffmann <>

7ce86aa1 08/31/2012 12:57 pm Hans de Goede

ehci: Fix NULL ptr deref when unplugging an USB dev with an iso stream active

Signed-off-by: Hans de Goede <>

e983395d 08/31/2012 12:57 pm Gerd Hoffmann

usb: unique packet ids

This patch adds IDs to usb packets. Those IDs are (a) supposed to be
unique for the lifecycle of a packet (from packet setup until the packet
is either completed or canceled) and (b) stable across migration.

uhci, ohci, ehci and xhci use the guest physical address of the transfer...

0132b4b6 08/31/2012 12:55 pm Hans de Goede

usb: Halt ep queue en cancel pending packets on a packet error

For controllers which queue up more then 1 packet at a time, we must halt the
ep queue, and inside the controller code cancel all pending packets on an
error.

There are multiple reasons for this:...

47d073cc 08/16/2012 12:48 pm Hans de Goede

ehci: Fix setting of halt bit from usbcmd register updates

This fixes linux guests started without any USB devices not seeing newly
plugged devices until "lsusb" is done inside the guest.

Signed-off-by: Hans de Goede <>
Signed-off-by: Gerd Hoffmann <>

6d3b6d3d 08/16/2012 09:39 am Gerd Hoffmann

ehci: fix Interrupt Threshold Control implementation

First, not all interrupts are subject to Interrupt Threshold Control,
some of them must be delivered without delay.

Second, Interrupt Threshold Control state must be part of vmstate,
otherwise we might loose IRQs on migration....

df6839c7 08/15/2012 05:18 pm Alejandro Martinez Ruiz

ehci: fix assertion typo

Signed-off-by: Alejandro Martinez Ruiz <>
Reviewed-by: Andreas Färber <>
Signed-off-by: Stefan Hajnoczi <>

f0ad01f9 07/12/2012 04:00 pm Gerd Hoffmann

ehci: raise irq in the frame timer

With the async schedule being kicked from other places than the frame
timer (commit 0f588df8b3688b00e77aabaa32e26ece5f19bd39) it may happen
that we call ehci_commit_interrupt() more than once per frame.

Move the call from the async schedule handler to the frame timer to...

7efc17af 07/12/2012 04:00 pm Gerd Hoffmann

ehci: implement Interrupt Threshold Control support

Also reorganize and comment the irq functions while being at it.

Signed-off-by: Gerd Hoffmann <>

afb7a0b8 07/12/2012 04:00 pm Gerd Hoffmann

ehci: improve expire time calculation

Move down the expire time calculation down in the frame timer, to the
point where the timer is actually reloaded. This way we'll notice any
async_stepdown changes (especially resetting to 0 due to usb activity).

Signed-off-by: Gerd Hoffmann <>

7341ea07 07/09/2012 12:59 pm Hans de Goede

usb-ehci: Fix an assert whenever isoc transfers are used

hcd-ehci.c is missing an usb_packet_init() call for the ipacket UsbPacket
it uses for isoc transfers, triggering an assert (taking the entire vm down)
in usb_packet_setup as soon as any isoc transfers are done by a high speed...

37952117 07/09/2012 12:59 pm Hans de Goede

ehci: Kick async schedule on wakeup in the non companion case

Commit 0f588df8b3688b00e77aabaa32e26ece5f19bd39, added code
to ehci_wakeup to kick the async schedule on wakeup, but the else
was positioned wrong making it trigger for devices which are routed...

9bc3a3a2 07/09/2012 12:59 pm Gerd Hoffmann

ehci: don't flush cache on doorbell rings.

Commit 4be23939ab0d7019c7e59a37485b416fbbf0f073 makes ehci instantly
zap any unlinked queue heads when the guest rings the doorbell.

While hacking up uas support this turned out to be a problem. The linux
kernel can unlink and instantly relink the very same queue head, thereby...

a5e0139a 07/09/2012 10:57 am Gerd Hoffmann

ehci: fix ehci_qh_do_overlay

Use ehci_flush_qh to make sure we touch inly the fields the hc is
allowed to touch.

Signed-off-by: Gerd Hoffmann <>

4ed1c57a 07/09/2012 10:57 am Gerd Hoffmann

ehci: fix td writeback

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 <>

e2f89926 06/28/2012 12:33 am David Gibson

usb: Convert usb_packet_{map, unmap} to universal DMA helpers

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()...

9a773408 06/20/2012 03:46 pm Gerd Hoffmann

ehci: add live migration support

Signed-off-by: Gerd Hoffmann <>

30e9d412 06/20/2012 03:46 pm Gerd Hoffmann

ehci: tracing improvements

Signed-off-by: Gerd Hoffmann <>

ec807d12 06/07/2012 11:02 am Gerd Hoffmann

ehci: add ehci_*_enabled() helpers

Add helper functions to query whenever the async / periodic schedule
is enabled or not. Put them into use too.

Signed-off-by: Gerd Hoffmann <>

b53f685d 06/07/2012 11:02 am Gerd Hoffmann

ehci: update status bits in ehci_set_state

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 <>

daf25307 06/07/2012 11:02 am Gerd Hoffmann

ehci: fix halt status handling

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...

863b4741 06/07/2012 11:02 am Gerd Hoffmann

ehci: remove unused attach_poll_counter

Signed-off-by: Gerd Hoffmann <>

6ceced0b 06/07/2012 11:02 am Gerd Hoffmann

ehci: create ehci_update_frindex

Factor out code from ehci_frame_timer.

Signed-off-by: Gerd Hoffmann <>

3a215326 06/07/2012 11:02 am Gerd Hoffmann

ehci: adaptive wakeup rate.

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...

f020ed36 06/07/2012 11:02 am Gerd Hoffmann

ehci: rework frame skipping

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 <>

0fb3e299 06/07/2012 11:02 am Gerd Hoffmann

ehci: move async schedule to bottom half

This way we can kick the async schedule independant from the
periodic frame timer.

Signed-off-by: Gerd Hoffmann <>

ae710b99 06/07/2012 11:02 am Gerd Hoffmann

ehci: schedule async bh on async packet completion

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 <>

0f588df8 06/07/2012 11:02 am Gerd Hoffmann

ehci: kick async schedule on wakeup

Kick async schedule when we get a wakeup
notification from a usb device.

Signed-off-by: Gerd Hoffmann <>

7046530c 06/07/2012 11:02 am Gerd Hoffmann

ehci: fix reset

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 <>