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> |
||
|---|---|---|
| .. | ||
| Makefile.objs | ||
| bus.c | ||
| core.c | ||
| desc.c | ||
| desc.h | ||
| dev-audio.c | ||
| dev-bluetooth.c | ||
| dev-hid.c | ||
| dev-hub.c | ||
| dev-network.c | ||
| dev-serial.c | ||
| dev-smartcard-reader.c | ||
| dev-storage.c | ||
| dev-uas.c | ||
| dev-wacom.c | ||
| hcd-ehci.c | ||
| hcd-musb.c | ||
| hcd-ohci.c | ||
| hcd-uhci.c | ||
| hcd-xhci.c | ||
| host-bsd.c | ||
| host-linux.c | ||
| host-stub.c | ||
| libhw.c | ||
| redirect.c | ||