History | View | Annotate | Download (38.4 kB)
uhci: Use an intermediate buffer for usb packet data
Due to various unfortunate reasons we cannot reliable detect a guestcancelling a packet as soon as it happens, instead we detect cancelswith some delay.
When packets are handled async, and we directly pass the guest memory for...
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 <kraxel@redhat.com>
uhci: stop using portio lists
uhci: Fix 1 ms delay in interrupt reporting to the guest
Re-arrange how we process frames / increase frnum / report pending interrupts,to avoid a 1 ms delay in interrupt reporting to the guest. This increasesthe packet throughput for cases where the guest submits a single packet,...
uhci: Fix pending interrupts getting lost on migration
Signed-off-by: Hans de Goede <hdegoede@redhat.com>Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
uhci: Add a QH_VALID define
Rather then using the magic 32 value in various places.
uhci: Limit amount of frames processed in one go
Before this patch uhci would process an unlimited amount of frames whenbehind on schedule, by setting the timer to a time already past, causing thetimer subsys to immediately recall the frame_timer function gain....
uhci: Maximize how many frames we catch up when behind
If somehow we've gotten behind a lot, simply skip ahead, like the ehci codedoes.
usb: Add an usb_device_ep_stopped USBDevice method
Some usb devices (host or network redirection) can benefit from knowing whenthe guest stops using an endpoint. Redirection may involve submitting packetsindependently from the guest (in combination with a fifo buffer between the...
softmmu: move include files to include/sysemu/
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
misc: move include files to include/qemu/
pci: update all users to look in pci/
update all users so we can remove the makefile hack.
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
usb: tag usb host adapters as not hotpluggable.
Hotplugging them simply doesn't work, so tag them accordingly toavoid users trying and then crashing qemu.
For xhci there is nothing fundamental which prevents hotplug fromworking, we'll "only" need a exit() function which cleans up...
uhci: Add a completions_only flag for async completions
Add a completions_only flag, and set this when running process_frame for asynccompletion handling, this fixes 2 issues in a single patch:
1) It makes sure async completed packets get written to guest mem immediately,...
uhci: Don't allow the guest to set port-enabled when there is no dev connected
It is possible for device disconnect and the guest trying to reset the port(because of USB xact errors prior to the disconnect getting signaled) to race,when we hit this race, the guest will write the port-control register with its...
uhci: Fix double unlink
uhci_async_cancel() already does a uhci_async_unlink().
usb: split packet result into actual_length + status
Since with the ehci and xhci controllers a single packet can be largerthen maxpacketsize, it is possible for the result of a single packetto be both having transferred some data as well as the transfer to have...
uhci: Add a uhci_handle_td_error() helper function
uhci: Don't crash on device disconnect
My recent uhci cleanup series has introduced a regression, whereqemu sometimes crashes on a device disconnect. The problem is thatthe uhci code never checked for a device not / no longer existing, insteadit was relying on usb_handle_packet accepting a NULL device....
uhci: dynamic type generation
uhci: stick irq routing info into UHCIInfo too.
Kills the ugly "switch (device_id) { ... }" struct and makes it easierto figure what the differences between the uhci variants are.
Need our own DeviceClass struct for that so we can allocate some spaceto store UHCIInfo....
uhci: add ich9 00:1a.* variants
uhci: When the guest marks a pending td non-active, cancel the queue
uhci: Always mark a queue valid when we encounter it
Before this patch we would not mark a queue valid when its head was anon-active td. This causes us to misbehave in the following scenario:
1) queue with multiple input transfers queued2) We hit some latency issue, causing qemu to get behind processing frames...
uhci: 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 device2) submit transfer 2 to the device...
uhci: Use only one queue for ctrl endpoints
ctrl endpoints use different pids for different phases of a controltransfer, this patch makes us use only one queue for a ctrl ep, ratherthen 3.
uhci: Drop unnecessary forward declaration of some static functions
uhci: Move emptying of the queue's asyncs' queue to uhci_queue_free
Cleanup: all callers of uhci_queue_free first unconditionally cancelall remaining asyncs in the queue, so lets move this to uhci_queue_free().
Signed-off-by: Hans de Goede <hdegoede@redhat.com>...
uhci: Rename UHCIAsync->td to UHCIAsync->td_addr
We use the name td both to refer to a UHCI_TD read from guest memory aswell as to refer to the guest address where a td is stored, switch overto always use td_addr in the second case for consistency.
uhci: Add uhci_read_td() helper function
uhci: Make uhci_fill_queue() actually operate on an UHCIQueue
And move its calling point to handle_td, this removes the ep_ret ugliness,and prepates the way for further cleanups in the follow-up patches in thispatch-set.
uhci: Store ep in UHCIQueue
This avoids the need to repeatedly lookup the device, and ep.
uhci: Immediately free queues on device disconnect
There is no need to just cancel any in-flight packets, and then waitfor validate-end to clean things up, we can simply clean things upimmediately on device removal.
uhci: Verify queue has not been changed by guest
According to the spec a guest can unlink a qh, and then as soon as frindexhas changed by 1 since the unlink, assume it is idle and re-use it. Howeverfor various reasons, we cannot simply consider a qh as unlinked if we've not...
uhci: Detect guest td re-use
A td can be reused by the guest in a different queue, before we noticethe original queue has been unlinked. So search for tds by addr only, detectguest td reuse, and cancel the original queue, this is necessary to keep ourpacket ids unique....
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...
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...
usb: Add an int_req flag to USBPacket
uhci: No need to handle async completion of isoc packets
No devices ever return async for isoc endpoints and the corealready enforces this.
uhci: cleanup: Add an unlink call to uhci_async_cancel()
All callers of uhci_async_cancel() call uhci_async_unlink() first, solets move the unlink call to uhci_async_cancel()
uhci: Don't retry on error
Since we are either dealing with emulated devices, where retrying isnot going to help, or with redirected devices where the host OS willhave already retried, don't bother retrying on failed transfers.
Also move some common/indentical code out of all the error cases...
usb: Add USB_RET_ADD_TO_QUEUE packet result code
This can be used by usb-device code which wishes to process an entire endpointqueue at once, to do this the usb-device code returns USB_RET_ADD_TO_QUEUEfrom its handle_data class method and defines a flush_ep_queue class method...
uhci: Properly unmap packets on cancel / invalid pid
Packets with an invalid pid, or which were cancelled haveusb_packet_map() called on them on init, but not usb_packet_unmap()before being freed.
uhci: Move checks to continue queuing to uhci_fill_queue()
Rather then having a special check to start queuing after the first packet,and then another check for the other packets in uhci_fill_queue(), simplycheck the previous packet beforehand in uhci_fill_queue()...
uhci: Raise interrupt when requested even for non active tds
According to the spec we must raise an interrupt when one is requestedeven for non active tds.
Linux depends on this, for bulk transfers it runs an inactivity timerto work around a bug in early uhci revisions, when we take longer then...
uhci: Don't queue up packets after one with the SPD flag set
Don't queue up packets after a packet with the SPD (short packet detect)flag set. Since we won't know if the packet will actually be short until ithas completed, and if it is short we should stop the queue....
usb: controllers do not need to check for babble themselves
If an (emulated) usb-device tries to write more data to a packet thenits iov len, this will trigger an assert in usb_packet_copy(), and ifa driver somehow circumvents that check and writes more data to the...
usb: unique packet ids
This patch adds IDs to usb packets. Those IDs are (a) supposed to beunique for the lifecycle of a packet (from packet setup until the packetis either completed or canceled) and (b) stable across migration.
uhci, ohci, ehci and xhci use the guest physical address of the transfer...
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 theep queue, and inside the controller code cancel all pending packets on anerror.
There are multiple reasons for this:...
Merge branch pci into master
Merge master and pci branch, resolve build breakage in hw/esp.cintroduced by f90c2bcd.
Conflicts: hw/esp.c
uhci: initialize expire_time when loading v1 vmstate
$subject says all: when loading old (v1) vmstate which doesn't containexpire_time initialize it with a reasonable default (current time).
pci: convert PCIUnregisterFunc to void
Not a single driver has any possibility of failure on theirexit function, let's keep it that way.
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
usb: Convert usb_packet_{map, unmap} to universal DMA helpers
The USB UHCI and EHCI drivers were converted some time ago to use thepci_dma_*() helper functions. However, this conversion was not completebecause in some places both these drivers do DMA via the usb_packet_map()...
uhci: fix uhci_async_cancel_all
We update the QTAILQ in the loop, thus we must use the SAFE versionto make sure we don't touch the queue struct after freeing it.
https://bugzilla.novell.com/show_bug.cgi?id=766310
uhci: fix bandwidth management
uhci_process_frame() can be invoked multiple times per frame, soaccounting usb bandwith in a local variable doesn't fly, use a variablein UHCIState instead. Also check the limit more frequently.
uhci: use bottom half
Schedule bottom half on completion of async packets instead of callinguhci_process_frame directly. This way we run uhci_process_frame onlyonce in case multiple packets finish in a row. Also check wheneverthere is bandwidth left before scheduling uhci_process_frame....
uhci: make bandwidth tunable
Add a property for the uhci bandwidth. Can be used to make uhciemulation run faster than real hardware.
uhci: zap uhci_pre_save
Cancel transactions before saving vmstate is pretty pointless and justcauses disruptions. We need to cancel them before loading vmstate,but in that case uhci_reset() handles it already and no special actionis needed.
uhci: fix irq routing
The multifunction ich9 ehci controller with uhci companions uses adifferent interrupt pin for each function. The three uhci devicesget pins A, B and C, whereas ehci uses pin D. This way the guestcan assign different IRQ lines to each controller....
usb-uhci: update irq line on reset
uhci_reset() clears irq mask and irq status registers, but doesn'tupdate the irq line. Which may result in suspious IRQs after uhcireset. Fix it.
usb-uhci: stop queue filling when we find a in-flight td
Not only QHs can form rings, but TDs too. With the newqueuing/pipelining support we are following TD chains andcan actually walk in circles. An assert() prevents us fromentering an endless loop then....
usb-uhci: queuing fix
When we queue up usb packets we may happen to find a already queuedpacket, which also might be finished at that point already. We don'twant continue processing the packet at this point though, so letsjust signal back we've found a in-flight packet when in queuing mode....
usb: the big rename
Reorganize usb source files. Create a new hw/usb/ directory and moveall usb source code to that place. Also make filenames a bit moredescriptive. Host adapters are prefixed with "hch-" now, usb deviceemulations are prefixed with "dev-". Fixup paths Makefile and include...
usb: zap hw/ush-{ohic,uhci}.h + init wrappers
Remove the uhci and ohci init wrappers, which all wrapped apci_create_simple() one-liner. Switch callsites to callpci_create_simple directly. Remove the header files wherethe wrappers where declared.
uhci: pass addr to uhci_async_alloc
Also do async->td initialization in uhci_async_alloc now.Prepares for adding tracepoints.
It should also free all queues.
uhci: cancel on schedule stop.
Cancel any in-flight transaction when the guest stops the uhci schedule.
uhci: tracing support
Zap DPRINTF, add tracepoints instead.
uhci: use enum for uhci_handle_td return codes
Step #1 (separate for better bisectability): replace numbers with names.
uhci: renumber uhci_handle_td return codes
Step #2 (separate for better bisectability): renumber so the silly '-1'goes away. Pick a range which doesn't overlap the old values.
uhci: new uhci_handle_td return code for tds still in flight
uhci: alloc can't fail, drop check.