From nobody Sat Nov 1 22:28:26 2025 Delivered-To: importer@patchew.org Received-SPF: temperror (zoho.com: Error in retrieving data from DNS) 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; spf=temperror (zoho.com: Error in retrieving data from DNS) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 1509000494090286.8969836496061; Wed, 25 Oct 2017 23:48:14 -0700 (PDT) Received: from localhost ([::1]:51245 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e7bxX-0006ZJ-Te for importer@patchew.org; Thu, 26 Oct 2017 02:48:07 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34931) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e7bwg-0006IP-M0 for qemu-devel@nongnu.org; Thu, 26 Oct 2017 02:47:15 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1e7bwc-0004kC-DB for qemu-devel@nongnu.org; Thu, 26 Oct 2017 02:47:14 -0400 Received: from ozlabs.ru ([107.173.13.209]:55926) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e7bwc-0004jc-78 for qemu-devel@nongnu.org; Thu, 26 Oct 2017 02:47:10 -0400 Received: from vpl1.ozlabs.ibm.com (localhost [IPv6:::1]) by ozlabs.ru (Postfix) with ESMTP id 761903A60068; Thu, 26 Oct 2017 02:45:31 -0400 (EDT) From: Alexey Kardashevskiy To: qemu-devel@nongnu.org Date: Thu, 26 Oct 2017 17:46:35 +1100 Message-Id: <20171026064635.7179-1-aik@ozlabs.ru> X-Mailer: git-send-email 2.11.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-Received-From: 107.173.13.209 Subject: [Qemu-devel] [PATCH qemu] fdc: Exit if ISA controller does not support DMA 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: Alexey Kardashevskiy Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_6 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" A "powernv" machine type defines an ISA bus but it does not add any DMA controller to it so it is possible to hit assert(fdctrl->dma) by adding "-machine powernv -device isa-fdc". This replaces assert() with an error message. Signed-off-by: Alexey Kardashevskiy --- Is it a must for ISA to have DMA controllers? --- hw/block/fdc.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/hw/block/fdc.c b/hw/block/fdc.c index 67f78ac702..ed8b367572 100644 --- a/hw/block/fdc.c +++ b/hw/block/fdc.c @@ -2700,7 +2700,10 @@ static void isabus_fdc_realize(DeviceState *dev, Err= or **errp) fdctrl->dma_chann =3D isa->dma; if (fdctrl->dma_chann !=3D -1) { fdctrl->dma =3D isa_get_dma(isa_bus_from_device(isadev), isa->dma); - assert(fdctrl->dma); + if (!fdctrl->dma) { + error_setg(errp, "ISA controller does not support DMA, exiting= "); + return; + } } =20 qdev_set_legacy_instance_id(dev, isa->iobase, 2); --=20 2.11.0