qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] dbdma: warn when using unassigned channel
@ 2016-02-25 12:02 Hervé Poussineau
  2016-02-25 12:27 ` Thomas Huth
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Hervé Poussineau @ 2016-02-25 12:02 UTC (permalink / raw)
  To: qemu-devel; +Cc: open list:Old World, Hervé Poussineau, Alexander Graf

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);
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [Qemu-devel] [PATCH] dbdma: warn when using unassigned channel
  2016-02-25 12:02 [Qemu-devel] [PATCH] dbdma: warn when using unassigned channel Hervé Poussineau
@ 2016-02-25 12:27 ` Thomas Huth
  2016-02-25 23:04 ` [Qemu-devel] [Qemu-ppc] " Mark Cave-Ayland
  2016-02-26  5:02 ` David Gibson
  2 siblings, 0 replies; 5+ messages in thread
From: Thomas Huth @ 2016-02-25 12:27 UTC (permalink / raw)
  To: Hervé Poussineau, qemu-devel; +Cc: open list:Old World, Alexander Graf

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>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Qemu-devel] [Qemu-ppc] [PATCH] dbdma: warn when using unassigned channel
  2016-02-25 12:02 [Qemu-devel] [PATCH] dbdma: warn when using unassigned channel Hervé Poussineau
  2016-02-25 12:27 ` Thomas Huth
@ 2016-02-25 23:04 ` Mark Cave-Ayland
  2016-02-26  5:02 ` David Gibson
  2 siblings, 0 replies; 5+ messages in thread
From: Mark Cave-Ayland @ 2016-02-25 23:04 UTC (permalink / raw)
  To: Hervé Poussineau, qemu-devel; +Cc: open list:Old World

On 25/02/16 12: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);

Acked-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>


ATB,

Mark.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Qemu-devel] [Qemu-ppc] [PATCH] dbdma: warn when using unassigned channel
  2016-02-25 12:02 [Qemu-devel] [PATCH] dbdma: warn when using unassigned channel Hervé Poussineau
  2016-02-25 12:27 ` Thomas Huth
  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
  2 siblings, 1 reply; 5+ messages in thread
From: David Gibson @ 2016-02-26  5:02 UTC (permalink / raw)
  To: Hervé Poussineau; +Cc: open list:Old World, qemu-devel

[-- Attachment #1: Type: text/plain, Size: 2528 bytes --]

On Thu, Feb 25, 2016 at 01:02:11PM +0100, 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>

Merged to ppc-for-2.6, thanks.

Btw, you're likely to get a prompter response if you CC me directly on
patches you want merged.  I only sometimes have time to go through the
qemu-ppc list looking for things.

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

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

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Qemu-devel] [Qemu-ppc] [PATCH] dbdma: warn when using unassigned channel
  2016-02-26  5:02 ` David Gibson
@ 2016-03-01  6:10   ` Thomas Huth
  0 siblings, 0 replies; 5+ messages in thread
From: Thomas Huth @ 2016-03-01  6:10 UTC (permalink / raw)
  To: David Gibson
  Cc: open list:Old World, Hervé Poussineau, qemu-devel,
	Alexander Graf

[-- Attachment #1: Type: text/plain, Size: 817 bytes --]

On 26.02.2016 06:02, David Gibson wrote:
> On Thu, Feb 25, 2016 at 01:02:11PM +0100, 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>
> 
> Merged to ppc-for-2.6, thanks.
> 
> Btw, you're likely to get a prompter response if you CC me directly on
> patches you want merged.  I only sometimes have time to go through the
> qemu-ppc list looking for things.

 David,

I guess the problem is likely that get_maintainers.pl does not list you
for ppc related stuff except the spapr files. How long is Alex still
going to be away? Maybe you should get listed in some more ppc-related
entries as co-maintainer in the MAINTAINERS file, for the time being?

 Thomas



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2016-03-01  6:10 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-02-25 12:02 [Qemu-devel] [PATCH] dbdma: warn when using unassigned channel Hervé Poussineau
2016-02-25 12:27 ` Thomas Huth
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

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