[PATCH v6 34/36] tests/qtest/bios-tables-test: Add aarch64 ACPI PCI hotplug test

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 34/36] tests/qtest/bios-tables-test: Add aarch64 ACPI PCI hotplug test
Posted by Eric Auger 4 months, 1 week ago
From: Gustavo Romero <gustavo.romero@linaro.org>

Add 2 new tests:
- test_acpi_aarch64_virt_acpi_pci_hotplug tests the acpi pci hotplug
  using -global acpi-ged.acpi-pci-hotplug-with-bridge-support=on
- test_acpi_aarch64_virt_pcie_root_port_hpoff tests static-acpi index
  on a root port with disabled hotplug

Signed-off-by: Gustavo Romero <gustavo.romero@linaro.org>
Signed-off-by: Eric Auger <eric.auger@redhat.com>
Reviewed-by: Jonathan Cameron <jonathan.cameron@huawei.com>

---
v3 -> v4:
- add -device pci-testdev for the first test case
- fix the chassis
- add a test for static acpi-index
---
 tests/qtest/bios-tables-test.c | 52 ++++++++++++++++++++++++++++++++++
 1 file changed, 52 insertions(+)

diff --git a/tests/qtest/bios-tables-test.c b/tests/qtest/bios-tables-test.c
index 357bcefd37..1074b8d67a 100644
--- a/tests/qtest/bios-tables-test.c
+++ b/tests/qtest/bios-tables-test.c
@@ -1643,6 +1643,54 @@ static void test_acpi_aarch64_virt_tcg_memhp(void)
 
 }
 
+static void test_acpi_aarch64_virt_acpi_pci_hotplug(void)
+{
+    test_data data = {
+        .machine = "virt",
+        .arch = "aarch64",
+        .tcg_only = true,
+        .uefi_fl1 = "pc-bios/edk2-aarch64-code.fd",
+        .uefi_fl2 = "pc-bios/edk2-arm-vars.fd",
+        .cd = "tests/data/uefi-boot-images/bios-tables-test.aarch64.iso.qcow2",
+        .ram_start = 0x40000000ULL,
+        .scan_len = 256ULL * MiB,
+        .variant = ".acpipcihp",
+    };
+
+   /* Use ACPI PCI Hotplug */
+   test_acpi_one(" -global acpi-ged.acpi-pci-hotplug-with-bridge-support=on"
+                 " -cpu cortex-a57"
+                 " -device pcie-root-port,id=pcie.1,bus=pcie.0,chassis=0,slot=1,addr=7.0"
+                 " -device pci-testdev,bus=pcie.1",
+                 &data);
+
+    free_test_data(&data);
+}
+
+static void test_acpi_aarch64_virt_pcie_root_port_hpoff(void)
+{
+    test_data data = {
+        .machine = "virt",
+        .arch = "aarch64",
+        .tcg_only = true,
+        .uefi_fl1 = "pc-bios/edk2-aarch64-code.fd",
+        .uefi_fl2 = "pc-bios/edk2-arm-vars.fd",
+        .cd = "tests/data/uefi-boot-images/bios-tables-test.aarch64.iso.qcow2",
+        .ram_start = 0x40000000ULL,
+        .scan_len = 256ULL * MiB,
+        .variant = ".hpoffacpiindex",
+    };
+
+   /* turn hotplug off on the pcie-root-port and use static acpi-index*/
+   test_acpi_one(" -device pcie-root-port,id=pcie.1,chassis=0,"
+                                          "slot=1,hotplug=off,addr=7.0"
+                 " -device pci-testdev,bus=pcie.1,acpi-index=12"
+                 " -cpu cortex-a57",
+                 &data);
+
+    free_test_data(&data);
+}
+
 static void test_acpi_microvm_prepare(test_data *data)
 {
     data->machine = "microvm";
@@ -2602,6 +2650,10 @@ int main(int argc, char *argv[])
             qtest_add_func("acpi/virt/numamem",
                            test_acpi_aarch64_virt_tcg_numamem);
             qtest_add_func("acpi/virt/memhp", test_acpi_aarch64_virt_tcg_memhp);
+            qtest_add_func("acpi/virt/acpipcihp",
+                           test_acpi_aarch64_virt_acpi_pci_hotplug);
+            qtest_add_func("acpi/virt/hpoffacpiindex",
+                          test_acpi_aarch64_virt_pcie_root_port_hpoff);
             qtest_add_func("acpi/virt/pxb", test_acpi_aarch64_virt_tcg_pxb);
             qtest_add_func("acpi/virt/oem-fields",
                            test_acpi_aarch64_virt_oem_fields);
-- 
2.49.0
Re: [PATCH v6 34/36] tests/qtest/bios-tables-test: Add aarch64 ACPI PCI hotplug test
Posted by Igor Mammedov 4 months ago
On Tue,  8 Jul 2025 16:23:16 +0200
Eric Auger <eric.auger@redhat.com> wrote:

> From: Gustavo Romero <gustavo.romero@linaro.org>
> 
> Add 2 new tests:
> - test_acpi_aarch64_virt_acpi_pci_hotplug tests the acpi pci hotplug
>   using -global acpi-ged.acpi-pci-hotplug-with-bridge-support=on
> - test_acpi_aarch64_virt_pcie_root_port_hpoff tests static-acpi index
>   on a root port with disabled hotplug

tests a bit simple, I wonder if we could reuse related x86 variants
for that (as those test a bit more corner cases with a more complicated
topology).
It's not a blocker and doing this of cause can be done on top.
 
> 
> Signed-off-by: Gustavo Romero <gustavo.romero@linaro.org>
> Signed-off-by: Eric Auger <eric.auger@redhat.com>
> Reviewed-by: Jonathan Cameron <jonathan.cameron@huawei.com>
> 
> ---
> v3 -> v4:
> - add -device pci-testdev for the first test case
> - fix the chassis
> - add a test for static acpi-index
> ---
>  tests/qtest/bios-tables-test.c | 52 ++++++++++++++++++++++++++++++++++
>  1 file changed, 52 insertions(+)
> 
> diff --git a/tests/qtest/bios-tables-test.c b/tests/qtest/bios-tables-test.c
> index 357bcefd37..1074b8d67a 100644
> --- a/tests/qtest/bios-tables-test.c
> +++ b/tests/qtest/bios-tables-test.c
> @@ -1643,6 +1643,54 @@ static void test_acpi_aarch64_virt_tcg_memhp(void)
>  
>  }
>  
> +static void test_acpi_aarch64_virt_acpi_pci_hotplug(void)
> +{
> +    test_data data = {
> +        .machine = "virt",
> +        .arch = "aarch64",
> +        .tcg_only = true,
> +        .uefi_fl1 = "pc-bios/edk2-aarch64-code.fd",
> +        .uefi_fl2 = "pc-bios/edk2-arm-vars.fd",
> +        .cd = "tests/data/uefi-boot-images/bios-tables-test.aarch64.iso.qcow2",
> +        .ram_start = 0x40000000ULL,
> +        .scan_len = 256ULL * MiB,
> +        .variant = ".acpipcihp",
> +    };
> +
> +   /* Use ACPI PCI Hotplug */
> +   test_acpi_one(" -global acpi-ged.acpi-pci-hotplug-with-bridge-support=on"
> +                 " -cpu cortex-a57"
> +                 " -device pcie-root-port,id=pcie.1,bus=pcie.0,chassis=0,slot=1,addr=7.0"
> +                 " -device pci-testdev,bus=pcie.1",
> +                 &data);
> +
> +    free_test_data(&data);
> +}
> +
> +static void test_acpi_aarch64_virt_pcie_root_port_hpoff(void)
> +{
> +    test_data data = {
> +        .machine = "virt",
> +        .arch = "aarch64",
> +        .tcg_only = true,
> +        .uefi_fl1 = "pc-bios/edk2-aarch64-code.fd",
> +        .uefi_fl2 = "pc-bios/edk2-arm-vars.fd",
> +        .cd = "tests/data/uefi-boot-images/bios-tables-test.aarch64.iso.qcow2",
> +        .ram_start = 0x40000000ULL,
> +        .scan_len = 256ULL * MiB,
> +        .variant = ".hpoffacpiindex",
> +    };
> +
> +   /* turn hotplug off on the pcie-root-port and use static acpi-index*/
> +   test_acpi_one(" -device pcie-root-port,id=pcie.1,chassis=0,"
> +                                          "slot=1,hotplug=off,addr=7.0"
> +                 " -device pci-testdev,bus=pcie.1,acpi-index=12"
> +                 " -cpu cortex-a57",
> +                 &data);
> +
> +    free_test_data(&data);
> +}
> +
>  static void test_acpi_microvm_prepare(test_data *data)
>  {
>      data->machine = "microvm";
> @@ -2602,6 +2650,10 @@ int main(int argc, char *argv[])
>              qtest_add_func("acpi/virt/numamem",
>                             test_acpi_aarch64_virt_tcg_numamem);
>              qtest_add_func("acpi/virt/memhp", test_acpi_aarch64_virt_tcg_memhp);
> +            qtest_add_func("acpi/virt/acpipcihp",
> +                           test_acpi_aarch64_virt_acpi_pci_hotplug);
> +            qtest_add_func("acpi/virt/hpoffacpiindex",
> +                          test_acpi_aarch64_virt_pcie_root_port_hpoff);
>              qtest_add_func("acpi/virt/pxb", test_acpi_aarch64_virt_tcg_pxb);
>              qtest_add_func("acpi/virt/oem-fields",
>                             test_acpi_aarch64_virt_oem_fields);
Re: [PATCH v6 34/36] tests/qtest/bios-tables-test: Add aarch64 ACPI PCI hotplug test
Posted by Eric Auger 4 months ago
Hi Igor,

On 7/11/25 3:47 PM, Igor Mammedov wrote:
> On Tue,  8 Jul 2025 16:23:16 +0200
> Eric Auger <eric.auger@redhat.com> wrote:
>
>> From: Gustavo Romero <gustavo.romero@linaro.org>
>>
>> Add 2 new tests:
>> - test_acpi_aarch64_virt_acpi_pci_hotplug tests the acpi pci hotplug
>>   using -global acpi-ged.acpi-pci-hotplug-with-bridge-support=on
>> - test_acpi_aarch64_virt_pcie_root_port_hpoff tests static-acpi index
>>   on a root port with disabled hotplug
> tests a bit simple, I wonder if we could reuse related x86 variants
> for that (as those test a bit more corner cases with a more complicated
> topology).
> It's not a blocker and doing this of cause can be done on top.

Sure I will work on that on top of this series.

Thanks

Eric
>  
>> Signed-off-by: Gustavo Romero <gustavo.romero@linaro.org>
>> Signed-off-by: Eric Auger <eric.auger@redhat.com>
>> Reviewed-by: Jonathan Cameron <jonathan.cameron@huawei.com>
>>
>> ---
>> v3 -> v4:
>> - add -device pci-testdev for the first test case
>> - fix the chassis
>> - add a test for static acpi-index
>> ---
>>  tests/qtest/bios-tables-test.c | 52 ++++++++++++++++++++++++++++++++++
>>  1 file changed, 52 insertions(+)
>>
>> diff --git a/tests/qtest/bios-tables-test.c b/tests/qtest/bios-tables-test.c
>> index 357bcefd37..1074b8d67a 100644
>> --- a/tests/qtest/bios-tables-test.c
>> +++ b/tests/qtest/bios-tables-test.c
>> @@ -1643,6 +1643,54 @@ static void test_acpi_aarch64_virt_tcg_memhp(void)
>>  
>>  }
>>  
>> +static void test_acpi_aarch64_virt_acpi_pci_hotplug(void)
>> +{
>> +    test_data data = {
>> +        .machine = "virt",
>> +        .arch = "aarch64",
>> +        .tcg_only = true,
>> +        .uefi_fl1 = "pc-bios/edk2-aarch64-code.fd",
>> +        .uefi_fl2 = "pc-bios/edk2-arm-vars.fd",
>> +        .cd = "tests/data/uefi-boot-images/bios-tables-test.aarch64.iso.qcow2",
>> +        .ram_start = 0x40000000ULL,
>> +        .scan_len = 256ULL * MiB,
>> +        .variant = ".acpipcihp",
>> +    };
>> +
>> +   /* Use ACPI PCI Hotplug */
>> +   test_acpi_one(" -global acpi-ged.acpi-pci-hotplug-with-bridge-support=on"
>> +                 " -cpu cortex-a57"
>> +                 " -device pcie-root-port,id=pcie.1,bus=pcie.0,chassis=0,slot=1,addr=7.0"
>> +                 " -device pci-testdev,bus=pcie.1",
>> +                 &data);
>> +
>> +    free_test_data(&data);
>> +}
>> +
>> +static void test_acpi_aarch64_virt_pcie_root_port_hpoff(void)
>> +{
>> +    test_data data = {
>> +        .machine = "virt",
>> +        .arch = "aarch64",
>> +        .tcg_only = true,
>> +        .uefi_fl1 = "pc-bios/edk2-aarch64-code.fd",
>> +        .uefi_fl2 = "pc-bios/edk2-arm-vars.fd",
>> +        .cd = "tests/data/uefi-boot-images/bios-tables-test.aarch64.iso.qcow2",
>> +        .ram_start = 0x40000000ULL,
>> +        .scan_len = 256ULL * MiB,
>> +        .variant = ".hpoffacpiindex",
>> +    };
>> +
>> +   /* turn hotplug off on the pcie-root-port and use static acpi-index*/
>> +   test_acpi_one(" -device pcie-root-port,id=pcie.1,chassis=0,"
>> +                                          "slot=1,hotplug=off,addr=7.0"
>> +                 " -device pci-testdev,bus=pcie.1,acpi-index=12"
>> +                 " -cpu cortex-a57",
>> +                 &data);
>> +
>> +    free_test_data(&data);
>> +}
>> +
>>  static void test_acpi_microvm_prepare(test_data *data)
>>  {
>>      data->machine = "microvm";
>> @@ -2602,6 +2650,10 @@ int main(int argc, char *argv[])
>>              qtest_add_func("acpi/virt/numamem",
>>                             test_acpi_aarch64_virt_tcg_numamem);
>>              qtest_add_func("acpi/virt/memhp", test_acpi_aarch64_virt_tcg_memhp);
>> +            qtest_add_func("acpi/virt/acpipcihp",
>> +                           test_acpi_aarch64_virt_acpi_pci_hotplug);
>> +            qtest_add_func("acpi/virt/hpoffacpiindex",
>> +                          test_acpi_aarch64_virt_pcie_root_port_hpoff);
>>              qtest_add_func("acpi/virt/pxb", test_acpi_aarch64_virt_tcg_pxb);
>>              qtest_add_func("acpi/virt/oem-fields",
>>                             test_acpi_aarch64_virt_oem_fields);