On Mon, 16 Jun 2025 11:46:36 +0200 Eric Auger <eric.au...@redhat.com> wrote:
> retrieve the acpi_pcihp option value from the ged. In > case acpi_pcihp is unset we configure pci native hotplug on > pci0. For expander bridges we keep legacy pci native hotplug, I guess it's remnants of from previous version s/legacy// > as done on x86 q35. > > Signed-off-by: Eric Auger <eric.au...@redhat.com> > > --- > > v2 -> v3: > - don'use the virt arm machine option anymore. > --- > include/hw/pci-host/gpex.h | 1 + > hw/arm/virt-acpi-build.c | 5 +++++ > hw/pci-host/gpex-acpi.c | 3 ++- > 3 files changed, 8 insertions(+), 1 deletion(-) > > diff --git a/include/hw/pci-host/gpex.h b/include/hw/pci-host/gpex.h > index 84471533af..feaf827474 100644 > --- a/include/hw/pci-host/gpex.h > +++ b/include/hw/pci-host/gpex.h > @@ -45,6 +45,7 @@ struct GPEXConfig { > MemMapEntry pio; > int irq; > PCIBus *bus; > + bool pci_native_hotplug; > }; > > typedef struct GPEXIrq GPEXIrq; > diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c > index 7e8e0f0298..d7547c8d3b 100644 > --- a/hw/arm/virt-acpi-build.c > +++ b/hw/arm/virt-acpi-build.c > @@ -123,12 +123,17 @@ static void acpi_dsdt_add_pci(Aml *scope, const > MemMapEntry *memmap, > uint32_t irq, VirtMachineState *vms) > { > int ecam_id = VIRT_ECAM_ID(vms->highmem_ecam); > + AcpiGedState *acpi_ged_state = ACPI_GED(vms->acpi_dev); > + AcpiPciHpState *pcihp_state = &acpi_ged_state->pcihp_state; 1) > + > struct GPEXConfig cfg = { > .mmio32 = memmap[VIRT_PCIE_MMIO], > .pio = memmap[VIRT_PCIE_PIO], > .ecam = memmap[ecam_id], > .irq = irq, > .bus = vms->bus, > + .pci_native_hotplug = !pcihp_state->use_acpi_hotplug_bridge, I'd use property accessor here instead of poking into device internals. and get rind of [1] > }; > > if (vms->highmem_mmio) { > diff --git a/hw/pci-host/gpex-acpi.c b/hw/pci-host/gpex-acpi.c > index 80fc2bf032..44737a8d81 100644 > --- a/hw/pci-host/gpex-acpi.c > +++ b/hw/pci-host/gpex-acpi.c > @@ -203,6 +203,7 @@ void acpi_dsdt_add_gpex(Aml *scope, struct GPEXConfig > *cfg) > if (is_cxl) { > build_cxl_osc_method(dev); > } else { > + /* pxb bridges do not have ACPI PCI Hot-plug enabled */ > acpi_dsdt_add_host_bridge_methods(dev, true); > } > > @@ -278,7 +279,7 @@ void acpi_dsdt_add_gpex(Aml *scope, struct GPEXConfig > *cfg) > } > aml_append(dev, aml_name_decl("_CRS", rbuf)); > > - acpi_dsdt_add_host_bridge_methods(dev, true); > + acpi_dsdt_add_host_bridge_methods(dev, cfg->pci_native_hotplug); > > Aml *dev_res0 = aml_device("%s", "RES0"); > aml_append(dev_res0, aml_name_decl("_HID", aml_string("PNP0C02")));