From nobody Wed Feb 11 03:45:07 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1522078853853530.0619916331035; Mon, 26 Mar 2018 08:40:53 -0700 (PDT) Received: from localhost ([::1]:57449 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f0UEu-000866-CI for importer@patchew.org; Mon, 26 Mar 2018 11:40:52 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34469) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f0U9B-00038r-Kz for qemu-devel@nongnu.org; Mon, 26 Mar 2018 11:34:58 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1f0U9A-0000Ei-EN for qemu-devel@nongnu.org; Mon, 26 Mar 2018 11:34:57 -0400 Received: from mail-qt0-x241.google.com ([2607:f8b0:400d:c0d::241]:33130) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1f0U9A-0000Ea-9n; Mon, 26 Mar 2018 11:34:56 -0400 Received: by mail-qt0-x241.google.com with SMTP id i8so20000900qtj.0; Mon, 26 Mar 2018 08:34:56 -0700 (PDT) Received: from x1.local ([138.117.48.212]) by smtp.gmail.com with ESMTPSA id i188sm2017502qkc.16.2018.03.26.08.34.51 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 26 Mar 2018 08:34:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=DEvy8UUq9rGI1F20fmnafnS1ThSwk/OpJshVsVRZHNA=; b=JCFUecikge4B/80KR16vaBCclPBcsCopPcW7WycHC7R8eFpcJ56sb3c+Q/xWCGesC5 sIMXpCVs72X4nCiZxlydzEwaXsrInRqhYyx2S9iaSnAXnDkRfhHFx0kcmrCSDmbZGHwL QSvAsq0ACHRQb5L44IhXXkz7gw/rtbruVsWsRHQjPB0ItyaRcDZR5zgfe8ITJ4m0KNGi IHnnnEeGjrRWfJ1EAnjIP9BS+IF3GHtiurc3IWjMV61G1jsJixEzaxhmsVY7teZ/dmWb qwzMYJNLXQXsWNVVxlL7J0uA9EKMrPpkiSb851W+CwZ0yifDvrip6WhVSmhdvwply+Ky /jhg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=DEvy8UUq9rGI1F20fmnafnS1ThSwk/OpJshVsVRZHNA=; b=P930iLNVGjy7EDqW2sqS5wYw3umkYx/ykHriRvD6MxKxAxSVLXWd4j0O6t8bYRZ01U lAYt7pf8dkNPy6AZPLHYhswdi6qD/LDnVhyyHRUO5M53cftILve28c8RKi8Bfxwv1UbR QiI0SOCzJMLedQ8hFhOIUgjKOv7eu4YvCjiwQI82m/zuxiSXOo0WbI//f0k8E6m8R/rz sjSyKgEXt7x8mfeXOg2pcjzmZkgb0lSuLioqtF9+dIebAtzj59cZ9BiU7IWUxy9gQi9Q FaU62OmDBkFWZZA8Bz6wa9vNJvIkmRKFQhiB7kdDPnFYxmzWI7pENcNQztr5NpJnkmLt ZwzQ== X-Gm-Message-State: AElRT7HTqHpknUpJ5XV55ZXP48rZr7ltpKlmSAfwFCnkOhYduEKcPvFJ HXcJ3JqGoiSJJ+B4dzK3Izo= X-Google-Smtp-Source: AG47ELvJu116I/g2g3fwjMRT8vtR0J1yvCQkNCsg+NqbrGVhs0LNjS3ICDDbdtXtbjiyfPRfHnJiRQ== X-Received: by 10.200.46.51 with SMTP id r48mr57901372qta.8.1522078495711; Mon, 26 Mar 2018 08:34:55 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: Eduardo Otubo , Thomas Huth , Paolo Bonzini Date: Mon, 26 Mar 2018 12:34:37 -0300 Message-Id: <20180326153441.32641-2-f4bug@amsat.org> X-Mailer: git-send-email 2.16.3 In-Reply-To: <20180326153441.32641-1-f4bug@amsat.org> References: <20180326153441.32641-1-f4bug@amsat.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400d:c0d::241 Subject: [Qemu-devel] [PATCH for-2.12 1/5] hw/dma/i82374: Avoid double creation of the 82374 controller X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "open list:PReP" , Eduardo Habkost , qemu-devel@nongnu.org, Michael Tokarev , Alexander Graf , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Nageswara Sastry , =?UTF-8?q?Herv=C3=A9=20Poussineau?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 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. T= he 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 creat= ing the device. Fixes: https://bugs.launchpad.net/qemu/+bug/1721224 Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Thomas Huth Tested-by: Thomas Huth --- 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 @@ */ =20 #include "qemu/osdep.h" +#include "qapi/error.h" #include "hw/isa/isa.h" #include "hw/dma/i8257.h" =20 @@ -118,13 +119,19 @@ static const MemoryRegionPortio i82374_portio_list[] = =3D { static void i82374_realize(DeviceState *dev, Error **errp) { I82374State *s =3D I82374(dev); + ISABus *isa_bus =3D 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); =20 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); =20 - i8257_dma_init(isa_bus_from_device(ISA_DEVICE(dev)), true); memset(s->commands, 0, sizeof(s->commands)); } =20 --=20 2.16.3