On Tue, Dec 01, 2015 at 10:53:07PM +0200, Marcel Apfelbaum wrote: > On 12/01/2015 08:20 PM, Eduardo Habkost wrote: > >On Thu, Nov 26, 2015 at 06:00:28PM +0200, Marcel Apfelbaum wrote: > >>Add bus property to PC machines and use it when looking > >>for primary PCI root bus (bus 0). > >> > >>Signed-off-by: Marcel Apfelbaum <mar...@redhat.com> > >>--- > >> hw/i386/acpi-build.c | 3 +-- > >> hw/i386/pc.c | 2 +- > >> hw/i386/pc_piix.c | 1 + > >> hw/i386/pc_q35.c | 1 + > >> include/hw/i386/pc.h | 1 + > >> 5 files changed, 5 insertions(+), 3 deletions(-) > >> > >>diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c > >>index 736b252..bca3f06 100644 > >>--- a/hw/i386/acpi-build.c > >>+++ b/hw/i386/acpi-build.c > >>@@ -950,8 +950,7 @@ build_ssdt(GArray *table_data, GArray *linker, > >> /* Reserve space for header */ > >> acpi_data_push(ssdt->buf, sizeof(AcpiTableHeader)); > >> > >>- /* Extra PCI root buses are implemented only for i440fx */ > >>- bus = find_i440fx(); > >>+ bus = PC_MACHINE(machine)->bus; > > > >You can use acpi_get_i386_pci_host()->bus here, so we can reduce > >the amount of PC-specific code inside acpi-build.c. > > > >(Making acpi_get_i386_pci_host() more generic and not depend on > >piix- and q35-specific checks is also on my plans) > > Well, at this point, looking at the names PC_MACHINE and > acpi_get_i386_pci_host, > I don't see much difference :)
I'm a bit confused by how generic acpi-build.c is supposed to be. It has some code that seems to be an attempt to be more generic (e.g. the "if (pci_host)" check at build_ssdt()), but lots of other code that only work with PC machines. Maybe we should stop pretending and simply use PCMachineState everywhere inside acpi-build.c? > I think we can change this later when acpi_get_i386_pci_host will be generic. No problem to me. :) -- Eduardo