From nobody Thu Nov 6 14:34:49 2025 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; 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; dmarc=fail(p=none dis=none) header.from=linux.intel.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1541383715018172.16780245524524; Sun, 4 Nov 2018 18:08:35 -0800 (PST) Received: from localhost ([::1]:32805 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gJUJd-0001Nn-NX for importer@patchew.org; Sun, 04 Nov 2018 21:08:33 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47417) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gJTvc-0000rY-GF for qemu-devel@nongnu.org; Sun, 04 Nov 2018 20:43:45 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gJTvW-0003iL-Kb for qemu-devel@nongnu.org; Sun, 04 Nov 2018 20:43:44 -0500 Received: from mga05.intel.com ([192.55.52.43]:26671) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gJTvG-0003Ia-GP; Sun, 04 Nov 2018 20:43:24 -0500 Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 04 Nov 2018 17:43:20 -0800 Received: from emurphy1-mobl1.ger.corp.intel.com (HELO localhost.localdomain) ([10.252.26.250]) by fmsmga005.fm.intel.com with ESMTP; 04 Nov 2018 17:43:14 -0800 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.54,466,1534834800"; d="scan'208";a="277074507" From: Samuel Ortiz To: qemu-devel@nongnu.org Date: Mon, 5 Nov 2018 02:40:42 +0100 Message-Id: <20181105014047.26447-20-sameo@linux.intel.com> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181105014047.26447-1-sameo@linux.intel.com> References: <20181105014047.26447-1-sameo@linux.intel.com> 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: 192.55.52.43 Subject: [Qemu-devel] [PATCH v5 19/24] hw: acpi: Retrieve the PCI bus from AcpiPciHpState 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: Peter Maydell , Stefano Stabellini , Eduardo Habkost , "Michael S. Tsirkin" , Jing Liu , Shannon Zhao , Igor Mammedov , qemu-arm@nongnu.org, Paolo Bonzini , Anthony Perard , xen-devel@lists.xenproject.org, Sebastien Boeuf , Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" From: Sebastien Boeuf Instead of using the machine type specific method find_i440fx() to retrieve the PCI bus, this commit aims to rely on the fact that the PCI bus is known by the structure AcpiPciHpState. When the structure is initialized through acpi_pcihp_init() call, it saves the PCI bus, which means there is no need to invoke a special function later on. Based on the fact that find_i440fx() was only used there, this patch also removes the function find_i440fx() itself from the entire codebase. Reviewed-by: Philippe Mathieu-Daud=C3=A9 Tested-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Sebastien Boeuf Signed-off-by: Jing Liu Reviewed-by: Igor Mammedov --- include/hw/i386/pc.h | 1 - hw/acpi/pcihp.c | 10 ++++------ hw/pci-host/piix.c | 8 -------- stubs/pci-host-piix.c | 6 ------ stubs/Makefile.objs | 1 - 5 files changed, 4 insertions(+), 22 deletions(-) delete mode 100644 stubs/pci-host-piix.c diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h index 44cb6bf3f3..8e5f1464eb 100644 --- a/include/hw/i386/pc.h +++ b/include/hw/i386/pc.h @@ -255,7 +255,6 @@ PCIBus *i440fx_init(const char *host_type, const char *= pci_type, MemoryRegion *pci_memory, MemoryRegion *ram_memory); =20 -PCIBus *find_i440fx(void); /* piix4.c */ extern PCIDevice *piix4_dev; int piix4_init(PCIBus *bus, ISABus **isa_bus, int devfn); diff --git a/hw/acpi/pcihp.c b/hw/acpi/pcihp.c index 80d42e12ff..254b2e50ab 100644 --- a/hw/acpi/pcihp.c +++ b/hw/acpi/pcihp.c @@ -93,10 +93,9 @@ static void *acpi_set_bsel(PCIBus *bus, void *opaque) return bsel_alloc; } =20 -static void acpi_set_pci_info(void) +static void acpi_set_pci_info(AcpiPciHpState *s) { static bool bsel_is_set; - PCIBus *bus; unsigned bsel_alloc =3D ACPI_PCIHP_BSEL_DEFAULT; =20 if (bsel_is_set) { @@ -104,10 +103,9 @@ static void acpi_set_pci_info(void) } bsel_is_set =3D true; =20 - bus =3D find_i440fx(); /* TODO: Q35 support */ - if (bus) { + if (s->root) { /* Scan all PCI buses. Set property to enable acpi based hotplug. = */ - pci_for_each_bus_depth_first(bus, acpi_set_bsel, NULL, &bsel_alloc= ); + pci_for_each_bus_depth_first(s->root, acpi_set_bsel, NULL, &bsel_a= lloc); } } =20 @@ -213,7 +211,7 @@ static void acpi_pcihp_update(AcpiPciHpState *s) =20 void acpi_pcihp_reset(AcpiPciHpState *s) { - acpi_set_pci_info(); + acpi_set_pci_info(s); acpi_pcihp_update(s); } =20 diff --git a/hw/pci-host/piix.c b/hw/pci-host/piix.c index 47293a3915..658460264b 100644 --- a/hw/pci-host/piix.c +++ b/hw/pci-host/piix.c @@ -445,14 +445,6 @@ PCIBus *i440fx_init(const char *host_type, const char = *pci_type, return b; } =20 -PCIBus *find_i440fx(void) -{ - PCIHostState *s =3D OBJECT_CHECK(PCIHostState, - object_resolve_path("/machine/i440fx", = NULL), - TYPE_PCI_HOST_BRIDGE); - return s ? s->bus : NULL; -} - /* PIIX3 PCI to ISA bridge */ static void piix3_set_irq_pic(PIIX3State *piix3, int pic_irq) { diff --git a/stubs/pci-host-piix.c b/stubs/pci-host-piix.c deleted file mode 100644 index 6ed81b1f21..0000000000 --- a/stubs/pci-host-piix.c +++ /dev/null @@ -1,6 +0,0 @@ -#include "qemu/osdep.h" -#include "hw/i386/pc.h" -PCIBus *find_i440fx(void) -{ - return NULL; -} diff --git a/stubs/Makefile.objs b/stubs/Makefile.objs index 5dd0aeeec6..725f78bedc 100644 --- a/stubs/Makefile.objs +++ b/stubs/Makefile.objs @@ -41,6 +41,5 @@ stub-obj-y +=3D pc_madt_cpu_entry.o stub-obj-y +=3D vmgenid.o stub-obj-y +=3D xen-common.o stub-obj-y +=3D xen-hvm.o -stub-obj-y +=3D pci-host-piix.o stub-obj-y +=3D ram-block.o stub-obj-y +=3D ramfb.o --=20 2.19.1