Statistics
| Branch: | Revision:

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

History | View | Annotate | Download (103.5 kB)

# Date Author Comment
37352df3 06/03/2013 12:38 pm Gerd Hoffmann

xhci: add live migration support

With all preparing pieces in place we can finally drop in
the vmstate structs and the postload function.

Signed-off-by: Gerd Hoffmann <>

4034e693 06/03/2013 12:37 pm Gerd Hoffmann

xhci: add XHCISlot->addressed

Preparing for live-migration support, post_load will need that.

Signed-off-by: Gerd Hoffmann <>

492b21f6 06/03/2013 12:37 pm Gerd Hoffmann

xhci: add xhci_alloc_epctx

Factor out endpoint context allocation to a separate function.
xhci live migration will need that too, in post_load.

Signed-off-by: Gerd Hoffmann <>

003e15a1 06/03/2013 12:37 pm Gerd Hoffmann

xhci: add xhci_init_epctx

Factor out endpoint context initialization to a separate function.
xhci live migration will need that too, in post_load.

Signed-off-by: Gerd Hoffmann <>

4e906d56 05/07/2013 12:34 pm Gerd Hoffmann

xhci: handle USB_RET_BABBLE

Signed-off-by: Gerd Hoffmann <>

7d04c2b7 04/23/2013 09:43 am Gerd Hoffmann

xhci: remove XHCIRing->base (unused)

Signed-off-by: Gerd Hoffmann <>

af203be3 04/16/2013 01:04 pm Gerd Hoffmann

xhci: use slotid as device address

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

a6718874 04/16/2013 01:04 pm Gerd Hoffmann

xhci: fix address device

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

94ae9eec 04/16/2013 12:59 pm Gerd Hoffmann

xhci: remove leftover debug printf

Signed-off-by: Gerd Hoffmann <>

6d3bc22e 04/16/2013 12:59 pm Gerd Hoffmann

xhci: add xhci_cap_write

Signed-off-by: Gerd Hoffmann <>

bdfce20d 04/16/2013 12:59 pm Gerd Hoffmann

xhci: fix portsc writes

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

4b7b2afa 04/03/2013 12:39 pm Gerd Hoffmann

xhci: zap unused name field

Signed-off-by: Gerd Hoffmann <>

c94a7c69 04/03/2013 10:55 am Gerd Hoffmann

xhci: fix numintrs sanity checks

Make sure numintrs is a power of two, msi requires this.

https://bugzilla.redhat.com/show_bug.cgi?id=918035

Signed-off-by: Gerd Hoffmann <>

61803996 04/03/2013 10:55 am Gerd Hoffmann

xhci: remove leftover debug printf

Signed-off-by: Gerd Hoffmann <>

0ab966cf 04/03/2013 10:55 am Gerd Hoffmann

xhci: remove unimplemented printfs

Replace them with a tracepoint, so they don't spam stderr by default.

Signed-off-by: Gerd Hoffmann <>

6214e73c 03/26/2013 09:02 pm Alex Williamson

pcie: Add endpoint capability initialization wrapper

Fix the awkward API of mangling the caller specified PCIe type and
just provide an interface to initialize an endpoint device. This
will pick either a regular endpoint or integrated endpoint based on
the bus and return pcie_cap_init to doing exactly what is asked....

685cbd2f 02/23/2013 11:39 am Hervé Poussineau

xhci: fix bad print specifier

This fixes the following compilation error:
hw/usb/hcd-xhci.c:1156:17: error: format ‘%llx’ expects argument of type
‘long long unsigned int’, but argument 4 has type ‘unsigned int’

Signed-off-by: Hervé Poussineau <>...

024426ac 02/19/2013 02:17 pm Gerd Hoffmann

usb-xhci: usb3 streams

Add streams support to the xhci emulation. No secondary streams yet,
only linear stream arays are supported for now.

Signed-off-by: Gerd Hoffmann <>

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

81251841 01/14/2013 09:59 am Gerd Hoffmann

xhci: create xhci_detach_slot helper function

Signed-off-by: Gerd Hoffmann <>

f3dcf638 01/14/2013 09:59 am Gerd Hoffmann

xhci: call xhci_detach_slot on root port detach too

Signed-off-by: Gerd Hoffmann <>

0cb41e2c 01/14/2013 09:59 am Gerd Hoffmann

xhci: nuke transfe5rs on detach

Signed-off-by: Gerd Hoffmann <>

8c43a6f0 01/10/2013 11:11 pm Andreas Färber

Make all static TypeInfos const

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

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

a820b575 01/07/2013 01:57 pm Gerd Hoffmann

xhci: call set-address with dummy usbpacket

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

1de7afc9 12/19/2012 09:32 am Paolo Bonzini

misc: move include files to include/qemu/

Signed-off-by: Paolo Bonzini <>

a2cb15b0 12/17/2012 01:02 pm Michael S. Tsirkin

pci: update all users to look in pci/

update all users so we can remove the makefile hack.

Signed-off-by: Michael S. Tsirkin <>

6c2d1c32 11/29/2012 09:04 am Gerd Hoffmann

usb: tag usb host adapters as not hotpluggable.

Hotplugging them simply doesn't work, so tag them accordingly to
avoid users trying and then crashing qemu.

For xhci there is nothing fundamental which prevents hotplug from
working, we'll "only" need a exit() function which cleans up...

616b5d53 11/09/2012 09:27 am David Gibson

xhci: Fix some DMA host endian bugs

The xhci device does correct endian switches on the results of some DMAs
but not all. In particular, there are many DMAs of what are essentially
arrays of 32-bit integers which never get byteswapped. This causes them...

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

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

85e05d82 11/01/2012 02:10 pm Gerd Hoffmann

xhci: add {get,set}_field macros & enum for pls

Add {get,set}_field macros (simliar to ehci) to read and update
some bits of a word. Put them into use for updating pls (port
link state) values. Also add a enum for pls values.

Signed-off-by: Gerd Hoffmann <>

f3214027 11/01/2012 02:10 pm Gerd Hoffmann

xhci: s/xhci_update_port/xhci_port_update/

Rename the function for xhci_port_* naming scheme, also drop
the xhci parameter as port carries a pointer to xhci anyway.

Signed-off-by: Gerd Hoffmann <>

6a32f80f 11/01/2012 02:10 pm Gerd Hoffmann

xhci: add xhci_port_have_device

Factor out the code which checks whenever a usb device is attached
to the port in question. No functional change.

Signed-off-by: Gerd Hoffmann <>

f705a362 11/01/2012 02:10 pm Gerd Hoffmann

xhci: add xhci_port_notify

Create a function to notify the guest about port
status changes and put it into use.

Signed-off-by: Gerd Hoffmann <>

40030130 11/01/2012 02:10 pm Gerd Hoffmann

xhci: add xhci_port_reset

Move port reset logic to its own function.

Signed-off-by: Gerd Hoffmann <>

b62b0828 11/01/2012 02:10 pm Gerd Hoffmann

xhci: set pls in xhci_port_update & xhci_port_reset

Set the port link state to the correct values in xhci_port_update and
xhci_port_reset functions.

Signed-off-by: Gerd Hoffmann <>

4f47f0f8 11/01/2012 02:10 pm Gerd Hoffmann

xhci: add port trace points

Signed-off-by: Gerd Hoffmann <>

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

xhci: allow address slot being called multiple times

win8 guests do that for some reason ...

Signed-off-by: Gerd Hoffmann <>

0ebfb144 10/25/2012 03:38 pm Gerd Hoffmann

xhci: fix usb name in caps

Used to be "UTB" not "USB".

Signed-off-by: Gerd Hoffmann <>

91062ae0 10/25/2012 03:37 pm Gerd Hoffmann

xhci: make number of interrupters and slots configurable

Add properties to tweak the numbers of available interrupters and slots.

Signed-off-by: Gerd Hoffmann <>

e099ad4b 10/25/2012 03:35 pm Gerd Hoffmann

xhci: allow disabling interrupters

For secondary interrupters this is explicitly allowed in the specs.
For the primary interrupter behavior is undefined, lets be friendly
and allow disabling too.

Signed-off-by: Gerd Hoffmann <>

3f973ee8 10/25/2012 03:35 pm Gerd Hoffmann

xhci: flush endpoint context unconditinally

Not updating the endpoint context in case the state didn't change is
wrong. Other context fields might have changed, for example the
dequeue pointer in response to a CR_SET_TR_DEQUEUE command.

Signed-off-by: Gerd Hoffmann <>

79a8af35 10/25/2012 03:35 pm Gerd Hoffmann

xhci: fix function name in error message

Signed-off-by: Gerd Hoffmann <>

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

3151f209 10/25/2012 10:08 am Hans de Goede

xhci: Add a xhci_ep_nuke_one_xfer helper function

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

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

4d5b97da 10/05/2012 04:10 pm Amos Kong

cleanup useless return sentence

This patch cleans up return sentences in the end of void functions.

Reported-by: Paolo Bonzini <>
Signed-off-by: Amos Kong <>
Signed-off-by: Stefan Hajnoczi <>

d95e74ea 09/26/2012 10:24 am Gerd Hoffmann

xhci: tweak limits

Set maxports to 15. This is what the usb3 route string can handle.

Set maxslots to 64. This is more than the number of root ports we
can have, but with additional hubs you can end up with more devices.

Set maxintrs (aka msi vectors) to 16. Should be enougth, especially...

ccaf87a0 09/26/2012 10:24 am Gerd Hoffmann

xhci: route string & usb hub support

Parse route string in slot contexts and
support devices connected via hub.

1d8a4e69 09/26/2012 10:24 am Gerd Hoffmann

xhci: create a memory region for each port

Signed-off-by: Gerd Hoffmann <>

4c47f800 09/11/2012 08:43 am Gerd Hoffmann

xhci: add msix support

Signed-off-by: Gerd Hoffmann <>

2cae4119 09/11/2012 08:43 am Gerd Hoffmann

xhci: move register update into xhci_intr_raise

Now that we have a separate function to raise an IRQ we can move
some comon code into the function.

Signed-off-by: Gerd Hoffmann <>

962d11e1 09/11/2012 08:43 am Gerd Hoffmann

xhci: add XHCIInterrupter

Move all state belonging to the (single) interrupter into a separate
struct. First step in adding support for multiple interrupters.

Signed-off-by: Gerd Hoffmann <>

43d9d604 09/11/2012 08:43 am Gerd Hoffmann

xhci: prepare xhci_runtime_{read,write} for multiple interrupters

Prepare xhci runtime register access function for multiple interrupters.

Signed-off-by: Gerd Hoffmann <>

2d1de850 09/11/2012 08:43 am Gerd Hoffmann

xhci: pick target interrupter

Pick the correct interrupter when queuing an event.

Signed-off-by: Gerd Hoffmann <>

fa8ee89e 09/11/2012 08:43 am Gerd Hoffmann

xhci: support multiple interrupters

Everything is in place, flip the big switch now
and enable support for multiple interrupters.

Signed-off-by: Gerd Hoffmann <>

1b067564 09/11/2012 08:43 am Gerd Hoffmann

xhci: kill xhci_mem_{read,write} dispatcher functions

... and register subregions instead, so we offload the dispatching
to the the memory subsystem which is designed to handle it.

Signed-off-by: Gerd Hoffmann <>

6ee021d4 09/11/2012 08:43 am Gerd Hoffmann

xhci: allow bytewise capability register reads

Some guests need this according to
Alejandro Martinez Ruiz <>

Signed-off-by: Gerd Hoffmann <>

d5a15814 09/11/2012 08:43 am Gerd Hoffmann

xhci: drop buffering

This patch splits the xhci_xfer_data function into three.
The xhci_xfer_data function used to do does two things:

(1) copy transfer data between guest memory and a temporary buffer.
(2) report transfer results to the guest using events....
5c08106f 09/11/2012 08:43 am Gerd Hoffmann

xhci: move device lookup into xhci_setup_packet

Signed-off-by: Gerd Hoffmann <>

01546fa6 09/11/2012 08:43 am Gerd Hoffmann

xhci: implement mfindex

Implement mfindex register and mfindex wrap event.

Signed-off-by: Gerd Hoffmann <>

3d139684 09/11/2012 08:43 am Gerd Hoffmann

xhci: iso xfer support

Add support for iso transfers.

Signed-off-by: Gerd Hoffmann <>

873123fe 09/11/2012 08:43 am Gerd Hoffmann

xhci: trace cc codes in cleartext

Signed-off-by: Gerd Hoffmann <>

d829fde9 09/11/2012 08:43 am Gerd Hoffmann

xhci: add trace_usb_xhci_ep_set_dequeue

Signed-off-by: Gerd Hoffmann <>

8e9f18b6 09/11/2012 08:43 am Gerd Hoffmann

xhci: fix runtime write tracepoint

Signed-off-by: Gerd Hoffmann <>

106b214c 09/11/2012 08:43 am Gerd Hoffmann

xhci: update register layout

Change the register layout to be a bit more sparse and also not depend
on the number of ports. Useful when for making the number of ports
runtime-configurable.

0846e635 09/11/2012 08:43 am Gerd Hoffmann

xhci: update port handling

This patch changes the way xhci ports are linked to USBPorts. The fixed
1:1 relationship between xhci ports and USBPorts is gone. Now each
USBPort represents a physical plug which has usually two xhci ports
assigned: one usb2 and ond usb3 port. usb devices show up at one or the...

c5e9b02d 09/11/2012 08:43 am Gerd Hoffmann

xhci: fix & cleanup msi.

Drop custom write_config function which isn't needed any more.
Make the msi property a bit property so it accepts 'on' & 'off'.
Enable MSI by default.

TODO: add compat property to disable on old machine types.

Signed-off-by: Gerd Hoffmann <>

4c4abe7c 09/11/2012 08:43 am Gerd Hoffmann

xhci: rework interrupt handling

Split xhci_irq_update into a function which handles intx updates
(including lowering the irq line once the guests acks the interrupt)
and one which is used for raising an irq only.

Signed-off-by: Gerd Hoffmann <>

331e9406 09/11/2012 08:43 am Gerd Hoffmann

xhci: rip out background transfer code

original xhci code (the one which used libusb directly) used to use
'background transfers' for iso streams. In upstream qemu the iso
stream buffering is handled by usb-host & usb-redir, so we will
never ever need this. It has been left in as reference, but is dead...

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

0703a4a7 06/07/2012 11:02 am Gerd Hoffmann

xhci: trace: ring fetch

Signed-off-by: Gerd Hoffmann <>

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

xhci: trace: endpoints

Signed-off-by: Gerd Hoffmann <>

97df650b 06/07/2012 11:02 am Gerd Hoffmann

xhci: trace: transfers

Signed-off-by: Gerd Hoffmann <>

348f1037 06/07/2012 11:02 am Gerd Hoffmann

xhci: trace: slots

Signed-off-by: Gerd Hoffmann <>

64619739 06/07/2012 11:02 am Jan Kiszka

xhci: Clean up reset function

Properly register reset function via the device class.

Signed-off-by: Jan Kiszka <>
Signed-off-by: Gerd Hoffmann <>

2d754a10 06/07/2012 11:02 am Gerd Hoffmann

xhci: trace: mmio reads+writes

Signed-off-by: Gerd Hoffmann <>

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

xhci: trace: run+stop

Signed-off-by: Gerd Hoffmann <>

7acd279f 06/07/2012 11:02 am Gerd Hoffmann

xhci: trace: irq + events

Signed-off-by: Gerd Hoffmann <>

59a70ccd 04/26/2012 01:21 pm David Gibson

usb-xhci: Use PCI DMA helper functions

Shortly before 1.0, we added helper functions / wrappers for doing PCI DMA
from individual devices. This makes what's going on clearer and means that
when we add IOMMU support somewhere in the future, only the general PCI...

215bff17 04/26/2012 01:21 pm Lai Jiangshan

usb-xhci: fix bit test

use & instead of the wrong &&

Signed-off-by: Lai Jiangshan <>
Signed-off-by: Gerd Hoffmann <>

f1ae32a1 03/13/2012 11:15 am Gerd Hoffmann

usb: the big rename

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