From nobody Sat Feb 7 18:52: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; 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 1541068875313260.5300743071658; Thu, 1 Nov 2018 03:41:15 -0700 (PDT) Received: from localhost ([::1]:41167 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gIAPZ-0007BE-TF for importer@patchew.org; Thu, 01 Nov 2018 06:41:14 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59966) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gIAAl-0005zn-P1 for qemu-devel@nongnu.org; Thu, 01 Nov 2018 06:25:56 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gIAAg-0004Or-Uf for qemu-devel@nongnu.org; Thu, 01 Nov 2018 06:25:55 -0400 Received: from mga17.intel.com ([192.55.52.151]:61548) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gIAAg-0003Hf-KW for qemu-devel@nongnu.org; Thu, 01 Nov 2018 06:25:50 -0400 Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga107.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 01 Nov 2018 03:25:19 -0700 Received: from jmath3-mobl1.ger.corp.intel.com (HELO localhost.localdomain) ([10.252.9.87]) by orsmga006.jf.intel.com with ESMTP; 01 Nov 2018 03:25:16 -0700 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.54,451,1534834800"; d="scan'208";a="87786320" From: Samuel Ortiz To: qemu-devel@nongnu.org Date: Thu, 1 Nov 2018 11:23:03 +0100 Message-Id: <20181101102303.16439-24-sameo@linux.intel.com> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181101102303.16439-1-sameo@linux.intel.com> References: <20181101102303.16439-1-sameo@linux.intel.com> MIME-Version: 1.0 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.151 Subject: [Qemu-devel] [PATCH v4 23/23] hw: i386: Refactor PCI host getter 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: Yang Zhong , Igor Mammedov , "Michael S. Tsirkin" Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" From: Yang Zhong Now that the ACPI builder methods are added, we can reach the ACPI configuration pointer from the MachineState pointer. From there we can get to the PCI host pointer and return it. This makes the PCI host getter an ACPI, architecture agnostic function. Signed-off-by: Yang Zhong --- hw/acpi/aml-build.c | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/hw/acpi/aml-build.c b/hw/acpi/aml-build.c index 33db1c1bc8..e8b087fcf5 100644 --- a/hw/acpi/aml-build.c +++ b/hw/acpi/aml-build.c @@ -22,6 +22,8 @@ #include "qemu/osdep.h" #include #include "hw/acpi/aml-build.h" +#include "hw/acpi/builder.h" +#include "hw/mem/memory-device.h" #include "qemu/bswap.h" #include "qemu/bitops.h" #include "sysemu/numa.h" @@ -1617,23 +1619,15 @@ void acpi_build_tables_cleanup(AcpiBuildTables *tab= les, bool mfre) g_array_free(tables->vmgenid, mfre); } =20 -/* - * Because of the PXB hosts we cannot simply query TYPE_PCI_HOST_BRIDGE. - */ Object *acpi_get_pci_host(void) { - PCIHostState *host; + MachineState *ms =3D MACHINE(qdev_get_machine()); + AcpiBuilder *ab =3D ACPI_BUILDER(ms); + AcpiConfiguration *acpi_conf; =20 - host =3D OBJECT_CHECK(PCIHostState, - object_resolve_path("/machine/i440fx", NULL), - TYPE_PCI_HOST_BRIDGE); - if (!host) { - host =3D OBJECT_CHECK(PCIHostState, - object_resolve_path("/machine/q35", NULL), - TYPE_PCI_HOST_BRIDGE); - } + acpi_conf =3D acpi_builder_configuration(ab); =20 - return OBJECT(host); + return OBJECT(acpi_conf->pci_host); } =20 =20 --=20 2.19.1