From nobody Tue May 14 13:52:33 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1621374969; cv=none; d=zohomail.com; s=zohoarc; b=h+yuohqTfmxSJ/ne+zFYeUcj7alb/SWtU3uGlwdfPmMPqow5egFrFpBW+aAZeKh6SUhRD3jMAnEtQ0m2KnwZ9/QOk8CiwOY6EwBxJQhZh7qcLxo4Nu1QrWqaNgR1zQKLOLFMyOXeG3ysloekzxdO+gYnU/NYp3qbazX9zS4IV2g= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1621374969; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=PE3iwyGyEcoAMEB/9uNGPwKDaH1AcQ1ElGBifGVOY78=; b=Kezp0tjYnPdwOB1vMA78nbtUZci72LHI3Cbvt03lRrE8lTILBo2pb67Sh+YDMKlFBndfxyUPtWJ6tb2DIQBgHPvp46TfBa2NmPW80FNqYBpU2PKxDmwlFhpTXWJp+Ybb/wfqaDK3wLPe1yeyes6znV+Jwp2KNIjbIm/McjV1s4Y= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1621374969793356.82748577579036; Tue, 18 May 2021 14:56:09 -0700 (PDT) Received: from mail-ej1-f71.google.com (mail-ej1-f71.google.com [209.85.218.71]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-351-25jIy6DBMFai0h7uWLAJIA-1; Tue, 18 May 2021 17:55:53 -0400 Received: by mail-ej1-f71.google.com with SMTP id z15-20020a170906074fb029038ca4d43d48so2937592ejb.17 for ; Tue, 18 May 2021 14:55:52 -0700 (PDT) Return-Path: Return-Path: Received: from x1w.redhat.com (31.red-83-51-215.dynamicip.rima-tde.net. [83.51.215.31]) by smtp.gmail.com with ESMTPSA id u14sm3394603edy.47.2021.05.18.14.55.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 18 May 2021 14:55:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1621374968; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=PE3iwyGyEcoAMEB/9uNGPwKDaH1AcQ1ElGBifGVOY78=; b=fQIhbs/IhZRyVzgOiHiMY5Oz6gp++Q8Rc6J8pDnY6kERyQq07iOZFFq1qP8DxqgZ9Ika7f bLCfshywlZ066n/8Rot7uKQV/3yEpW6/kPo6h/Ze5shYkVDhTx0k9A1O9GuqOfQ+lpKvC8 Xs7M4KgzkBFhksrCahXQ/8QA79F5Az0= X-MC-Unique: 25jIy6DBMFai0h7uWLAJIA-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=PE3iwyGyEcoAMEB/9uNGPwKDaH1AcQ1ElGBifGVOY78=; b=VWaIrtJUOpY+gEVKMuSaAyCGQ1h9PmajxYOd4z3WYr4WCRqIIbEir6SDCCCsVpe+57 t1CSGuZUwsaZIE2h4hc05BTymLTkVKccCnKF/mI3jZHpdi/KHOb4T8vVOUrg+Xqr6Q1X zdSYQXlpi1PmbjqDKGPBc7J9syy5eVdliGzbk+Caojx6c664iq0loNivH5ZNjv1lb3Xa wr/kCSFDq69crHFLJQXkyImAne87lDwvy8lFpnvNjCD/etCHK/PAqvDpuf1NUD/TL0zi 6K70F7q5psqxh59G8PqpoIVV4u8FeI291quF+cemywvd5Py1+ygbKYrleQmaf8v/JW2L wT/A== X-Gm-Message-State: AOAM532OIuICbFsG8F6AwsWfrRrcjMFxyODXJeEboAAeU4aFnLZYpoPU QAVk42Y7QG1sEU8XyWm4ln0ULNjp9dSPTMvJ2IJWGJCN1SsZ9Sj6l9IP2xGqTLUkuJAO2oyGv9Q GX8n5deOgLO3kVA== X-Received: by 2002:a17:906:c299:: with SMTP id r25mr4888930ejz.501.1621374951815; Tue, 18 May 2021 14:55:51 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzWVOhAotvN7IhI9s6XiwQJDj2ZhJMuuGYh31gStlR4AYAsrVT/q0c66jCgFe2KKO+Jsz3Idw== X-Received: by 2002:a17:906:c299:: with SMTP id r25mr4888923ejz.501.1621374951674; Tue, 18 May 2021 14:55:51 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: John Snow , qemu-devel@nongnu.org Cc: Elena Ufimtseva , Markus Armbruster , Mark Cave-Ayland , Stefan Hajnoczi , Jagannathan Raman , Thomas Huth , John G Johnson , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [RFC PATCH 01/11] hw/isa: Explode pci_create_simple() calls Date: Tue, 18 May 2021 23:55:35 +0200 Message-Id: <20210518215545.1793947-2-philmd@redhat.com> X-Mailer: git-send-email 2.26.3 In-Reply-To: <20210518215545.1793947-1-philmd@redhat.com> References: <20210518215545.1793947-1-philmd@redhat.com> MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=philmd@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) To be able to set a property on the ISA-IDE bridges objects before they are realized, explode the pci_create_simple() calls as pci_new() + pci_realize_and_unref(). Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- hw/i386/pc_piix.c | 5 +++-- hw/isa/piix4.c | 3 ++- hw/mips/fuloong2e.c | 3 ++- hw/ppc/pegasos2.c | 3 ++- 4 files changed, 9 insertions(+), 5 deletions(-) diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c index 30b8bd6ea92..fb606c14768 100644 --- a/hw/i386/pc_piix.c +++ b/hw/i386/pc_piix.c @@ -244,8 +244,9 @@ static void pc_init1(MachineState *machine, if (pcmc->pci_enabled) { PCIDevice *dev; =20 - dev =3D pci_create_simple(pci_bus, piix3_devfn + 1, - xen_enabled() ? "piix3-ide-xen" : "piix3-i= de"); + dev =3D pci_new(piix3_devfn + 1, + xen_enabled() ? "piix3-ide-xen" : "piix3-ide"); + pci_realize_and_unref(dev, pci_bus, &error_abort); pci_ide_create_devs(dev); idebus[0] =3D qdev_get_child_bus(&dev->qdev, "ide.0"); idebus[1] =3D qdev_get_child_bus(&dev->qdev, "ide.1"); diff --git a/hw/isa/piix4.c b/hw/isa/piix4.c index 0fe7b69bc4c..d60f161ecf4 100644 --- a/hw/isa/piix4.c +++ b/hw/isa/piix4.c @@ -261,7 +261,8 @@ DeviceState *piix4_create(PCIBus *pci_bus, ISABus **isa= _bus, I2CBus **smbus) *isa_bus =3D ISA_BUS(qdev_get_child_bus(dev, "isa.0")); } =20 - pci =3D pci_create_simple(pci_bus, devfn + 1, "piix4-ide"); + pci =3D pci_new(devfn + 1, "piix4-ide"); + pci_realize_and_unref(pci, pci_bus, &error_abort); pci_ide_create_devs(pci); =20 pci_create_simple(pci_bus, devfn + 2, "piix4-usb-uhci"); diff --git a/hw/mips/fuloong2e.c b/hw/mips/fuloong2e.c index c1b8066a13b..40e9a645e1b 100644 --- a/hw/mips/fuloong2e.c +++ b/hw/mips/fuloong2e.c @@ -206,7 +206,8 @@ static void vt82c686b_southbridge_init(PCIBus *pci_bus,= int slot, qemu_irq intc, TYPE_VT82C686B_ISA); qdev_connect_gpio_out(DEVICE(dev), 0, intc); =20 - dev =3D pci_create_simple(pci_bus, PCI_DEVFN(slot, 1), "via-ide"); + dev =3D pci_new(PCI_DEVFN(slot, 1), "via-ide"); + pci_realize_and_unref(dev, pci_bus, &error_abort); pci_ide_create_devs(dev); =20 pci_create_simple(pci_bus, PCI_DEVFN(slot, 2), "vt82c686b-usb-uhci"); diff --git a/hw/ppc/pegasos2.c b/hw/ppc/pegasos2.c index 0bfd0928aa5..8486a2eb8c6 100644 --- a/hw/ppc/pegasos2.c +++ b/hw/ppc/pegasos2.c @@ -108,7 +108,8 @@ static void pegasos2_init(MachineState *machine) qdev_get_gpio_in_named(mv, "gpp", 31)); =20 /* VT8231 function 1: IDE Controller */ - dev =3D pci_create_simple(pci_bus, PCI_DEVFN(12, 1), "via-ide"); + dev =3D pci_new(PCI_DEVFN(12, 1), "via-ide"); + pci_realize_and_unref(dev, pci_bus, &error_abort); pci_ide_create_devs(dev); =20 /* VT8231 function 2-3: USB Ports */ --=20 2.26.3 From nobody Tue May 14 13:52:33 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1621374960; cv=none; d=zohomail.com; s=zohoarc; b=bfyBOylgDo+Kd9E9ZVeUl7oZYGP7KMlv2cg+jh4gHQq4VU4WV/ZgZO67DhX28VPNcWw+1nRz5jS+9cyWaDyOY1dpNM2On9o70yzyx+UEnRjvGcnujgTzny73zxnSwJNlvOEm0CVxYIaIack6dMiRyEbc8ThhEZtbhTxgmwBwEXA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1621374960; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=dfCgiJU0/iWOxOTGg77x6mXGX5z5RsV773l26eByVJA=; b=WclXsSy39U8w06e0o+tzBGnySbJ0zM4oZtt3ILIRHN5SvWbrDwGKB7G9FgHgYBa/+CsZkBhhZQc1YAoGRWqC/1v534mh1JOmQ4DnpKiUbcrTVMsL6xht8rbQqxvK1/o0ACaJYCP2lGk3Ib7PDtVobIlFcGHk61oTEv0u64Zp/Qo= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1621374960497716.1488343067844; Tue, 18 May 2021 14:56:00 -0700 (PDT) Received: from mail-ed1-f72.google.com (mail-ed1-f72.google.com [209.85.208.72]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-257-U1OoipDEPxyOemvc3Tjc8g-1; Tue, 18 May 2021 17:55:58 -0400 Received: by mail-ed1-f72.google.com with SMTP id u14-20020a05640207ceb029038d4bfbf3a6so2928938edy.9 for ; Tue, 18 May 2021 14:55:57 -0700 (PDT) Return-Path: Return-Path: Received: from x1w.redhat.com (31.red-83-51-215.dynamicip.rima-tde.net. [83.51.215.31]) by smtp.gmail.com with ESMTPSA id f26sm6989792ejl.66.2021.05.18.14.55.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 18 May 2021 14:55:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1621374959; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=dfCgiJU0/iWOxOTGg77x6mXGX5z5RsV773l26eByVJA=; b=Kli1h2L7zEJft5MiX18k3xySSnegfZaHUWjlGxACzQvOcm00Tqzg1X7MAlj3GlD3u6iivr HBQcsRDez+Xj1N3mq1PdHLQRPlqnN2W3zEd2VT8QvDIqnS9zM9ATlEUp9X4I5WPGnOVS2R 87cvsxYQb/pu6hPHBk0EorPnvH2+oZE= X-MC-Unique: U1OoipDEPxyOemvc3Tjc8g-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=dfCgiJU0/iWOxOTGg77x6mXGX5z5RsV773l26eByVJA=; b=IAc35XutJ3C5mAxV8frHp7xpMIGNIPn8qsZAxZO/wip8/6TDjWVV+oMV5v9mGCxB7o ZpddpGOXpVXrh5JiAnvghOtO1kQgvF5m/TyGco0OWYuc+jiY7rUvxOCZ/t88s/a5UqCl cqzYwBf2w9usgtowjaMGLQ+eliQkasCY7vzqldyECrC1zb0Dz/IwVdjTJIvRIviGe1ya h8/+Hd7nVBT8OHeERegDjoDkwa007IFaZYHElMpr6/GXzTPFhD00u9h88+kiHrsXLV9I i94szOiI5We7dHVm3qDzgefwXB13rizM6oNgWxtpX0bo00Ukszmt8k9UsI2TTsZV3oXs XyFQ== X-Gm-Message-State: AOAM532V7aSrRyoFfAY5jFCEghtA4XUc8bG3meM2++KdctaXpfz2F8Po hCApBL6TNhx/A0bqwHHMmCOdyz4AZ1kK5+izTen5J0uK60do4gRrp1YtHzGDV8Ay2TpECGXklN0 ytK8XsuZsMT3ijw== X-Received: by 2002:a17:907:920e:: with SMTP id ka14mr8282131ejb.193.1621374956761; Tue, 18 May 2021 14:55:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz+MTukvoJwK8+OcNQSzpnyMtpae8UHmkN1XpssPufUEfT7X9ivR+M6SXkYCeI/zYf5hMpEDg== X-Received: by 2002:a17:907:920e:: with SMTP id ka14mr8282122ejb.193.1621374956593; Tue, 18 May 2021 14:55:56 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: John Snow , qemu-devel@nongnu.org Cc: Elena Ufimtseva , Markus Armbruster , Mark Cave-Ayland , Stefan Hajnoczi , Jagannathan Raman , Thomas Huth , John G Johnson , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [RFC PATCH 02/11] hw/ide: Add PCIIDEState::isa_bus link Date: Tue, 18 May 2021 23:55:36 +0200 Message-Id: <20210518215545.1793947-3-philmd@redhat.com> X-Mailer: git-send-email 2.26.3 In-Reply-To: <20210518215545.1793947-1-philmd@redhat.com> References: <20210518215545.1793947-1-philmd@redhat.com> MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=philmd@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) IDE bus depends on ISA bus for IRQ/DMA. Add an ISABus reference in PCIIDEState, and add link properties to it in the PIIX and VIA objects (which inherit PCI_IDE). Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- include/hw/ide/pci.h | 1 + hw/ide/piix.c | 11 ++++++++++- hw/ide/via.c | 10 +++++++++- 3 files changed, 20 insertions(+), 2 deletions(-) diff --git a/include/hw/ide/pci.h b/include/hw/ide/pci.h index d8384e1c422..e790722ed14 100644 --- a/include/hw/ide/pci.h +++ b/include/hw/ide/pci.h @@ -47,6 +47,7 @@ struct PCIIDEState { PCIDevice parent_obj; /*< public >*/ =20 + ISABus *isa_bus; IDEBus bus[2]; BMDMAState bmdma[2]; uint32_t secondary; /* used only for cmd646 */ diff --git a/hw/ide/piix.c b/hw/ide/piix.c index b9860e35a5c..48da68da37f 100644 --- a/hw/ide/piix.c +++ b/hw/ide/piix.c @@ -30,8 +30,9 @@ #include "sysemu/block-backend.h" #include "sysemu/blockdev.h" #include "sysemu/dma.h" - +#include "qapi/error.h" #include "hw/ide/pci.h" +#include "hw/isa/isa.h" #include "trace.h" =20 static uint64_t bmdma_read(void *opaque, hwaddr addr, unsigned size) @@ -207,6 +208,12 @@ static void pci_piix_ide_exitfn(PCIDevice *dev) } } =20 +static Property piix_ide_properties[] =3D { + DEFINE_PROP_LINK("isa-bus", PCIIDEState, isa_bus, + TYPE_ISA_BUS, ISABus *), + DEFINE_PROP_END_OF_LIST(), +}; + /* NOTE: for the PIIX3, the IRQs and IOports are hardcoded */ static void piix3_ide_class_init(ObjectClass *klass, void *data) { @@ -221,6 +228,7 @@ static void piix3_ide_class_init(ObjectClass *klass, vo= id *data) k->class_id =3D PCI_CLASS_STORAGE_IDE; set_bit(DEVICE_CATEGORY_STORAGE, dc->categories); dc->hotpluggable =3D false; + device_class_set_props(dc, piix_ide_properties); } =20 static const TypeInfo piix3_ide_info =3D { @@ -249,6 +257,7 @@ static void piix4_ide_class_init(ObjectClass *klass, vo= id *data) k->class_id =3D PCI_CLASS_STORAGE_IDE; set_bit(DEVICE_CATEGORY_STORAGE, dc->categories); dc->hotpluggable =3D false; + device_class_set_props(dc, piix_ide_properties); } =20 static const TypeInfo piix4_ide_info =3D { diff --git a/hw/ide/via.c b/hw/ide/via.c index be09912b334..65fdca6dcf4 100644 --- a/hw/ide/via.c +++ b/hw/ide/via.c @@ -28,8 +28,9 @@ #include "hw/pci/pci.h" #include "migration/vmstate.h" #include "qemu/module.h" +#include "qapi/error.h" #include "sysemu/dma.h" - +#include "hw/isa/isa.h" #include "hw/ide/pci.h" #include "trace.h" =20 @@ -210,6 +211,12 @@ static void via_ide_exitfn(PCIDevice *dev) } } =20 +static Property via_ide_properties[] =3D { + DEFINE_PROP_LINK("isa-bus", PCIIDEState, isa_bus, + TYPE_ISA_BUS, ISABus *), + DEFINE_PROP_END_OF_LIST(), +}; + static void via_ide_class_init(ObjectClass *klass, void *data) { DeviceClass *dc =3D DEVICE_CLASS(klass); @@ -224,6 +231,7 @@ static void via_ide_class_init(ObjectClass *klass, void= *data) k->revision =3D 0x06; k->class_id =3D PCI_CLASS_STORAGE_IDE; set_bit(DEVICE_CATEGORY_STORAGE, dc->categories); + device_class_set_props(dc, via_ide_properties); } =20 static const TypeInfo via_ide_info =3D { --=20 2.26.3 From nobody Tue May 14 13:52:33 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1621374967; cv=none; d=zohomail.com; s=zohoarc; b=XC/L3UVV+VSZCVe4ZCC+yD2lBrHdv6ulvsr1KpIimmK0OyoAvSTG7JN6yJgCskY5DI8+E72AFSl+UE/PVAC/38dX36Gcey20/K4FqgbXETMKnysQ2MIIcrgS/jDlRT7ApsqfIPnyRo8jWhFo3MTWO4KeUI0n0HhRMk+XkLAEXrE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1621374967; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=gn9E3ldchIQVg6abwyiugztlAOCm9ATrI49DFupz98Y=; b=XRaYq+GNXnX/ty1ZGoqiP+Rc7bprw9bnUASVa8WlrobjpSCLiZJOxgUIcdVtaVakZF4i2UvjU5mI3ZJLp2NTHsAOUDERCtV5FmxXxZDrbErL9N8klXSIQ3nOJ18kNpnbGWmdWqpsEl/+CuTwPDA+Vb9L8t3H0Qc/7k8G12ggGRw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1621374967550756.1224397746148; Tue, 18 May 2021 14:56:07 -0700 (PDT) Received: from mail-ej1-f70.google.com (mail-ej1-f70.google.com [209.85.218.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-43-BvkOBHV9M3KzoKEuBDi3cA-1; Tue, 18 May 2021 17:56:02 -0400 Received: by mail-ej1-f70.google.com with SMTP id la2-20020a170906ad82b02903d4bcc8de3bso2943079ejb.4 for ; Tue, 18 May 2021 14:56:02 -0700 (PDT) Return-Path: Return-Path: Received: from x1w.redhat.com (31.red-83-51-215.dynamicip.rima-tde.net. [83.51.215.31]) by smtp.gmail.com with ESMTPSA id zg18sm3285302ejb.41.2021.05.18.14.56.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 18 May 2021 14:56:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1621374966; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=gn9E3ldchIQVg6abwyiugztlAOCm9ATrI49DFupz98Y=; b=fx3wJBRJtrWiMlnMzzFP8ONzeCNEh4zGOeTVq92Dfz2p1QL93VJ4loPw2TYwkceqom9+Ql NU1RmriOJi8ENYGRIVret98xhCRZCRU8FaPL+l1f5M60Fc76YspD7YJTpr01Zr6Htu1cr9 rux2f8wWizmY3pKeX6Z4KqdtW/hs1b4= X-MC-Unique: BvkOBHV9M3KzoKEuBDi3cA-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=gn9E3ldchIQVg6abwyiugztlAOCm9ATrI49DFupz98Y=; b=XQWKuErjCzITnKqYUUv6QzGjlAuQuqCsqjkMF5xo7QFXWsFrnhXwAb8q9RV/mYRdLS tVMfOXYQIpxH3Zx2c6yPlrm46SfytiBrGts3jprWytK0+kjRSAUZY+M8yJN229KH1QYM 2mVUvGpRQYHNWXqbGmrs7oB5iQfActqlJA7hpkgCj1INy/eS9jPUlvopZaNKrS5BADp8 zQdQvZw3ts+POxToCkO3p8e/DeGgrIms/ejTcyBr1g5+N49Q2G+dZsKd3j/DEOnKEvK+ 4cOyEaGOZj7GHLzQSqx6gaCyStf+WvxodCxHufaGlsgam7IH+/BrhWrzovvfbVknm469 1bTw== X-Gm-Message-State: AOAM531ASEP9LZje34bumK3lNaSV3UbJKZdXtdtPMyxbzkc0ICaWvkua olbPnewqbBImrTFJcP7KBPGOKUVQnW0KKBY5UjH5jOcdZ6mVw7J+xTHl5qxDFDWgunbvVatSIFB LmAwdtDJzo08UKA== X-Received: by 2002:aa7:c789:: with SMTP id n9mr9670495eds.352.1621374961621; Tue, 18 May 2021 14:56:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwgc8iWE4iB6idJShlAeZwhnPROOUoOUE7+ks3AVxbdhNDGXzEmoj0aqRcNnCUWsppBXEOQ0A== X-Received: by 2002:aa7:c789:: with SMTP id n9mr9670485eds.352.1621374961501; Tue, 18 May 2021 14:56:01 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: John Snow , qemu-devel@nongnu.org Cc: Elena Ufimtseva , Markus Armbruster , Mark Cave-Ayland , Stefan Hajnoczi , Jagannathan Raman , Thomas Huth , John G Johnson , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [RFC PATCH 03/11] hw/ide/piix: Set the ISA-bus QOM link Date: Tue, 18 May 2021 23:55:37 +0200 Message-Id: <20210518215545.1793947-4-philmd@redhat.com> X-Mailer: git-send-email 2.26.3 In-Reply-To: <20210518215545.1793947-1-philmd@redhat.com> References: <20210518215545.1793947-1-philmd@redhat.com> MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=philmd@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Set the ISA Bus link property on the PIIX IDE object from the two unique users, the PC machine and the PIIX4 function. Add a check in pci_piix_ide_realize() to be sure this property is set. Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- hw/i386/pc_piix.c | 2 ++ hw/ide/piix.c | 5 +++++ hw/isa/piix4.c | 10 +++++++--- 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c index fb606c14768..d799c8004df 100644 --- a/hw/i386/pc_piix.c +++ b/hw/i386/pc_piix.c @@ -246,6 +246,8 @@ static void pc_init1(MachineState *machine, =20 dev =3D pci_new(piix3_devfn + 1, xen_enabled() ? "piix3-ide-xen" : "piix3-ide"); + object_property_set_link(OBJECT(dev), "isa-bus", + OBJECT(isa_bus), &error_abort); pci_realize_and_unref(dev, pci_bus, &error_abort); pci_ide_create_devs(dev); idebus[0] =3D qdev_get_child_bus(&dev->qdev, "ide.0"); diff --git a/hw/ide/piix.c b/hw/ide/piix.c index 48da68da37f..3aef9b1e21c 100644 --- a/hw/ide/piix.c +++ b/hw/ide/piix.c @@ -152,6 +152,11 @@ static void pci_piix_ide_realize(PCIDevice *dev, Error= **errp) PCIIDEState *d =3D PCI_IDE(dev); uint8_t *pci_conf =3D dev->config; =20 + if (!d->isa_bus) { + error_setg(errp, "piix-ide: 'isa-bus' link not set"); + return; + } + pci_conf[PCI_CLASS_PROG] =3D 0x80; // legacy ATA mode =20 bmdma_setup_bar(d); diff --git a/hw/isa/piix4.c b/hw/isa/piix4.c index d60f161ecf4..ef11c2d1f8d 100644 --- a/hw/isa/piix4.c +++ b/hw/isa/piix4.c @@ -248,20 +248,24 @@ static void piix4_register_types(void) =20 type_init(piix4_register_types) =20 -DeviceState *piix4_create(PCIBus *pci_bus, ISABus **isa_bus, I2CBus **smbu= s) +DeviceState *piix4_create(PCIBus *pci_bus, ISABus **isa_busp, I2CBus **smb= us) { PCIDevice *pci; DeviceState *dev; + ISABus *isa_bus; int devfn =3D PCI_DEVFN(10, 0); =20 pci =3D pci_create_simple_multifunction(pci_bus, devfn, true, TYPE_PIIX4_PCI_DEVICE); dev =3D DEVICE(pci); - if (isa_bus) { - *isa_bus =3D ISA_BUS(qdev_get_child_bus(dev, "isa.0")); + isa_bus =3D ISA_BUS(qdev_get_child_bus(dev, "isa.0")); + if (isa_busp) { + *isa_busp =3D isa_bus; } =20 pci =3D pci_new(devfn + 1, "piix4-ide"); + object_property_set_link(OBJECT(pci), "isa-bus", + OBJECT(isa_bus), &error_abort); pci_realize_and_unref(pci, pci_bus, &error_abort); pci_ide_create_devs(pci); =20 --=20 2.26.3 From nobody Tue May 14 13:52:33 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1621374970; cv=none; d=zohomail.com; s=zohoarc; b=iLrSTV1vMytMG2GVs4Q920ots7t5TKCNfU4VswyWRRY3QJ0wpmMFv5ithf23SE2chje+2yjf5nK/tlxVJ9AAkfFE3RNFe31zZ5xb6vkCPMdMv06P5nYNJ4COm06+ZYewI6nTvyRxwFnytJPa6/ZCwkIhAQRhLdqjy1BtjxXkJqM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1621374970; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=4mj2gfnZfCBRpQogSZRkYuV2axSsjwCefiXC31wD6Zo=; b=S4YPWQ46qkybkk/lR8eR9OglXWYqIAFrQj3UhKX4oGE+y04GKevgzh7vUw1rWwYCFxzUS6+4FzUAnuM35VwqkWBz+p4QSs/8qfnfEGMsOpDms4Tf7Q9BJtV1RTHmsgTfQODgHXemKUodhYY1kga/bcqfSgdfAgBTN4iCA1fLj7U= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1621374970684917.833993821618; Tue, 18 May 2021 14:56:10 -0700 (PDT) Received: from mail-ej1-f71.google.com (mail-ej1-f71.google.com [209.85.218.71]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-525-DrPEyNdVNJS9N_zPxODnkw-1; Tue, 18 May 2021 17:56:07 -0400 Received: by mail-ej1-f71.google.com with SMTP id x20-20020a1709061354b02903cff4894505so2926856ejb.14 for ; Tue, 18 May 2021 14:56:07 -0700 (PDT) Return-Path: Return-Path: Received: from x1w.redhat.com (31.red-83-51-215.dynamicip.rima-tde.net. [83.51.215.31]) by smtp.gmail.com with ESMTPSA id k22sm1728326ejz.108.2021.05.18.14.56.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 18 May 2021 14:56:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1621374969; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=4mj2gfnZfCBRpQogSZRkYuV2axSsjwCefiXC31wD6Zo=; b=KYzI7VdARF2sUuVx49WghkS1QeV2nPDyjOG8GSSZKcqwq8rEDJn7QF7Y6ovG4y7p8+LHt/ DweeNXbu1rXRPfRdbL/eJJmND32KAbD4LKdQb3vy1NgCSEJt+pcALWVoMS7ZxCo6g9kFeW aBWIh0AnH/9y7N6972Yvv1njuwfmCYI= X-MC-Unique: DrPEyNdVNJS9N_zPxODnkw-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=4mj2gfnZfCBRpQogSZRkYuV2axSsjwCefiXC31wD6Zo=; b=iz5JjIc1Iz5xZfMvaq8zM1T6jXNRQZlClIn8Qx0CES7eO4CK/1BrwcB0R4QM8MuzaS IEbFDwnbYj2Y4WwgCbkVUwNKERfHArp+vCMATQ30Fb80kISoriD1xE6wc2RnnOf+aBg/ Q5ZjWs9M3BCFw+2JLkF/Ybg6weQI6GpXeD8sfDwiGuknLUo3GQIoCac41k53/iVuGXu+ D/0ooByd1XI8qd+LYVbCNJIRARrMwUc3+0Lup4Re0CowxIdi0IaDW/goRYEvBd8MdxJG YHoRpPdKVamQ4U6j1ZD8lsuz7D+tPldrbWCPtuAXzidlgOdXo5F0NQgv7FrE9GKatIQQ 1mWA== X-Gm-Message-State: AOAM531O38Gd+ghutgjjhzPA5h36OrWiyLEcF2iaORZjetn7CXiFLC6w lKSHPW7yBr0iRlSibjjwvTSArHC1R9R7mRTvxhrRQAykA8onRNbBBHi+OTHdkNSRK1Vl/enhD0e +gEtV4dHAFOWBmw== X-Received: by 2002:aa7:d718:: with SMTP id t24mr9681604edq.259.1621374966605; Tue, 18 May 2021 14:56:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwLcxhisD70Y685w1e2tU1HSum86pDVs1XDF6xvVyRDYtUtt/up1h9E2iAQytr0lkSJCD6BrQ== X-Received: by 2002:aa7:d718:: with SMTP id t24mr9681585edq.259.1621374966434; Tue, 18 May 2021 14:56:06 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: John Snow , qemu-devel@nongnu.org Cc: Elena Ufimtseva , Markus Armbruster , Mark Cave-Ayland , Stefan Hajnoczi , Jagannathan Raman , Thomas Huth , John G Johnson , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [RFC PATCH 04/11] hw/ide/via: Set the ISA-bus QOM link Date: Tue, 18 May 2021 23:55:38 +0200 Message-Id: <20210518215545.1793947-5-philmd@redhat.com> X-Mailer: git-send-email 2.26.3 In-Reply-To: <20210518215545.1793947-1-philmd@redhat.com> References: <20210518215545.1793947-1-philmd@redhat.com> MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=philmd@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Set the ISA Bus link property on the VIA IDE object from the two unique users, the Fuloong and Pegasos machines. Add a check in via_ide_realize() to be sure this property is set. Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- hw/ide/via.c | 5 +++++ hw/mips/fuloong2e.c | 4 ++++ hw/ppc/pegasos2.c | 4 ++++ 3 files changed, 13 insertions(+) diff --git a/hw/ide/via.c b/hw/ide/via.c index 65fdca6dcf4..654e15edfed 100644 --- a/hw/ide/via.c +++ b/hw/ide/via.c @@ -165,6 +165,11 @@ static void via_ide_realize(PCIDevice *dev, Error **er= rp) uint8_t *pci_conf =3D dev->config; int i; =20 + if (!d->isa_bus) { + error_setg(errp, "via-ide: 'isa-bus' link not set"); + return; + } + pci_config_set_prog_interface(pci_conf, 0x8a); /* legacy mode */ pci_set_long(pci_conf + PCI_CAPABILITY_LIST, 0x000000c0); dev->wmask[PCI_INTERRUPT_LINE] =3D 0; diff --git a/hw/mips/fuloong2e.c b/hw/mips/fuloong2e.c index 40e9a645e1b..7e644a701bc 100644 --- a/hw/mips/fuloong2e.c +++ b/hw/mips/fuloong2e.c @@ -201,12 +201,16 @@ static void vt82c686b_southbridge_init(PCIBus *pci_bu= s, int slot, qemu_irq intc, I2CBus **i2c_bus) { PCIDevice *dev; + BusState *isa_bus; =20 dev =3D pci_create_simple_multifunction(pci_bus, PCI_DEVFN(slot, 0), t= rue, TYPE_VT82C686B_ISA); + isa_bus =3D qdev_get_child_bus(DEVICE(dev), "isa.0"); qdev_connect_gpio_out(DEVICE(dev), 0, intc); =20 dev =3D pci_new(PCI_DEVFN(slot, 1), "via-ide"); + object_property_set_link(OBJECT(dev), "isa-bus", + OBJECT(isa_bus), &error_abort); pci_realize_and_unref(dev, pci_bus, &error_abort); pci_ide_create_devs(dev); =20 diff --git a/hw/ppc/pegasos2.c b/hw/ppc/pegasos2.c index 8486a2eb8c6..ed6ddc3569b 100644 --- a/hw/ppc/pegasos2.c +++ b/hw/ppc/pegasos2.c @@ -57,6 +57,7 @@ static void pegasos2_init(MachineState *machine) PCIBus *pci_bus; PCIDevice *dev; I2CBus *i2c_bus; + BusState *isa_bus; const char *fwname =3D machine->firmware ?: PROM_FILENAME; char *filename; int sz; @@ -104,11 +105,14 @@ static void pegasos2_init(MachineState *machine) /* VT8231 function 0: PCI-to-ISA Bridge */ dev =3D pci_create_simple_multifunction(pci_bus, PCI_DEVFN(12, 0), tru= e, TYPE_VT8231_ISA); + isa_bus =3D qdev_get_child_bus(DEVICE(dev), "isa.0"); qdev_connect_gpio_out(DEVICE(dev), 0, qdev_get_gpio_in_named(mv, "gpp", 31)); =20 /* VT8231 function 1: IDE Controller */ dev =3D pci_new(PCI_DEVFN(12, 1), "via-ide"); + object_property_set_link(OBJECT(dev), "isa-bus", + OBJECT(isa_bus), &error_abort); pci_realize_and_unref(dev, pci_bus, &error_abort); pci_ide_create_devs(dev); =20 --=20 2.26.3 From nobody Tue May 14 13:52:33 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1621374975; cv=none; d=zohomail.com; s=zohoarc; b=kA4IXpNyIcoSPUrcgX/TbsqD4p2IQgRgdox4Xa6Vl8I4pUfh6BpFRHh6nfbVTnpAk7WrGj36OxJFO91s0bKs3uJ+BnD5TcYqZ/Rv9NakMncUUE3X60opxztu2xMEZ+FQckk0QZPBemHNzr/Ng5HnPlrolKclrqgETBcQPfRFkGo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1621374975; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=Z2jo9vllxtRVdXYudVjnDuNUHTkF+iLAh9lZ9RqOdvs=; b=ZpFhVgsEF1oy87+oYYdNjBBjBiqM+ImwTjlxylF3K/fY2I7rcSV9O1xI3hjEbjDkrARN62YEFOXvx05fCnO2L7+6M2qe9eiNTHerpwatqY1WFW2Pkvm3VWLBVFFkP71tWWCjpKuedZVnIcS2djhm8DEWW1ewji324f/24HrvIlQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1621374975929318.9289426010271; Tue, 18 May 2021 14:56:15 -0700 (PDT) Received: from mail-ed1-f71.google.com (mail-ed1-f71.google.com [209.85.208.71]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-306-XzuNgCorO3qAuPC5K0SfHQ-1; Tue, 18 May 2021 17:56:13 -0400 Received: by mail-ed1-f71.google.com with SMTP id ba15-20020a0564021acfb029038d3b33d7ffso3821140edb.23 for ; Tue, 18 May 2021 14:56:13 -0700 (PDT) Return-Path: Return-Path: Received: from x1w.redhat.com (31.red-83-51-215.dynamicip.rima-tde.net. [83.51.215.31]) by smtp.gmail.com with ESMTPSA id zg18sm3285496ejb.41.2021.05.18.14.56.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 18 May 2021 14:56:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1621374974; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Z2jo9vllxtRVdXYudVjnDuNUHTkF+iLAh9lZ9RqOdvs=; b=IWdMDScKb0jChd25+B3kMU1TpPKm6Gmzzqa0bVQtdCDyBYMyJIkXn1Uz876x3rbyd4G7Oc V/n+WQ3X2iXQMixb0dvpI9BvCbagD0DwQcfRkF2z+mp8vQR09KmdfTrKrw+rIDIM/PNEjb dgTX/KE+bbpOS33JKhl9exXlw7du/Jg= X-MC-Unique: XzuNgCorO3qAuPC5K0SfHQ-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Z2jo9vllxtRVdXYudVjnDuNUHTkF+iLAh9lZ9RqOdvs=; b=lFsh01A/gW362WhEemom0aTEHvt+NdhlC5qTxjZzm74JvCVBn+qkBIrJT9DV4XewMt efntDfo1LelrBt6K35h/pdsFag4yor/v36jys5juaiUTDZTEVaX8EShm0pCXts114m9S grgQ7/wMBkUQuqEkNZYwfniOSCDpX3LLaEN6AM3tzWPuo5fJvak2SkzoNiGBxs/KGivw kemh5Aikm8L0mWmq4JiyjCPK1nbM4AFXk6rZlZqLBjYf9P7zqMNs3AfYFhX/nVS4PyKi sIBzUsJi9CW3RsMaHe+x3ATUVRdo9/CeW1yVa5cElxEV31hz74P2OJ5pLhISY2NY9G/T JrZQ== X-Gm-Message-State: AOAM5316fjZQXOfVLklCgzH/pwyWc8ePITmbm28vqoDNF02fBssuoQOo zhHi6/0adFcc8yKDinVgaJkJt3DwjjtdElUuAaCNC2d2ZpzTTOqXML2vv8bTZTZOp2a5kCl0Tk0 rUSmDtFLMP4P1Cw== X-Received: by 2002:a17:906:3883:: with SMTP id q3mr8088483ejd.4.1621374971381; Tue, 18 May 2021 14:56:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxfQFpA9LNFzEWOM0TFjIGwruGLe+BynHlo8AVtNrc5Ezqha8EVgrLfergrXNZHXSj1iFpn3w== X-Received: by 2002:a17:906:3883:: with SMTP id q3mr8088468ejd.4.1621374971251; Tue, 18 May 2021 14:56:11 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: John Snow , qemu-devel@nongnu.org Cc: Elena Ufimtseva , Markus Armbruster , Mark Cave-Ayland , Stefan Hajnoczi , Jagannathan Raman , Thomas Huth , John G Johnson , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [RFC PATCH 05/11] hw/isa: Extract isa_bus_get_irq() from isa_get_irq() Date: Tue, 18 May 2021 23:55:39 +0200 Message-Id: <20210518215545.1793947-6-philmd@redhat.com> X-Mailer: git-send-email 2.26.3 In-Reply-To: <20210518215545.1793947-1-philmd@redhat.com> References: <20210518215545.1793947-1-philmd@redhat.com> MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=philmd@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) isa_get_irq() takes an ISADevice argument mostly to resolve the ISA bus. Extract the bus logic to isa_bus_get_irq(). Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- include/hw/isa/isa.h | 1 + hw/isa/isa-bus.c | 9 +++++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/include/hw/isa/isa.h b/include/hw/isa/isa.h index ddaae89a853..fd8b84d8007 100644 --- a/include/hw/isa/isa.h +++ b/include/hw/isa/isa.h @@ -91,6 +91,7 @@ struct ISADevice { ISABus *isa_bus_new(DeviceState *dev, MemoryRegion *address_space, MemoryRegion *address_space_io, Error **errp); void isa_bus_irqs(ISABus *bus, qemu_irq *irqs); +qemu_irq isa_bus_get_irq(ISABus *bus, unsigned isairq); qemu_irq isa_get_irq(ISADevice *dev, unsigned isairq); void isa_init_irq(ISADevice *dev, qemu_irq *p, unsigned isairq); void isa_connect_gpio_out(ISADevice *isadev, int gpioirq, unsigned isairq); diff --git a/hw/isa/isa-bus.c b/hw/isa/isa-bus.c index 7820068e6e1..b946e6dc478 100644 --- a/hw/isa/isa-bus.c +++ b/hw/isa/isa-bus.c @@ -75,6 +75,12 @@ void isa_bus_irqs(ISABus *bus, qemu_irq *irqs) bus->irqs =3D irqs; } =20 +qemu_irq isa_bus_get_irq(ISABus *bus, unsigned isairq) +{ + assert(isairq < ISA_NUM_IRQS); + return bus->irqs[isairq]; +} + /* * isa_get_irq() returns the corresponding qemu_irq entry for the i8259. * @@ -84,8 +90,7 @@ void isa_bus_irqs(ISABus *bus, qemu_irq *irqs) qemu_irq isa_get_irq(ISADevice *dev, unsigned isairq) { assert(!dev || ISA_BUS(qdev_get_parent_bus(DEVICE(dev))) =3D=3D isabus= ); - assert(isairq < ISA_NUM_IRQS); - return isabus->irqs[isairq]; + return isa_bus_get_irq(isabus, isairq); } =20 void isa_init_irq(ISADevice *dev, qemu_irq *p, unsigned isairq) --=20 2.26.3 From nobody Tue May 14 13:52:33 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1621374980; cv=none; d=zohomail.com; s=zohoarc; b=ZOAwS+qWf+jWrPKGJ5Xp4wHDyBEevhN4lJG9Jf4bFIl7gH5Kehkn0tzDMo2luBmGzmvifyELtsQvtIKJ3WweB34qltrWAmsIy9NXWhHNsBb4fSQXFE52b94M/CJ05HpR8l8a52rfsb8XIllYvPKGcMQlWxkwQFjichkUg+DkFec= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1621374980; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=HR1VL7xO46nG3TW0eDU8ydyDYyyww2jJCBLbd9ZBTCg=; b=JenrP+oKGHctZVzR9ykpVASzRrlmLYvmKCUxT7GD9NIMhocQ19GaNkvxQvW4frqYwDHwjmBZkwyVPNPcd3IAkRudtxsppD45G4wbpbHzDMExfFoocKOAPLjG9Jexsto1/cT+o9Fk1VrLLPO/5TqaPCRi3qTE6vp0AkwaWI1sLXI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 162137498011580.4961071984867; Tue, 18 May 2021 14:56:20 -0700 (PDT) Received: from mail-ej1-f70.google.com (mail-ej1-f70.google.com [209.85.218.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-10-mf0x7XBxNsCOBVteeiMaLA-1; Tue, 18 May 2021 17:56:17 -0400 Received: by mail-ej1-f70.google.com with SMTP id la2-20020a170906ad82b02903d4bcc8de3bso2943240ejb.4 for ; Tue, 18 May 2021 14:56:17 -0700 (PDT) Return-Path: Return-Path: Received: from x1w.redhat.com (31.red-83-51-215.dynamicip.rima-tde.net. [83.51.215.31]) by smtp.gmail.com with ESMTPSA id v8sm7164395ejq.62.2021.05.18.14.56.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 18 May 2021 14:56:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1621374979; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=HR1VL7xO46nG3TW0eDU8ydyDYyyww2jJCBLbd9ZBTCg=; b=TTeu+99QYKPij5fe2y7uzY7RfiBEwir3a32rmmogNqcZizJoLxiEH1T0lKKX8PNHByv+gj FAlUSacSs6MyfGbPMOvHCEIGAGau8rxNEsxEvY8EA9C6fFGHyNQJLOneYaJ2KIEcvTjCiO NLCVi1d/sLxqri/1We4gNbM3ytmRvNY= X-MC-Unique: mf0x7XBxNsCOBVteeiMaLA-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=HR1VL7xO46nG3TW0eDU8ydyDYyyww2jJCBLbd9ZBTCg=; b=ghonVbtdMx9vxuD+rmnfJF6QCv+yP4uunNDD3IgUCNLTz7kI6e1NJ1WJgxnwUBRxBI ltX1f0Q1Yi5lBU5th82sZ0Omob0cl6C2xhTj7W18GOSvltTi0xFuWteRslQ/Mk+iik/w JvgDNfVB74NRe6E8gpXqavJaO1D92uO0fT1kNmFsIR/TUHcFPIGbmbYL5SF5V73GuL+W 9SexdreOwLEpngNGL0pIQguFs7Mr3kEyAz0xAue4aS9XuvDxiUWD8ZYcCGD0GuoGVS6e 8C2x/wWcUBgWlLzvpBupbVmnObeZkGOrhUjKiYlw464adMq5iC5pUL+PXydnM//cilr6 p/xQ== X-Gm-Message-State: AOAM5323HLJsONFsZ4IE+Nsth2UjzCX/XtgP/rDlDUKUUrgNn06cVFC+ W0Z7rh71mzSYEWAzd/2/mJaQSCE0AKn8HcEVUOhjzwKL76iAUVLMQLju4FIAxgxYGe9dMrn5Pau kuX0DRKMppyhB2w== X-Received: by 2002:a05:6402:48f:: with SMTP id k15mr9325853edv.262.1621374976273; Tue, 18 May 2021 14:56:16 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzCSwgJxABwZAVfapYqFe2X4sxUnBxNd9hryF/dFWDfuvAt4BLjCAfg6wKSsr+ykn7jKVwuAA== X-Received: by 2002:a05:6402:48f:: with SMTP id k15mr9325841edv.262.1621374976120; Tue, 18 May 2021 14:56:16 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: John Snow , qemu-devel@nongnu.org Cc: Elena Ufimtseva , Markus Armbruster , Mark Cave-Ayland , Stefan Hajnoczi , Jagannathan Raman , Thomas Huth , John G Johnson , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [RFC PATCH 06/11] hw/ide: Replace isa_get_irq() by isa_bus_get_irq() Date: Tue, 18 May 2021 23:55:40 +0200 Message-Id: <20210518215545.1793947-7-philmd@redhat.com> X-Mailer: git-send-email 2.26.3 In-Reply-To: <20210518215545.1793947-1-philmd@redhat.com> References: <20210518215545.1793947-1-philmd@redhat.com> MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=philmd@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Both PIIX/VIA objects inherit PCI_IDE, thus have a pointer to an ISA bus. Pass this bus argument to isa_bus_get_irq() instead of calling isa_get_irq() with a NULL device. Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- hw/ide/piix.c | 2 +- hw/ide/via.c | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/hw/ide/piix.c b/hw/ide/piix.c index 3aef9b1e21c..debbc0023dc 100644 --- a/hw/ide/piix.c +++ b/hw/ide/piix.c @@ -139,7 +139,7 @@ static void pci_piix_init_ports(PCIIDEState *d) { ide_bus_new(&d->bus[i], sizeof(d->bus[i]), DEVICE(d), i, 2); ide_init_ioport(&d->bus[i], NULL, port_info[i].iobase, port_info[i].iobase2); - ide_init2(&d->bus[i], isa_get_irq(NULL, port_info[i].isairq)); + ide_init2(&d->bus[i], isa_bus_get_irq(d->isa_bus, port_info[i].isa= irq)); =20 bmdma_init(&d->bus[i], &d->bmdma[i], d); d->bmdma[i].bus =3D &d->bus[i]; diff --git a/hw/ide/via.c b/hw/ide/via.c index 654e15edfed..53545aac474 100644 --- a/hw/ide/via.c +++ b/hw/ide/via.c @@ -106,6 +106,7 @@ static void bmdma_setup_bar(PCIIDEState *d) static void via_ide_set_irq(void *opaque, int n, int level) { PCIDevice *d =3D PCI_DEVICE(opaque); + PCIIDEState *id =3D PCI_IDE(d); =20 if (level) { d->config[0x70 + n * 8] |=3D 0x80; @@ -113,7 +114,7 @@ static void via_ide_set_irq(void *opaque, int n, int le= vel) d->config[0x70 + n * 8] &=3D ~0x80; } =20 - qemu_set_irq(isa_get_irq(NULL, 14 + n), level); + qemu_set_irq(isa_bus_get_irq(id->isa_bus, 14 + n), level); } =20 static void via_ide_reset(DeviceState *dev) --=20 2.26.3 From nobody Tue May 14 13:52:33 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1621374984; cv=none; d=zohomail.com; s=zohoarc; b=Nayzj4jWPYpsNQdXkxpCKPVzPHxubNVYzzHJAe6FjxB5BwO4332HONpiN/QVMSIhVtuEv2mcHgdGVtE16hZMEp0uKY8Y+HqweSnHQcPyHjzOPJpk8IXNm1VN9NxuAGM0f88m1n0Brf/Y8nTsi0TnvtuazT0Xdk2noMb/pgs/u7A= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1621374984; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=ikpWd2OyM2n7rA9VZke1YbE+cyYsUCfVNrvrzcxe5R8=; b=LSs242ORDhcbR8Xrin9ddQiIr5UpoOSdzoSSLQ3329gLftAwvsdRSJxq4KpNKk2l5gXco5oUK5+nmAoiNMOfzlYmdk21ZKY0ZRa6EdGinLWBjPpw/N86kIFM+POTdQ0d/fWiqHDQ7RlMAGrQWYc2FDfuJxdpDtDkYtsoMUYLr9E= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1621374984848689.487861826059; Tue, 18 May 2021 14:56:24 -0700 (PDT) Received: from mail-ej1-f69.google.com (mail-ej1-f69.google.com [209.85.218.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-414--0XlAqEhMriJxSRggOyZig-1; Tue, 18 May 2021 17:56:22 -0400 Received: by mail-ej1-f69.google.com with SMTP id w13-20020a170906384db02903d9ad6b26d8so1066374ejc.0 for ; Tue, 18 May 2021 14:56:22 -0700 (PDT) Return-Path: Return-Path: Received: from x1w.redhat.com (31.red-83-51-215.dynamicip.rima-tde.net. [83.51.215.31]) by smtp.gmail.com with ESMTPSA id p9sm13752152edu.79.2021.05.18.14.56.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 18 May 2021 14:56:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1621374983; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ikpWd2OyM2n7rA9VZke1YbE+cyYsUCfVNrvrzcxe5R8=; b=FX3/lCxx4E/tREyhY9hAaoi/OqH6BPyaqIsURUT9qW98o0v3n09sYfCzyVa6sv7vj8ZWxZ 46ZOB+RKXpLzP4zGD6PH+tsD0Z3op0b33vbybJ/S4cMpgyHilynRani8JsYsQRyTy8Bgqg 65OlalSIDECvcm6DOjK5srVwbcB3iy4= X-MC-Unique: -0XlAqEhMriJxSRggOyZig-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ikpWd2OyM2n7rA9VZke1YbE+cyYsUCfVNrvrzcxe5R8=; b=OSGlKsv//E6U5PhlQizrudRdE5iAolRwIiQSVmDzTiTomhsms4NEeTe7lKNDixhT6d U9TgpQMD8PbIqTm9nheQN5araKfsg/pLHriG/3FYWro07l6QUsnvFPefX3UzYgSAx3aQ S27Su6HrrmWEc0H4DiL03nh5Xx3l5g76OxOf5vJjTo/EcATPQwaNaNngMfxviiNFeik7 7SwLCzprCfoaY9tp3h46BNmxICdVFXjMXEh2P2URlajriNnUDLkN/hB5rsKF84qxDXF9 zfG2pcvp/6uBoj+yVQE2m4qyALCF9PwofejnNpijap3z/1dcgUVgnJoGg/DjP2qNYwA5 OKng== X-Gm-Message-State: AOAM533O4N7kvBm2zEAgFOkt+n6U0RXwWutQxYdandVchGr5ZDjsnLnt psQxOfqHt3Stzf9HFxmyP4QBMYcDHp8lIF4gqOpQqPPCBPqNDERC9tUKV05l0/rCqT2bRhoD+4L tALOAtnFxBzb49Q== X-Received: by 2002:a50:ff08:: with SMTP id a8mr9299085edu.46.1621374981074; Tue, 18 May 2021 14:56:21 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx9z0vfSzJXYPjIgl8PVjjfHMdAt8ZAsx52ZHlLHu0c47c7R7aZomL11YipaDMH4K8432Wyrw== X-Received: by 2002:a50:ff08:: with SMTP id a8mr9299076edu.46.1621374980899; Tue, 18 May 2021 14:56:20 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: John Snow , qemu-devel@nongnu.org Cc: Elena Ufimtseva , Markus Armbruster , Mark Cave-Ayland , Stefan Hajnoczi , Jagannathan Raman , Thomas Huth , John G Johnson , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [RFC PATCH 07/11] hw/isa: Simplify isa_get_irq() Date: Tue, 18 May 2021 23:55:41 +0200 Message-Id: <20210518215545.1793947-8-philmd@redhat.com> X-Mailer: git-send-email 2.26.3 In-Reply-To: <20210518215545.1793947-1-philmd@redhat.com> References: <20210518215545.1793947-1-philmd@redhat.com> MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=philmd@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Previous commit removed the calls to isa_get_irq() passing a NULL ISADevice. Simplify the assertion, removing the use on the global isabus object. Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- hw/isa/isa-bus.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/hw/isa/isa-bus.c b/hw/isa/isa-bus.c index b946e6dc478..65a26ac6c2c 100644 --- a/hw/isa/isa-bus.c +++ b/hw/isa/isa-bus.c @@ -89,7 +89,11 @@ qemu_irq isa_bus_get_irq(ISABus *bus, unsigned isairq) */ qemu_irq isa_get_irq(ISADevice *dev, unsigned isairq) { - assert(!dev || ISA_BUS(qdev_get_parent_bus(DEVICE(dev))) =3D=3D isabus= ); + ISABus *isabus; + + assert(dev); + isabus =3D isa_bus_from_device(dev); + return isa_bus_get_irq(isabus, isairq); } =20 --=20 2.26.3 From nobody Tue May 14 13:52:33 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1621374989; cv=none; d=zohomail.com; s=zohoarc; b=Fydz25+1ZhM6sCPqd5dHjqtxv+Dws50oaqNfwQ1zynW5Y5iCuL9VeUQoxg5C1fEXmH0S82vmeVsdG0kLuuZIxjbKrvIOWwoDa3DOvM4L6dVru7tZtTgv4K8i2W6nkMOHxpCuZcufebT3QF+AEAwaGCK7a5tRQzjrliFa73Hpre4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1621374989; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=GNOnqYtJWtXTtX74dMfNOzHIoPFRBVKHzI5qhATwsig=; b=eGxBIKVUO3aqP8qNhTr96tPlBQzFygpHhLrm5DQ7QiJ1gLQWwn/ciie6rTy5jq2yHFb+oGTqyLIcHQOJ5ytMTXaX+DdpjgMmzSJn62uAOUvclxPAbviVd+8hSwN866I7m37+CrihHgrKsUhxGgEOFNv16iXy3lN+l9MsTyKXILY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1621374989826117.25233902454227; Tue, 18 May 2021 14:56:29 -0700 (PDT) Received: from mail-ed1-f69.google.com (mail-ed1-f69.google.com [209.85.208.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-564-uPa5QnPRNhaSDn9ZVsCjwQ-1; Tue, 18 May 2021 17:56:27 -0400 Received: by mail-ed1-f69.google.com with SMTP id cy15-20020a0564021c8fb029038d26976787so5062839edb.0 for ; Tue, 18 May 2021 14:56:27 -0700 (PDT) Return-Path: Return-Path: Received: from x1w.redhat.com (31.red-83-51-215.dynamicip.rima-tde.net. [83.51.215.31]) by smtp.gmail.com with ESMTPSA id d7sm10749316ejk.55.2021.05.18.14.56.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 18 May 2021 14:56:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1621374988; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=GNOnqYtJWtXTtX74dMfNOzHIoPFRBVKHzI5qhATwsig=; b=ahZhrIQd3INvycY9/0H8MRDRkaMKlZNaVZz4Wv/MJvZVd6GPWAB+IiwP4nqV0oCmSLpaCm Eksr8B3ACz+AQzIdk3qP9Qf1egQ0DfNTIkuix+21ylNyMD/jxA8R2KuCcFbuFYRqobkKHa S+jwG+sPVghw8V/gMluzwTOnQ2IlPQ4= X-MC-Unique: uPa5QnPRNhaSDn9ZVsCjwQ-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=GNOnqYtJWtXTtX74dMfNOzHIoPFRBVKHzI5qhATwsig=; b=LON7FtajdQan7ijVGEAgn2hK3wHctBkYwDgDZlyHZ1gmoioyxcHNtekCEkRZ79KFTF kNee20eAum3ziIhLOwgEkPRDT3n4vi5ZfTVR/1tgF0FVNP62x9mPZeDuRu4HZHxFOEPg 0wMiYOExufbTCxPyf+zGu/+/xZk9zGrOmStQRjXautIYBDm0Z92LcrKU60nvbl8z+Wwk bPiru7roj++HnxvvlBhjHyJpxmCx+1nKDuKHWbc45VJucN6CCSLDrxiLqkHv6d7ClJoI H1YBYTp1OUzC/X8d1XmmNHwuKETVCo/z6Heywm0UCtaZz3gvekNCyLUn4aZYHW7vfF0p h7/g== X-Gm-Message-State: AOAM532CmMSMGJ8NDURjZPqiKnfPFXykB61wJUbt6H+14jn1BnnT4Wp5 4icQLewzIg/zoQ7TcC57pc5yV+01peuEdr9qKQsVgn5I+sDeVPjn1UqNNZkR/LthhONUNJTLSOE 21MeddmXL1bOeAw== X-Received: by 2002:aa7:dbcd:: with SMTP id v13mr9329791edt.59.1621374986148; Tue, 18 May 2021 14:56:26 -0700 (PDT) X-Google-Smtp-Source: ABdhPJycDQIdlwnflwljCWCxllNAFXAvl5/fabwXWSdRlQnCIMbSqaVwIeFwKRJodiJ7NyxHq/PY2Q== X-Received: by 2002:aa7:dbcd:: with SMTP id v13mr9329775edt.59.1621374985985; Tue, 18 May 2021 14:56:25 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: John Snow , qemu-devel@nongnu.org Cc: Elena Ufimtseva , Markus Armbruster , Mark Cave-Ayland , Stefan Hajnoczi , Jagannathan Raman , Thomas Huth , John G Johnson , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [RFC PATCH 08/11] hw/isa: Extract bus part from isa_register_portio_list() Date: Tue, 18 May 2021 23:55:42 +0200 Message-Id: <20210518215545.1793947-9-philmd@redhat.com> X-Mailer: git-send-email 2.26.3 In-Reply-To: <20210518215545.1793947-1-philmd@redhat.com> References: <20210518215545.1793947-1-philmd@redhat.com> MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=philmd@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) isa_register_portio_list() takes an ISADevice argument mostly to resolve the ISA bus. Extract the bus logic to a new function: isa_bus_register_portio_list(). Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- include/hw/isa/isa.h | 4 ++++ hw/isa/isa-bus.c | 17 +++++++++++++---- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/include/hw/isa/isa.h b/include/hw/isa/isa.h index fd8b84d8007..ce31eef8858 100644 --- a/include/hw/isa/isa.h +++ b/include/hw/isa/isa.h @@ -139,6 +139,10 @@ void isa_register_portio_list(ISADevice *dev, uint16_t start, const MemoryRegionPortio *portio, void *opaque, const char *name); +void isa_bus_register_portio_list(ISABus *isabus, Object *owner, + PortioList *piolist, uint16_t start, + const MemoryRegionPortio *portio, + void *opaque, const char *name); =20 static inline ISABus *isa_bus_from_device(ISADevice *d) { diff --git a/hw/isa/isa-bus.c b/hw/isa/isa-bus.c index 65a26ac6c2c..c79d7e338b0 100644 --- a/hw/isa/isa-bus.c +++ b/hw/isa/isa-bus.c @@ -140,20 +140,29 @@ void isa_register_ioport(ISADevice *dev, MemoryRegion= *io, uint16_t start) isa_init_ioport(dev, start); } =20 +void isa_bus_register_portio_list(ISABus *isabus, Object *owner, + PortioList *piolist, uint16_t start, + const MemoryRegionPortio *portio, + void *opaque, const char *name) +{ + assert(piolist && !piolist->owner); + + portio_list_init(piolist, owner, portio, opaque, name); + portio_list_add(piolist, isabus->address_space_io, start); +} + void isa_register_portio_list(ISADevice *dev, PortioList *piolist, uint16_t start, const MemoryRegionPortio *pio_start, void *opaque, const char *name) { - assert(piolist && !piolist->owner); - /* START is how we should treat DEV, regardless of the actual contents of the portio array. This is how the old code actually handled e.g. the FDC device. */ isa_init_ioport(dev, start); =20 - portio_list_init(piolist, OBJECT(dev), pio_start, opaque, name); - portio_list_add(piolist, isabus->address_space_io, start); + isa_bus_register_portio_list(isabus, OBJECT(dev), piolist, start, + pio_start, opaque, name); } =20 static void isa_device_init(Object *obj) --=20 2.26.3 From nobody Tue May 14 13:52:33 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1621374994; cv=none; d=zohomail.com; s=zohoarc; b=PItjDax5qFMNT/VBMCHzCTEjT0jM+nxWBIvLE5u4txV1S1eigvKNzyLrqVUeFbcSKEpnA8B0Igl5tgkk3SAZEdeZFJ8poSXoJ6IIYKO+YJbFMrj7LlzA5TwbXp1pbO2gepJTxwMew3xhs4b+WXZyvXH62W+f6vHMxq7DXC0vO0c= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1621374994; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=rr3mNRHifEVHB6ysNxRHbVJ3RkaEoRT+Kli4CYUxdaw=; b=lIiunsxuVuAN9Owp7Fb2V+xzdZauVM2tlhw1BJP4H/iMXcUzWxfOe8WJb89ZrFtamMGBKJa8P0DQT+bfJkqS2GRkcrpVgF6IlbN6FVC2MuCpqdjDR+r/FhRgeU++nHvO9xyYCFHs+YxHn5v7hY6ZQO/MtxxqGzqP+VwRG2zR+q8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1621374994599410.9103711443971; Tue, 18 May 2021 14:56:34 -0700 (PDT) Received: from mail-ed1-f70.google.com (mail-ed1-f70.google.com [209.85.208.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-455-Sa2LAkqAMbOBjl2MRituDw-1; Tue, 18 May 2021 17:56:32 -0400 Received: by mail-ed1-f70.google.com with SMTP id m6-20020aa7c4860000b029038d4e973878so2318190edq.10 for ; Tue, 18 May 2021 14:56:31 -0700 (PDT) Return-Path: Return-Path: Received: from x1w.redhat.com (31.red-83-51-215.dynamicip.rima-tde.net. [83.51.215.31]) by smtp.gmail.com with ESMTPSA id c7sm13670451ede.37.2021.05.18.14.56.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 18 May 2021 14:56:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1621374993; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=rr3mNRHifEVHB6ysNxRHbVJ3RkaEoRT+Kli4CYUxdaw=; b=IAXepeNF4u2/Ggk10NccD6cMiAfhu1G0TqgqLQjZBSYEH/5dXcpq2RjDin6xB9hqTVbJvY 1STt+yRJUWcM+TnHPzOBKgPNnD3ccfnzzIm+UlJw0CAiuVz9qMpQi+J5je3W1DXM6RW9D3 BBiv1TouUOtX13ZPZQ9UZ5UKRJ48z4Q= X-MC-Unique: Sa2LAkqAMbOBjl2MRituDw-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=rr3mNRHifEVHB6ysNxRHbVJ3RkaEoRT+Kli4CYUxdaw=; b=fgyako80tyujn6EzkzGQktG4pgPjKLdpLs4zDQRRHUWCxmT+fopcgIzUdkydcp4gac 8GQvM3q8iIOIScT0ZkRiTkuNin7viFVYx3ZxlFhtIN13XgiU6yn2hxZsodHxl2F+g/xw 17cdr81h/nKo0LX970s07ct8FV72uTss8pqugA2A9+SGpZIsgSIYNC+7aXKsLSjV917P bBJX2JlGED9kyPvY5hPG46MVV34Ro2Iystq0lq4+MUQKg7F7Nuz0XGKhL/ZHi1RxqZgN pL1l6TMiWAtq6rT5HpMiyuDbCH83O9yf3N8kkrsrdwaarNWzAUD7BknAJpwzf+ZVtQme E++Q== X-Gm-Message-State: AOAM533Ea1jVT6xNU9Ophi6MuS1FhdTKdLp15P5lO1/QnHeonhylxN+O KrBaJ6Qq9AxHxGF+WsOz8YzJ3PJgzi5nQdmO8bxahOTsLfilCWBLNePn4bDyX4mgbdtDbpDP2N7 sIdugYLqNAGyU/g== X-Received: by 2002:a17:906:5617:: with SMTP id f23mr7893902ejq.298.1621374990963; Tue, 18 May 2021 14:56:30 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwsFcpSCXAucTyHeAi1k0VOvDyNCeNXtdGnJ99bhDASi8/TFB5x3F0I5efwdIWIZr5S4HhNkw== X-Received: by 2002:a17:906:5617:: with SMTP id f23mr7893893ejq.298.1621374990829; Tue, 18 May 2021 14:56:30 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: John Snow , qemu-devel@nongnu.org Cc: Elena Ufimtseva , Markus Armbruster , Mark Cave-Ayland , Stefan Hajnoczi , Jagannathan Raman , Thomas Huth , John G Johnson , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [RFC PATCH 09/11] hw/ide: Let ide_init_ioport() take an ISA bus argument instead of device Date: Tue, 18 May 2021 23:55:43 +0200 Message-Id: <20210518215545.1793947-10-philmd@redhat.com> X-Mailer: git-send-email 2.26.3 In-Reply-To: <20210518215545.1793947-1-philmd@redhat.com> References: <20210518215545.1793947-1-philmd@redhat.com> MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=philmd@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Both callers to ide_init_ioport() have access to the ISA bus of the device, so can pass it directly. This allows ide_init_ioport() to directly call isa_bus_register_portio_list(). Note, now the callers become the owner of the PortioList. Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- include/hw/ide/internal.h | 3 ++- hw/ide/ioport.c | 11 ++++++----- hw/ide/isa.c | 3 ++- hw/ide/piix.c | 4 ++-- 4 files changed, 12 insertions(+), 9 deletions(-) diff --git a/include/hw/ide/internal.h b/include/hw/ide/internal.h index 2d09162eeb7..141f53006a9 100644 --- a/include/hw/ide/internal.h +++ b/include/hw/ide/internal.h @@ -624,7 +624,8 @@ int ide_init_drive(IDEState *s, BlockBackend *blk, IDED= riveKind kind, int chs_trans, Error **errp); void ide_init2(IDEBus *bus, qemu_irq irq); void ide_exit(IDEState *s); -void ide_init_ioport(IDEBus *bus, ISADevice *isa, int iobase, int iobase2); +void ide_init_ioport(IDEBus *bus, ISABus *isabus, Object *owner, + int iobase, int iobase2); void ide_register_restart_cb(IDEBus *bus); =20 void ide_exec_cmd(IDEBus *bus, uint32_t val); diff --git a/hw/ide/ioport.c b/hw/ide/ioport.c index b613ff3bbaf..be2309459e1 100644 --- a/hw/ide/ioport.c +++ b/hw/ide/ioport.c @@ -50,15 +50,16 @@ static const MemoryRegionPortio ide_portio2_list[] =3D { PORTIO_END_OF_LIST(), }; =20 -void ide_init_ioport(IDEBus *bus, ISADevice *dev, int iobase, int iobase2) +void ide_init_ioport(IDEBus *bus, ISABus *isabus, Object *owner, + int iobase, int iobase2) { /* ??? Assume only ISA and PCI configurations, and that the PCI-ISA bridge has been setup properly to always register with ISA. */ - isa_register_portio_list(dev, &bus->portio_list, - iobase, ide_portio_list, bus, "ide"); + isa_bus_register_portio_list(isabus, owner, &bus->portio_list, + iobase, ide_portio_list, bus, "ide"); =20 if (iobase2) { - isa_register_portio_list(dev, &bus->portio2_list, - iobase2, ide_portio2_list, bus, "ide"); + isa_bus_register_portio_list(isabus, owner, &bus->portio2_list, + iobase2, ide_portio2_list, bus, "ide"= ); } } diff --git a/hw/ide/isa.c b/hw/ide/isa.c index 6bc19de2265..e7cf6714c8f 100644 --- a/hw/ide/isa.c +++ b/hw/ide/isa.c @@ -74,7 +74,8 @@ static void isa_ide_realizefn(DeviceState *dev, Error **e= rrp) ISAIDEState *s =3D ISA_IDE(dev); =20 ide_bus_new(&s->bus, sizeof(s->bus), dev, 0, 2); - ide_init_ioport(&s->bus, isadev, s->iobase, s->iobase2); + ide_init_ioport(&s->bus, isa_bus_from_device(isadev), OBJECT(dev), + s->iobase, s->iobase2); isa_init_irq(isadev, &s->irq, s->isairq); ide_init2(&s->bus, s->irq); vmstate_register(VMSTATE_IF(dev), 0, &vmstate_ide_isa, s); diff --git a/hw/ide/piix.c b/hw/ide/piix.c index debbc0023dc..0d6966fc7cb 100644 --- a/hw/ide/piix.c +++ b/hw/ide/piix.c @@ -137,8 +137,8 @@ static void pci_piix_init_ports(PCIIDEState *d) { =20 for (i =3D 0; i < 2; i++) { ide_bus_new(&d->bus[i], sizeof(d->bus[i]), DEVICE(d), i, 2); - ide_init_ioport(&d->bus[i], NULL, port_info[i].iobase, - port_info[i].iobase2); + ide_init_ioport(&d->bus[i], d->isa_bus, OBJECT(d), + port_info[i].iobase, port_info[i].iobase2); ide_init2(&d->bus[i], isa_bus_get_irq(d->isa_bus, port_info[i].isa= irq)); =20 bmdma_init(&d->bus[i], &d->bmdma[i], d); --=20 2.26.3 From nobody Tue May 14 13:52:33 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1621375001; cv=none; d=zohomail.com; s=zohoarc; b=oKDznH+NTrjJVM8hPfnzxbn1QAVhDFh4ri+L//dHr+BuBUW6u3KsdWRnoR/7nQRUkB2Tp8HQjPvqbzCw+BzB+RGCFQZwVeMyT0p1UjXha7zFYYINoHlD3XdzTbMDdtCZrXUFe8eyIDHToYH9ene+eyjGcF9Os/yg+8ISDays9L4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1621375001; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=r2Pvl9I1wj1oCEyIeTI4k6awM4sKJAsI8r1Cgft8c+U=; b=Ky6Syg+Sv5zaPOME96dsrakjBjQabBHO2w+oIxtnel5CZxgNLSU1U4A4r+nh7p4VQWhGG/LuL+qrs/sqCg+Axs+l0NG1H3ZGLrSUwF6IbDsNWGQJYgDTqgVALlOO9ANXEBrEcWSSaNedHEqXj2o+x4lmUdBg5740AAmzsDsJFHQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1621375001618339.63083052479544; Tue, 18 May 2021 14:56:41 -0700 (PDT) Received: from mail-ed1-f70.google.com (mail-ed1-f70.google.com [209.85.208.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-450-zFLNuO6bMwq-sXloF7aRRA-1; Tue, 18 May 2021 17:56:36 -0400 Received: by mail-ed1-f70.google.com with SMTP id cn20-20020a0564020cb4b029038d0b0e183fso6492744edb.22 for ; Tue, 18 May 2021 14:56:36 -0700 (PDT) Return-Path: Return-Path: Received: from x1w.redhat.com (31.red-83-51-215.dynamicip.rima-tde.net. [83.51.215.31]) by smtp.gmail.com with ESMTPSA id a19sm36820edv.80.2021.05.18.14.56.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 18 May 2021 14:56:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1621375000; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=r2Pvl9I1wj1oCEyIeTI4k6awM4sKJAsI8r1Cgft8c+U=; b=VIw54yJ86R/uDqMjZo/48uUeqNANfTV0yDm0Qvm9fSxHKWDVd+GZPKnc1h5sXbhemPbUZv dOWeUlpOdOkqAHr6bCzPm11A2b6nWq3zEWvQ2gjqXPn5z+CpRD9YsSonlgipEf/0arAouO xd7PhrtR/1uF3sMj6oTZi8hxUslfxNg= X-MC-Unique: zFLNuO6bMwq-sXloF7aRRA-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=r2Pvl9I1wj1oCEyIeTI4k6awM4sKJAsI8r1Cgft8c+U=; b=E/gv25yd13Okmbk34Et+YbPfTACXp4nZRjikp8hiYdBdaMBJXdwaZ+e7ie/ShLfLCR bhix9MAJ5iXcJaChWNeZhFxG08SucUf0b70KRe/fuaVKEV5Jd5VbJ2pXjvRy3D5UzK9M BfPAkMzAVyX9OKjllad6s6wHk9AXZpB8tvaYA5+6+ZiY+FcI6ExlK9ZoJDMNX6UXeDR+ 469PYrEeOcFwf1ruvhldFlzKDG18XVlAqXcSQEFrCJV1xs9vHrdKslSzU/7+k7/NBVar SmLASMqOK4E5l0ll4R631S2nc2+TlJ4JinTFg1z4MBqo+rLqt1HOjuwr+qKB11v+dGIL LM0w== X-Gm-Message-State: AOAM530Y803KWCi/vpLuFATbg+nul1Pxbv3kLi/82Pq4kQd8NgTng8uc PYVv41SzjruBb25MkFHNVuh6IivjjDXquFn5KISLl0B91SObsp+jmwkVKzHVIePeU7A/wTssrAe FGrSfNdlymrznXg== X-Received: by 2002:a05:6402:2712:: with SMTP id y18mr9854288edd.41.1621374995839; Tue, 18 May 2021 14:56:35 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxETrQp6NBFg+Rgy6IjkVcEfaW9d6MOii61B2nUbMh7qPkl6u871/KxSkt/ET6Jehxz5LGoGw== X-Received: by 2002:a05:6402:2712:: with SMTP id y18mr9854268edd.41.1621374995672; Tue, 18 May 2021 14:56:35 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: John Snow , qemu-devel@nongnu.org Cc: Elena Ufimtseva , Markus Armbruster , Mark Cave-Ayland , Stefan Hajnoczi , Jagannathan Raman , Thomas Huth , John G Johnson , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [RFC PATCH 10/11] hw/isa: Remove use of global isa bus Date: Tue, 18 May 2021 23:55:44 +0200 Message-Id: <20210518215545.1793947-11-philmd@redhat.com> X-Mailer: git-send-email 2.26.3 In-Reply-To: <20210518215545.1793947-1-philmd@redhat.com> References: <20210518215545.1793947-1-philmd@redhat.com> MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=philmd@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) In the previous commit we removed all call to these functions passing a NULL ISADevice argument. We can simplify and remove the use of the global isabus object. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Stefan Hajnoczi --- hw/isa/isa-bus.c | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/hw/isa/isa-bus.c b/hw/isa/isa-bus.c index c79d7e338b0..a19e3688c28 100644 --- a/hw/isa/isa-bus.c +++ b/hw/isa/isa-bus.c @@ -136,6 +136,10 @@ static inline void isa_init_ioport(ISADevice *dev, uin= t16_t ioport) =20 void isa_register_ioport(ISADevice *dev, MemoryRegion *io, uint16_t start) { + ISABus *isabus; + + assert(dev); + isabus =3D isa_bus_from_device(dev); memory_region_add_subregion(isabus->address_space_io, start, io); isa_init_ioport(dev, start); } @@ -156,6 +160,11 @@ void isa_register_portio_list(ISADevice *dev, const MemoryRegionPortio *pio_start, void *opaque, const char *name) { + ISABus *isabus; + + assert(dev); + isabus =3D isa_bus_from_device(dev); + /* START is how we should treat DEV, regardless of the actual contents of the portio array. This is how the old code actually handled e.g. the FDC device. */ @@ -302,18 +311,20 @@ static char *isabus_get_fw_dev_path(DeviceState *dev) =20 MemoryRegion *isa_address_space(ISADevice *dev) { - if (dev) { - return isa_bus_from_device(dev)->address_space; - } + ISABus *isabus; + + assert(dev); + isabus =3D isa_bus_from_device(dev); =20 return isabus->address_space; } =20 MemoryRegion *isa_address_space_io(ISADevice *dev) { - if (dev) { - return isa_bus_from_device(dev)->address_space_io; - } + ISABus *isabus; + + assert(dev); + isabus =3D isa_bus_from_device(dev); =20 return isabus->address_space_io; } --=20 2.26.3 From nobody Tue May 14 13:52:33 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1621375004; cv=none; d=zohomail.com; s=zohoarc; b=mudXuSgpMZYjwQyz/gnc2ZJi0fBbKLT36XAb2uaZqOcXMV80DzEBQaEi/JppI3j4Ei0cuRAKN87B5yms4i7hQ0yr2RCr+3OmfJJHKcNohOjQr2RHJ+GHnRTA3SsbNdIL68DRGD+EB76xm57XWeTQYxZ856d+Dqo7KCMxS9DfeVw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1621375004; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=SA3xLaeZ2FwOXvV1CNVXzUH12bBqCIlfWoPhxP84IQI=; b=HtGu+E5Jipxbp2g9unkc51VXXTDv//JXoKWzGxE9NNtTgd8vucsSuBpnGGjhgW0+aYaT9dzPksrCyuU3u22ht+d0ngE1vw+JKOMvODGwreKwwiFyzn99PVk1Qn8OSRvH59/6xsSH3mnJ8A+63VoyNQEggaDDtSIEhPUlejQ3SW4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1621375004899878.17185696874; Tue, 18 May 2021 14:56:44 -0700 (PDT) Received: from mail-ed1-f69.google.com (mail-ed1-f69.google.com [209.85.208.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-64-G0BYlBBAOzCQWqDzDQkifQ-1; Tue, 18 May 2021 17:56:41 -0400 Received: by mail-ed1-f69.google.com with SMTP id cn20-20020a0564020cb4b029038d0b0e183fso6492811edb.22 for ; Tue, 18 May 2021 14:56:41 -0700 (PDT) Return-Path: Return-Path: Received: from x1w.redhat.com (31.red-83-51-215.dynamicip.rima-tde.net. [83.51.215.31]) by smtp.gmail.com with ESMTPSA id jt11sm10868407ejb.83.2021.05.18.14.56.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 18 May 2021 14:56:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1621375003; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=SA3xLaeZ2FwOXvV1CNVXzUH12bBqCIlfWoPhxP84IQI=; b=dXcHohBhdYHfEtGJd5c/5BovnavxzVQkqOJFKh5IzAdImr7rrm98IWeUoOKLRG4UC4dcQX 4D8XLg01Yz54f50hy7D+zc/2RdgQBARdsakstTE9UhJKvGi7hzsK58twjQMAGd3vZwKzMy WPlTJopaeAMTsIg/zP8O+yxwTdfjX5A= X-MC-Unique: G0BYlBBAOzCQWqDzDQkifQ-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=SA3xLaeZ2FwOXvV1CNVXzUH12bBqCIlfWoPhxP84IQI=; b=l1ClLLuIzklw/7Vv7CWJeUmg9aRNmmk5LCOcqQUJnRhdhViTObKpMNxMkWkO5LkHN2 FlYLLA8p01TVQ0qQXGsyPrrNLoOuW25WYUve5utpCOivYyEcMqJJZzlTPeFi5vs4OF1l S+wD+rpCmALNRn7V8tHXOcXSszS6S1WxhyY+rh032nZIK5aYxepHcpCHJWQkUcmxvNFL /YYHOi9QYqcDQkdirK7rgT7eKkzXPYiZng29zhXxONc73//yqRmHdxWITrbrIvIqAPpt ohhHSPDR77k1VGul8R93IJvT87cyMwsFBPzfJp6VZ925NPfttDttlAFhNJsHKTC3g0ve 5DDg== X-Gm-Message-State: AOAM530YdSVwRQSa3KFeo2jPhiDzSftVtzchyg2k88TMreny0Dj478Vw L07kebjRgnopx1VHmdahwzb+tflUcUYoKgXx9y9tFgDkxwjqHyWHILdI4AWW1zHctzb66+TRbRt OXNskMyi2e9oJYA== X-Received: by 2002:a17:906:4806:: with SMTP id w6mr8075538ejq.180.1621375000808; Tue, 18 May 2021 14:56:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxIQhd3LfebpiOisU4PBvm0zr/zBYoZN4wHTN01wT0PnsApruV3LJ2lfBYIHz4J9PTSqRC+jw== X-Received: by 2002:a17:906:4806:: with SMTP id w6mr8075532ejq.180.1621375000697; Tue, 18 May 2021 14:56:40 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: John Snow , qemu-devel@nongnu.org Cc: Elena Ufimtseva , Markus Armbruster , Mark Cave-Ayland , Stefan Hajnoczi , Jagannathan Raman , Thomas Huth , John G Johnson , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [RFC PATCH 11/11] hw/isa: Rename isabus singleton as 'g_isabus' Date: Tue, 18 May 2021 23:55:45 +0200 Message-Id: <20210518215545.1793947-12-philmd@redhat.com> X-Mailer: git-send-email 2.26.3 In-Reply-To: <20210518215545.1793947-1-philmd@redhat.com> References: <20210518215545.1793947-1-philmd@redhat.com> MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=philmd@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) To make explicit the isabus singleton isn't used anywhere else, move it's static declaration locally to isa_bus_new() and rename it as 'g_isabus'. Unfortunately we provide the get_system_io() call which expose an unique I/O bus to a machine, and the ISA bus rely on this I/O bus, so we can not remove the ISA bus singleton until we remove the get_system_io() API. Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- hw/isa/isa-bus.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/hw/isa/isa-bus.c b/hw/isa/isa-bus.c index a19e3688c28..422eb9615f4 100644 --- a/hw/isa/isa-bus.c +++ b/hw/isa/isa-bus.c @@ -26,8 +26,6 @@ #include "sysemu/sysemu.h" #include "hw/isa/isa.h" =20 -static ISABus *isabus; - static void isabus_dev_print(Monitor *mon, DeviceState *dev, int indent); static char *isabus_get_fw_dev_path(DeviceState *dev); =20 @@ -55,7 +53,10 @@ static const TypeInfo isa_bus_info =3D { ISABus *isa_bus_new(DeviceState *dev, MemoryRegion* address_space, MemoryRegion *address_space_io, Error **errp) { - if (isabus) { + static ISABus *g_isabus; + ISABus *isabus; + + if (g_isabus) { error_setg(errp, "Can't create a second ISA bus"); return NULL; } @@ -67,6 +68,7 @@ ISABus *isa_bus_new(DeviceState *dev, MemoryRegion* addre= ss_space, isabus =3D ISA_BUS(qbus_create(TYPE_ISA_BUS, dev, NULL)); isabus->address_space =3D address_space; isabus->address_space_io =3D address_space_io; + g_isabus =3D isabus; return isabus; } =20 --=20 2.26.3