qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH qemu] isa-bus: Replace assert() about DMA with e


From: Markus Armbruster
Subject: Re: [Qemu-devel] [PATCH qemu] isa-bus: Replace assert() about DMA with error report
Date: Mon, 06 Nov 2017 11:54:19 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.3 (gnu/linux)

Alexey Kardashevskiy <address@hidden> writes:

> 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 <address@hidden>
> ---
>
>
> 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;
>  }

Quote include/qapi/error.h:

 * Please don't error_setg(&error_fatal, ...), use error_report() and
 * exit(), because that's more obvious.



reply via email to

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