From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:34976) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RGiqo-0000PP-TF for qemu-devel@nongnu.org; Wed, 19 Oct 2011 22:59:23 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RGiqn-0005FK-8D for qemu-devel@nongnu.org; Wed, 19 Oct 2011 22:59:22 -0400 Received: from e23smtp09.au.ibm.com ([202.81.31.142]:59681) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RGiqm-0005CP-Ko for qemu-devel@nongnu.org; Wed, 19 Oct 2011 22:59:21 -0400 Received: from /spool/local by e23smtp09.au.ibm.com with XMail ESMTP for from ; Thu, 20 Oct 2011 03:54:20 +1000 Received: from d23av01.au.ibm.com (d23av01.au.ibm.com [9.190.234.96]) by d23relay03.au.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id p9K2x1l62588678 for ; Thu, 20 Oct 2011 13:59:01 +1100 Received: from d23av01.au.ibm.com (loopback [127.0.0.1]) by d23av01.au.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id p9K2x1cx026589 for ; Thu, 20 Oct 2011 13:59:01 +1100 Date: Thu, 20 Oct 2011 13:58:53 +1100 From: David Gibson Message-ID: <20111020025853.GA16619@truffala.fritz.box> References: <20111002105238.GE30747@redhat.com> <4E8843DB.1020404@redhat.com> <20111002111700.GF30747@redhat.com> <4E885286.30905@redhat.com> <20111002121426.GK30747@redhat.com> <4E89B5D1.4080600@us.ibm.com> <20111014021407.GB4580@truffala.fritz.box> <4E9AD909.1000509@redhat.com> <20111018014650.GB6655@truffala.fritz.box> <4E9E93F7.8080400@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4E9E93F7.8080400@redhat.com> Subject: Re: [Qemu-devel] [PATCH 1/9] Add stub functions for PCI device models to do PCI DMA List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Avi Kivity Cc: Anthony Liguori , "Michael S. Tsirkin" , joerg.roedel@amd.com, Paul 'Rusty' Russell , qemu-devel@nongnu.org, agraf@suse.de, kraxel@redhat.com, eduard.munteanu@linux360.ro, rth@twiddle.net On Wed, Oct 19, 2011 at 11:10:15AM +0200, Avi Kivity wrote: > On 10/18/2011 03:46 AM, David Gibson wrote: > > On Sun, Oct 16, 2011 at 03:15:53PM +0200, Avi Kivity wrote: > > > On 10/14/2011 04:14 AM, David Gibson wrote: > > > > > Virtio is a very, very special case. virtio requires coherent RAM access. > > > > > > > > Right. Virtio's access to memory is *not* emulated PCI DMA, it's > > > > god-like hypervisor access to guest system memory. It should > > > > correctly bypass any IOMMU, and so should remain as > > > > cpu_physical_memory_rw() or the atomic accessors, rather than being > > > > converted to this new API. > > > > > > virtio should definitely not bypass an iommu. > > > > So, I just had a chat with Rusty about this. Perhaps it shouldn't, > > but it does. The spec is in terms of guest physical addresses, not > > bus/DMA addresses, and more to the point the Linux driver does *not* > > do the necessary dma_map() and unmap operations to treat this as a PCI > > DMA. So like it or not, god-like hypervisor access rather than > > emulated PCI DMA is what it does. > > Wow, how did we manage to break virtio in so many different ways? > > Is there a way to unbreak it? Yes, using a feature bit. > On x86 it will continue to work if we > rewrite the spec in terms of pci dma, what about non-x86? No, anything with a non-optional IOMMU will break horribly. That's why we need a feature bit. > > > A guest may assign a > > > virtio device to nested guests, and would wish it confined by the > > > emulated iommu. > > > > Well, that would be nice, but it can't be done. It could be fixed, > > but it would be an incompatible change so it would need a new feature > > bit corresponding changes in the Linux driver to do the dma map/unmap > > if it accepts the "respect IOMMU" feature. > > Needs to be done IMO. Well, sure, but my point is that I'm not volunteering for it. Someone who actually needs the feature can do the work. -- David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson