From: David Gibson <david@gibson.dropbear.id.au>
To: Alexander Graf <agraf@suse.de>
Cc: kwolf@redhat.com, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] Use DMADirection type for dma_bdrv_io
Date: Tue, 21 Feb 2012 12:14:47 +1100 [thread overview]
Message-ID: <20120221011447.GK16796@truffala.fritz.box> (raw)
In-Reply-To: <8A3EA298-2301-454F-81AE-301E1D898F50@suse.de>
On Mon, Feb 20, 2012 at 11:50:40AM +0100, Alexander Graf wrote:
>
> On 20.02.2012, at 04:01, David Gibson wrote:
>
> > Currently dma_bdrv_io() takes a 'to_dev' boolean parameter to
> > determine the direction of DMA it is emulating. We already have a
> > DMADirection enum designed specifically to encode DMA directions.
> > This patch uses it for dma_bdrv_io() as well.
> >
> > Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
> > ---
> > dma-helpers.c | 20 ++++++++++++--------
> > dma.h | 2 +-
> > hw/ide/core.c | 3 ++-
> > hw/ide/macio.c | 3 ++-
> > 4 files changed, 17 insertions(+), 11 deletions(-)
> >
> > diff --git a/dma-helpers.c b/dma-helpers.c
> > index f08cdb5..d4af367 100644
> > --- a/dma-helpers.c
> > +++ b/dma-helpers.c
> > @@ -42,7 +42,7 @@ typedef struct {
> > BlockDriverAIOCB *acb;
> > QEMUSGList *sg;
> > uint64_t sector_num;
> > - bool to_dev;
> > + DMADirection dir;
> > bool in_cancel;
> > int sg_cur_index;
> > dma_addr_t sg_cur_byte;
> > @@ -76,7 +76,8 @@ static void dma_bdrv_unmap(DMAAIOCB *dbs)
> >
> > for (i = 0; i < dbs->iov.niov; ++i) {
> > cpu_physical_memory_unmap(dbs->iov.iov[i].iov_base,
> > - dbs->iov.iov[i].iov_len, !dbs->to_dev,
> > + dbs->iov.iov[i].iov_len,
> > + dbs->dir != DMA_DIRECTION_TO_DEVICE,
> > dbs->iov.iov[i].iov_len);
> > }
> > qemu_iovec_reset(&dbs->iov);
> > @@ -123,7 +124,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->to_dev);
> > + mem = cpu_physical_memory_map(cur_addr, &cur_len,
> > + dbs->dir != DMA_DIRECTION_TO_DEVICE);
> > if (!mem)
> > break;
> > qemu_iovec_add(&dbs->iov, mem, cur_len);
> > @@ -170,11 +172,11 @@ static AIOPool dma_aio_pool = {
> > BlockDriverAIOCB *dma_bdrv_io(
> > BlockDriverState *bs, QEMUSGList *sg, uint64_t sector_num,
> > DMAIOFunc *io_func, BlockDriverCompletionFunc *cb,
> > - void *opaque, bool to_dev)
> > + void *opaque, DMADirection dir)
> > {
> > DMAAIOCB *dbs = qemu_aio_get(&dma_aio_pool, bs, cb, opaque);
> >
> > - trace_dma_bdrv_io(dbs, bs, sector_num, to_dev);
> > + trace_dma_bdrv_io(dbs, bs, sector_num, dir);
>
> Was the trace wrong before or is it now? I don't see its definition changed anywhere.
So, there's no explicit prototype for the trace function anywhere I
could see. As best as I can tell, it is autogenerated from the
surrounding function definition, and so needs to change when it does.
But I'm certainly no expert on the tracing code.
--
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
next prev parent reply other threads:[~2012-02-21 1:30 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-02-20 3:01 [Qemu-devel] [PATCH] Use DMADirection type for dma_bdrv_io David Gibson
2012-02-20 10:50 ` Alexander Graf
2012-02-21 1:14 ` David Gibson [this message]
2012-02-21 8:35 ` Paolo Bonzini
2012-02-21 9:09 ` Kevin Wolf
2012-02-22 1:11 ` David Gibson
2012-02-22 9:54 ` Andreas Färber
2012-02-22 9:55 ` Hannes Reinecke
-- strict thread matches above, loose matches on Subject: below --
2012-03-27 2:42 David Gibson
2012-03-27 7:17 ` Stefan Hajnoczi
2012-03-27 14:30 ` Andreas Färber
2012-03-27 14:43 ` Kevin Wolf
2012-03-27 15:17 ` Andreas Färber
2012-03-27 15:23 ` Kevin Wolf
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20120221011447.GK16796@truffala.fritz.box \
--to=david@gibson.dropbear.id.au \
--cc=agraf@suse.de \
--cc=kwolf@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).