Re: [Qemu-devel] [RFC PATCH 01/13] Generic DMA memory access interface

2011-06-02 Thread David Gibson
On Wed, Jun 01, 2011 at 08:16:44AM -0700, Richard Henderson wrote: > On 06/01/2011 07:29 AM, Avi Kivity wrote: > > On 06/01/2011 05:01 PM, Richard Henderson wrote: > >> > +err = dev->mmu->translate(dev, addr,&paddr,&plen, is_write); > >> > >> I see you didn't take my suggestion for using a

Re: [Qemu-devel] [RFC PATCH 01/13] Generic DMA memory access interface

2011-06-02 Thread David Gibson
On Wed, Jun 01, 2011 at 08:45:56AM -0700, Richard Henderson wrote: > On 06/01/2011 08:35 AM, Eduard - Gabriel Munteanu wrote: > > Maybe it's not nice, but you're missing the fact upcasting gives you > > some type safety. With opaques you have none. > > Lol. Do you understand what container_of doe

Re: [Qemu-devel] [RFC PATCH 01/13] Generic DMA memory access interface

2011-06-01 Thread Richard Henderson
On 06/01/2011 07:29 AM, Avi Kivity wrote: > On 06/01/2011 05:01 PM, Richard Henderson wrote: >> > +err = dev->mmu->translate(dev, addr,&paddr,&plen, is_write); >> >> I see you didn't take my suggestion for using an opaque callback pointer. >> Really and truly, I won't be able to use this a

Re: [Qemu-devel] [RFC PATCH 01/13] Generic DMA memory access interface

2011-06-01 Thread Richard Henderson
On 06/01/2011 08:35 AM, Eduard - Gabriel Munteanu wrote: > Maybe it's not nice, but you're missing the fact upcasting gives you > some type safety. With opaques you have none. Lol. Do you understand what container_of does? This is not dynamic_cast<> with RTTI. You can put any type name in there

Re: [Qemu-devel] [RFC PATCH 01/13] Generic DMA memory access interface

2011-06-01 Thread Eduard - Gabriel Munteanu
On Wed, Jun 01, 2011 at 08:09:29AM -0700, Richard Henderson wrote: > On 06/01/2011 07:52 AM, Eduard - Gabriel Munteanu wrote: > > The main selling point is there are more chances to screw up if every > > bus layer implements these manually. And it's really convenient, > > especially if we get to ad

Re: [Qemu-devel] [RFC PATCH 01/13] Generic DMA memory access interface

2011-06-01 Thread Richard Henderson
On 06/01/2011 07:52 AM, Eduard - Gabriel Munteanu wrote: > The main selling point is there are more chances to screw up if every > bus layer implements these manually. And it's really convenient, > especially if we get to add another ld/st. If we drop the ld/st, we're talking about 5 lines for eve

Re: [Qemu-devel] [RFC PATCH 01/13] Generic DMA memory access interface

2011-06-01 Thread Eduard - Gabriel Munteanu
On Wed, Jun 01, 2011 at 07:01:42AM -0700, Richard Henderson wrote: > On 05/31/2011 06:38 PM, Eduard - Gabriel Munteanu wrote: > > +static inline void dma_memory_rw(DMADevice *dev, > > + dma_addr_t addr, > > + void *buf, > > +

Re: [Qemu-devel] [RFC PATCH 01/13] Generic DMA memory access interface

2011-06-01 Thread Avi Kivity
On 06/01/2011 05:01 PM, Richard Henderson wrote: > +err = dev->mmu->translate(dev, addr,&paddr,&plen, is_write); I see you didn't take my suggestion for using an opaque callback pointer. Really and truly, I won't be able to use this as-is for Alpha. Rather than opaques, please pass t

Re: [Qemu-devel] [RFC PATCH 01/13] Generic DMA memory access interface

2011-06-01 Thread Richard Henderson
On 05/31/2011 06:38 PM, Eduard - Gabriel Munteanu wrote: > +static inline void dma_memory_rw(DMADevice *dev, > + dma_addr_t addr, > + void *buf, > + dma_addr_t len, > + in

[Qemu-devel] [RFC PATCH 01/13] Generic DMA memory access interface

2011-05-31 Thread Eduard - Gabriel Munteanu
This introduces replacements for memory access functions like cpu_physical_memory_read(). The new interface can handle address translation and access checking through an IOMMU. Signed-off-by: Eduard - Gabriel Munteanu --- Makefile.target |2 +- hw/dma_rw.c | 155