qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Thomas Huth <thuth@redhat.com>
To: "Philippe Mathieu-Daudé" <f4bug@amsat.org>,
	"Eduardo Otubo" <otubo@redhat.com>,
	"Paolo Bonzini" <pbonzini@redhat.com>
Cc: "open list:PReP" <qemu-ppc@nongnu.org>,
	"Eduardo Habkost" <ehabkost@redhat.com>,
	qemu-devel@nongnu.org, "Michael Tokarev" <mjt@tls.msk.ru>,
	"David Gibson" <david@gibson.dropbear.id.au>,
	"Nageswara Sastry" <nasastry@in.ibm.com>,
	"Hervé Poussineau" <hpoussin@reactos.org>
Subject: Re: [Qemu-devel] [PATCH for-2.12 1/5] hw/dma/i82374: Avoid double creation of the 82374 controller
Date: Tue, 27 Mar 2018 11:43:14 +0200	[thread overview]
Message-ID: <0a8516df-4a42-9576-bc54-736debf928eb@redhat.com> (raw)
In-Reply-To: <20180326153441.32641-2-f4bug@amsat.org>

On 26.03.2018 17:34, Philippe Mathieu-Daudé wrote:
> QEMU fails when used with the following command line:
> 
>     ./ppc64-softmmu/qemu-system-ppc64 -S -machine 40p -device i82374
>     qemu-system-ppc64: hw/isa/isa-bus.c:110: isa_bus_dma: Assertion `!bus->dma[0] && !bus->dma[1]' failed.
> 
> The 40p machine type already creates the device i82374. If specified in the
> command line, it will try to create it again, hence generating the error. The
> function isa_bus_dma() isn't supposed to be called twice for the same bus.
> Check the bus doesn't already have a DMA controller registered before creating
> the device.
> 
> Fixes: https://bugs.launchpad.net/qemu/+bug/1721224
> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
> ---
>  hw/dma/i82374.c | 9 ++++++++-
>  1 file changed, 8 insertions(+), 1 deletion(-)
> 
> diff --git a/hw/dma/i82374.c b/hw/dma/i82374.c
> index 83c87d92e0..892f655a7e 100644
> --- a/hw/dma/i82374.c
> +++ b/hw/dma/i82374.c
> @@ -23,6 +23,7 @@
>   */
>  
>  #include "qemu/osdep.h"
> +#include "qapi/error.h"
>  #include "hw/isa/isa.h"
>  #include "hw/dma/i8257.h"
>  
> @@ -118,13 +119,19 @@ static const MemoryRegionPortio i82374_portio_list[] = {
>  static void i82374_realize(DeviceState *dev, Error **errp)
>  {
>      I82374State *s = I82374(dev);
> +    ISABus *isa_bus = isa_bus_from_device(ISA_DEVICE(dev));
> +
> +    if (isa_get_dma(isa_bus, 0)) {
> +        error_setg(errp, "DMA already initialized on ISA bus");
> +        return;
> +    }
> +    i8257_dma_init(isa_bus, true);
>  
>      portio_list_init(&s->port_list, OBJECT(s), i82374_portio_list, s,
>                       "i82374");
>      portio_list_add(&s->port_list, isa_address_space_io(&s->parent_obj),
>                      s->iobase);
>  
> -    i8257_dma_init(isa_bus_from_device(ISA_DEVICE(dev)), true);
>      memset(s->commands, 0, sizeof(s->commands));
>  }
>  
> 

Thanks, looks like a good way to fix this issue for QEMU 2.12 indeed.

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

  reply	other threads:[~2018-03-27  9:43 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-26 15:34 [Qemu-devel] [PATCH 0/5] dma/i82374: avoid double creation of i82374 device Philippe Mathieu-Daudé
2018-03-26 15:34 ` [Qemu-devel] [PATCH for-2.12 1/5] hw/dma/i82374: Avoid double creation of the 82374 controller Philippe Mathieu-Daudé
2018-03-27  9:43   ` Thomas Huth [this message]
2018-03-26 15:34 ` [Qemu-devel] [PATCH for-2.13 2/5] hw/dma/i8257: Define I8257_CHANNEL_COUNT Philippe Mathieu-Daudé
2018-03-26 15:34 ` [Qemu-devel] [PATCH for-2.13 3/5] hw/dma/i8257: Split i8257_dma_init() by master/slave Philippe Mathieu-Daudé
2018-03-26 15:34 ` [Qemu-devel] [PATCH for-2.13 /5] hw/dma/i8257: Rename i8257_dma_init() -> i8257_dma_init_cascaded() Philippe Mathieu-Daudé
2018-03-26 15:34 ` [Qemu-devel] [PATCH for-2.13 5/5] hw/dma/i8257: Rename i8257_dma_init(false) -> i8257_dma_init_pc_at() Philippe Mathieu-Daudé
2018-03-26 15:43   ` Marcel Apfelbaum
2018-03-26 16:02 ` [Qemu-devel] [PATCH for-2.13 4/5] hw/dma/i8257: Rename i8257_dma_init() -> i8257_dma_init_cascaded() Philippe Mathieu-Daudé
2018-03-27  8:24 ` [Qemu-devel] [PATCH 0/5] dma/i82374: avoid double creation of i82374 device Eduardo Otubo

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=0a8516df-4a42-9576-bc54-736debf928eb@redhat.com \
    --to=thuth@redhat.com \
    --cc=david@gibson.dropbear.id.au \
    --cc=ehabkost@redhat.com \
    --cc=f4bug@amsat.org \
    --cc=hpoussin@reactos.org \
    --cc=mjt@tls.msk.ru \
    --cc=nasastry@in.ibm.com \
    --cc=otubo@redhat.com \
    --cc=pbonzini@redhat.com \
    --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 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).