From patchwork Sun Sep 24 21:22:46 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Tokarev X-Patchwork-Id: 9968851 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id C9091602CB for ; Sun, 24 Sep 2017 21:45:32 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BAE2928B9C for ; Sun, 24 Sep 2017 21:45:32 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AF91228BA9; Sun, 24 Sep 2017 21:45:32 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 677D328B9C for ; Sun, 24 Sep 2017 21:45:32 +0000 (UTC) Received: from localhost ([::1]:39572 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dwEiR-00054d-O1 for patchwork-qemu-devel@patchwork.kernel.org; Sun, 24 Sep 2017 17:45:31 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48480) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dwEf7-0003BU-O5 for qemu-devel@nongnu.org; Sun, 24 Sep 2017 17:42:06 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dwEf2-0004m9-TI for qemu-devel@nongnu.org; Sun, 24 Sep 2017 17:42:05 -0400 Received: from isrv.corpit.ru ([86.62.121.231]:39003) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dwEf2-0004lf-MR; Sun, 24 Sep 2017 17:42:00 -0400 Received: from tsrv.corpit.ru (tsrv.tls.msk.ru [192.168.177.2]) by isrv.corpit.ru (Postfix) with ESMTP id 094F341C96; Mon, 25 Sep 2017 00:42:00 +0300 (MSK) Received: from tls.msk.ru (mjt.vpn.tls.msk.ru [192.168.177.99]) by tsrv.corpit.ru (Postfix) with SMTP id 7109EC43; Mon, 25 Sep 2017 00:22:57 +0300 (MSK) Received: (nullmailer pid 28296 invoked by uid 1000); Sun, 24 Sep 2017 21:22:52 -0000 From: Michael Tokarev To: qemu-devel@nongnu.org Date: Mon, 25 Sep 2017 00:22:46 +0300 Message-Id: <9e482d1a7ea967ffd465f530b3e5a6df32c20f69.1506288070.git.mjt@msgid.tls.msk.ru> X-Mailer: git-send-email 2.11.0 In-Reply-To: References: In-Reply-To: References: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 86.62.121.231 Subject: [Qemu-devel] [PULL 28/31] dma/i82374: avoid double creation of i82374 device 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: Eduardo Otubo , qemu-trivial@nongnu.org, Michael Tokarev Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Eduardo Otubo QEMU fails when used with the following command line: ./ppc64-softmmu/qemu-system-ppc64 -S -machine 40p,accel=tcg -device i82374 qemu-system-ppc64: hw/isa/isa-bus.c:110: isa_bus_dma: Assertion `!bus->dma[0] && !bus->dma[1]' failed. Aborted (core dumped) 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. One way to avoid this problem is to set user_creatable=false. A possible fix in a near future would be making isa_bus_dma()/DMA_init()/i82374_realize() return an error instead of asserting as well. Signed-off-by: Eduardo Otubo Signed-off-by: Michael Tokarev --- hw/dma/i82374.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/hw/dma/i82374.c b/hw/dma/i82374.c index 6c0f975df0..e76dea8dc7 100644 --- a/hw/dma/i82374.c +++ b/hw/dma/i82374.c @@ -139,6 +139,11 @@ static void i82374_class_init(ObjectClass *klass, void *data) dc->realize = i82374_realize; dc->vmsd = &vmstate_i82374; dc->props = i82374_properties; + dc->user_creatable = false; + /* + * Reason: i82374_realize() crashes (assertion failure inside isa_bus_dma() + * if the device is instantiated twice. + */ } static const TypeInfo i82374_info = {