summaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2012-09-11usb3: bos decriptorGerd Hoffmann4-0/+141
Add support for creating BOS descriptor and device cappability descriptors. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-09-11usb3: superspeed endpoint companionGerd Hoffmann3-20/+62
Add support for building superspeed endpoint companion descriptors, create them for superspeed usb devices. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-09-11usb3: superspeed descriptorsGerd Hoffmann2-1/+10
Add superspeed descriptor entry to USBDesc, advertise superspeed support when present. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-09-11xhci: update port handlingGerd Hoffmann1-40/+97
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 other, depending on whenever they support superspeed or not. This patch also makes the number of usb2 and usb3 ports runtime configurable by adding 'p2' and 'p3' properties. It is allowed to have different numbers of usb2 and usb3 ports. Specifying p2=4,p3=2 will give you an xhci adapter which supports all speeds on physical ports 1+2 and usb2 only on ports 3+4.
2012-09-11xhci: update register layoutGerd Hoffmann1-8/+13
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.
2012-09-11xhci: fix runtime write tracepointGerd Hoffmann1-1/+1
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-09-11xhci: add trace_usb_xhci_ep_set_dequeueGerd Hoffmann2-1/+2
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-09-11xhci: trace cc codes in cleartextGerd Hoffmann2-2/+48
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-09-11xhci: iso xfer supportGerd Hoffmann1-16/+101
Add support for iso transfers. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-09-11xhci: implement mfindexGerd Hoffmann1-7/+46
Implement mfindex register and mfindex wrap event. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-09-11xhci: move device lookup into xhci_setup_packetGerd Hoffmann1-36/+38
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-09-11xhci: drop bufferingGerd Hoffmann2-115/+72
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. Now we three functions to handle this: (1) xhci_xfer_map creates a scatter list for the transfer and uses that (instead of the temporary buffer) to build a USBPacket. (2) xhci_xfer_unmap undoes the mapping. (3) xhci_xfer_report sends out events. The patch also fixes reporting of transaction errors which must be reported unconditinally, not only in case the guest asks for it using the ISP flag. [ v2: fix warning ] Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-09-11xhci: rip out background transfer codeGerd Hoffmann1-219/+4
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 code anyway. Rip it out. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-09-11usb-audio: fix usb versionGerd Hoffmann1-1/+1
usb-audio is a full speed (1.1) device, but bcdUSB claims it is usb 2.0. Fix it. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-09-11Better name usb braille deviceSamuel Thibault1-1/+1
Windows users need to know that they have to use the Baum driver to make the qemu braille device work. Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-09-11usb-redir: Enable pipelining for bulk endpointsHans de Goede1-0/+3
Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-09-11usb-redir: Ensure our peer has the necessary caps when redirecting to XHCIHans de Goede1-0/+11
In order for redirection to work properly when redirecting to an emulated XHCI controller, the usb-redir-host must support both usb_redir_cap_ep_info_max_packet_size and usb_redir_cap_64bits_ids, reject any devices redirected to an XHCI controller when these are not supported. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-09-11usb-redir: Add a usbredir_reject_device helper functionHans de Goede1-10/+11
Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-09-11usb-redir: Set ep max_packet_size if availableHans de Goede1-0/+5
This is needed for usb-redir to work properly with the xhci emulation. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-09-11usb-redir: Convert to new libusbredirparser 0.5 APIHans de Goede2-32/+32
This gives us support for 64 bit ids which is needed for using XHCI with the new hcd generated ids. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-09-11usb-redir: Return babble when getting more bulk data then requestedHans de Goede1-3/+3
Babble is the appropriate error in this case (rather then signalling a stall). Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-09-11usb-redir: Move to core packet id and queue handlingHans de Goede1-134/+92
Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-09-11usb-redir: Get rid of unused async-struct dev memberHans de Goede1-2/+0
This is a preparation patch for completely getting rid of the async-packet struct in usb-redir, instead relying on the (new) per ep queues in the qemu usb core. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-09-11usb-redir: Get rid of local shadow copy of packet headersHans de Goede1-27/+0
The shadow copy only serves as an extra check (besides the packet-id) to ensure the packet we get back is a reply to the packet we think it is. This check has never triggered in all the time usb-redir is in use now, and since the verified data in the returned packet-header is not used otherwise, removing the check does not open any possibilities for the usbredirhost to confuse us. This is a preparation patch for completely getting rid of the async-packet struct in usb-redir, instead relying on the (new) per ep queues in the qemu usb core. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-09-11usb-redir: Get rid of async-struct get memberHans de Goede1-6/+3
This is a preparation patch for completely getting rid of the async-packet struct in usb-redir, instead relying on the (new) per ep queues in the qemu usb core. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-09-11usb-redir: Don't delay handling of open events to a bottom halfHans de Goede1-47/+53
There is no need for this, and doing so means that a backend trying to write immediately after an open event will see qemu_chr_be_can_write returning 0, which not all backends handle well as there is no wakeup mechanism to detect when the frontend does become writable. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-09-11usb-redir: Never return USB_RET_NAK for async handled packetsHans de Goede1-3/+6
USB_RET_NAK is not a valid response for async handled packets (and will trigger an assert as such). Also drop the warning when receiving a status of cancelled for packets not cancelled by qemu itself, this can happen when a device gets unredirected by the usbredir-host while transfers are pending. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-09-11ehci: Correct a comment in fetchqtd packet processingHans de Goede1-1/+4
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. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-09-11ehci: Handle USB_RET_PROCERR in ehci_fill_queueHans de Goede1-3/+6
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 <hdegoede@redhat.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-09-11ehci: Fix memory leak in handling of NAK-ed packetsHans de Goede1-11/+27
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 that we also properly cleanup a NAK-ed packet on cancel. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-09-11ehci: Add some additional ehci_trace_guest_bug() callsHans de Goede1-6/+13
Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-09-11ehci: add doorbell trace eventsGerd Hoffmann2-1/+4
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-09-11ehci: trace guest bugsGerd Hoffmann2-6/+21
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 <kraxel@redhat.com>
2012-09-11ehci: check for EHCI_ASYNC_FINISHED first in ehci_free_packetGerd Hoffmann1-6/+6
Otherwise we'll see the packet free twice in the trace log even though it actually happens only once. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-09-11ehci: Properly report completed but not yet processed packets to the guestHans de Goede1-0/+13
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. Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2012-09-11ehci: Properly cleanup packets on cancelHans de Goede1-0/+2
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2012-09-11ehci: Update copyright headers to reflect recent workHans de Goede1-0/+5
Update copyright headers to reflect all the work Gerd and I have been doing on the EHCI emulation. Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2012-09-11ehci: Validate qh is not changed unexpectedly by the guestHans de Goede1-11/+28
-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 <hdegoede@redhat.com>
2012-09-11Revert "ehci: don't flush cache on doorbell rings."Hans de Goede1-29/+6
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 cancel pending packets on a packet error" patch, the "don't flush" fix is no longer needed. Not only is it not needed, it causes us to see cancellations (unlinks) done by the Linux EHCI driver too late, which in combination with the new usb-core packet-id generation where qtd addresses are used as ids, causes duplicate ids for in flight packets. Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2012-09-11usb-core: Allow the first packet of a pipelined ep to complete immediatelyHans de Goede1-1/+1
This can happen with usb-redir live-migration when the packet gets re-queued after the migration and the original queuing from the migration source side has already finished. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-09-11usb-core: Add a usb_ep_find_packet_by_id() helper functionHans de Goede2-0/+17
Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-09-11usb-core: Don't set packet state to complete on a nakHans de Goede1-2/+4
This way the hcd can re-use the same packet to retry without needing to re-init it. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-09-11usb: controllers do not need to check for babble themselvesHans de Goede2-9/+0
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 iov then there is space, we have a much bigger problem then not correctly reporting babble to the guest. In practice babble will only happen with (real) redirected devices, and there both the usb-host os and the qemu usb-device code already check for it. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-09-10Add ability to force enable/disable of tools buildDaniel P. Berrange1-6/+15
The qemu-img, qemu-nbd and qemu-io tools are built conditionally based on whether any softmmu target is enabled. These are useful self-contained tools which can be used in many other scenarios. Add new --enable-tools/--disable-tools args to configure to allow the user to explicitly turn on / off their build. The default behaviour is now to build these tools are all times, regardless of whether any softmmu target is enabled Signed-off-by: Daniel P. Berrange <berrange@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2012-09-10Add ability to disable build of all targetsDaniel P. Berrange1-9/+4
Allow passing of '--target-list=' to configure to request that all targets are to be disabled. This allows for doing a very fast tools-only build of things like qemu-img, qemu-io, qemu-nbd. Signed-off-by: Daniel P. Berrange <berrange@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2012-09-10RTC: Remove the current_tm fieldPaolo Bonzini1-11/+1
This is not used anymore and only written to. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2012-09-10RTC: Get and set time without going through s->current_tmPaolo Bonzini1-16/+22
This patch makes rtc_set_time and rtc_set_cmos work without reading s->current_tm. In the case of rtc_set_time I introduce a new function that retrieves the time and stores into a given struct tm (not hard-coded to s->current_tm). In the case of rtc_set_cmos, the current time is similarly taken from a struct tm rather than s->current_tm. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2012-09-10RTC: Do not fire timer periodically to catch next alarmPaolo Bonzini1-14/+103
This patch limits further the usage of a periodic timer. It computes the time of the next alarm, and uses it to skip all intermediate occurrences of the timer. Cc: Yang Zhang <yang.z.zhang@intel.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2012-09-10RTC: Add divider reset supportYang Zhang1-9/+41
The first update cycle begins one-half seconds after divider reset is removed. This feature is useful for testing. Signed-off-by: Yang Zhang <yang.z.zhang@intel.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2012-09-10RTC: Update the RTC clock only when reading itYang Zhang1-135/+194
Calculate guest RTC based on the time of the last update, instead of using timers. The formula is (base_rtc + guest_time_now - guest_time_last_update + offset) Base_rtc is the RTC value when the RTC was last updated. Guest_time_now is the guest time when the access happens. Guest_time_last_update was the guest time when the RTC was last updated. Offset is used when divider reset happens or the set bit is toggled. The timer is kept in order to signal interrupts, but it only needs to run when either UF or AF is cleared. When the bits are both set, the timer does not run. UIP is now synthesized when reading register A. If the timer is not set, or if there is more than one second before it (as is the case at the end of this series), the leading edge of UIP is computed and the rising edge occurs 220us later. If the update timer occurs within one second, however, the rising edge of the AF and UF bits should coincide withe the falling edge of UIP. We do not know exactly when this will happen because there could be delays in the servicing of the timer. Hence, in this case reading register A only computes for the rising edge of UIP, and latches the bit until the timer is fired and clears it. Signed-off-by: Yang Zhang <yang.z.zhang@intel.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>