All of lore.kernel.org
 help / color / mirror / Atom feed
From: Thomas Huth <thuth@redhat.com>
To: "Hervé Poussineau" <hpoussin@reactos.org>, qemu-devel@nongnu.org
Cc: "open list:Old World" <qemu-ppc@nongnu.org>,
	Alexander Graf <agraf@suse.de>
Subject: Re: [Qemu-devel] [PATCH] dbdma: warn when using unassigned channel
Date: Thu, 25 Feb 2016 13:27:16 +0100	[thread overview]
Message-ID: <56CEF324.40303@redhat.com> (raw)
In-Reply-To: <1456401731-10672-1-git-send-email-hpoussin@reactos.org>

On 25.02.2016 13:02, Hervé Poussineau wrote:
> With this, it's easier to know if a guest uses an invalid and/or unimplemented
> DMA channel.
> 
> Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
> ---
>  hw/misc/macio/mac_dbdma.c | 25 +++++++++++++++++++++++--
>  1 file changed, 23 insertions(+), 2 deletions(-)
> 
> diff --git a/hw/misc/macio/mac_dbdma.c b/hw/misc/macio/mac_dbdma.c
> index d81dea7..6051f17 100644
> --- a/hw/misc/macio/mac_dbdma.c
> +++ b/hw/misc/macio/mac_dbdma.c
> @@ -557,11 +557,13 @@ void DBDMA_register_channel(void *dbdma, int nchan, qemu_irq irq,
>  
>      DBDMA_DPRINTF("DBDMA_register_channel 0x%x\n", nchan);
>  
> +    assert(rw);
> +    assert(flush);
> +
>      ch->irq = irq;
>      ch->rw = rw;
>      ch->flush = flush;
>      ch->io.opaque = opaque;
> -    ch->io.channel = ch;
>  }
>  
>  static void
> @@ -775,6 +777,20 @@ static void dbdma_reset(void *opaque)
>          memset(s->channels[i].regs, 0, DBDMA_SIZE);
>  }
>  
> +static void dbdma_unassigned_rw(DBDMA_io *io)
> +{
> +    DBDMA_channel *ch = io->channel;
> +    qemu_log_mask(LOG_GUEST_ERROR, "%s: use of unassigned channel %d\n",
> +                  __func__, ch->channel);
> +}
> +
> +static void dbdma_unassigned_flush(DBDMA_io *io)
> +{
> +    DBDMA_channel *ch = io->channel;
> +    qemu_log_mask(LOG_GUEST_ERROR, "%s: use of unassigned channel %d\n",
> +                  __func__, ch->channel);
> +}
> +
>  void* DBDMA_init (MemoryRegion **dbdma_mem)
>  {
>      DBDMAState *s;
> @@ -784,8 +800,13 @@ void* DBDMA_init (MemoryRegion **dbdma_mem)
>  
>      for (i = 0; i < DBDMA_CHANNELS; i++) {
>          DBDMA_io *io = &s->channels[i].io;
> +        DBDMA_channel *ch = &s->channels[i];
>          qemu_iovec_init(&io->iov, 1);
> -        s->channels[i].channel = i;
> +
> +        ch->rw = dbdma_unassigned_rw;
> +        ch->flush = dbdma_unassigned_flush;
> +        ch->channel = i;
> +        ch->io.channel = ch;
>      }
>  
>      memory_region_init_io(&s->mem, NULL, &dbdma_ops, s, "dbdma", 0x1000);
> 

Looks reasonable.

Reviewed-by: Thomas Huth <thuth@redhat.com>

  reply	other threads:[~2016-02-25 12:27 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-25 12:02 [Qemu-devel] [PATCH] dbdma: warn when using unassigned channel Hervé Poussineau
2016-02-25 12:27 ` Thomas Huth [this message]
2016-02-25 23:04 ` [Qemu-devel] [Qemu-ppc] " Mark Cave-Ayland
2016-02-26  5:02 ` David Gibson
2016-03-01  6:10   ` Thomas Huth

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=56CEF324.40303@redhat.com \
    --to=thuth@redhat.com \
    --cc=agraf@suse.de \
    --cc=hpoussin@reactos.org \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.