@@ -462,7 +462,7 @@ static void test_query_cpu_model_expansion(const void *data)
assert_has_not_feature(qts, "max", "kvm-no-adjvtime");
assert_has_not_feature(qts, "max", "kvm-steal-time");
- if (g_str_equal(qtest_get_arch(), "aarch64")) {
+ if (qtest_get_arch_bits() == 64) {
assert_has_feature_enabled(qts, "max", "aarch64");
assert_has_feature_enabled(qts, "max", "sve");
assert_has_feature_enabled(qts, "max", "sve128");
@@ -507,7 +507,7 @@ static void test_query_cpu_model_expansion_kvm(const void *data)
assert_set_feature(qts, "host", "kvm-no-adjvtime", true);
assert_set_feature(qts, "host", "kvm-no-adjvtime", false);
- if (g_str_equal(qtest_get_arch(), "aarch64")) {
+ if (qtest_get_arch_bits() == 64) {
bool kvm_supports_steal_time;
bool kvm_supports_sve;
char max_name[8], name[8];
@@ -636,34 +636,31 @@ int main(int argc, char **argv)
NULL, test_query_cpu_model_expansion);
}
- if (!g_str_equal(qtest_get_arch(), "aarch64")) {
- goto out;
- }
-
- /*
- * For now we only run KVM specific tests with AArch64 QEMU in
- * order avoid attempting to run an AArch32 QEMU with KVM on
- * AArch64 hosts. That won't work and isn't easy to detect.
- */
- if (qtest_has_accel("kvm")) {
+ if (qtest_get_arch_bits() == 64) {
/*
- * This tests target the 'host' CPU type, so register it only if
- * KVM is available.
+ * For now we only run KVM specific tests with AArch64 QEMU in
+ * order avoid attempting to run an AArch32 QEMU with KVM on
+ * AArch64 hosts. That won't work and isn't easy to detect.
*/
- qtest_add_data_func("/arm/kvm/query-cpu-model-expansion",
- NULL, test_query_cpu_model_expansion_kvm);
+ if (qtest_has_accel("kvm")) {
+ /*
+ * This tests target the 'host' CPU type, so register it only if
+ * KVM is available.
+ */
+ qtest_add_data_func("/arm/kvm/query-cpu-model-expansion",
+ NULL, test_query_cpu_model_expansion_kvm);
- qtest_add_data_func("/arm/kvm/query-cpu-model-expansion/sve-off",
- NULL, sve_tests_sve_off_kvm);
+ qtest_add_data_func("/arm/kvm/query-cpu-model-expansion/sve-off",
+ NULL, sve_tests_sve_off_kvm);
+ }
+
+ if (qtest_has_accel("tcg")) {
+ qtest_add_data_func("/arm/max/query-cpu-model-expansion/sve-max-vq-8",
+ NULL, sve_tests_sve_max_vq_8);
+ qtest_add_data_func("/arm/max/query-cpu-model-expansion/sve-off",
+ NULL, sve_tests_sve_off);
+ }
}
- if (qtest_has_accel("tcg")) {
- qtest_add_data_func("/arm/max/query-cpu-model-expansion/sve-max-vq-8",
- NULL, sve_tests_sve_max_vq_8);
- qtest_add_data_func("/arm/max/query-cpu-model-expansion/sve-off",
- NULL, sve_tests_sve_off);
- }
-
-out:
return g_test_run();
}
@@ -2089,7 +2089,7 @@ int main(int argc, char *argv[])
qtest_add_func("acpi/piix4/nohpet", test_acpi_piix4_tcg_nohpet);
/* i386 does not support memory hotplug */
- if (strcmp(arch, "i386")) {
+ if (qtest_get_arch_bits() == 64) {
qtest_add_func("acpi/piix4/memhp", test_acpi_piix4_tcg_memhp);
qtest_add_func("acpi/piix4/dimmpxm",
test_acpi_piix4_tcg_dimm_pxm);
@@ -2127,7 +2127,7 @@ int main(int argc, char *argv[])
test_acpi_q35_tcg_acpi_hmat_noinitiator);
/* i386 does not support memory hotplug */
- if (strcmp(arch, "i386")) {
+ if (qtest_get_arch_bits() == 64) {
qtest_add_func("acpi/q35/memhp", test_acpi_q35_tcg_memhp);
qtest_add_func("acpi/q35/dimmpxm", test_acpi_q35_tcg_dimm_pxm);
qtest_add_func("acpi/q35/acpihmat",
@@ -2164,15 +2164,13 @@ int main(int argc, char *argv[])
test_acpi_microvm_ioapic2_tcg);
qtest_add_func("acpi/microvm/oem-fields",
test_acpi_microvm_oem_fields);
- if (has_tcg) {
- if (strcmp(arch, "x86_64") == 0) {
- qtest_add_func("acpi/microvm/pcie",
- test_acpi_microvm_pcie_tcg);
+ if (has_tcg && qtest_get_arch_bits() == 64) {
+ qtest_add_func("acpi/microvm/pcie",
+ test_acpi_microvm_pcie_tcg);
#ifdef CONFIG_POSIX
- qtest_add_func("acpi/microvm/acpierst",
- test_acpi_microvm_acpi_erst);
+ qtest_add_func("acpi/microvm/acpierst",
+ test_acpi_microvm_acpi_erst);
#endif
- }
}
}
} else if (strcmp(arch, "aarch64") == 0) {
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> --- tests/qtest/arm-cpu-features.c | 49 ++++++++++++++++------------------ tests/qtest/bios-tables-test.c | 16 +++++------ 2 files changed, 30 insertions(+), 35 deletions(-)