qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: John Snow <jsnow@redhat.com>
To: Alexey Kardashevskiy <aik@ozlabs.ru>, qemu-devel@nongnu.org
Cc: Eric Blake <eblake@redhat.com>, Markus Armbruster <armbru@redhat.com>
Subject: Re: [Qemu-devel] [PATCH qemu] isa-bus: Replace assert() about DMA with error report
Date: Mon, 6 Nov 2017 19:49:31 -0500	[thread overview]
Message-ID: <1cfd3d4f-616d-c9fc-fd82-8d6c2573c0d8@redhat.com> (raw)
In-Reply-To: <20171026080041.8280-1-aik@ozlabs.ru>



On 10/26/2017 04:00 AM, Alexey Kardashevskiy wrote:
> Running "qemu-system-ppc64 -machine prep -device i82374" creates an ISA
> bus with two i82374 DMA controllers - one is implicit from ppc_prep_init(),
> the other one is from "-device i82374". QEMU asserts but it is not
> immediately clear why.
> 
> This adds an error message to explain the failure.
> 
> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
> ---
> 
> 
> Better phase suggestions are welcome. Thanks!
> 
> 
> ---
>  hw/isa/isa-bus.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/hw/isa/isa-bus.c b/hw/isa/isa-bus.c
> index 348e0eab9d..553707b18d 100644
> --- a/hw/isa/isa-bus.c
> +++ b/hw/isa/isa-bus.c
> @@ -107,7 +107,10 @@ void isa_connect_gpio_out(ISADevice *isadev, int gpioirq, int isairq)
>  void isa_bus_dma(ISABus *bus, IsaDma *dma8, IsaDma *dma16)
>  {
>      assert(bus && dma8 && dma16);
> -    assert(!bus->dma[0] && !bus->dma[1]);
> +    if (bus->dma[0] || bus->dma[1]) {
> +        error_setg(&error_fatal,
> +                   "DMA is already set to ISA bus, duplicated DMA controller?");
> +    }
>      bus->dma[0] = dma8;
>      bus->dma[1] = dma16;
>  }
> 

I suppose it's an improvement strictly, but really we're just naming a
runtime assertion here. We should be avoiding the assertion -- and then
how valuable is the error message?

Is this something we anticipate can never be fixed? (I.e. exclusively
the cause of asking for impossible configurations?)

      parent reply	other threads:[~2017-11-07  0:49 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-26  8:00 [Qemu-devel] [PATCH qemu] isa-bus: Replace assert() about DMA with error report Alexey Kardashevskiy
2017-11-06 10:54 ` Markus Armbruster
2017-11-06 11:07 ` Peter Maydell
2017-11-07  0:49 ` John Snow [this message]

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=1cfd3d4f-616d-c9fc-fd82-8d6c2573c0d8@redhat.com \
    --to=jsnow@redhat.com \
    --cc=aik@ozlabs.ru \
    --cc=armbru@redhat.com \
    --cc=eblake@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).