From: "Philippe Mathieu-Daudé" <philmd@redhat.com>
To: Samuel Ortiz <sameo@linux.intel.com>
Cc: qemu-devel@nongnu.org, Yang Zhong <yang.zhong@intel.com>,
Eduardo Habkost <ehabkost@redhat.com>,
Rob Bradford <robert.bradford@intel.com>,
"Michael S. Tsirkin" <mst@redhat.com>,
Igor Mammedov <imammedo@redhat.com>,
Paolo Bonzini <pbonzini@redhat.com>,
Richard Henderson <rth@twiddle.net>
Subject: Re: [Qemu-devel] [PATCH v3 09/19] hw: acpi: Export and generalize the PCI host AML API
Date: Tue, 30 Oct 2018 19:04:15 +0100 [thread overview]
Message-ID: <16d95ea4-12a7-7372-9d4a-218108f9f2db@redhat.com> (raw)
In-Reply-To: <20181030145715.GC5291@caravaggio.home>
Hi Samuel,
On 30/10/18 15:57, Samuel Ortiz wrote:
> Hi Philippe,
>
> On Mon, Oct 29, 2018 at 08:29:38PM +0100, Philippe Mathieu-Daudé wrote:
>> On 29/10/18 20:23, Philippe Mathieu-Daudé wrote:
>>> On 29/10/18 18:01, Samuel Ortiz wrote:
>>>> From: Yang Zhong <yang.zhong@intel.com>
>>>>
>>>> The AML build routines for the PCI host bridge and the corresponding
>>>> DSDT addition are neither x86 nor PC machine type specific.
>>>> We can move them to the architecture agnostic hw/acpi folder, and by
>>>> carrying all the needed information through a new AcpiPciBus structure,
>>>> we can make them PC machine type independent.
>>>>
>>>> Signed-off-by: Yang Zhong <yang.zhong@intel.com>
>>>> Signed-off-by: Rob Bradford <robert.bradford@intel.com>
>>>> ---
>>>> hw/acpi/aml-build.c | 208 ++++++++++++++++++++++++++++++++++++
>>>> hw/i386/acpi-build.c | 167 ++---------------------------
>>>> include/hw/acpi/aml-build.h | 10 ++
>>>> 3 files changed, 226 insertions(+), 159 deletions(-)
>>>>
>>>> diff --git a/hw/acpi/aml-build.c b/hw/acpi/aml-build.c
>>>> index 52ac39acdb..aa72b5459c 100644
>>>> --- a/hw/acpi/aml-build.c
>>>> +++ b/hw/acpi/aml-build.c
>>>> @@ -29,6 +29,25 @@
>>>> #include "hw/pci/pci_bus.h"
>>>> #include "qemu/range.h"
>>>> #include "hw/pci/pci_bridge.h"
>>>> +#include "hw/i386/pc.h"
>>
>> Err I just missed that, this include doesn't belong here, ...
>>
>>>> +#include "sysemu/tpm.h"
>>>> +#include "hw/acpi/tpm.h"
>>>> +
>>>> +#define PCI_HOST_BRIDGE_CONFIG_ADDR 0xcf8
>>>> +#define PCI_HOST_BRIDGE_IO_0_MIN_ADDR 0x0000
>>>> +#define PCI_HOST_BRIDGE_IO_0_MAX_ADDR 0x0cf7
>>>> +#define PCI_HOST_BRIDGE_IO_1_MIN_ADDR 0x0d00
>>>> +#define PCI_HOST_BRIDGE_IO_1_MAX_ADDR 0xffff
>>>> +#define PCI_VGA_MEM_BASE_ADDR 0x000a0000
>>>> +#define PCI_VGA_MEM_MAX_ADDR 0x000bffff
>>>> +#define IO_0_LEN 0xcf8
>>>> +#define VGA_MEM_LEN 0x20000
>>>> +
>>>> +static const char *pci_hosts[] = {
>>>
>>> This array should stay in hw/i386/acpi-build.c.
>>>
>>>> + "/machine/i440fx",
>>>> + "/machine/q35",
>>>> + NULL,
>>>> +};
>>>> static GArray *build_alloc_array(void)
>>>> {
>>>> @@ -1601,6 +1620,51 @@ 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)
>>>
>>> This function should take the machine_paths as argument.
>>>
>>>> +{
>>>> + PCIHostState *host;
>>>> + int i = 0;
>>>> +
>>>> + while (pci_hosts[i]) {
>>>> + host = OBJECT_CHECK(PCIHostState,
>>>> + object_resolve_path(pci_hosts[i], NULL),
>>>> + TYPE_PCI_HOST_BRIDGE);
>>>> + if (host) {
>>>> + return OBJECT(host);
>>>> + }
>>>> +
>>>> + i++;
>>>> + }
>>>> +
>>>> + return NULL;
>>>> +}
>>>> +
>>>> +void acpi_get_pci_holes(Range *hole, Range *hole64)
>>
>> ... and this function neither, it should stay in hw/i386/acpi-build.c, thus
>> you don't need to modify the prototype and can call
>> acpi_get_pci_host(x86_machine_paths) directly.
>>
> So the idea for those routines is that they're not x86 specific. As a
> matter of fact, they will eventually get called from architecture
> agnostic code like e.g. hw/acpi/reduced.c. So I don't think they should
> live under hw/i386/
But PCI_HOST_PROP_PCI_HOLE_START is only defined in "hw/i386/pc.h"...
This file is no more arch agnostic.
I can understand/accept a acpi_get_pci_holes() function, but the ranges
shouldn't be i386 based.
>
> Moreover adding an argument to acpi_get_pci_host() means the caller should
> know which potential machines it needs to go through. And once both
> arm/virt and i386/virt calls into hw/acpi/reduced.c, we need to somehow
> pass a relevant set of machines paths to this API.
> So I think a more robust way to do so would be for each machine instance to
> be able to set its own PCI host pointer instead of having to maintain
> a per architecture set of potential PCI machine paths. I'm thinking
> about adding that to the AcpiConfiguration structure and let each
> machine fills it if/when it builds its PCI host.
>
> Cheers,
> Samuel.
>
next prev parent reply other threads:[~2018-10-30 18:04 UTC|newest]
Thread overview: 45+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-10-29 17:01 [Qemu-devel] [PATCH v3 00/19] ACPI reorganization for hardware-reduced support Samuel Ortiz
2018-10-29 17:01 ` [Qemu-devel] [PATCH v3 01/19] hw: i386: Decouple the ACPI build from the PC machine type Samuel Ortiz
2018-10-29 19:50 ` Philippe Mathieu-Daudé
2018-10-29 17:01 ` [Qemu-devel] [PATCH v3 02/19] hw: acpi: Export ACPI build alignment API Samuel Ortiz
2018-10-29 19:01 ` Philippe Mathieu-Daudé
2018-10-29 17:01 ` [Qemu-devel] [PATCH v3 03/19] hw: acpi: Export the RSDP build API Samuel Ortiz
2018-10-29 18:58 ` Philippe Mathieu-Daudé
2018-10-29 17:01 ` [Qemu-devel] [PATCH v3 04/19] hw: acpi: Implement XSDT support for RSDP Samuel Ortiz
2018-10-29 17:01 ` [Qemu-devel] [PATCH v3 05/19] hw: arm: Switch to the AML build RSDP building routine Samuel Ortiz
2018-10-29 17:01 ` [Qemu-devel] [PATCH v3 06/19] hw: acpi: Generalize AML build routines Samuel Ortiz
2018-10-29 19:09 ` Philippe Mathieu-Daudé
2018-10-29 17:01 ` [Qemu-devel] [PATCH v3 07/19] hw: acpi: Factorize _OSC AML across architectures Samuel Ortiz
2018-10-29 17:01 ` [Qemu-devel] [PATCH v3 08/19] hw: i386: Refactor PCI host getter Samuel Ortiz
2018-10-29 19:18 ` Philippe Mathieu-Daudé
2018-10-29 17:01 ` [Qemu-devel] [PATCH v3 09/19] hw: acpi: Export and generalize the PCI host AML API Samuel Ortiz
2018-10-29 19:23 ` Philippe Mathieu-Daudé
2018-10-29 19:29 ` Philippe Mathieu-Daudé
2018-10-30 14:57 ` Samuel Ortiz
2018-10-30 18:04 ` Philippe Mathieu-Daudé [this message]
2018-10-31 10:46 ` Samuel Ortiz
2018-10-29 17:01 ` [Qemu-devel] [PATCH v3 10/19] hw: acpi: Export the MCFG getter Samuel Ortiz
2018-10-29 19:31 ` Philippe Mathieu-Daudé
2018-10-29 17:01 ` [Qemu-devel] [PATCH v3 11/19] hw: acpi: Do not create hotplug method when handler is not defined Samuel Ortiz
2018-10-29 19:33 ` Philippe Mathieu-Daudé
2018-10-29 17:01 ` [Qemu-devel] [PATCH v3 12/19] hw: i386: Make the hotpluggable memory size property more generic Samuel Ortiz
2018-10-29 19:38 ` Philippe Mathieu-Daudé
2018-10-29 17:01 ` [Qemu-devel] [PATCH v3 13/19] hw: acpi: Export the SRAT AML build API Samuel Ortiz
2018-10-29 19:40 ` Philippe Mathieu-Daudé
2018-10-29 17:01 ` [Qemu-devel] [PATCH v3 14/19] hw: acpi: Fix memory hotplug AML generation error Samuel Ortiz
2018-10-29 17:01 ` [Qemu-devel] [PATCH v3 15/19] hw: acpi: Export the PCI hotplug API Samuel Ortiz
2018-10-29 19:46 ` Philippe Mathieu-Daudé
2018-10-29 23:34 ` Boeuf, Sebastien
2018-10-29 17:01 ` [Qemu-devel] [PATCH v3 16/19] hw: acpi: Retrieve the PCI bus from AcpiPciHpState Samuel Ortiz
2018-10-29 21:02 ` Philippe Mathieu-Daudé
2018-10-29 23:35 ` Boeuf, Sebastien
2018-10-29 17:01 ` [Qemu-devel] [PATCH v3 17/19] hw: acpi: Define ACPI tables builder interface Samuel Ortiz
2018-10-29 21:06 ` Philippe Mathieu-Daudé
2018-10-29 17:01 ` [Qemu-devel] [PATCH v3 18/19] hw: i386: Export the MADT build method Samuel Ortiz
2018-10-29 21:18 ` Philippe Mathieu-Daudé
2018-10-29 17:01 ` [Qemu-devel] [PATCH v3 19/19] hw: i386: Implement the ACPI builder interface for PC Samuel Ortiz
2018-10-29 17:28 ` Paolo Bonzini
2018-10-30 14:13 ` Samuel Ortiz
2018-10-30 16:03 ` Paolo Bonzini
2018-10-31 1:02 ` Samuel Ortiz
2018-10-29 21:23 ` Philippe Mathieu-Daudé
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=16d95ea4-12a7-7372-9d4a-218108f9f2db@redhat.com \
--to=philmd@redhat.com \
--cc=ehabkost@redhat.com \
--cc=imammedo@redhat.com \
--cc=mst@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=robert.bradford@intel.com \
--cc=rth@twiddle.net \
--cc=sameo@linux.intel.com \
--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).