qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH 07/13] iommu: Make sglists and dma_bdrv helpers


From: David Gibson
Subject: Re: [Qemu-devel] [PATCH 07/13] iommu: Make sglists and dma_bdrv helpers use new universal DMA helpers
Date: Tue, 13 Mar 2012 17:37:25 +1100
User-agent: Mutt/1.5.21 (2010-09-15)

On Fri, Mar 09, 2012 at 11:11:41AM +0100, Paolo Bonzini wrote:
> Il 09/03/2012 06:01, David Gibson ha scritto:
[snip]
> > +static void dma_bdrv_cancel(void *opaque)
> > +{
> > +    DMAAIOCB *dbs = opaque;
> > +
> > +    bdrv_aio_cancel(dbs->acb);
> > +    dma_bdrv_unmap(dbs);
> > +    qemu_iovec_destroy(&dbs->iov);
> > +    qemu_aio_release(dbs);
> > +}
> 
> What Kevin said.  Instead of a generic callback, dma_memory_map should
> probably just receive the AIOCB (in this case &dbs->common) and call
> bdrv_aio_cancel on it.

Uh, that doesn't really make sense.  There's no guarantee that a
dma_memory_map() invocation will be associated with an AIOCB, although
that is a mjor use.

> >  static void dma_bdrv_cb(void *opaque, int ret)
> >  {
> >      DMAAIOCB *dbs = (DMAAIOCB *)opaque;
> > -    target_phys_addr_t cur_addr, cur_len;
> > +    dma_addr_t cur_addr, cur_len;
> >      void *mem;
> >  
> >      trace_dma_bdrv_cb(dbs, ret);
> > @@ -124,8 +134,8 @@ static void dma_bdrv_cb(void *opaque, int ret)
> >      while (dbs->sg_cur_index < dbs->sg->nsg) {
> >          cur_addr = dbs->sg->sg[dbs->sg_cur_index].base + dbs->sg_cur_byte;
> >          cur_len = dbs->sg->sg[dbs->sg_cur_index].len - dbs->sg_cur_byte;
> > -        mem = cpu_physical_memory_map(cur_addr, &cur_len,
> > -                                      dbs->dir != DMA_DIRECTION_TO_DEVICE);
> > +        mem = dma_memory_map(dbs->sg->dma, dma_bdrv_cancel, dbs,
> > +                             cur_addr, &cur_len, dbs->dir);
> >          if (!mem)
> >              break;
> >          qemu_iovec_add(&dbs->iov, mem, cur_len);
> > dma_buf_rw should also use the DMAContext here (passing a NULL
> invalidate function).

Done in the next spin.  Although no invalidate function is needed,
NULL or otherwise, since dma_buf_rw uses plain _rw, rather than
map/unmap.

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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]