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
2012-08-28 20:38:39 +02:00
2012-08-20 11:05:08 -03:00
2012-08-28 20:38:39 +02:00
2012-09-07 09:02:44 +03:00
2012-09-21 15:12:58 +02:00
2012-09-05 15:48:57 -03:00
2012-09-21 15:12:58 +02:00
2012-09-15 15:34:27 +00:00
2012-08-16 13:41:16 -05:00
2012-09-05 15:48:57 -03:00
2012-09-22 17:59:12 +00:00
2012-09-05 15:48:57 -03:00
2012-09-05 15:48:57 -03:00
2012-09-05 15:48:57 -03:00
2012-09-09 17:03:09 +03:00
2012-09-10 15:29:51 +03:00
2012-09-21 15:12:57 +02:00
2012-09-21 15:12:58 +02:00
2012-09-19 15:26:31 +02:00
2012-09-19 15:26:31 +02:00
2012-08-16 13:41:16 -05:00
2012-08-16 13:41:16 -05:00
2012-08-16 13:41:15 -05:00
2012-08-16 13:41:15 -05:00
2012-09-05 15:48:57 -03:00
2012-09-05 11:44:53 -05:00
2012-09-10 13:52:28 -05:00

Read the documentation in qemu-doc.html or on http://wiki.qemu.org

- QEMU team
Description
No description provided
Readme 404 MiB
Languages
C 82.6%
C++ 6.5%
Python 3.4%
Dylan 2.9%
Shell 1.6%
Other 2.8%