[PATCH v3 28/29] tests/qtest/bios-tables-test: Add aarch64 ACPI PCI hotplug test

Eric Auger posted 29 patches 5 months ago
Maintainers: "Michael S. Tsirkin" <mst@redhat.com>, Igor Mammedov <imammedo@redhat.com>, Ani Sinha <anisinha@redhat.com>, 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>, Marcel Apfelbaum <marcel.apfelbaum@gmail.com>, Richard Henderson <richard.henderson@linaro.org>
There is a newer version of this series
[PATCH v3 28/29] tests/qtest/bios-tables-test: Add aarch64 ACPI PCI hotplug test
Posted by Eric Auger 5 months ago
From: Gustavo Romero <gustavo.romero@linaro.org>

The test uses -global acpi-ged.acpi-pci-hotplug-with-bridge-support=on
to force the usage of ACPI PCI hotplug.

Signed-off-by: Gustavo Romero <gustavo.romero@linaro.org>
Signed-off-by: Eric Auger <eric.auger@redhat.com>
---
 tests/qtest/bios-tables-test.c | 34 ++++++++++++++++++++++++++++++++++
 1 file changed, 34 insertions(+)

diff --git a/tests/qtest/bios-tables-test.c b/tests/qtest/bios-tables-test.c
index 0b2bdf9d0d..4b9e391eaf 100644
--- a/tests/qtest/bios-tables-test.c
+++ b/tests/qtest/bios-tables-test.c
@@ -1643,6 +1643,38 @@ 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"
+                 /*
+                  * We just pick address=0x04 for the root port to avoid
+                  * collisions with other PCI devices on the root bus (pcie.0).
+                  * It could be any other value that doesn't collide.
+                  *
+                  * The 'chassis' and 'slot' options equal to 1 have no special
+                  * meaning here, could be any integer, but we set them to known
+                  * values to keep the test consistent.
+                  */
+                 " -device pcie-root-port,bus=pcie.0,chassis=1,slot=1,addr=0x04.0x00",
+                 &data);
+
+    free_test_data(&data);
+}
+
 static void test_acpi_microvm_prepare(test_data *data)
 {
     data->machine = "microvm";
@@ -2580,6 +2612,8 @@ 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/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 v3 28/29] tests/qtest/bios-tables-test: Add aarch64 ACPI PCI hotplug test
Posted by Igor Mammedov 4 months, 4 weeks ago
On Mon, 16 Jun 2025 11:46:57 +0200
Eric Auger <eric.auger@redhat.com> wrote:

> From: Gustavo Romero <gustavo.romero@linaro.org>
> 
> The test uses -global acpi-ged.acpi-pci-hotplug-with-bridge-support=on
> to force the usage of ACPI PCI hotplug.
> 
> Signed-off-by: Gustavo Romero <gustavo.romero@linaro.org>
> Signed-off-by: Eric Auger <eric.auger@redhat.com>
> ---
>  tests/qtest/bios-tables-test.c | 34 ++++++++++++++++++++++++++++++++++
>  1 file changed, 34 insertions(+)
> 
> diff --git a/tests/qtest/bios-tables-test.c b/tests/qtest/bios-tables-test.c
> index 0b2bdf9d0d..4b9e391eaf 100644
> --- a/tests/qtest/bios-tables-test.c
> +++ b/tests/qtest/bios-tables-test.c
> @@ -1643,6 +1643,38 @@ 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"
> +                 /*
> +                  * We just pick address=0x04 for the root port to avoid
> +                  * collisions with other PCI devices on the root bus (pcie.0).
> +                  * It could be any other value that doesn't collide.
> +                  *
> +                  * The 'chassis' and 'slot' options equal to 1 have no special
shouldn't be slot be equal to 0 for pcie root ports?

> +                  * meaning here, could be any integer, but we set them to known
> +                  * values to keep the test consistent.
> +                  */
> +                 " -device pcie-root-port,bus=pcie.0,chassis=1,slot=1,addr=0x04.0x00",
> +                 &data);
> +
> +    free_test_data(&data);
> +}
> +
>  static void test_acpi_microvm_prepare(test_data *data)
>  {
>      data->machine = "microvm";
> @@ -2580,6 +2612,8 @@ 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/pxb", test_acpi_aarch64_virt_tcg_pxb);
>              qtest_add_func("acpi/virt/oem-fields",
>                             test_acpi_aarch64_virt_oem_fields);
Re: [PATCH v3 28/29] tests/qtest/bios-tables-test: Add aarch64 ACPI PCI hotplug test
Posted by Jonathan Cameron via 4 months, 4 weeks ago
On Mon, 16 Jun 2025 11:46:57 +0200
Eric Auger <eric.auger@redhat.com> wrote:

> From: Gustavo Romero <gustavo.romero@linaro.org>
> 
> The test uses -global acpi-ged.acpi-pci-hotplug-with-bridge-support=on
> to force the usage of ACPI PCI hotplug.
> 
> Signed-off-by: Gustavo Romero <gustavo.romero@linaro.org>
> Signed-off-by: Eric Auger <eric.auger@redhat.com>

Could we add the necessary (I'm not quite sure what) to trigger the _DSM
creation so EDSM gets used?  I'm not keen on that being dead code
wrt to tests on ARM.

Jonathan



> ---
>  tests/qtest/bios-tables-test.c | 34 ++++++++++++++++++++++++++++++++++
>  1 file changed, 34 insertions(+)
> 
> diff --git a/tests/qtest/bios-tables-test.c b/tests/qtest/bios-tables-test.c
> index 0b2bdf9d0d..4b9e391eaf 100644
> --- a/tests/qtest/bios-tables-test.c
> +++ b/tests/qtest/bios-tables-test.c
> @@ -1643,6 +1643,38 @@ 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"
> +                 /*
> +                  * We just pick address=0x04 for the root port to avoid
> +                  * collisions with other PCI devices on the root bus (pcie.0).
> +                  * It could be any other value that doesn't collide.
> +                  *
> +                  * The 'chassis' and 'slot' options equal to 1 have no special
> +                  * meaning here, could be any integer, but we set them to known
> +                  * values to keep the test consistent.
> +                  */
> +                 " -device pcie-root-port,bus=pcie.0,chassis=1,slot=1,addr=0x04.0x00",
> +                 &data);
> +
> +    free_test_data(&data);
> +}
> +
>  static void test_acpi_microvm_prepare(test_data *data)
>  {
>      data->machine = "microvm";
> @@ -2580,6 +2612,8 @@ 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/pxb", test_acpi_aarch64_virt_tcg_pxb);
>              qtest_add_func("acpi/virt/oem-fields",
>                             test_acpi_aarch64_virt_oem_fields);
Re: [PATCH v3 28/29] tests/qtest/bios-tables-test: Add aarch64 ACPI PCI hotplug test
Posted by Igor Mammedov 4 months, 4 weeks ago
On Fri, 20 Jun 2025 11:40:29 +0100
Jonathan Cameron <Jonathan.Cameron@huawei.com> wrote:

> On Mon, 16 Jun 2025 11:46:57 +0200
> Eric Auger <eric.auger@redhat.com> wrote:
> 
> > From: Gustavo Romero <gustavo.romero@linaro.org>
> > 
> > The test uses -global acpi-ged.acpi-pci-hotplug-with-bridge-support=on
> > to force the usage of ACPI PCI hotplug.
> > 
> > Signed-off-by: Gustavo Romero <gustavo.romero@linaro.org>
> > Signed-off-by: Eric Auger <eric.auger@redhat.com>  
> 
> Could we add the necessary (I'm not quite sure what) to trigger the _DSM
> creation so EDSM gets used?  I'm not keen on that being dead code
> wrt to tests on ARM.

relevant x86 example:

        " -device pcie-root-port,id=nohprp,port=0x0,chassis=2,hotplug=off,"      
                                 "addr=7.0"                                      
        " -device pci-testdev,bus=nohprp,acpi-index=501"  
> 
> Jonathan
> 
> 
> 
> > ---
> >  tests/qtest/bios-tables-test.c | 34 ++++++++++++++++++++++++++++++++++
> >  1 file changed, 34 insertions(+)
> > 
> > diff --git a/tests/qtest/bios-tables-test.c b/tests/qtest/bios-tables-test.c
> > index 0b2bdf9d0d..4b9e391eaf 100644
> > --- a/tests/qtest/bios-tables-test.c
> > +++ b/tests/qtest/bios-tables-test.c
> > @@ -1643,6 +1643,38 @@ 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"
> > +                 /*
> > +                  * We just pick address=0x04 for the root port to avoid
> > +                  * collisions with other PCI devices on the root bus (pcie.0).
> > +                  * It could be any other value that doesn't collide.
> > +                  *
> > +                  * The 'chassis' and 'slot' options equal to 1 have no special
> > +                  * meaning here, could be any integer, but we set them to known
> > +                  * values to keep the test consistent.
> > +                  */
> > +                 " -device pcie-root-port,bus=pcie.0,chassis=1,slot=1,addr=0x04.0x00",
> > +                 &data);
> > +
> > +    free_test_data(&data);
> > +}
> > +
> >  static void test_acpi_microvm_prepare(test_data *data)
> >  {
> >      data->machine = "microvm";
> > @@ -2580,6 +2612,8 @@ 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/pxb", test_acpi_aarch64_virt_tcg_pxb);
> >              qtest_add_func("acpi/virt/oem-fields",
> >                             test_acpi_aarch64_virt_oem_fields);  
>
Re: [PATCH v3 28/29] tests/qtest/bios-tables-test: Add aarch64 ACPI PCI hotplug test
Posted by Eric Auger 4 months, 3 weeks ago

On 6/20/25 3:22 PM, Igor Mammedov wrote:
> On Fri, 20 Jun 2025 11:40:29 +0100
> Jonathan Cameron <Jonathan.Cameron@huawei.com> wrote:
>
>> On Mon, 16 Jun 2025 11:46:57 +0200
>> Eric Auger <eric.auger@redhat.com> wrote:
>>
>>> From: Gustavo Romero <gustavo.romero@linaro.org>
>>>
>>> The test uses -global acpi-ged.acpi-pci-hotplug-with-bridge-support=on
>>> to force the usage of ACPI PCI hotplug.
>>>
>>> Signed-off-by: Gustavo Romero <gustavo.romero@linaro.org>
>>> Signed-off-by: Eric Auger <eric.auger@redhat.com>  
>> Could we add the necessary (I'm not quite sure what) to trigger the _DSM
>> creation so EDSM gets used?  I'm not keen on that being dead code
>> wrt to tests on ARM.
> relevant x86 example:
>
>         " -device pcie-root-port,id=nohprp,port=0x0,chassis=2,hotplug=off,"    
argh. I did not see hotplug=off.

So then static acpi-index also works on ARM. So I will make edsm
independent on acpi pcihp

Sorry for the noise

Eric
>   
>                                  "addr=7.0"                                      
>         " -device pci-testdev,bus=nohprp,acpi-index=501"  
>> Jonathan
>>
>>
>>
>>> ---
>>>  tests/qtest/bios-tables-test.c | 34 ++++++++++++++++++++++++++++++++++
>>>  1 file changed, 34 insertions(+)
>>>
>>> diff --git a/tests/qtest/bios-tables-test.c b/tests/qtest/bios-tables-test.c
>>> index 0b2bdf9d0d..4b9e391eaf 100644
>>> --- a/tests/qtest/bios-tables-test.c
>>> +++ b/tests/qtest/bios-tables-test.c
>>> @@ -1643,6 +1643,38 @@ 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"
>>> +                 /*
>>> +                  * We just pick address=0x04 for the root port to avoid
>>> +                  * collisions with other PCI devices on the root bus (pcie.0).
>>> +                  * It could be any other value that doesn't collide.
>>> +                  *
>>> +                  * The 'chassis' and 'slot' options equal to 1 have no special
>>> +                  * meaning here, could be any integer, but we set them to known
>>> +                  * values to keep the test consistent.
>>> +                  */
>>> +                 " -device pcie-root-port,bus=pcie.0,chassis=1,slot=1,addr=0x04.0x00",
>>> +                 &data);
>>> +
>>> +    free_test_data(&data);
>>> +}
>>> +
>>>  static void test_acpi_microvm_prepare(test_data *data)
>>>  {
>>>      data->machine = "microvm";
>>> @@ -2580,6 +2612,8 @@ 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/pxb", test_acpi_aarch64_virt_tcg_pxb);
>>>              qtest_add_func("acpi/virt/oem-fields",
>>>                             test_acpi_aarch64_virt_oem_fields);