From: Igor Mammedov <imammedo@redhat.com>
To: Marcel Apfelbaum <marcel@redhat.com>
Cc: qemu-devel@nongnu.org, mst@redhat.com, pbonzini@redhat.com,
ehabkost@redhat.com
Subject: Re: [Qemu-devel] [PATCH RFC 2/7] hw/acpi: simplify dsdt building code
Date: Fri, 17 Jun 2016 10:39:14 +0200 [thread overview]
Message-ID: <20160617103914.73f10319@nial.brq.redhat.com> (raw)
In-Reply-To: <1464716918-29689-3-git-send-email-marcel@redhat.com>
On Tue, 31 May 2016 20:48:33 +0300
Marcel Apfelbaum <marcel@redhat.com> wrote:
> Get the pci root-bus once and pass it around.
>
> Signed-off-by: Marcel Apfelbaum <marcel@redhat.com>
> ---
> hw/i386/acpi-build.c | 58 +++++++++++++++++++++++-----------------------------
> 1 file changed, 26 insertions(+), 32 deletions(-)
>
> diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
> index 9aef25d..c6f4afe 100644
> --- a/hw/i386/acpi-build.c
> +++ b/hw/i386/acpi-build.c
> @@ -1990,7 +1990,7 @@ build_dsdt(GArray *table_data, GArray *linker,
> PCMachineState *pcms = PC_MACHINE(machine);
> uint32_t nr_mem = machine->ram_slots;
> int root_bus_limit = 0xFF;
> - PCIBus *bus = NULL;
> + PCIBus *root_bus = NULL;
> int i;
>
> dsdt = init_aml_allocator();
> @@ -2033,6 +2033,9 @@ build_dsdt(GArray *table_data, GArray *linker,
> build_q35_pci0_int(dsdt);
> }
>
> + root_bus = PC_MACHINE(machine)->bus;
> + assert(root_bus);
nit:
I'd put it in place of removed
bus = PC_MACHINE(machine)->bus;
in the next hunk
> +
> build_cpu_hotplug_aml(dsdt);
> build_memory_hotplug_aml(dsdt, nr_mem, pm->mem_hp_io_base,
> pm->mem_hp_io_len);
> @@ -2077,8 +2080,8 @@ build_dsdt(GArray *table_data, GArray *linker,
> }
> aml_append(dsdt, scope);
>
> - bus = PC_MACHINE(machine)->bus;
> - if (bus) {
> + {
> + PCIBus *bus = root_bus;
> QLIST_FOREACH(bus, &bus->child, sibling) {
> uint8_t bus_num = pci_bus_num(bus);
> uint8_t numa_node = pci_bus_numa_node(bus);
> @@ -2318,38 +2321,29 @@ build_dsdt(GArray *table_data, GArray *linker,
> pm->mem_hp_io_len);
>
> {
> - Object *pci_host;
> - PCIBus *bus = NULL;
> + Aml *scope = aml_scope("PCI0");
>
> - pci_host = acpi_get_i386_pci_host();
perhaps it's worth to replace acpi_get_i386_pci_host() usage
in other places with PC_MACHINE(machine)->bus as well and remove
acpi_get_i386_pci_host()
> - if (pci_host) {
> - bus = PCI_HOST_BRIDGE(pci_host)->bus;
> - }
> -
> - if (bus) {
> - Aml *scope = aml_scope("PCI0");
> - /* Scan all PCI buses. Generate tables to support hotplug. */
> - build_append_pci_bus_devices(scope, bus, pm->pcihp_bridge_en);
> -
> - if (misc->tpm_version != TPM_VERSION_UNSPEC) {
> - dev = aml_device("ISA.TPM");
> - aml_append(dev, aml_name_decl("_HID", aml_eisaid("PNP0C31")));
> - aml_append(dev, aml_name_decl("_STA", aml_int(0xF)));
> - crs = aml_resource_template();
> - aml_append(crs, aml_memory32_fixed(TPM_TIS_ADDR_BASE,
> - TPM_TIS_ADDR_SIZE, AML_READ_WRITE));
> - /*
> - FIXME: TPM_TIS_IRQ=5 conflicts with PNP0C0F irqs,
> - Rewrite to take IRQ from TPM device model and
> - fix default IRQ value there to use some unused IRQ
> - */
> - /* aml_append(crs, aml_irq_no_flags(TPM_TIS_IRQ)); */
> - aml_append(dev, aml_name_decl("_CRS", crs));
> - aml_append(scope, dev);
> - }
> + /* Scan all PCI buses. Generate tables to support hotplug. */
> + build_append_pci_bus_devices(scope, root_bus,
> + pm->pcihp_bridge_en);
no need for line break here, it all fits in 80 column limit
>
> - aml_append(sb_scope, scope);
> + if (misc->tpm_version != TPM_VERSION_UNSPEC) {
> + dev = aml_device("ISA.TPM");
> + aml_append(dev, aml_name_decl("_HID", aml_eisaid("PNP0C31")));
> + aml_append(dev, aml_name_decl("_STA", aml_int(0xF)));
> + crs = aml_resource_template();
> + aml_append(crs, aml_memory32_fixed(TPM_TIS_ADDR_BASE,
> + TPM_TIS_ADDR_SIZE, AML_READ_WRITE));
> + /*
> + FIXME: TPM_TIS_IRQ=5 conflicts with PNP0C0F irqs,
> + Rewrite to take IRQ from TPM device model and
> + fix default IRQ value there to use some unused IRQ
> + */
> + /* aml_append(crs, aml_irq_no_flags(TPM_TIS_IRQ)); */
> + aml_append(dev, aml_name_decl("_CRS", crs));
> + aml_append(scope, dev);
> }
> + aml_append(sb_scope, scope);
> }
> aml_append(dsdt, sb_scope);
> }
Otherwise looks good,
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
next prev parent reply other threads:[~2016-06-17 8:39 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-05-31 17:48 [Qemu-devel] [PATCH RFC 0/7] q35: add legacy pci acpi hotplug support Marcel Apfelbaum
2016-05-31 17:48 ` [Qemu-devel] [PATCH RFC 1/7] hw/acpi: remove dead acpi code Marcel Apfelbaum
2016-06-17 7:57 ` Igor Mammedov
2016-05-31 17:48 ` [Qemu-devel] [PATCH RFC 2/7] hw/acpi: simplify dsdt building code Marcel Apfelbaum
2016-06-17 8:39 ` Igor Mammedov [this message]
2016-05-31 17:48 ` [Qemu-devel] [PATCH RFC 3/7] hw/acpi: fix a DSDT table issue when a pxb is present Marcel Apfelbaum
2016-06-17 8:57 ` Igor Mammedov
2016-06-21 8:50 ` Marcel Apfelbaum
2016-05-31 17:48 ` [Qemu-devel] [PATCH RFC 4/7] hw/apci: fix pcihp io initialization Marcel Apfelbaum
2016-06-17 9:04 ` Igor Mammedov
2016-06-21 8:57 ` Marcel Apfelbaum
2016-06-21 11:19 ` Igor Mammedov
2016-06-21 11:50 ` Marcel Apfelbaum
2016-05-31 17:48 ` [Qemu-devel] [PATCH RFC 5/7] hw/acpi: prepare pci hotplug IO for ich9 Marcel Apfelbaum
2016-05-31 17:48 ` [Qemu-devel] [PATCH RFC 6/7] hw/acpi: extend acpi pci hotplug support for pci express Marcel Apfelbaum
2016-06-20 14:11 ` Igor Mammedov
2016-06-21 9:05 ` Marcel Apfelbaum
2016-06-21 11:28 ` Igor Mammedov
2016-06-21 11:47 ` Marcel Apfelbaum
2016-06-21 12:19 ` Igor Mammedov
2016-05-31 17:48 ` [Qemu-devel] [PATCH RFC 7/7] hw/ich9: enable pci acpi hotplug Marcel Apfelbaum
2016-06-20 14:27 ` Igor Mammedov
2016-06-21 9:06 ` Marcel Apfelbaum
2016-06-21 11:30 ` Igor Mammedov
2016-06-21 11:48 ` Marcel Apfelbaum
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=20160617103914.73f10319@nial.brq.redhat.com \
--to=imammedo@redhat.com \
--cc=ehabkost@redhat.com \
--cc=marcel@redhat.com \
--cc=mst@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
/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).