qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH] usb: Fix usb_packet_map() in the presence of IO


From: Gerd Hoffmann
Subject: Re: [Qemu-devel] [PATCH] usb: Fix usb_packet_map() in the presence of IOMMUs
Date: Wed, 26 Sep 2012 08:32:26 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:10.0.7) Gecko/20120825 Thunderbird/10.0.7

On 09/26/12 04:59, David Gibson wrote:
> 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

Patch added to usb patch queue.

thanks,
  Gerd



reply via email to

[Prev in Thread] Current Thread [Next in Thread]