[PATCH v6 21/36] hw/arm/virt-acpi-build: Let non hotplug ports support static acpi-index

Eric Auger posted 36 patches 4 months, 1 week ago
Maintainers: "Michael S. Tsirkin" <mst@redhat.com>, Igor Mammedov <imammedo@redhat.com>, Ani Sinha <anisinha@redhat.com>, Marcel Apfelbaum <marcel.apfelbaum@gmail.com>, "Philippe Mathieu-Daudé" <philmd@linaro.org>, Aurelien Jarno <aurelien@aurel32.net>, Paolo Bonzini <pbonzini@redhat.com>, Peter Maydell <peter.maydell@linaro.org>, Shannon Zhao <shannon.zhaosl@gmail.com>, "Daniel P. Berrangé" <berrange@redhat.com>, Eduardo Habkost <eduardo@habkost.net>, Richard Henderson <richard.henderson@linaro.org>
There is a newer version of this series
[PATCH v6 21/36] hw/arm/virt-acpi-build: Let non hotplug ports support static acpi-index
Posted by Eric Auger 4 months, 1 week ago
hw/arm/virt-acpi-build: Let non hotplug ports support static acpi-index

Add the requested ACPI bits requested to support static acpi-index
for non hotplug ports.

Signed-off-by: Eric Auger <eric.auger@redhat.com>
Reviewed-by: Jonathan Cameron <jonathan.cameron@huawei.com>
---
 hw/arm/virt-acpi-build.c | 12 ++++++++++++
 hw/arm/Kconfig           |  2 ++
 2 files changed, 14 insertions(+)

diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c
index a2f31be9ec..1f936516b3 100644
--- a/hw/arm/virt-acpi-build.c
+++ b/hw/arm/virt-acpi-build.c
@@ -34,6 +34,7 @@
 #include "hw/core/cpu.h"
 #include "hw/acpi/acpi-defs.h"
 #include "hw/acpi/acpi.h"
+#include "hw/acpi/pcihp.h"
 #include "hw/nvram/fw_cfg_acpi.h"
 #include "hw/acpi/bios-linker-loader.h"
 #include "hw/acpi/aml-build.h"
@@ -883,6 +884,7 @@ build_dsdt(GArray *table_data, BIOSLinker *linker, VirtMachineState *vms)
     const int *irqmap = vms->irqmap;
     AcpiTable table = { .sig = "DSDT", .rev = 2, .oem_id = vms->oem_id,
                         .oem_table_id = vms->oem_table_id };
+    Aml *pci0_scope;
 
     acpi_table_begin(&table, table_data);
     dsdt = init_aml_allocator();
@@ -936,6 +938,16 @@ build_dsdt(GArray *table_data, BIOSLinker *linker, VirtMachineState *vms)
 
     aml_append(dsdt, scope);
 
+    pci0_scope = aml_scope("\\_SB.PCI0");
+
+    aml_append(pci0_scope, build_pci_bridge_edsm());
+    build_append_pci_bus_devices(pci0_scope, vms->bus);
+    if (object_property_find(OBJECT(vms->bus), ACPI_PCIHP_PROP_BSEL)) {
+        build_append_pcihp_slots(pci0_scope, vms->bus);
+    }
+
+    aml_append(dsdt, pci0_scope);
+
     /* copy AML table into ACPI tables blob */
     g_array_append_vals(table_data, dsdt->buf->data, dsdt->buf->len);
 
diff --git a/hw/arm/Kconfig b/hw/arm/Kconfig
index 6ea86534d5..50153331ed 100644
--- a/hw/arm/Kconfig
+++ b/hw/arm/Kconfig
@@ -34,6 +34,8 @@ config ARM_VIRT
     select ACPI_HW_REDUCED
     select ACPI_APEI
     select ACPI_VIOT
+    select ACPI_PCIHP
+    select ACPI_PCI_BRIDGE
     select VIRTIO_MEM_SUPPORTED
     select ACPI_CXL
     select ACPI_HMAT
-- 
2.49.0
Re: [PATCH v6 21/36] hw/arm/virt-acpi-build: Let non hotplug ports support static acpi-index
Posted by Igor Mammedov 4 months, 1 week ago
On Tue,  8 Jul 2025 16:23:03 +0200
Eric Auger <eric.auger@redhat.com> wrote:

> hw/arm/virt-acpi-build: Let non hotplug ports support static acpi-index
> 
> Add the requested ACPI bits requested to support static acpi-index
> for non hotplug ports.
> 
> Signed-off-by: Eric Auger <eric.auger@redhat.com>
> Reviewed-by: Jonathan Cameron <jonathan.cameron@huawei.com>
> ---
>  hw/arm/virt-acpi-build.c | 12 ++++++++++++
>  hw/arm/Kconfig           |  2 ++
>  2 files changed, 14 insertions(+)
> 
> diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c
> index a2f31be9ec..1f936516b3 100644
> --- a/hw/arm/virt-acpi-build.c
> +++ b/hw/arm/virt-acpi-build.c
> @@ -34,6 +34,7 @@
>  #include "hw/core/cpu.h"
>  #include "hw/acpi/acpi-defs.h"
>  #include "hw/acpi/acpi.h"
> +#include "hw/acpi/pcihp.h"
>  #include "hw/nvram/fw_cfg_acpi.h"
>  #include "hw/acpi/bios-linker-loader.h"
>  #include "hw/acpi/aml-build.h"
> @@ -883,6 +884,7 @@ build_dsdt(GArray *table_data, BIOSLinker *linker, VirtMachineState *vms)
>      const int *irqmap = vms->irqmap;
>      AcpiTable table = { .sig = "DSDT", .rev = 2, .oem_id = vms->oem_id,
>                          .oem_table_id = vms->oem_table_id };
> +    Aml *pci0_scope;
>  
>      acpi_table_begin(&table, table_data);
>      dsdt = init_aml_allocator();
> @@ -936,6 +938,16 @@ build_dsdt(GArray *table_data, BIOSLinker *linker, VirtMachineState *vms)
>  
>      aml_append(dsdt, scope);
>  
> +    pci0_scope = aml_scope("\\_SB.PCI0");
> +
> +    aml_append(pci0_scope, build_pci_bridge_edsm());
> +    build_append_pci_bus_devices(pci0_scope, vms->bus);

> +    if (object_property_find(OBJECT(vms->bus), ACPI_PCIHP_PROP_BSEL)) {
> +        build_append_pcihp_slots(pci0_scope, vms->bus);
> +    }
this part seems to be hotplug specific, is it really necessary in this patch?

> +
> +    aml_append(dsdt, pci0_scope);
> +
>      /* copy AML table into ACPI tables blob */
>      g_array_append_vals(table_data, dsdt->buf->data, dsdt->buf->len);
>  
> diff --git a/hw/arm/Kconfig b/hw/arm/Kconfig
> index 6ea86534d5..50153331ed 100644
> --- a/hw/arm/Kconfig
> +++ b/hw/arm/Kconfig
> @@ -34,6 +34,8 @@ config ARM_VIRT
>      select ACPI_HW_REDUCED
>      select ACPI_APEI
>      select ACPI_VIOT
> +    select ACPI_PCIHP
> +    select ACPI_PCI_BRIDGE
>      select VIRTIO_MEM_SUPPORTED
>      select ACPI_CXL
>      select ACPI_HMAT
Re: [PATCH v6 21/36] hw/arm/virt-acpi-build: Let non hotplug ports support static acpi-index
Posted by Eric Auger 4 months ago

On 7/11/25 2:03 PM, Igor Mammedov wrote:
> On Tue,  8 Jul 2025 16:23:03 +0200
> Eric Auger <eric.auger@redhat.com> wrote:
>
>> hw/arm/virt-acpi-build: Let non hotplug ports support static acpi-index
>>
>> Add the requested ACPI bits requested to support static acpi-index
>> for non hotplug ports.
>>
>> Signed-off-by: Eric Auger <eric.auger@redhat.com>
>> Reviewed-by: Jonathan Cameron <jonathan.cameron@huawei.com>
>> ---
>>  hw/arm/virt-acpi-build.c | 12 ++++++++++++
>>  hw/arm/Kconfig           |  2 ++
>>  2 files changed, 14 insertions(+)
>>
>> diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c
>> index a2f31be9ec..1f936516b3 100644
>> --- a/hw/arm/virt-acpi-build.c
>> +++ b/hw/arm/virt-acpi-build.c
>> @@ -34,6 +34,7 @@
>>  #include "hw/core/cpu.h"
>>  #include "hw/acpi/acpi-defs.h"
>>  #include "hw/acpi/acpi.h"
>> +#include "hw/acpi/pcihp.h"
>>  #include "hw/nvram/fw_cfg_acpi.h"
>>  #include "hw/acpi/bios-linker-loader.h"
>>  #include "hw/acpi/aml-build.h"
>> @@ -883,6 +884,7 @@ build_dsdt(GArray *table_data, BIOSLinker *linker, VirtMachineState *vms)
>>      const int *irqmap = vms->irqmap;
>>      AcpiTable table = { .sig = "DSDT", .rev = 2, .oem_id = vms->oem_id,
>>                          .oem_table_id = vms->oem_table_id };
>> +    Aml *pci0_scope;
>>  
>>      acpi_table_begin(&table, table_data);
>>      dsdt = init_aml_allocator();
>> @@ -936,6 +938,16 @@ build_dsdt(GArray *table_data, BIOSLinker *linker, VirtMachineState *vms)
>>  
>>      aml_append(dsdt, scope);
>>  
>> +    pci0_scope = aml_scope("\\_SB.PCI0");
>> +
>> +    aml_append(pci0_scope, build_pci_bridge_edsm());
>> +    build_append_pci_bus_devices(pci0_scope, vms->bus);
>> +    if (object_property_find(OBJECT(vms->bus), ACPI_PCIHP_PROP_BSEL)) {
>> +        build_append_pcihp_slots(pci0_scope, vms->bus);
>> +    }
> this part seems to be hotplug specific, is it really necessary in this patch?
Well I put this because it does not depend on
ACPI_PM_PROP_ACPI_PCIHP_BRIDGE GED property as opposed to the other
pieces added in [PATCH v6 23/36] hw/arm/virt-acpi-build: Modify the DSDT
ACPI table to enable ACPI PCI hotplug and rather depends on the bus

ACPI_PCIHP_PROP_BSEL property.

The initial comment was to move that code generation outside of the
ACPI_PM_PROP_ACPI_PCIHP_BRIDGE GED check. Thanks Eric
>
>> +
>> +    aml_append(dsdt, pci0_scope);
>> +
>>      /* copy AML table into ACPI tables blob */
>>      g_array_append_vals(table_data, dsdt->buf->data, dsdt->buf->len);
>>  
>> diff --git a/hw/arm/Kconfig b/hw/arm/Kconfig
>> index 6ea86534d5..50153331ed 100644
>> --- a/hw/arm/Kconfig
>> +++ b/hw/arm/Kconfig
>> @@ -34,6 +34,8 @@ config ARM_VIRT
>>      select ACPI_HW_REDUCED
>>      select ACPI_APEI
>>      select ACPI_VIOT
>> +    select ACPI_PCIHP
>> +    select ACPI_PCI_BRIDGE
>>      select VIRTIO_MEM_SUPPORTED
>>      select ACPI_CXL
>>      select ACPI_HMAT