diff mbox series

[v5,08/10] qtest/bios-tables-test: Make test build-independent from accelerator

Message ID 20210501223638.510712-9-philmd@redhat.com (mailing list archive)
State New, archived
Headers show
Series qtests: Check accelerator available at runtime via QMP 'query-accels' | expand

Commit Message

Philippe Mathieu-Daudé May 1, 2021, 10:36 p.m. UTC
Now than we can probe if the TCG accelerator is available
at runtime with a QMP command, do it once at the beginning
and only register the tests we can run.
We can then replace the #ifdef'ry by an assertion.

Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
 tests/qtest/bios-tables-test.c | 99 ++++++++++++++++++----------------
 1 file changed, 52 insertions(+), 47 deletions(-)

Comments

Igor Mammedov May 3, 2021, 12:36 p.m. UTC | #1
On Sun,  2 May 2021 00:36:36 +0200
Philippe Mathieu-Daudé <philmd@redhat.com> wrote:

> Now than we can probe if the TCG accelerator is available
> at runtime with a QMP command, do it once at the beginning
> and only register the tests we can run.
> We can then replace the #ifdef'ry by an assertion.
> 
> Reviewed-by: Eric Blake <eblake@redhat.com>
> Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> ---
>  tests/qtest/bios-tables-test.c | 99 ++++++++++++++++++----------------
>  1 file changed, 52 insertions(+), 47 deletions(-)
> 
> diff --git a/tests/qtest/bios-tables-test.c b/tests/qtest/bios-tables-test.c
> index 156d4174aa3..a4c7bddf6f3 100644
> --- a/tests/qtest/bios-tables-test.c
> +++ b/tests/qtest/bios-tables-test.c
> @@ -97,6 +97,7 @@ typedef struct {
>      QTestState *qts;
>  } test_data;
>  
> +static bool tcg_accel_available;
>  static char disk[] = "tests/acpi-test-disk-XXXXXX";
>  static const char *data_dir = "tests/data/acpi";
>  #ifdef CONFIG_IASL
> @@ -718,15 +719,11 @@ static void test_acpi_one(const char *params, test_data *data)
>      char *args;
>      bool use_uefi = data->uefi_fl1 && data->uefi_fl2;
>  
> -#ifndef CONFIG_TCG
> -    if (data->tcg_only) {
> -        g_test_skip("TCG disabled, skipping ACPI tcg_only test");
> -        return;
> -    }
> -#endif /* CONFIG_TCG */
> +    assert(!data->tcg_only || tcg_accel_available);
>  
>      args = test_acpi_create_args(data, params, use_uefi);
>      data->qts = qtest_init(args);
> +
stray new line?

>      test_acpi_load_tables(data, use_uefi);
>  
>      if (getenv(ACPI_REBUILD_EXPECTED_AML)) {
> @@ -1504,6 +1501,8 @@ int main(int argc, char *argv[])
>      const char *arch = qtest_get_arch();
>      int ret;
>  
> +    tcg_accel_available = qtest_has_accel("tcg");
> +
>      g_test_init(&argc, &argv, NULL);
>  
>      if (strcmp(arch, "i386") == 0 || strcmp(arch, "x86_64") == 0) {
> @@ -1512,56 +1511,62 @@ int main(int argc, char *argv[])
>              return ret;
>          }
>          qtest_add_func("acpi/q35/oem-fields", test_acpi_oem_fields_q35);
> -        qtest_add_func("acpi/q35/tpm-tis", test_acpi_q35_tcg_tpm_tis);
> -        qtest_add_func("acpi/piix4", test_acpi_piix4_tcg);
>          qtest_add_func("acpi/oem-fields", test_acpi_oem_fields_pc);
> -        qtest_add_func("acpi/piix4/bridge", test_acpi_piix4_tcg_bridge);
> +        qtest_add_func("acpi/microvm/oem-fields", test_acpi_oem_fields_microvm);
>          qtest_add_func("acpi/piix4/pci-hotplug/no_root_hotplug",
>                         test_acpi_piix4_no_root_hotplug);
>          qtest_add_func("acpi/piix4/pci-hotplug/no_bridge_hotplug",
>                         test_acpi_piix4_no_bridge_hotplug);
>          qtest_add_func("acpi/piix4/pci-hotplug/off",
>                         test_acpi_piix4_no_acpi_pci_hotplug);
> -        qtest_add_func("acpi/q35", test_acpi_q35_tcg);
> -        qtest_add_func("acpi/q35/bridge", test_acpi_q35_tcg_bridge);
> -        qtest_add_func("acpi/q35/mmio64", test_acpi_q35_tcg_mmio64);
> -        qtest_add_func("acpi/piix4/ipmi", test_acpi_piix4_tcg_ipmi);
> -        qtest_add_func("acpi/q35/ipmi", test_acpi_q35_tcg_ipmi);
> -        qtest_add_func("acpi/piix4/cpuhp", test_acpi_piix4_tcg_cphp);
> -        qtest_add_func("acpi/q35/cpuhp", test_acpi_q35_tcg_cphp);
> -        qtest_add_func("acpi/piix4/memhp", test_acpi_piix4_tcg_memhp);
> -        qtest_add_func("acpi/q35/memhp", test_acpi_q35_tcg_memhp);
> -        qtest_add_func("acpi/piix4/numamem", test_acpi_piix4_tcg_numamem);
> -        qtest_add_func("acpi/q35/numamem", test_acpi_q35_tcg_numamem);
> -        qtest_add_func("acpi/piix4/nosmm", test_acpi_piix4_tcg_nosmm);
> -        qtest_add_func("acpi/piix4/smm-compat",
> -                       test_acpi_piix4_tcg_smm_compat);
> -        qtest_add_func("acpi/piix4/smm-compat-nosmm",
> -                       test_acpi_piix4_tcg_smm_compat_nosmm);
> -        qtest_add_func("acpi/piix4/nohpet", test_acpi_piix4_tcg_nohpet);
> -        qtest_add_func("acpi/q35/nosmm", test_acpi_q35_tcg_nosmm);
> -        qtest_add_func("acpi/q35/smm-compat",
> -                       test_acpi_q35_tcg_smm_compat);
> -        qtest_add_func("acpi/q35/smm-compat-nosmm",
> -                       test_acpi_q35_tcg_smm_compat_nosmm);
> -        qtest_add_func("acpi/q35/nohpet", test_acpi_q35_tcg_nohpet);
> -        qtest_add_func("acpi/piix4/dimmpxm", test_acpi_piix4_tcg_dimm_pxm);
> -        qtest_add_func("acpi/q35/dimmpxm", test_acpi_q35_tcg_dimm_pxm);
> -        qtest_add_func("acpi/piix4/acpihmat", test_acpi_piix4_tcg_acpi_hmat);
> -        qtest_add_func("acpi/q35/acpihmat", test_acpi_q35_tcg_acpi_hmat);
> -        qtest_add_func("acpi/microvm", test_acpi_microvm_tcg);
> -        qtest_add_func("acpi/microvm/usb", test_acpi_microvm_usb_tcg);
> -        qtest_add_func("acpi/microvm/rtc", test_acpi_microvm_rtc_tcg);
> -        qtest_add_func("acpi/microvm/ioapic2", test_acpi_microvm_ioapic2_tcg);
> -        qtest_add_func("acpi/microvm/oem-fields", test_acpi_oem_fields_microvm);
> -        if (strcmp(arch, "x86_64") == 0) {
> -            qtest_add_func("acpi/microvm/pcie", test_acpi_microvm_pcie_tcg);
> +        if (tcg_accel_available) {

most of this can run without TCG if KVM is available, so why are you limiting it to TCG only
or am I missing something?

> +            qtest_add_func("acpi/q35/tpm-tis", test_acpi_q35_tcg_tpm_tis);
> +            qtest_add_func("acpi/piix4", test_acpi_piix4_tcg);
> +            qtest_add_func("acpi/piix4/bridge", test_acpi_piix4_tcg_bridge);
> +            qtest_add_func("acpi/q35", test_acpi_q35_tcg);
> +            qtest_add_func("acpi/q35/bridge", test_acpi_q35_tcg_bridge);
> +            qtest_add_func("acpi/q35/mmio64", test_acpi_q35_tcg_mmio64);
> +            qtest_add_func("acpi/piix4/ipmi", test_acpi_piix4_tcg_ipmi);
> +            qtest_add_func("acpi/q35/ipmi", test_acpi_q35_tcg_ipmi);
> +            qtest_add_func("acpi/piix4/cpuhp", test_acpi_piix4_tcg_cphp);
> +            qtest_add_func("acpi/q35/cpuhp", test_acpi_q35_tcg_cphp);
> +            qtest_add_func("acpi/piix4/memhp", test_acpi_piix4_tcg_memhp);
> +            qtest_add_func("acpi/q35/memhp", test_acpi_q35_tcg_memhp);
> +            qtest_add_func("acpi/piix4/numamem", test_acpi_piix4_tcg_numamem);
> +            qtest_add_func("acpi/q35/numamem", test_acpi_q35_tcg_numamem);
> +            qtest_add_func("acpi/piix4/nosmm", test_acpi_piix4_tcg_nosmm);
> +            qtest_add_func("acpi/piix4/smm-compat",
> +                           test_acpi_piix4_tcg_smm_compat);
> +            qtest_add_func("acpi/piix4/smm-compat-nosmm",
> +                           test_acpi_piix4_tcg_smm_compat_nosmm);
> +            qtest_add_func("acpi/piix4/nohpet", test_acpi_piix4_tcg_nohpet);
> +            qtest_add_func("acpi/q35/nosmm", test_acpi_q35_tcg_nosmm);
> +            qtest_add_func("acpi/q35/smm-compat",
> +                           test_acpi_q35_tcg_smm_compat);
> +            qtest_add_func("acpi/q35/smm-compat-nosmm",
> +                           test_acpi_q35_tcg_smm_compat_nosmm);
> +            qtest_add_func("acpi/q35/nohpet", test_acpi_q35_tcg_nohpet);
> +            qtest_add_func("acpi/piix4/dimmpxm", test_acpi_piix4_tcg_dimm_pxm);
> +            qtest_add_func("acpi/q35/dimmpxm", test_acpi_q35_tcg_dimm_pxm);
> +            qtest_add_func("acpi/piix4/acpihmat",
> +                           test_acpi_piix4_tcg_acpi_hmat);
> +            qtest_add_func("acpi/q35/acpihmat", test_acpi_q35_tcg_acpi_hmat);
> +            qtest_add_func("acpi/microvm", test_acpi_microvm_tcg);
> +            qtest_add_func("acpi/microvm/usb", test_acpi_microvm_usb_tcg);
> +            qtest_add_func("acpi/microvm/rtc", test_acpi_microvm_rtc_tcg);
> +            qtest_add_func("acpi/microvm/ioapic2",
> +                           test_acpi_microvm_ioapic2_tcg);
> +            if (strcmp(arch, "x86_64") == 0) {
> +                qtest_add_func("acpi/microvm/pcie", test_acpi_microvm_pcie_tcg);
> +            }
>          }
>      } else if (strcmp(arch, "aarch64") == 0) {
> -        qtest_add_func("acpi/virt", test_acpi_virt_tcg);
> -        qtest_add_func("acpi/virt/numamem", test_acpi_virt_tcg_numamem);
> -        qtest_add_func("acpi/virt/memhp", test_acpi_virt_tcg_memhp);
> -        qtest_add_func("acpi/virt/pxb", test_acpi_virt_tcg_pxb);
> +        if (tcg_accel_available) {
> +            qtest_add_func("acpi/virt", test_acpi_virt_tcg);
> +            qtest_add_func("acpi/virt/numamem", test_acpi_virt_tcg_numamem);
> +            qtest_add_func("acpi/virt/memhp", test_acpi_virt_tcg_memhp);
> +            qtest_add_func("acpi/virt/pxb", test_acpi_virt_tcg_pxb);
> +        }
>          qtest_add_func("acpi/virt/oem-fields", test_acpi_oem_fields_virt);
>      }
>      ret = g_test_run();
Philippe Mathieu-Daudé May 3, 2021, 12:44 p.m. UTC | #2
Hi Igor,

On 5/3/21 2:36 PM, Igor Mammedov wrote:
> On Sun,  2 May 2021 00:36:36 +0200
> Philippe Mathieu-Daudé <philmd@redhat.com> wrote:
> 
>> Now than we can probe if the TCG accelerator is available
>> at runtime with a QMP command, do it once at the beginning
>> and only register the tests we can run.
>> We can then replace the #ifdef'ry by an assertion.
>>
>> Reviewed-by: Eric Blake <eblake@redhat.com>
>> Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
>> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
>> ---
>>  tests/qtest/bios-tables-test.c | 99 ++++++++++++++++++----------------
>>  1 file changed, 52 insertions(+), 47 deletions(-)
>>
>> diff --git a/tests/qtest/bios-tables-test.c b/tests/qtest/bios-tables-test.c
>> index 156d4174aa3..a4c7bddf6f3 100644
>> --- a/tests/qtest/bios-tables-test.c
>> +++ b/tests/qtest/bios-tables-test.c
>> @@ -97,6 +97,7 @@ typedef struct {
>>      QTestState *qts;
>>  } test_data;
>>  
>> +static bool tcg_accel_available;
>>  static char disk[] = "tests/acpi-test-disk-XXXXXX";
>>  static const char *data_dir = "tests/data/acpi";
>>  #ifdef CONFIG_IASL
>> @@ -718,15 +719,11 @@ static void test_acpi_one(const char *params, test_data *data)
>>      char *args;
>>      bool use_uefi = data->uefi_fl1 && data->uefi_fl2;
>>  
>> -#ifndef CONFIG_TCG
>> -    if (data->tcg_only) {
>> -        g_test_skip("TCG disabled, skipping ACPI tcg_only test");
>> -        return;
>> -    }
>> -#endif /* CONFIG_TCG */
>> +    assert(!data->tcg_only || tcg_accel_available);
>>  
>>      args = test_acpi_create_args(data, params, use_uefi);
>>      data->qts = qtest_init(args);
>> +
> stray new line?

Oops.

> 
>>      test_acpi_load_tables(data, use_uefi);
>>  
>>      if (getenv(ACPI_REBUILD_EXPECTED_AML)) {
>> @@ -1504,6 +1501,8 @@ int main(int argc, char *argv[])
>>      const char *arch = qtest_get_arch();
>>      int ret;
>>  
>> +    tcg_accel_available = qtest_has_accel("tcg");
>> +
>>      g_test_init(&argc, &argv, NULL);
>>  
>>      if (strcmp(arch, "i386") == 0 || strcmp(arch, "x86_64") == 0) {
>> @@ -1512,56 +1511,62 @@ int main(int argc, char *argv[])
>>              return ret;
>>          }
>>          qtest_add_func("acpi/q35/oem-fields", test_acpi_oem_fields_q35);
>> -        qtest_add_func("acpi/q35/tpm-tis", test_acpi_q35_tcg_tpm_tis);
>> -        qtest_add_func("acpi/piix4", test_acpi_piix4_tcg);
>>          qtest_add_func("acpi/oem-fields", test_acpi_oem_fields_pc);
>> -        qtest_add_func("acpi/piix4/bridge", test_acpi_piix4_tcg_bridge);
>> +        qtest_add_func("acpi/microvm/oem-fields", test_acpi_oem_fields_microvm);
>>          qtest_add_func("acpi/piix4/pci-hotplug/no_root_hotplug",
>>                         test_acpi_piix4_no_root_hotplug);
>>          qtest_add_func("acpi/piix4/pci-hotplug/no_bridge_hotplug",
>>                         test_acpi_piix4_no_bridge_hotplug);
>>          qtest_add_func("acpi/piix4/pci-hotplug/off",
>>                         test_acpi_piix4_no_acpi_pci_hotplug);
>> -        qtest_add_func("acpi/q35", test_acpi_q35_tcg);
>> -        qtest_add_func("acpi/q35/bridge", test_acpi_q35_tcg_bridge);
>> -        qtest_add_func("acpi/q35/mmio64", test_acpi_q35_tcg_mmio64);
>> -        qtest_add_func("acpi/piix4/ipmi", test_acpi_piix4_tcg_ipmi);
>> -        qtest_add_func("acpi/q35/ipmi", test_acpi_q35_tcg_ipmi);
>> -        qtest_add_func("acpi/piix4/cpuhp", test_acpi_piix4_tcg_cphp);
>> -        qtest_add_func("acpi/q35/cpuhp", test_acpi_q35_tcg_cphp);
>> -        qtest_add_func("acpi/piix4/memhp", test_acpi_piix4_tcg_memhp);
>> -        qtest_add_func("acpi/q35/memhp", test_acpi_q35_tcg_memhp);
>> -        qtest_add_func("acpi/piix4/numamem", test_acpi_piix4_tcg_numamem);
>> -        qtest_add_func("acpi/q35/numamem", test_acpi_q35_tcg_numamem);
>> -        qtest_add_func("acpi/piix4/nosmm", test_acpi_piix4_tcg_nosmm);
>> -        qtest_add_func("acpi/piix4/smm-compat",
>> -                       test_acpi_piix4_tcg_smm_compat);
>> -        qtest_add_func("acpi/piix4/smm-compat-nosmm",
>> -                       test_acpi_piix4_tcg_smm_compat_nosmm);
>> -        qtest_add_func("acpi/piix4/nohpet", test_acpi_piix4_tcg_nohpet);
>> -        qtest_add_func("acpi/q35/nosmm", test_acpi_q35_tcg_nosmm);
>> -        qtest_add_func("acpi/q35/smm-compat",
>> -                       test_acpi_q35_tcg_smm_compat);
>> -        qtest_add_func("acpi/q35/smm-compat-nosmm",
>> -                       test_acpi_q35_tcg_smm_compat_nosmm);
>> -        qtest_add_func("acpi/q35/nohpet", test_acpi_q35_tcg_nohpet);
>> -        qtest_add_func("acpi/piix4/dimmpxm", test_acpi_piix4_tcg_dimm_pxm);
>> -        qtest_add_func("acpi/q35/dimmpxm", test_acpi_q35_tcg_dimm_pxm);
>> -        qtest_add_func("acpi/piix4/acpihmat", test_acpi_piix4_tcg_acpi_hmat);
>> -        qtest_add_func("acpi/q35/acpihmat", test_acpi_q35_tcg_acpi_hmat);
>> -        qtest_add_func("acpi/microvm", test_acpi_microvm_tcg);
>> -        qtest_add_func("acpi/microvm/usb", test_acpi_microvm_usb_tcg);
>> -        qtest_add_func("acpi/microvm/rtc", test_acpi_microvm_rtc_tcg);
>> -        qtest_add_func("acpi/microvm/ioapic2", test_acpi_microvm_ioapic2_tcg);
>> -        qtest_add_func("acpi/microvm/oem-fields", test_acpi_oem_fields_microvm);
>> -        if (strcmp(arch, "x86_64") == 0) {
>> -            qtest_add_func("acpi/microvm/pcie", test_acpi_microvm_pcie_tcg);
>> +        if (tcg_accel_available) {
> 
> most of this can run without TCG if KVM is available, so why are you limiting it to TCG only
> or am I missing something?

This patch is a simple API change, these tests are already restricted by
the 'g_test_skip("TCG disabled, skipping ACPI tcg_only test");' call.

If someone is willing to send a patch to have them run without TCG, I'm
fine to rebase my series on top. Else it can also be done on top of my
series. Whichever you prefer, but I'd rather not delay Claudio's work
too long...

> 
>> +            qtest_add_func("acpi/q35/tpm-tis", test_acpi_q35_tcg_tpm_tis);
>> +            qtest_add_func("acpi/piix4", test_acpi_piix4_tcg);
>> +            qtest_add_func("acpi/piix4/bridge", test_acpi_piix4_tcg_bridge);
>> +            qtest_add_func("acpi/q35", test_acpi_q35_tcg);
>> +            qtest_add_func("acpi/q35/bridge", test_acpi_q35_tcg_bridge);
>> +            qtest_add_func("acpi/q35/mmio64", test_acpi_q35_tcg_mmio64);
>> +            qtest_add_func("acpi/piix4/ipmi", test_acpi_piix4_tcg_ipmi);
>> +            qtest_add_func("acpi/q35/ipmi", test_acpi_q35_tcg_ipmi);
>> +            qtest_add_func("acpi/piix4/cpuhp", test_acpi_piix4_tcg_cphp);
>> +            qtest_add_func("acpi/q35/cpuhp", test_acpi_q35_tcg_cphp);
>> +            qtest_add_func("acpi/piix4/memhp", test_acpi_piix4_tcg_memhp);
>> +            qtest_add_func("acpi/q35/memhp", test_acpi_q35_tcg_memhp);
>> +            qtest_add_func("acpi/piix4/numamem", test_acpi_piix4_tcg_numamem);
>> +            qtest_add_func("acpi/q35/numamem", test_acpi_q35_tcg_numamem);
>> +            qtest_add_func("acpi/piix4/nosmm", test_acpi_piix4_tcg_nosmm);
>> +            qtest_add_func("acpi/piix4/smm-compat",
>> +                           test_acpi_piix4_tcg_smm_compat);
>> +            qtest_add_func("acpi/piix4/smm-compat-nosmm",
>> +                           test_acpi_piix4_tcg_smm_compat_nosmm);
>> +            qtest_add_func("acpi/piix4/nohpet", test_acpi_piix4_tcg_nohpet);
>> +            qtest_add_func("acpi/q35/nosmm", test_acpi_q35_tcg_nosmm);
>> +            qtest_add_func("acpi/q35/smm-compat",
>> +                           test_acpi_q35_tcg_smm_compat);
>> +            qtest_add_func("acpi/q35/smm-compat-nosmm",
>> +                           test_acpi_q35_tcg_smm_compat_nosmm);
>> +            qtest_add_func("acpi/q35/nohpet", test_acpi_q35_tcg_nohpet);
>> +            qtest_add_func("acpi/piix4/dimmpxm", test_acpi_piix4_tcg_dimm_pxm);
>> +            qtest_add_func("acpi/q35/dimmpxm", test_acpi_q35_tcg_dimm_pxm);
>> +            qtest_add_func("acpi/piix4/acpihmat",
>> +                           test_acpi_piix4_tcg_acpi_hmat);
>> +            qtest_add_func("acpi/q35/acpihmat", test_acpi_q35_tcg_acpi_hmat);
>> +            qtest_add_func("acpi/microvm", test_acpi_microvm_tcg);
>> +            qtest_add_func("acpi/microvm/usb", test_acpi_microvm_usb_tcg);
>> +            qtest_add_func("acpi/microvm/rtc", test_acpi_microvm_rtc_tcg);
>> +            qtest_add_func("acpi/microvm/ioapic2",
>> +                           test_acpi_microvm_ioapic2_tcg);
>> +            if (strcmp(arch, "x86_64") == 0) {
>> +                qtest_add_func("acpi/microvm/pcie", test_acpi_microvm_pcie_tcg);
>> +            }
>>          }
>>      } else if (strcmp(arch, "aarch64") == 0) {
>> -        qtest_add_func("acpi/virt", test_acpi_virt_tcg);
>> -        qtest_add_func("acpi/virt/numamem", test_acpi_virt_tcg_numamem);
>> -        qtest_add_func("acpi/virt/memhp", test_acpi_virt_tcg_memhp);
>> -        qtest_add_func("acpi/virt/pxb", test_acpi_virt_tcg_pxb);
>> +        if (tcg_accel_available) {
>> +            qtest_add_func("acpi/virt", test_acpi_virt_tcg);
>> +            qtest_add_func("acpi/virt/numamem", test_acpi_virt_tcg_numamem);
>> +            qtest_add_func("acpi/virt/memhp", test_acpi_virt_tcg_memhp);
>> +            qtest_add_func("acpi/virt/pxb", test_acpi_virt_tcg_pxb);
>> +        }
>>          qtest_add_func("acpi/virt/oem-fields", test_acpi_oem_fields_virt);
>>      }
>>      ret = g_test_run();
>
Igor Mammedov May 3, 2021, 4:04 p.m. UTC | #3
On Mon, 3 May 2021 14:44:32 +0200
Philippe Mathieu-Daudé <philmd@redhat.com> wrote:

> Hi Igor,
> 
> On 5/3/21 2:36 PM, Igor Mammedov wrote:
> > On Sun,  2 May 2021 00:36:36 +0200
> > Philippe Mathieu-Daudé <philmd@redhat.com> wrote:
> >   
> >> Now than we can probe if the TCG accelerator is available
> >> at runtime with a QMP command, do it once at the beginning
> >> and only register the tests we can run.
> >> We can then replace the #ifdef'ry by an assertion.
> >>
> >> Reviewed-by: Eric Blake <eblake@redhat.com>
> >> Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
> >> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> >> ---
> >>  tests/qtest/bios-tables-test.c | 99 ++++++++++++++++++----------------
> >>  1 file changed, 52 insertions(+), 47 deletions(-)
> >>
> >> diff --git a/tests/qtest/bios-tables-test.c b/tests/qtest/bios-tables-test.c
> >> index 156d4174aa3..a4c7bddf6f3 100644
> >> --- a/tests/qtest/bios-tables-test.c
> >> +++ b/tests/qtest/bios-tables-test.c
> >> @@ -97,6 +97,7 @@ typedef struct {
> >>      QTestState *qts;
> >>  } test_data;
> >>  
> >> +static bool tcg_accel_available;
> >>  static char disk[] = "tests/acpi-test-disk-XXXXXX";
> >>  static const char *data_dir = "tests/data/acpi";
> >>  #ifdef CONFIG_IASL
> >> @@ -718,15 +719,11 @@ static void test_acpi_one(const char *params, test_data *data)
> >>      char *args;
> >>      bool use_uefi = data->uefi_fl1 && data->uefi_fl2;
> >>  
> >> -#ifndef CONFIG_TCG
> >> -    if (data->tcg_only) {
> >> -        g_test_skip("TCG disabled, skipping ACPI tcg_only test");
> >> -        return;
> >> -    }
> >> -#endif /* CONFIG_TCG */
> >> +    assert(!data->tcg_only || tcg_accel_available);
> >>  
> >>      args = test_acpi_create_args(data, params, use_uefi);
> >>      data->qts = qtest_init(args);
> >> +  
> > stray new line?  
> 
> Oops.
> 
> >   
> >>      test_acpi_load_tables(data, use_uefi);
> >>  
> >>      if (getenv(ACPI_REBUILD_EXPECTED_AML)) {
> >> @@ -1504,6 +1501,8 @@ int main(int argc, char *argv[])
> >>      const char *arch = qtest_get_arch();
> >>      int ret;
> >>  
> >> +    tcg_accel_available = qtest_has_accel("tcg");
> >> +
> >>      g_test_init(&argc, &argv, NULL);
> >>  
> >>      if (strcmp(arch, "i386") == 0 || strcmp(arch, "x86_64") == 0) {
> >> @@ -1512,56 +1511,62 @@ int main(int argc, char *argv[])
> >>              return ret;
> >>          }
> >>          qtest_add_func("acpi/q35/oem-fields", test_acpi_oem_fields_q35);
> >> -        qtest_add_func("acpi/q35/tpm-tis", test_acpi_q35_tcg_tpm_tis);
> >> -        qtest_add_func("acpi/piix4", test_acpi_piix4_tcg);
> >>          qtest_add_func("acpi/oem-fields", test_acpi_oem_fields_pc);
> >> -        qtest_add_func("acpi/piix4/bridge", test_acpi_piix4_tcg_bridge);
> >> +        qtest_add_func("acpi/microvm/oem-fields", test_acpi_oem_fields_microvm);
> >>          qtest_add_func("acpi/piix4/pci-hotplug/no_root_hotplug",
> >>                         test_acpi_piix4_no_root_hotplug);
> >>          qtest_add_func("acpi/piix4/pci-hotplug/no_bridge_hotplug",
> >>                         test_acpi_piix4_no_bridge_hotplug);
> >>          qtest_add_func("acpi/piix4/pci-hotplug/off",
> >>                         test_acpi_piix4_no_acpi_pci_hotplug);
> >> -        qtest_add_func("acpi/q35", test_acpi_q35_tcg);
> >> -        qtest_add_func("acpi/q35/bridge", test_acpi_q35_tcg_bridge);
> >> -        qtest_add_func("acpi/q35/mmio64", test_acpi_q35_tcg_mmio64);
> >> -        qtest_add_func("acpi/piix4/ipmi", test_acpi_piix4_tcg_ipmi);
> >> -        qtest_add_func("acpi/q35/ipmi", test_acpi_q35_tcg_ipmi);
> >> -        qtest_add_func("acpi/piix4/cpuhp", test_acpi_piix4_tcg_cphp);
> >> -        qtest_add_func("acpi/q35/cpuhp", test_acpi_q35_tcg_cphp);
> >> -        qtest_add_func("acpi/piix4/memhp", test_acpi_piix4_tcg_memhp);
> >> -        qtest_add_func("acpi/q35/memhp", test_acpi_q35_tcg_memhp);
> >> -        qtest_add_func("acpi/piix4/numamem", test_acpi_piix4_tcg_numamem);
> >> -        qtest_add_func("acpi/q35/numamem", test_acpi_q35_tcg_numamem);
> >> -        qtest_add_func("acpi/piix4/nosmm", test_acpi_piix4_tcg_nosmm);
> >> -        qtest_add_func("acpi/piix4/smm-compat",
> >> -                       test_acpi_piix4_tcg_smm_compat);
> >> -        qtest_add_func("acpi/piix4/smm-compat-nosmm",
> >> -                       test_acpi_piix4_tcg_smm_compat_nosmm);
> >> -        qtest_add_func("acpi/piix4/nohpet", test_acpi_piix4_tcg_nohpet);
> >> -        qtest_add_func("acpi/q35/nosmm", test_acpi_q35_tcg_nosmm);
> >> -        qtest_add_func("acpi/q35/smm-compat",
> >> -                       test_acpi_q35_tcg_smm_compat);
> >> -        qtest_add_func("acpi/q35/smm-compat-nosmm",
> >> -                       test_acpi_q35_tcg_smm_compat_nosmm);
> >> -        qtest_add_func("acpi/q35/nohpet", test_acpi_q35_tcg_nohpet);
> >> -        qtest_add_func("acpi/piix4/dimmpxm", test_acpi_piix4_tcg_dimm_pxm);
> >> -        qtest_add_func("acpi/q35/dimmpxm", test_acpi_q35_tcg_dimm_pxm);
> >> -        qtest_add_func("acpi/piix4/acpihmat", test_acpi_piix4_tcg_acpi_hmat);
> >> -        qtest_add_func("acpi/q35/acpihmat", test_acpi_q35_tcg_acpi_hmat);
> >> -        qtest_add_func("acpi/microvm", test_acpi_microvm_tcg);
> >> -        qtest_add_func("acpi/microvm/usb", test_acpi_microvm_usb_tcg);
> >> -        qtest_add_func("acpi/microvm/rtc", test_acpi_microvm_rtc_tcg);
> >> -        qtest_add_func("acpi/microvm/ioapic2", test_acpi_microvm_ioapic2_tcg);
> >> -        qtest_add_func("acpi/microvm/oem-fields", test_acpi_oem_fields_microvm);
> >> -        if (strcmp(arch, "x86_64") == 0) {
> >> -            qtest_add_func("acpi/microvm/pcie", test_acpi_microvm_pcie_tcg);
> >> +        if (tcg_accel_available) {  
> > 
> > most of this can run without TCG if KVM is available, so why are you limiting it to TCG only
> > or am I missing something?  
> 
> This patch is a simple API change, these tests are already restricted by
> the 'g_test_skip("TCG disabled, skipping ACPI tcg_only test");' call.
> 


with current code, assume we have TCG compiled out:
 - test_acpi_one() will execute any test that is not marked as tcg_only

with this patch if tcg_accel_available == False,
it will not even register any test under "if (tcg_accel_available) {" branch
and in this patch that includes a bunch of _non_ tcg_only tests.
So tests won't be executed on KVM only build, where previously they were executed just fine.

> If someone is willing to send a patch to have them run without TCG, I'm
> fine to rebase my series on top. Else it can also be done on top of my
> series. Whichever you prefer, but I'd rather not delay Claudio's work
> too long...
> 
> >   
> >> +            qtest_add_func("acpi/q35/tpm-tis", test_acpi_q35_tcg_tpm_tis);
> >> +            qtest_add_func("acpi/piix4", test_acpi_piix4_tcg);
> >> +            qtest_add_func("acpi/piix4/bridge", test_acpi_piix4_tcg_bridge);
> >> +            qtest_add_func("acpi/q35", test_acpi_q35_tcg);
> >> +            qtest_add_func("acpi/q35/bridge", test_acpi_q35_tcg_bridge);
> >> +            qtest_add_func("acpi/q35/mmio64", test_acpi_q35_tcg_mmio64);
> >> +            qtest_add_func("acpi/piix4/ipmi", test_acpi_piix4_tcg_ipmi);
> >> +            qtest_add_func("acpi/q35/ipmi", test_acpi_q35_tcg_ipmi);
> >> +            qtest_add_func("acpi/piix4/cpuhp", test_acpi_piix4_tcg_cphp);
> >> +            qtest_add_func("acpi/q35/cpuhp", test_acpi_q35_tcg_cphp);
> >> +            qtest_add_func("acpi/piix4/memhp", test_acpi_piix4_tcg_memhp);
> >> +            qtest_add_func("acpi/q35/memhp", test_acpi_q35_tcg_memhp);
> >> +            qtest_add_func("acpi/piix4/numamem", test_acpi_piix4_tcg_numamem);
> >> +            qtest_add_func("acpi/q35/numamem", test_acpi_q35_tcg_numamem);
> >> +            qtest_add_func("acpi/piix4/nosmm", test_acpi_piix4_tcg_nosmm);
> >> +            qtest_add_func("acpi/piix4/smm-compat",
> >> +                           test_acpi_piix4_tcg_smm_compat);
> >> +            qtest_add_func("acpi/piix4/smm-compat-nosmm",
> >> +                           test_acpi_piix4_tcg_smm_compat_nosmm);
> >> +            qtest_add_func("acpi/piix4/nohpet", test_acpi_piix4_tcg_nohpet);
> >> +            qtest_add_func("acpi/q35/nosmm", test_acpi_q35_tcg_nosmm);
> >> +            qtest_add_func("acpi/q35/smm-compat",
> >> +                           test_acpi_q35_tcg_smm_compat);
> >> +            qtest_add_func("acpi/q35/smm-compat-nosmm",
> >> +                           test_acpi_q35_tcg_smm_compat_nosmm);
> >> +            qtest_add_func("acpi/q35/nohpet", test_acpi_q35_tcg_nohpet);
> >> +            qtest_add_func("acpi/piix4/dimmpxm", test_acpi_piix4_tcg_dimm_pxm);
> >> +            qtest_add_func("acpi/q35/dimmpxm", test_acpi_q35_tcg_dimm_pxm);
> >> +            qtest_add_func("acpi/piix4/acpihmat",
> >> +                           test_acpi_piix4_tcg_acpi_hmat);
> >> +            qtest_add_func("acpi/q35/acpihmat", test_acpi_q35_tcg_acpi_hmat);
> >> +            qtest_add_func("acpi/microvm", test_acpi_microvm_tcg);
> >> +            qtest_add_func("acpi/microvm/usb", test_acpi_microvm_usb_tcg);
> >> +            qtest_add_func("acpi/microvm/rtc", test_acpi_microvm_rtc_tcg);
> >> +            qtest_add_func("acpi/microvm/ioapic2",
> >> +                           test_acpi_microvm_ioapic2_tcg);
> >> +            if (strcmp(arch, "x86_64") == 0) {
> >> +                qtest_add_func("acpi/microvm/pcie", test_acpi_microvm_pcie_tcg);
> >> +            }
> >>          }
> >>      } else if (strcmp(arch, "aarch64") == 0) {
> >> -        qtest_add_func("acpi/virt", test_acpi_virt_tcg);
> >> -        qtest_add_func("acpi/virt/numamem", test_acpi_virt_tcg_numamem);
> >> -        qtest_add_func("acpi/virt/memhp", test_acpi_virt_tcg_memhp);
> >> -        qtest_add_func("acpi/virt/pxb", test_acpi_virt_tcg_pxb);
> >> +        if (tcg_accel_available) {
> >> +            qtest_add_func("acpi/virt", test_acpi_virt_tcg);
> >> +            qtest_add_func("acpi/virt/numamem", test_acpi_virt_tcg_numamem);
> >> +            qtest_add_func("acpi/virt/memhp", test_acpi_virt_tcg_memhp);
> >> +            qtest_add_func("acpi/virt/pxb", test_acpi_virt_tcg_pxb);
> >> +        }
> >>          qtest_add_func("acpi/virt/oem-fields", test_acpi_oem_fields_virt);
> >>      }
> >>      ret = g_test_run();  
> >   
> 
>
Philippe Mathieu-Daudé May 3, 2021, 4:33 p.m. UTC | #4
On 5/3/21 6:04 PM, Igor Mammedov wrote:
> On Mon, 3 May 2021 14:44:32 +0200
> Philippe Mathieu-Daudé <philmd@redhat.com> wrote:
> 
>> Hi Igor,
>>
>> On 5/3/21 2:36 PM, Igor Mammedov wrote:
>>> On Sun,  2 May 2021 00:36:36 +0200
>>> Philippe Mathieu-Daudé <philmd@redhat.com> wrote:
>>>   
>>>> Now than we can probe if the TCG accelerator is available
>>>> at runtime with a QMP command, do it once at the beginning
>>>> and only register the tests we can run.
>>>> We can then replace the #ifdef'ry by an assertion.
>>>>
>>>> Reviewed-by: Eric Blake <eblake@redhat.com>
>>>> Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
>>>> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
>>>> ---
>>>>  tests/qtest/bios-tables-test.c | 99 ++++++++++++++++++----------------
>>>>  1 file changed, 52 insertions(+), 47 deletions(-)
>>>>
>>>> diff --git a/tests/qtest/bios-tables-test.c b/tests/qtest/bios-tables-test.c
>>>> index 156d4174aa3..a4c7bddf6f3 100644
>>>> --- a/tests/qtest/bios-tables-test.c
>>>> +++ b/tests/qtest/bios-tables-test.c
>>>> @@ -97,6 +97,7 @@ typedef struct {
>>>>      QTestState *qts;
>>>>  } test_data;
>>>>  
>>>> +static bool tcg_accel_available;
>>>>  static char disk[] = "tests/acpi-test-disk-XXXXXX";
>>>>  static const char *data_dir = "tests/data/acpi";
>>>>  #ifdef CONFIG_IASL
>>>> @@ -718,15 +719,11 @@ static void test_acpi_one(const char *params, test_data *data)
>>>>      char *args;
>>>>      bool use_uefi = data->uefi_fl1 && data->uefi_fl2;
>>>>  
>>>> -#ifndef CONFIG_TCG
>>>> -    if (data->tcg_only) {
>>>> -        g_test_skip("TCG disabled, skipping ACPI tcg_only test");
>>>> -        return;
>>>> -    }
>>>> -#endif /* CONFIG_TCG */
>>>> +    assert(!data->tcg_only || tcg_accel_available);
>>>>  
>>>>      args = test_acpi_create_args(data, params, use_uefi);
>>>>      data->qts = qtest_init(args);
>>>> +  
>>> stray new line?  
>>
>> Oops.
>>
>>>   
>>>>      test_acpi_load_tables(data, use_uefi);
>>>>  
>>>>      if (getenv(ACPI_REBUILD_EXPECTED_AML)) {
>>>> @@ -1504,6 +1501,8 @@ int main(int argc, char *argv[])
>>>>      const char *arch = qtest_get_arch();
>>>>      int ret;
>>>>  
>>>> +    tcg_accel_available = qtest_has_accel("tcg");
>>>> +
>>>>      g_test_init(&argc, &argv, NULL);
>>>>  
>>>>      if (strcmp(arch, "i386") == 0 || strcmp(arch, "x86_64") == 0) {
>>>> @@ -1512,56 +1511,62 @@ int main(int argc, char *argv[])
>>>>              return ret;
>>>>          }
>>>>          qtest_add_func("acpi/q35/oem-fields", test_acpi_oem_fields_q35);
>>>> -        qtest_add_func("acpi/q35/tpm-tis", test_acpi_q35_tcg_tpm_tis);
>>>> -        qtest_add_func("acpi/piix4", test_acpi_piix4_tcg);
>>>>          qtest_add_func("acpi/oem-fields", test_acpi_oem_fields_pc);
>>>> -        qtest_add_func("acpi/piix4/bridge", test_acpi_piix4_tcg_bridge);
>>>> +        qtest_add_func("acpi/microvm/oem-fields", test_acpi_oem_fields_microvm);
>>>>          qtest_add_func("acpi/piix4/pci-hotplug/no_root_hotplug",
>>>>                         test_acpi_piix4_no_root_hotplug);
>>>>          qtest_add_func("acpi/piix4/pci-hotplug/no_bridge_hotplug",
>>>>                         test_acpi_piix4_no_bridge_hotplug);
>>>>          qtest_add_func("acpi/piix4/pci-hotplug/off",
>>>>                         test_acpi_piix4_no_acpi_pci_hotplug);
>>>> -        qtest_add_func("acpi/q35", test_acpi_q35_tcg);
>>>> -        qtest_add_func("acpi/q35/bridge", test_acpi_q35_tcg_bridge);
>>>> -        qtest_add_func("acpi/q35/mmio64", test_acpi_q35_tcg_mmio64);
>>>> -        qtest_add_func("acpi/piix4/ipmi", test_acpi_piix4_tcg_ipmi);
>>>> -        qtest_add_func("acpi/q35/ipmi", test_acpi_q35_tcg_ipmi);
>>>> -        qtest_add_func("acpi/piix4/cpuhp", test_acpi_piix4_tcg_cphp);
>>>> -        qtest_add_func("acpi/q35/cpuhp", test_acpi_q35_tcg_cphp);
>>>> -        qtest_add_func("acpi/piix4/memhp", test_acpi_piix4_tcg_memhp);
>>>> -        qtest_add_func("acpi/q35/memhp", test_acpi_q35_tcg_memhp);
>>>> -        qtest_add_func("acpi/piix4/numamem", test_acpi_piix4_tcg_numamem);
>>>> -        qtest_add_func("acpi/q35/numamem", test_acpi_q35_tcg_numamem);
>>>> -        qtest_add_func("acpi/piix4/nosmm", test_acpi_piix4_tcg_nosmm);
>>>> -        qtest_add_func("acpi/piix4/smm-compat",
>>>> -                       test_acpi_piix4_tcg_smm_compat);
>>>> -        qtest_add_func("acpi/piix4/smm-compat-nosmm",
>>>> -                       test_acpi_piix4_tcg_smm_compat_nosmm);
>>>> -        qtest_add_func("acpi/piix4/nohpet", test_acpi_piix4_tcg_nohpet);
>>>> -        qtest_add_func("acpi/q35/nosmm", test_acpi_q35_tcg_nosmm);
>>>> -        qtest_add_func("acpi/q35/smm-compat",
>>>> -                       test_acpi_q35_tcg_smm_compat);
>>>> -        qtest_add_func("acpi/q35/smm-compat-nosmm",
>>>> -                       test_acpi_q35_tcg_smm_compat_nosmm);
>>>> -        qtest_add_func("acpi/q35/nohpet", test_acpi_q35_tcg_nohpet);
>>>> -        qtest_add_func("acpi/piix4/dimmpxm", test_acpi_piix4_tcg_dimm_pxm);
>>>> -        qtest_add_func("acpi/q35/dimmpxm", test_acpi_q35_tcg_dimm_pxm);
>>>> -        qtest_add_func("acpi/piix4/acpihmat", test_acpi_piix4_tcg_acpi_hmat);
>>>> -        qtest_add_func("acpi/q35/acpihmat", test_acpi_q35_tcg_acpi_hmat);
>>>> -        qtest_add_func("acpi/microvm", test_acpi_microvm_tcg);
>>>> -        qtest_add_func("acpi/microvm/usb", test_acpi_microvm_usb_tcg);
>>>> -        qtest_add_func("acpi/microvm/rtc", test_acpi_microvm_rtc_tcg);
>>>> -        qtest_add_func("acpi/microvm/ioapic2", test_acpi_microvm_ioapic2_tcg);
>>>> -        qtest_add_func("acpi/microvm/oem-fields", test_acpi_oem_fields_microvm);
>>>> -        if (strcmp(arch, "x86_64") == 0) {
>>>> -            qtest_add_func("acpi/microvm/pcie", test_acpi_microvm_pcie_tcg);
>>>> +        if (tcg_accel_available) {  
>>>
>>> most of this can run without TCG if KVM is available, so why are you limiting it to TCG only
>>> or am I missing something?  
>>
>> This patch is a simple API change, these tests are already restricted by
>> the 'g_test_skip("TCG disabled, skipping ACPI tcg_only test");' call.
>>
> 
> 
> with current code, assume we have TCG compiled out:
>  - test_acpi_one() will execute any test that is not marked as tcg_only
> 
> with this patch if tcg_accel_available == False,
> it will not even register any test under "if (tcg_accel_available) {" branch
> and in this patch that includes a bunch of _non_ tcg_only tests.
> So tests won't be executed on KVM only build, where previously they were executed just fine.

I guess you refer to the 'data->tcg_only' field, OK, now I understood.
diff mbox series

Patch

diff --git a/tests/qtest/bios-tables-test.c b/tests/qtest/bios-tables-test.c
index 156d4174aa3..a4c7bddf6f3 100644
--- a/tests/qtest/bios-tables-test.c
+++ b/tests/qtest/bios-tables-test.c
@@ -97,6 +97,7 @@  typedef struct {
     QTestState *qts;
 } test_data;
 
+static bool tcg_accel_available;
 static char disk[] = "tests/acpi-test-disk-XXXXXX";
 static const char *data_dir = "tests/data/acpi";
 #ifdef CONFIG_IASL
@@ -718,15 +719,11 @@  static void test_acpi_one(const char *params, test_data *data)
     char *args;
     bool use_uefi = data->uefi_fl1 && data->uefi_fl2;
 
-#ifndef CONFIG_TCG
-    if (data->tcg_only) {
-        g_test_skip("TCG disabled, skipping ACPI tcg_only test");
-        return;
-    }
-#endif /* CONFIG_TCG */
+    assert(!data->tcg_only || tcg_accel_available);
 
     args = test_acpi_create_args(data, params, use_uefi);
     data->qts = qtest_init(args);
+
     test_acpi_load_tables(data, use_uefi);
 
     if (getenv(ACPI_REBUILD_EXPECTED_AML)) {
@@ -1504,6 +1501,8 @@  int main(int argc, char *argv[])
     const char *arch = qtest_get_arch();
     int ret;
 
+    tcg_accel_available = qtest_has_accel("tcg");
+
     g_test_init(&argc, &argv, NULL);
 
     if (strcmp(arch, "i386") == 0 || strcmp(arch, "x86_64") == 0) {
@@ -1512,56 +1511,62 @@  int main(int argc, char *argv[])
             return ret;
         }
         qtest_add_func("acpi/q35/oem-fields", test_acpi_oem_fields_q35);
-        qtest_add_func("acpi/q35/tpm-tis", test_acpi_q35_tcg_tpm_tis);
-        qtest_add_func("acpi/piix4", test_acpi_piix4_tcg);
         qtest_add_func("acpi/oem-fields", test_acpi_oem_fields_pc);
-        qtest_add_func("acpi/piix4/bridge", test_acpi_piix4_tcg_bridge);
+        qtest_add_func("acpi/microvm/oem-fields", test_acpi_oem_fields_microvm);
         qtest_add_func("acpi/piix4/pci-hotplug/no_root_hotplug",
                        test_acpi_piix4_no_root_hotplug);
         qtest_add_func("acpi/piix4/pci-hotplug/no_bridge_hotplug",
                        test_acpi_piix4_no_bridge_hotplug);
         qtest_add_func("acpi/piix4/pci-hotplug/off",
                        test_acpi_piix4_no_acpi_pci_hotplug);
-        qtest_add_func("acpi/q35", test_acpi_q35_tcg);
-        qtest_add_func("acpi/q35/bridge", test_acpi_q35_tcg_bridge);
-        qtest_add_func("acpi/q35/mmio64", test_acpi_q35_tcg_mmio64);
-        qtest_add_func("acpi/piix4/ipmi", test_acpi_piix4_tcg_ipmi);
-        qtest_add_func("acpi/q35/ipmi", test_acpi_q35_tcg_ipmi);
-        qtest_add_func("acpi/piix4/cpuhp", test_acpi_piix4_tcg_cphp);
-        qtest_add_func("acpi/q35/cpuhp", test_acpi_q35_tcg_cphp);
-        qtest_add_func("acpi/piix4/memhp", test_acpi_piix4_tcg_memhp);
-        qtest_add_func("acpi/q35/memhp", test_acpi_q35_tcg_memhp);
-        qtest_add_func("acpi/piix4/numamem", test_acpi_piix4_tcg_numamem);
-        qtest_add_func("acpi/q35/numamem", test_acpi_q35_tcg_numamem);
-        qtest_add_func("acpi/piix4/nosmm", test_acpi_piix4_tcg_nosmm);
-        qtest_add_func("acpi/piix4/smm-compat",
-                       test_acpi_piix4_tcg_smm_compat);
-        qtest_add_func("acpi/piix4/smm-compat-nosmm",
-                       test_acpi_piix4_tcg_smm_compat_nosmm);
-        qtest_add_func("acpi/piix4/nohpet", test_acpi_piix4_tcg_nohpet);
-        qtest_add_func("acpi/q35/nosmm", test_acpi_q35_tcg_nosmm);
-        qtest_add_func("acpi/q35/smm-compat",
-                       test_acpi_q35_tcg_smm_compat);
-        qtest_add_func("acpi/q35/smm-compat-nosmm",
-                       test_acpi_q35_tcg_smm_compat_nosmm);
-        qtest_add_func("acpi/q35/nohpet", test_acpi_q35_tcg_nohpet);
-        qtest_add_func("acpi/piix4/dimmpxm", test_acpi_piix4_tcg_dimm_pxm);
-        qtest_add_func("acpi/q35/dimmpxm", test_acpi_q35_tcg_dimm_pxm);
-        qtest_add_func("acpi/piix4/acpihmat", test_acpi_piix4_tcg_acpi_hmat);
-        qtest_add_func("acpi/q35/acpihmat", test_acpi_q35_tcg_acpi_hmat);
-        qtest_add_func("acpi/microvm", test_acpi_microvm_tcg);
-        qtest_add_func("acpi/microvm/usb", test_acpi_microvm_usb_tcg);
-        qtest_add_func("acpi/microvm/rtc", test_acpi_microvm_rtc_tcg);
-        qtest_add_func("acpi/microvm/ioapic2", test_acpi_microvm_ioapic2_tcg);
-        qtest_add_func("acpi/microvm/oem-fields", test_acpi_oem_fields_microvm);
-        if (strcmp(arch, "x86_64") == 0) {
-            qtest_add_func("acpi/microvm/pcie", test_acpi_microvm_pcie_tcg);
+        if (tcg_accel_available) {
+            qtest_add_func("acpi/q35/tpm-tis", test_acpi_q35_tcg_tpm_tis);
+            qtest_add_func("acpi/piix4", test_acpi_piix4_tcg);
+            qtest_add_func("acpi/piix4/bridge", test_acpi_piix4_tcg_bridge);
+            qtest_add_func("acpi/q35", test_acpi_q35_tcg);
+            qtest_add_func("acpi/q35/bridge", test_acpi_q35_tcg_bridge);
+            qtest_add_func("acpi/q35/mmio64", test_acpi_q35_tcg_mmio64);
+            qtest_add_func("acpi/piix4/ipmi", test_acpi_piix4_tcg_ipmi);
+            qtest_add_func("acpi/q35/ipmi", test_acpi_q35_tcg_ipmi);
+            qtest_add_func("acpi/piix4/cpuhp", test_acpi_piix4_tcg_cphp);
+            qtest_add_func("acpi/q35/cpuhp", test_acpi_q35_tcg_cphp);
+            qtest_add_func("acpi/piix4/memhp", test_acpi_piix4_tcg_memhp);
+            qtest_add_func("acpi/q35/memhp", test_acpi_q35_tcg_memhp);
+            qtest_add_func("acpi/piix4/numamem", test_acpi_piix4_tcg_numamem);
+            qtest_add_func("acpi/q35/numamem", test_acpi_q35_tcg_numamem);
+            qtest_add_func("acpi/piix4/nosmm", test_acpi_piix4_tcg_nosmm);
+            qtest_add_func("acpi/piix4/smm-compat",
+                           test_acpi_piix4_tcg_smm_compat);
+            qtest_add_func("acpi/piix4/smm-compat-nosmm",
+                           test_acpi_piix4_tcg_smm_compat_nosmm);
+            qtest_add_func("acpi/piix4/nohpet", test_acpi_piix4_tcg_nohpet);
+            qtest_add_func("acpi/q35/nosmm", test_acpi_q35_tcg_nosmm);
+            qtest_add_func("acpi/q35/smm-compat",
+                           test_acpi_q35_tcg_smm_compat);
+            qtest_add_func("acpi/q35/smm-compat-nosmm",
+                           test_acpi_q35_tcg_smm_compat_nosmm);
+            qtest_add_func("acpi/q35/nohpet", test_acpi_q35_tcg_nohpet);
+            qtest_add_func("acpi/piix4/dimmpxm", test_acpi_piix4_tcg_dimm_pxm);
+            qtest_add_func("acpi/q35/dimmpxm", test_acpi_q35_tcg_dimm_pxm);
+            qtest_add_func("acpi/piix4/acpihmat",
+                           test_acpi_piix4_tcg_acpi_hmat);
+            qtest_add_func("acpi/q35/acpihmat", test_acpi_q35_tcg_acpi_hmat);
+            qtest_add_func("acpi/microvm", test_acpi_microvm_tcg);
+            qtest_add_func("acpi/microvm/usb", test_acpi_microvm_usb_tcg);
+            qtest_add_func("acpi/microvm/rtc", test_acpi_microvm_rtc_tcg);
+            qtest_add_func("acpi/microvm/ioapic2",
+                           test_acpi_microvm_ioapic2_tcg);
+            if (strcmp(arch, "x86_64") == 0) {
+                qtest_add_func("acpi/microvm/pcie", test_acpi_microvm_pcie_tcg);
+            }
         }
     } else if (strcmp(arch, "aarch64") == 0) {
-        qtest_add_func("acpi/virt", test_acpi_virt_tcg);
-        qtest_add_func("acpi/virt/numamem", test_acpi_virt_tcg_numamem);
-        qtest_add_func("acpi/virt/memhp", test_acpi_virt_tcg_memhp);
-        qtest_add_func("acpi/virt/pxb", test_acpi_virt_tcg_pxb);
+        if (tcg_accel_available) {
+            qtest_add_func("acpi/virt", test_acpi_virt_tcg);
+            qtest_add_func("acpi/virt/numamem", test_acpi_virt_tcg_numamem);
+            qtest_add_func("acpi/virt/memhp", test_acpi_virt_tcg_memhp);
+            qtest_add_func("acpi/virt/pxb", test_acpi_virt_tcg_pxb);
+        }
         qtest_add_func("acpi/virt/oem-fields", test_acpi_oem_fields_virt);
     }
     ret = g_test_run();