From: Samuel Ortiz <sameo@linux.intel.com>
To: qemu-devel@nongnu.org
Cc: Yang Zhong <yang.zhong@intel.com>,
"Michael S. Tsirkin" <mst@redhat.com>,
Igor Mammedov <imammedo@redhat.com>
Subject: [Qemu-devel] [PATCH v4 23/23] hw: i386: Refactor PCI host getter
Date: Thu, 1 Nov 2018 11:23:03 +0100 [thread overview]
Message-ID: <20181101102303.16439-24-sameo@linux.intel.com> (raw)
In-Reply-To: <20181101102303.16439-1-sameo@linux.intel.com>
From: Yang Zhong <yang.zhong@intel.com>
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 <yang.zhong@intel.com>
---
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 <glib/gprintf.h>
#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 *tables, bool mfre)
g_array_free(tables->vmgenid, mfre);
}
-/*
- * Because of the PXB hosts we cannot simply query TYPE_PCI_HOST_BRIDGE.
- */
Object *acpi_get_pci_host(void)
{
- PCIHostState *host;
+ MachineState *ms = MACHINE(qdev_get_machine());
+ AcpiBuilder *ab = ACPI_BUILDER(ms);
+ AcpiConfiguration *acpi_conf;
- host = OBJECT_CHECK(PCIHostState,
- object_resolve_path("/machine/i440fx", NULL),
- TYPE_PCI_HOST_BRIDGE);
- if (!host) {
- host = OBJECT_CHECK(PCIHostState,
- object_resolve_path("/machine/q35", NULL),
- TYPE_PCI_HOST_BRIDGE);
- }
+ acpi_conf = acpi_builder_configuration(ab);
- return OBJECT(host);
+ return OBJECT(acpi_conf->pci_host);
}
--
2.19.1
next prev parent reply other threads:[~2018-11-01 10:25 UTC|newest]
Thread overview: 41+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-11-01 10:22 [Qemu-devel] [PATCH v4 00/23] ACPI reorganization for hardware-reduced support Samuel Ortiz
2018-11-01 10:22 ` [Qemu-devel] [PATCH v4 01/23] hw: i386: Decouple the ACPI build from the PC machine type Samuel Ortiz
2018-11-01 10:22 ` [Qemu-devel] [PATCH v4 02/23] hw: acpi: Export ACPI build alignment API Samuel Ortiz
2018-11-01 10:22 ` [Qemu-devel] [PATCH v4 03/23] hw: acpi: Export the RSDP build API Samuel Ortiz
2018-11-01 17:50 ` Philippe Mathieu-Daudé
2018-11-02 9:20 ` Shannon Zhao
2018-11-02 9:56 ` Philippe Mathieu-Daudé
2018-11-06 10:17 ` Paolo Bonzini
2018-11-01 10:22 ` [Qemu-devel] [PATCH v4 04/23] hw: acpi: Implement XSDT support for RSDP Samuel Ortiz
2018-11-01 10:22 ` [Qemu-devel] [PATCH v4 05/23] hw: arm: Switch to the AML build RSDP building routine Samuel Ortiz
2018-11-02 9:35 ` Shannon Zhao
2018-11-02 10:05 ` Shannon Zhao
2018-11-02 10:23 ` Igor Mammedov
2018-11-01 10:22 ` [Qemu-devel] [PATCH v4 06/23] hw: acpi: Generalize AML build routines Samuel Ortiz
2018-11-02 9:41 ` [Qemu-devel] [Qemu-arm] " Shannon Zhao
2018-11-01 10:22 ` [Qemu-devel] [PATCH v4 07/23] hw: acpi: Factorize _OSC AML across architectures Samuel Ortiz
2018-11-01 10:22 ` [Qemu-devel] [PATCH v4 08/23] hw: i386: Move PCI host definitions to pci_host.h Samuel Ortiz
2018-11-01 10:22 ` [Qemu-devel] [PATCH v4 09/23] hw: acpi: Export the PCI host and holes getters Samuel Ortiz
2018-11-01 10:22 ` [Qemu-devel] [PATCH v4 10/23] hw: acpi: Export and generalize the PCI host AML API Samuel Ortiz
2018-11-01 10:22 ` [Qemu-devel] [PATCH v4 11/23] hw: acpi: Export the MCFG getter Samuel Ortiz
2018-11-01 10:22 ` [Qemu-devel] [PATCH v4 12/23] hw: acpi: Do not create hotplug method when handler is not defined Samuel Ortiz
2018-11-01 10:22 ` [Qemu-devel] [PATCH v4 13/23] hw: i386: Make the hotpluggable memory size property more generic Samuel Ortiz
2018-11-01 10:22 ` [Qemu-devel] [PATCH v4 14/23] hw: i386: Export the i386 ACPI SRAT build method Samuel Ortiz
2018-11-01 10:22 ` [Qemu-devel] [PATCH v4 15/23] hw: acpi: Fix memory hotplug AML generation error Samuel Ortiz
2018-11-01 10:22 ` [Qemu-devel] [PATCH v4 16/23] hw: acpi: Export the PCI hotplug API Samuel Ortiz
2018-11-01 15:27 ` Philippe Mathieu-Daudé
2018-11-01 10:22 ` [Qemu-devel] [PATCH v4 17/23] hw: i386: Export the MADT build method Samuel Ortiz
2018-11-01 15:12 ` Philippe Mathieu-Daudé
2018-11-01 15:24 ` Philippe Mathieu-Daudé
2018-11-01 10:22 ` [Qemu-devel] [PATCH v4 18/23] hw: acpi: Retrieve the PCI bus from AcpiPciHpState Samuel Ortiz
2018-11-01 10:22 ` [Qemu-devel] [PATCH v4 19/23] hw: acpi: Define ACPI tables builder interface Samuel Ortiz
2018-11-01 10:23 ` [Qemu-devel] [PATCH v4 20/23] hw: i386: Implement the ACPI builder interface for PC Samuel Ortiz
2018-11-01 10:23 ` [Qemu-devel] [PATCH v4 21/23] hw: pci-host: piix: Return PCI host pointer instead of PCI bus Samuel Ortiz
2018-11-01 10:23 ` [Qemu-devel] [PATCH v4 22/23] hw: i386: Set ACPI configuration PCI host pointer Samuel Ortiz
2018-11-01 10:23 ` Samuel Ortiz [this message]
2018-11-02 12:29 ` [Qemu-devel] [PATCH v4 00/23] ACPI reorganization for hardware-reduced support Igor Mammedov
2018-11-05 2:10 ` Samuel Ortiz
2018-11-05 15:37 ` Samuel Ortiz
2018-11-05 16:07 ` Andrew Jones
2018-11-05 16:16 ` Samuel Ortiz
2018-11-08 14:12 ` Igor Mammedov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20181101102303.16439-24-sameo@linux.intel.com \
--to=sameo@linux.intel.com \
--cc=imammedo@redhat.com \
--cc=mst@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=yang.zhong@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).