From mboxrd@z Thu Jan 1 00:00:00 1970 From: Rusty Russell Subject: Re: virtio DMA API? Date: Wed, 27 Aug 2014 20:40:51 +0930 Message-ID: <87iole89xg.fsf@rustcorp.com.au> References: Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: virtualization-bounces@lists.linux-foundation.org Errors-To: virtualization-bounces@lists.linux-foundation.org To: Andy Lutomirski , "Michael S. Tsirkin" , virtualization@lists.linux-foundation.org, Konrad Rzeszutek Wilk , Benjamin Herrenschmidt List-Id: virtualization@lists.linuxfoundation.org Andy Lutomirski writes: > Currently, a lot of the virtio code assumes that bus (i.e. hypervisor) > addresses are the same as physical address. This is false on Xen, so > virtio is completely broken. I wouldn't be surprised if it also > becomes a problem the first time that someone sticks a physical > "virtio" device on a 32-bit bus on an ARM SOC with more than 4G RAM. > > Would you accept patches to convert virtio_ring and virtio_pci to use > the DMA APIs? I think that the only real catch will be that > virtio_ring's approach to freeing indirect blocks is currently > incompatible with the DMA API -- it assumes that knowing the bus > address is enough to call kfree, and I don't think that the DMA API > provides a reverse mapping like that. Hi Andy, This has long been a source of contention. virtio assumes that the hypervisor can decode guest-physical addresses. PowerPC, in particular, doesn't want to pay the cost of IOMMU manipulations, and all arguments presented so far for using an IOMMU for a virtio device are weak. And changing to use DMA APIs would break them anyway. Of course, it's Just A Matter of Code, so it's possible to create a Xen-specific variant which uses the DMA APIs. I'm not sure what that would look like in the virtio standard, however. Cheers, Rusty.