qemu/hw/usb
David Gibson 39c138c842 usb: Fix usb_packet_map() in the presence of IOMMUs
With the IOMMU infrastructure introduced before 1.2, we need to use
dma_memory_map() to obtain a qemu pointer to memory from an IO bus address.
However, dma_memory_map() alters the given length to reflect the length
over which the used DMA translation is valid - which could be either more
or less than the requested length.

usb_packet_map() does not correctly handle these cases, simply failing if
dma_memory_map() alters the requested length.  If dma_memory_map()
increased the length, we just need to use the requested length for the
qemu_iovec_add().  However, if it decreased the length, it means that a
single DMA translation is not valid for the whole sglist element, and so
we need to loop, splitting it up into multiple iovec entries for each
piece with a DMA translation (in practice >2 pieces is unlikely).

This patch implements the correct behaviour

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-09-26 09:24:42 +02:00
..
bus.c
core.c usb-core: Allow the first packet of a pipelined ep to complete immediately 2012-09-11 07:42:59 +02:00
desc.c usb3: bos decriptor 2012-09-11 07:43:01 +02:00
desc.h usb3: bos decriptor 2012-09-11 07:43:01 +02:00
dev-audio.c usb-audio: fix usb version 2012-09-11 07:43:00 +02:00
dev-bluetooth.c
dev-hid.c
dev-hub.c
dev-network.c net: fix usbnet_receive() packet drops 2012-09-14 08:40:32 +01:00
dev-serial.c Better name usb braille device 2012-09-11 07:43:00 +02:00
dev-smartcard-reader.c
dev-storage.c usb-storage: usb3 support 2012-09-11 07:43:01 +02:00
dev-uas.c uas: move transfer kickoff 2012-08-31 15:47:57 +02:00
dev-wacom.c
hcd-ehci.c ehci: Fix interrupt packet MULT handling 2012-09-26 09:24:41 +02:00
hcd-musb.c usb: unique packet ids 2012-08-31 11:57:23 +02:00
hcd-ohci.c usb: unique packet ids 2012-08-31 11:57:23 +02:00
hcd-uhci.c uhci: Don't queue up packets after one with the SPD flag set 2012-09-13 09:50:47 +02:00
hcd-xhci.c xhci: create a memory region for each port 2012-09-26 09:24:41 +02:00
host-bsd.c
host-linux.c usb-host: allow emulated (non-async) control requests without USBPacket 2012-09-12 08:09:48 +02:00
host-stub.c
libhw.c usb: Fix usb_packet_map() in the presence of IOMMUs 2012-09-26 09:24:42 +02:00
Makefile.objs
redirect.c usb-redir: Revert usb-redir part of commit 93bfef4c 2012-09-13 09:50:47 +02:00