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 does?

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 an opaque

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, + int

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 the

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 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 every

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 as-is for

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 add

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