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-06-21 20:04:24 +00: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-07-07 09:04:42 +00:00
…
…
…
…
…
…
2012-04-19 16:51:47 +02:00
…
2012-09-21 15:12:58 +02:00
…
…
…
…
…
2012-08-04 15:51:23 +00:00
…
…
…
…
2012-05-14 07:27:24 +02:00
…
…
2012-09-05 15:48:57 -03:00
…
2012-08-02 18:12:17 +02:00
2012-09-21 15:12:58 +02:00
2012-03-30 08:14:11 -05:00
…
2012-09-15 15:34:27 +00:00
2012-04-01 20:30:23 +02:00
2012-03-14 22:20:27 +01:00
2012-08-16 13:41:16 -05:00
2012-07-28 09:23:11 +00:00
…
…
2012-08-13 14:17:53 -03:00
2012-09-05 15:48:57 -03:00
2012-09-22 17:59:12 +00:00
2012-03-14 22:20:27 +01: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-03-19 15:17:21 +02:00
…
…
2012-09-09 17:03:09 +03:00
2012-09-10 15:29:51 +03:00
…
…
2012-05-10 08:33:34 -05:00
2012-09-21 15:12:57 +02:00
2012-09-21 15:12:58 +02:00
2012-03-15 10:39:52 -03:00
2012-08-08 13:51:12 +02:00
…
…
2012-09-19 15:26:31 +02:00
2012-09-19 15:26:31 +02:00
…
…
2012-07-10 18:27:33 +02:00
2012-08-08 13:51:12 +02:00
…
…
…
…
2012-04-07 14:00:45 +00:00
…
…
…
…
…
2012-07-14 11:53:03 +00:00
2012-07-14 11:53:03 +00:00
2012-04-07 14:00:45 +00:00
2012-08-16 13:41:16 -05:00
2012-08-16 13:41:16 -05:00
…
2012-08-13 14:17:53 -03:00
2012-08-13 14:17:53 -03: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-04-24 09:50:31 -05: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
S
Description
Original Xbox Emulator for Windows, macOS, and Linux (Active Development)
Readme GPL-2.0
717 MiB
0 Stars 1 Watchers 0 Forks
Languages
C 82.3%
C++ 6.9%
Python 3.5%
Dylan 2.7%
Shell 1.5%
Other 2.9%