Received: from eggs.gnu.org ([140.186.70.92]:51733) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1REXJC-00045z-MZ for qemu-devel@nongnu.org; Thu, 13 Oct 2011 22:15:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1REXJB-0003mB-8F for qemu-devel@nongnu.org; Thu, 13 Oct 2011 22:15:38 -0400 Received: from e23smtp02.au.ibm.com ([202.81.31.144]:50679) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1REXJA-0003lt-My for qemu-devel@nongnu.org; Thu, 13 Oct 2011 22:15:37 -0400 Received: from d23relay04.au.ibm.com (d23relay04.au.ibm.com [202.81.31.246]) by e23smtp02.au.ibm.com (8.14.4/8.13.1) with ESMTP id p9E28lu8032764 for ; Fri, 14 Oct 2011 13:08:47 +1100 Received: from d23av03.au.ibm.com (d23av03.au.ibm.com [9.190.234.97]) by d23relay04.au.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id p9E2Cwvk1900716 for ; Fri, 14 Oct 2011 13:13:02 +1100 Received: from d23av03.au.ibm.com (loopback [127.0.0.1]) by d23av03.au.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id p9E2FLbM004947 for ; Fri, 14 Oct 2011 13:15:21 +1100 Date: Fri, 14 Oct 2011 13:14:07 +1100 From: David Gibson Message-ID: <20111014021407.GB4580@truffala.fritz.box> References: <1315197304-22469-1-git-send-email-david@gibson.dropbear.id.au> <1315197304-22469-2-git-send-email-david@gibson.dropbear.id.au> <20111002102547.GC30747@redhat.com> <4E883CF4.6060606@redhat.com> <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> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4E89B5D1.4080600@us.ibm.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: Anthony Liguori Cc: kraxel@redhat.com, "Michael S. Tsirkin" , joerg.roedel@amd.com, qemu-devel@nongnu.org, agraf@suse.de, Avi Kivity , eduard.munteanu@linux360.ro, rth@twiddle.net On Mon, Oct 03, 2011 at 08:17:05AM -0500, Anthony Liguori wrote: > On 10/02/2011 07:14 AM, Michael S. Tsirkin wrote: > >On Sun, Oct 02, 2011 at 02:01:10PM +0200, Avi Kivity wrote: > >>>Hmm, not entirely virtio specific, some devices use stX macros to do the > >>>conversion. E.g. stw_be_phys and stl_le_phys are used in several > >>>places. > >> > >>These are fine - explicit endianness. > > > >Right. So changing these to e.g. stl_dma and assuming > >LE is default seems like a step backwards. > > We're generalizing too much. > > In general, the device model doesn't need atomic access functions. > That's because device model RAM access is not coherent with CPU RAM > access. Ok, so the next spin of these patches will have explicit LE and BE versions of the accessors by popular demand. I'm still using cpu_physical_memory_rw() as the backend though, because I can't see a case where a device could safely _require_ an emulated DMA access to be atomic. > 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. -- 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