From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:33774) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S5yGd-0005wP-TS for qemu-devel@nongnu.org; Fri, 09 Mar 2012 06:45:53 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1S5yGF-0005zn-3E for qemu-devel@nongnu.org; Fri, 09 Mar 2012 06:45:51 -0500 Received: from ozlabs.org ([203.10.76.45]:40062) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S5yGE-0005zK-O7 for qemu-devel@nongnu.org; Fri, 09 Mar 2012 06:45:27 -0500 Date: Fri, 9 Mar 2012 22:19:14 +1100 From: David Gibson Message-ID: <20120309111914.GB24916@truffala.fritz.box> References: <1331269308-22372-1-git-send-email-david@gibson.dropbear.id.au> <1331269308-22372-6-git-send-email-david@gibson.dropbear.id.au> <4F59D631.3050702@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4F59D631.3050702@redhat.com> Subject: Re: [Qemu-devel] [PATCH 05/13] iommu: Add universal DMA helper functions List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini Cc: mst@redhat.com, Joerg Rodel , agraf@suse.de, qemu-devel@nongnu.org, eduard.munteanu@linux360.ro, rth@twiddle.net On Fri, Mar 09, 2012 at 11:06:41AM +0100, Paolo Bonzini wrote: > Il 09/03/2012 06:01, David Gibson ha scritto: > > +static inline int dma_memory_read(DMAContext *dma, dma_addr_t addr, > > + void *buf, dma_addr_t len) > > +{ > > + return dma_memory_rw(dma, addr, buf, len, DMA_DIRECTION_TO_DEVICE); > > +} > > + > > +static inline int dma_memory_write(DMAContext *dma, dma_addr_t addr, > > + const void *buf, dma_addr_t len) > > +{ > > + return dma_memory_rw(dma, addr, (void *)buf, len, > > + DMA_DIRECTION_FROM_DEVICE); > > +} > > This is opposite to the convention of dma_buf_read/dma_buf_write, which > is from the point of view of the device. Uh, these are from the point of view of the device - the device writes to memory == transfer from device. More importantly, this is the same convention as cpu_physical_memory_{read,write}() which is what these generally replace. dma_buf_read() is from the point of view of the core/memory. -- 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