Skip to contentSkip to conversation

tests/acpi: speedup acpi tests

PATCH Superseded Marcel Apfelbaum 5 participants 18 messages Sep 6, 2016 – Sep 22, 2020

v1 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tests/acpi: speedup acpi tests

Use kvm acceleration if available.

---

Hi,

It saves a few seconds so we'll be able to add more tests. I cc-ed Paolo to get his opinion on the correct way to look for the kvm support.

Thanks,
Marcel

 tests/bios-tables-test.c | 51 +++++++++++++++++++++++++++++++-----------------
 1 file changed, 33 insertions(+), 18 deletions(-)
tests/bios-tables-test.c +33 -18
index de4019e..c10b356 100644
@@ -114,6 +114,7 @@ typedef struct {
 
 static const char *disk = "tests/acpi-test-disk.raw";
 static const char *data_dir = "tests/acpi-test-data";
+static bool kvm_enabled;
 #ifdef CONFIG_IASL
 static const char *iasl = stringify(CONFIG_IASL);
 #else
@@ -707,13 +708,15 @@ static void test_smbios_structs(test_data *data)
     }
 }
 
-static void test_acpi_one(const char *params, test_data *data)
+static void test_acpi_one(const char *machine, const char *params,
+                          test_data *data)
 {
     char *args;
 
-    args = g_strdup_printf("-net none -display none %s "
+    args = g_strdup_printf("-machine %s,accel=%s -net none -display none %s "
                            "-drive id=hd0,if=none,file=%s,format=raw "
                            "-device ide-hd,drive=hd0 ",
+                           machine, kvm_enabled ? "kvm" : "tcg",
                            params ? params : "", disk);
 
     qtest_start(args);
@@ -758,7 +761,7 @@ static void test_acpi_piix4_tcg(void)
     data.machine = MACHINE_PC;
     data.required_struct_types = base_required_struct_types;
     data.required_struct_types_len = ARRAY_SIZE(base_required_struct_types);
-    test_acpi_one("-machine accel=tcg", &data);
+    test_acpi_one("pc", NULL, &data);
     free_test_data(&data);
 }
 
@@ -771,7 +774,7 @@ static void test_acpi_piix4_tcg_bridge(void)
     data.variant = ".bridge";
     data.required_struct_types = base_required_struct_types;
     data.required_struct_types_len = ARRAY_SIZE(base_required_struct_types);
-    test_acpi_one("-machine accel=tcg -device pci-bridge,chassis_nr=1", &data);
+    test_acpi_one("pc", "-device pci-bridge,chassis_nr=1", &data);
     free_test_data(&data);
 }
 
@@ -783,7 +786,7 @@ static void test_acpi_q35_tcg(void)
     data.machine = MACHINE_Q35;
     data.required_struct_types = base_required_struct_types;
     data.required_struct_types_len = ARRAY_SIZE(base_required_struct_types);
-    test_acpi_one("-machine q35,accel=tcg", &data);
+    test_acpi_one("q35", NULL, &data);
     free_test_data(&data);
 }
 
@@ -796,7 +799,7 @@ static void test_acpi_q35_tcg_bridge(void)
     data.variant = ".bridge";
     data.required_struct_types = base_required_struct_types;
     data.required_struct_types_len = ARRAY_SIZE(base_required_struct_types);
-    test_acpi_one("-machine q35,accel=tcg -device pci-bridge,chassis_nr=1",
+    test_acpi_one("q35", "-device pci-bridge,chassis_nr=1",
                   &data);
     free_test_data(&data);
 }
@@ -808,7 +811,7 @@ static void test_acpi_piix4_tcg_cphp(void)
     memset(&data, 0, sizeof(data));
     data.machine = MACHINE_PC;
     data.variant = ".cphp";
-    test_acpi_one("-machine accel=tcg"
+    test_acpi_one("pc",
                   " -smp 2,cores=3,sockets=2,maxcpus=6",
                   &data);
     free_test_data(&data);
@@ -821,7 +824,7 @@ static void test_acpi_q35_tcg_cphp(void)
     memset(&data, 0, sizeof(data));
     data.machine = MACHINE_Q35;
     data.variant = ".cphp";
-    test_acpi_one("-machine q35,accel=tcg"
+    test_acpi_one("q35",
                   " -smp 2,cores=3,sockets=2,maxcpus=6",
                   &data);
     free_test_data(&data);
@@ -840,7 +843,7 @@ static void test_acpi_q35_tcg_ipmi(void)
     data.variant = ".ipmibt";
     data.required_struct_types = ipmi_required_struct_types;
     data.required_struct_types_len = ARRAY_SIZE(ipmi_required_struct_types);
-    test_acpi_one("-machine q35,accel=tcg -device ipmi-bmc-sim,id=bmc0"
+    test_acpi_one("q35", "-device ipmi-bmc-sim,id=bmc0"
                   " -device isa-ipmi-bt,bmc=bmc0",
                   &data);
     free_test_data(&data);
@@ -858,12 +861,22 @@ static void test_acpi_piix4_tcg_ipmi(void)
     data.variant = ".ipmikcs";
     data.required_struct_types = ipmi_required_struct_types;
     data.required_struct_types_len = ARRAY_SIZE(ipmi_required_struct_types);
-    test_acpi_one("-machine accel=tcg -device ipmi-bmc-sim,id=bmc0"
+    test_acpi_one("pc", "-device ipmi-bmc-sim,id=bmc0"
                   " -device isa-ipmi-kcs,irq=0,bmc=bmc0",
                   &data);
     free_test_data(&data);
 }
 
+static void check_kvm(void)
+{
+    int fd = qemu_open("/dev/kvm", O_RDWR);
+
+    if (fd > 0) {
+        kvm_enabled = true;
+        qemu_close(fd);
+    }
+}
+
 int main(int argc, char *argv[])
 {
     const char *arch = qtest_get_arch();
@@ -873,17 +886,19 @@ int main(int argc, char *argv[])
     if(ret)
         return ret;
 
+    check_kvm();
+
     g_test_init(&argc, &argv, NULL);
 
     if (strcmp(arch, "i386") == 0 || strcmp(arch, "x86_64") == 0) {
-        qtest_add_func("acpi/piix4/tcg", test_acpi_piix4_tcg);
-        qtest_add_func("acpi/piix4/tcg/bridge", test_acpi_piix4_tcg_bridge);
-        qtest_add_func("acpi/q35/tcg", test_acpi_q35_tcg);
-        qtest_add_func("acpi/q35/tcg/bridge", test_acpi_q35_tcg_bridge);
-        qtest_add_func("acpi/piix4/tcg/ipmi", test_acpi_piix4_tcg_ipmi);
-        qtest_add_func("acpi/q35/tcg/ipmi", test_acpi_q35_tcg_ipmi);
-        qtest_add_func("acpi/piix4/tcg/cpuhp", test_acpi_piix4_tcg_cphp);
-        qtest_add_func("acpi/q35/tcg/cpuhp", test_acpi_q35_tcg_cphp);
+        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/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);
     }
     ret = g_test_run();
     boot_sector_cleanup(disk);
Signature · 1 line
2.5.5
#1 lore raw
Quoted 152 lines · Marcel Apfelbaum

Use kvm acceleration if available.

---

Hi,

It saves a few seconds so we'll be able to add more tests. I cc-ed Paolo to get his opinion on the correct way to look for the kvm support.

Thanks,
Marcel

 tests/bios-tables-test.c | 51 +++++++++++++++++++++++++++++++-----------------
 1 file changed, 33 insertions(+), 18 deletions(-)
tests/bios-tables-test.c +26 -18
index de4019e..c10b356 100644
@@ -114,6 +114,7 @@ typedef struct {
 
 static const char *disk = "tests/acpi-test-disk.raw";
 static const char *data_dir = "tests/acpi-test-data";
+static bool kvm_enabled;
 #ifdef CONFIG_IASL
 static const char *iasl = stringify(CONFIG_IASL);
 #else
@@ -707,13 +708,15 @@ static void test_smbios_structs(test_data *data)
     }
 }
 
-static void test_acpi_one(const char *params, test_data *data)
+static void test_acpi_one(const char *machine, const char *params,
+                          test_data *data)
 {
     char *args;
 
-    args = g_strdup_printf("-net none -display none %s "
+    args = g_strdup_printf("-machine %s,accel=%s -net none -display none %s "
                            "-drive id=hd0,if=none,file=%s,format=raw "
                            "-device ide-hd,drive=hd0 ",
+                           machine, kvm_enabled ? "kvm" : "tcg",
                            params ? params : "", disk);
 
     qtest_start(args);
@@ -758,7 +761,7 @@ static void test_acpi_piix4_tcg(void)
     data.machine = MACHINE_PC;
     data.required_struct_types = base_required_struct_types;
     data.required_struct_types_len = ARRAY_SIZE(base_required_struct_types);
-    test_acpi_one("-machine accel=tcg", &data);
+    test_acpi_one("pc", NULL, &data);
     free_test_data(&data);
 }
 
@@ -771,7 +774,7 @@ static void test_acpi_piix4_tcg_bridge(void)
     data.variant = ".bridge";
     data.required_struct_types = base_required_struct_types;
     data.required_struct_types_len = ARRAY_SIZE(base_required_struct_types);
-    test_acpi_one("-machine accel=tcg -device pci-bridge,chassis_nr=1", &data);
+    test_acpi_one("pc", "-device pci-bridge,chassis_nr=1", &data);
     free_test_data(&data);
 }
 
@@ -783,7 +786,7 @@ static void test_acpi_q35_tcg(void)
     data.machine = MACHINE_Q35;
     data.required_struct_types = base_required_struct_types;
     data.required_struct_types_len = ARRAY_SIZE(base_required_struct_types);
-    test_acpi_one("-machine q35,accel=tcg", &data);
+    test_acpi_one("q35", NULL, &data);
     free_test_data(&data);
 }
 
@@ -796,7 +799,7 @@ static void test_acpi_q35_tcg_bridge(void)
     data.variant = ".bridge";
     data.required_struct_types = base_required_struct_types;
     data.required_struct_types_len = ARRAY_SIZE(base_required_struct_types);
-    test_acpi_one("-machine q35,accel=tcg -device pci-bridge,chassis_nr=1",
+    test_acpi_one("q35", "-device pci-bridge,chassis_nr=1",
                   &data);
     free_test_data(&data);
 }
@@ -808,7 +811,7 @@ static void test_acpi_piix4_tcg_cphp(void)
     memset(&data, 0, sizeof(data));
     data.machine = MACHINE_PC;
     data.variant = ".cphp";
-    test_acpi_one("-machine accel=tcg"
+    test_acpi_one("pc",
                   " -smp 2,cores=3,sockets=2,maxcpus=6",
                   &data);
     free_test_data(&data);
@@ -821,7 +824,7 @@ static void test_acpi_q35_tcg_cphp(void)
     memset(&data, 0, sizeof(data));
     data.machine = MACHINE_Q35;
     data.variant = ".cphp";
-    test_acpi_one("-machine q35,accel=tcg"
+    test_acpi_one("q35",
                   " -smp 2,cores=3,sockets=2,maxcpus=6",
                   &data);
     free_test_data(&data);
@@ -840,7 +843,7 @@ static void test_acpi_q35_tcg_ipmi(void)
     data.variant = ".ipmibt";
     data.required_struct_types = ipmi_required_struct_types;
     data.required_struct_types_len = ARRAY_SIZE(ipmi_required_struct_types);
-    test_acpi_one("-machine q35,accel=tcg -device ipmi-bmc-sim,id=bmc0"
+    test_acpi_one("q35", "-device ipmi-bmc-sim,id=bmc0"
                   " -device isa-ipmi-bt,bmc=bmc0",
                   &data);
     free_test_data(&data);
@@ -858,12 +861,22 @@ static void test_acpi_piix4_tcg_ipmi(void)
     data.variant = ".ipmikcs";
     data.required_struct_types = ipmi_required_struct_types;
     data.required_struct_types_len = ARRAY_SIZE(ipmi_required_struct_types);
-    test_acpi_one("-machine accel=tcg -device ipmi-bmc-sim,id=bmc0"
+    test_acpi_one("pc", "-device ipmi-bmc-sim,id=bmc0"
                   " -device isa-ipmi-kcs,irq=0,bmc=bmc0",
                   &data);
     free_test_data(&data);
 }
 
+static void check_kvm(void)
+{
+    int fd = qemu_open("/dev/kvm", O_RDWR);
+
+    if (fd > 0) {
+        kvm_enabled = true;
+        qemu_close(fd);
+    }
+}
+
 int main(int argc, char *argv[])
 {
     const char *arch = qtest_get_arch();
@@ -873,17 +886,19 @@ int main(int argc, char *argv[])
     if(ret)
         return ret;
 
+    check_kvm();
+
     g_test_init(&argc, &argv, NULL);
 
     if (strcmp(arch, "i386") == 0 || strcmp(arch, "x86_64") == 0) {
-        qtest_add_func("acpi/piix4/tcg", test_acpi_piix4_tcg);
-        qtest_add_func("acpi/piix4/tcg/bridge", test_acpi_piix4_tcg_bridge);
-        qtest_add_func("acpi/q35/tcg", test_acpi_q35_tcg);
-        qtest_add_func("acpi/q35/tcg/bridge", test_acpi_q35_tcg_bridge);
-        qtest_add_func("acpi/piix4/tcg/ipmi", test_acpi_piix4_tcg_ipmi);
-        qtest_add_func("acpi/q35/tcg/ipmi", test_acpi_q35_tcg_ipmi);
-        qtest_add_func("acpi/piix4/tcg/cpuhp", test_acpi_piix4_tcg_cphp);
-        qtest_add_func("acpi/q35/tcg/cpuhp", test_acpi_q35_tcg_cphp);
+        qtest_add_func("acpi/piix4", test_acpi_piix4_tcg);

tests/bios-tables-test.c int main(int argc, char *argv[]) · line 904

Quoted 10 lines
tests/bios-tables-test.c +7 -0
+        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/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);
     }
     ret = g_test_run();
     boot_sector_cleanup(disk);

I think you need to check kvm_allows_irq0_override though.

Quoted 2 lines
Signature · 1 line
2.5.5
#2 lore raw
Quoted 157 lines · Michael S. Tsirkin
Quoted 156 lines · Marcel Apfelbaum

Use kvm acceleration if available.

---

Hi,

It saves a few seconds so we'll be able to add more tests. I cc-ed Paolo to get his opinion on the correct way to look for the kvm support.

Thanks,
Marcel

 tests/bios-tables-test.c | 51 +++++++++++++++++++++++++++++++-----------------
 1 file changed, 33 insertions(+), 18 deletions(-)
tests/bios-tables-test.c +30 -18
index de4019e..c10b356 100644
@@ -114,6 +114,7 @@ typedef struct {
 
 static const char *disk = "tests/acpi-test-disk.raw";
 static const char *data_dir = "tests/acpi-test-data";
+static bool kvm_enabled;
 #ifdef CONFIG_IASL
 static const char *iasl = stringify(CONFIG_IASL);
 #else
@@ -707,13 +708,15 @@ static void test_smbios_structs(test_data *data)
     }
 }
 
-static void test_acpi_one(const char *params, test_data *data)
+static void test_acpi_one(const char *machine, const char *params,
+                          test_data *data)
 {
     char *args;
 
-    args = g_strdup_printf("-net none -display none %s "
+    args = g_strdup_printf("-machine %s,accel=%s -net none -display none %s "
                            "-drive id=hd0,if=none,file=%s,format=raw "
                            "-device ide-hd,drive=hd0 ",
+                           machine, kvm_enabled ? "kvm" : "tcg",
                            params ? params : "", disk);
 
     qtest_start(args);
@@ -758,7 +761,7 @@ static void test_acpi_piix4_tcg(void)
     data.machine = MACHINE_PC;
     data.required_struct_types = base_required_struct_types;
     data.required_struct_types_len = ARRAY_SIZE(base_required_struct_types);
-    test_acpi_one("-machine accel=tcg", &data);
+    test_acpi_one("pc", NULL, &data);
     free_test_data(&data);
 }
 
@@ -771,7 +774,7 @@ static void test_acpi_piix4_tcg_bridge(void)
     data.variant = ".bridge";
     data.required_struct_types = base_required_struct_types;
     data.required_struct_types_len = ARRAY_SIZE(base_required_struct_types);
-    test_acpi_one("-machine accel=tcg -device pci-bridge,chassis_nr=1", &data);
+    test_acpi_one("pc", "-device pci-bridge,chassis_nr=1", &data);
     free_test_data(&data);
 }
 
@@ -783,7 +786,7 @@ static void test_acpi_q35_tcg(void)
     data.machine = MACHINE_Q35;
     data.required_struct_types = base_required_struct_types;
     data.required_struct_types_len = ARRAY_SIZE(base_required_struct_types);
-    test_acpi_one("-machine q35,accel=tcg", &data);
+    test_acpi_one("q35", NULL, &data);
     free_test_data(&data);
 }
 
@@ -796,7 +799,7 @@ static void test_acpi_q35_tcg_bridge(void)
     data.variant = ".bridge";
     data.required_struct_types = base_required_struct_types;
     data.required_struct_types_len = ARRAY_SIZE(base_required_struct_types);
-    test_acpi_one("-machine q35,accel=tcg -device pci-bridge,chassis_nr=1",
+    test_acpi_one("q35", "-device pci-bridge,chassis_nr=1",
                   &data);
     free_test_data(&data);
 }
@@ -808,7 +811,7 @@ static void test_acpi_piix4_tcg_cphp(void)
     memset(&data, 0, sizeof(data));
     data.machine = MACHINE_PC;
     data.variant = ".cphp";
-    test_acpi_one("-machine accel=tcg"
+    test_acpi_one("pc",
                   " -smp 2,cores=3,sockets=2,maxcpus=6",
                   &data);
     free_test_data(&data);
@@ -821,7 +824,7 @@ static void test_acpi_q35_tcg_cphp(void)
     memset(&data, 0, sizeof(data));
     data.machine = MACHINE_Q35;
     data.variant = ".cphp";
-    test_acpi_one("-machine q35,accel=tcg"
+    test_acpi_one("q35",
                   " -smp 2,cores=3,sockets=2,maxcpus=6",
                   &data);
     free_test_data(&data);
@@ -840,7 +843,7 @@ static void test_acpi_q35_tcg_ipmi(void)
     data.variant = ".ipmibt";
     data.required_struct_types = ipmi_required_struct_types;
     data.required_struct_types_len = ARRAY_SIZE(ipmi_required_struct_types);
-    test_acpi_one("-machine q35,accel=tcg -device ipmi-bmc-sim,id=bmc0"
+    test_acpi_one("q35", "-device ipmi-bmc-sim,id=bmc0"
                   " -device isa-ipmi-bt,bmc=bmc0",
                   &data);
     free_test_data(&data);
@@ -858,12 +861,22 @@ static void test_acpi_piix4_tcg_ipmi(void)
     data.variant = ".ipmikcs";
     data.required_struct_types = ipmi_required_struct_types;
     data.required_struct_types_len = ARRAY_SIZE(ipmi_required_struct_types);
-    test_acpi_one("-machine accel=tcg -device ipmi-bmc-sim,id=bmc0"
+    test_acpi_one("pc", "-device ipmi-bmc-sim,id=bmc0"
                   " -device isa-ipmi-kcs,irq=0,bmc=bmc0",
                   &data);
     free_test_data(&data);
 }
 
+static void check_kvm(void)
+{
+    int fd = qemu_open("/dev/kvm", O_RDWR);
+
+    if (fd > 0) {
+        kvm_enabled = true;
+        qemu_close(fd);
+    }
+}
+
 int main(int argc, char *argv[])
 {
     const char *arch = qtest_get_arch();
@@ -873,17 +886,19 @@ int main(int argc, char *argv[])
     if(ret)
         return ret;
 
+    check_kvm();
+
     g_test_init(&argc, &argv, NULL);
 
     if (strcmp(arch, "i386") == 0 || strcmp(arch, "x86_64") == 0) {
-        qtest_add_func("acpi/piix4/tcg", test_acpi_piix4_tcg);
-        qtest_add_func("acpi/piix4/tcg/bridge", test_acpi_piix4_tcg_bridge);
-        qtest_add_func("acpi/q35/tcg", test_acpi_q35_tcg);
-        qtest_add_func("acpi/q35/tcg/bridge", test_acpi_q35_tcg_bridge);
-        qtest_add_func("acpi/piix4/tcg/ipmi", test_acpi_piix4_tcg_ipmi);
-        qtest_add_func("acpi/q35/tcg/ipmi", test_acpi_q35_tcg_ipmi);
-        qtest_add_func("acpi/piix4/tcg/cpuhp", test_acpi_piix4_tcg_cphp);
-        qtest_add_func("acpi/q35/tcg/cpuhp", test_acpi_q35_tcg_cphp);
+        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/piix4/ipmi", test_acpi_piix4_tcg_ipmi);
Quoted 9 lines

tests/bios-tables-test.c int main(int argc, char *argv[]) · line 904

Quoted 6 lines
tests/bios-tables-test.c +3 -0
+        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);
     }
     ret = g_test_run();
     boot_sector_cleanup(disk);

I think you need to check kvm_allows_irq0_override though.

Do you mean we should check both:
- we can use the /dev/kvm device
- the kvm_allows_irq0_override is true?

Thanks,
Marcel

Quoted 2 lines
Quoted 2 lines

--
2.5.5

#3 lore raw
In reply to Marcel Apfelbaum
Quoted 30 lines · Marcel Apfelbaum

Use kvm acceleration if available.

---

Hi,

It saves a few seconds so we'll be able to add more tests. I cc-ed Paolo to get his opinion on the correct way to look for the kvm support.

Thanks,
Marcel

 tests/bios-tables-test.c | 51 +++++++++++++++++++++++++++++++-----------------
 1 file changed, 33 insertions(+), 18 deletions(-)
tests/bios-tables-test.c +1 -0
index de4019e..c10b356 100644
@@ -114,6 +114,7 @@ typedef struct {
 
 static const char *disk = "tests/acpi-test-disk.raw";
 static const char *data_dir = "tests/acpi-test-data";
+static bool kvm_enabled;
 #ifdef CONFIG_IASL
 static const char *iasl = stringify(CONFIG_IASL);
 #else

tests/bios-tables-test.c static void test_smbios_structs(test_data *data) · line 712

Quoted 6 lines
tests/bios-tables-test.c +2 -1
@@ -707,13 +708,15 @@ static void test_smbios_structs(test_data *data)
     }
 }
 
-static void test_acpi_one(const char *params, test_data *data)
+static void test_acpi_one(const char *machine, const char *params,
+                          test_data *data)

We don't need to pass the machine parameter since is part of test_data structure.

Will be fixed in V2.

Thanks,
Marcel

Quoted 127 lines
tests/bios-tables-test.c +30 -17
 {
     char *args;
 
-    args = g_strdup_printf("-net none -display none %s "
+    args = g_strdup_printf("-machine %s,accel=%s -net none -display none %s "
                            "-drive id=hd0,if=none,file=%s,format=raw "
                            "-device ide-hd,drive=hd0 ",
+                           machine, kvm_enabled ? "kvm" : "tcg",
                            params ? params : "", disk);
 
     qtest_start(args);
@@ -758,7 +761,7 @@ static void test_acpi_piix4_tcg(void)
     data.machine = MACHINE_PC;
     data.required_struct_types = base_required_struct_types;
     data.required_struct_types_len = ARRAY_SIZE(base_required_struct_types);
-    test_acpi_one("-machine accel=tcg", &data);
+    test_acpi_one("pc", NULL, &data);
     free_test_data(&data);
 }
 
@@ -771,7 +774,7 @@ static void test_acpi_piix4_tcg_bridge(void)
     data.variant = ".bridge";
     data.required_struct_types = base_required_struct_types;
     data.required_struct_types_len = ARRAY_SIZE(base_required_struct_types);
-    test_acpi_one("-machine accel=tcg -device pci-bridge,chassis_nr=1", &data);
+    test_acpi_one("pc", "-device pci-bridge,chassis_nr=1", &data);
     free_test_data(&data);
 }
 
@@ -783,7 +786,7 @@ static void test_acpi_q35_tcg(void)
     data.machine = MACHINE_Q35;
     data.required_struct_types = base_required_struct_types;
     data.required_struct_types_len = ARRAY_SIZE(base_required_struct_types);
-    test_acpi_one("-machine q35,accel=tcg", &data);
+    test_acpi_one("q35", NULL, &data);
     free_test_data(&data);
 }
 
@@ -796,7 +799,7 @@ static void test_acpi_q35_tcg_bridge(void)
     data.variant = ".bridge";
     data.required_struct_types = base_required_struct_types;
     data.required_struct_types_len = ARRAY_SIZE(base_required_struct_types);
-    test_acpi_one("-machine q35,accel=tcg -device pci-bridge,chassis_nr=1",
+    test_acpi_one("q35", "-device pci-bridge,chassis_nr=1",
                   &data);
     free_test_data(&data);
 }
@@ -808,7 +811,7 @@ static void test_acpi_piix4_tcg_cphp(void)
     memset(&data, 0, sizeof(data));
     data.machine = MACHINE_PC;
     data.variant = ".cphp";
-    test_acpi_one("-machine accel=tcg"
+    test_acpi_one("pc",
                   " -smp 2,cores=3,sockets=2,maxcpus=6",
                   &data);
     free_test_data(&data);
@@ -821,7 +824,7 @@ static void test_acpi_q35_tcg_cphp(void)
     memset(&data, 0, sizeof(data));
     data.machine = MACHINE_Q35;
     data.variant = ".cphp";
-    test_acpi_one("-machine q35,accel=tcg"
+    test_acpi_one("q35",
                   " -smp 2,cores=3,sockets=2,maxcpus=6",
                   &data);
     free_test_data(&data);
@@ -840,7 +843,7 @@ static void test_acpi_q35_tcg_ipmi(void)
     data.variant = ".ipmibt";
     data.required_struct_types = ipmi_required_struct_types;
     data.required_struct_types_len = ARRAY_SIZE(ipmi_required_struct_types);
-    test_acpi_one("-machine q35,accel=tcg -device ipmi-bmc-sim,id=bmc0"
+    test_acpi_one("q35", "-device ipmi-bmc-sim,id=bmc0"
                   " -device isa-ipmi-bt,bmc=bmc0",
                   &data);
     free_test_data(&data);
@@ -858,12 +861,22 @@ static void test_acpi_piix4_tcg_ipmi(void)
     data.variant = ".ipmikcs";
     data.required_struct_types = ipmi_required_struct_types;
     data.required_struct_types_len = ARRAY_SIZE(ipmi_required_struct_types);
-    test_acpi_one("-machine accel=tcg -device ipmi-bmc-sim,id=bmc0"
+    test_acpi_one("pc", "-device ipmi-bmc-sim,id=bmc0"
                   " -device isa-ipmi-kcs,irq=0,bmc=bmc0",
                   &data);
     free_test_data(&data);
 }
 
+static void check_kvm(void)
+{
+    int fd = qemu_open("/dev/kvm", O_RDWR);
+
+    if (fd > 0) {
+        kvm_enabled = true;
+        qemu_close(fd);
+    }
+}
+
 int main(int argc, char *argv[])
 {
     const char *arch = qtest_get_arch();
@@ -873,17 +886,19 @@ int main(int argc, char *argv[])
     if(ret)
         return ret;
 
+    check_kvm();
+
     g_test_init(&argc, &argv, NULL);
 
     if (strcmp(arch, "i386") == 0 || strcmp(arch, "x86_64") == 0) {
-        qtest_add_func("acpi/piix4/tcg", test_acpi_piix4_tcg);
-        qtest_add_func("acpi/piix4/tcg/bridge", test_acpi_piix4_tcg_bridge);
-        qtest_add_func("acpi/q35/tcg", test_acpi_q35_tcg);
-        qtest_add_func("acpi/q35/tcg/bridge", test_acpi_q35_tcg_bridge);
-        qtest_add_func("acpi/piix4/tcg/ipmi", test_acpi_piix4_tcg_ipmi);
-        qtest_add_func("acpi/q35/tcg/ipmi", test_acpi_q35_tcg_ipmi);
-        qtest_add_func("acpi/piix4/tcg/cpuhp", test_acpi_piix4_tcg_cphp);
-        qtest_add_func("acpi/q35/tcg/cpuhp", test_acpi_q35_tcg_cphp);
+        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/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);
     }
     ret = g_test_run();
     boot_sector_cleanup(disk);
#4 lore raw
In reply to Marcel Apfelbaum
Quoted 10 lines · Marcel Apfelbaum

Use kvm acceleration if available.

---

Hi,

It saves a few seconds so we'll be able to add more tests. I cc-ed Paolo to get his opinion on the correct way to look for the kvm support.

Just use "-machine accel=kvm:tcg" and let QEMU do the hard work. :)

Paolo

Quoted 152 lines

Thanks,
Marcel

 tests/bios-tables-test.c | 51 +++++++++++++++++++++++++++++++-----------------
 1 file changed, 33 insertions(+), 18 deletions(-)
tests/bios-tables-test.c +33 -18
index de4019e..c10b356 100644
@@ -114,6 +114,7 @@ typedef struct {
 
 static const char *disk = "tests/acpi-test-disk.raw";
 static const char *data_dir = "tests/acpi-test-data";
+static bool kvm_enabled;
 #ifdef CONFIG_IASL
 static const char *iasl = stringify(CONFIG_IASL);
 #else
@@ -707,13 +708,15 @@ static void test_smbios_structs(test_data *data)
     }
 }
 
-static void test_acpi_one(const char *params, test_data *data)
+static void test_acpi_one(const char *machine, const char *params,
+                          test_data *data)
 {
     char *args;
 
-    args = g_strdup_printf("-net none -display none %s "
+    args = g_strdup_printf("-machine %s,accel=%s -net none -display none %s "
                            "-drive id=hd0,if=none,file=%s,format=raw "
                            "-device ide-hd,drive=hd0 ",
+                           machine, kvm_enabled ? "kvm" : "tcg",
                            params ? params : "", disk);
 
     qtest_start(args);
@@ -758,7 +761,7 @@ static void test_acpi_piix4_tcg(void)
     data.machine = MACHINE_PC;
     data.required_struct_types = base_required_struct_types;
     data.required_struct_types_len = ARRAY_SIZE(base_required_struct_types);
-    test_acpi_one("-machine accel=tcg", &data);
+    test_acpi_one("pc", NULL, &data);
     free_test_data(&data);
 }
 
@@ -771,7 +774,7 @@ static void test_acpi_piix4_tcg_bridge(void)
     data.variant = ".bridge";
     data.required_struct_types = base_required_struct_types;
     data.required_struct_types_len = ARRAY_SIZE(base_required_struct_types);
-    test_acpi_one("-machine accel=tcg -device pci-bridge,chassis_nr=1", &data);
+    test_acpi_one("pc", "-device pci-bridge,chassis_nr=1", &data);
     free_test_data(&data);
 }
 
@@ -783,7 +786,7 @@ static void test_acpi_q35_tcg(void)
     data.machine = MACHINE_Q35;
     data.required_struct_types = base_required_struct_types;
     data.required_struct_types_len = ARRAY_SIZE(base_required_struct_types);
-    test_acpi_one("-machine q35,accel=tcg", &data);
+    test_acpi_one("q35", NULL, &data);
     free_test_data(&data);
 }
 
@@ -796,7 +799,7 @@ static void test_acpi_q35_tcg_bridge(void)
     data.variant = ".bridge";
     data.required_struct_types = base_required_struct_types;
     data.required_struct_types_len = ARRAY_SIZE(base_required_struct_types);
-    test_acpi_one("-machine q35,accel=tcg -device pci-bridge,chassis_nr=1",
+    test_acpi_one("q35", "-device pci-bridge,chassis_nr=1",
                   &data);
     free_test_data(&data);
 }
@@ -808,7 +811,7 @@ static void test_acpi_piix4_tcg_cphp(void)
     memset(&data, 0, sizeof(data));
     data.machine = MACHINE_PC;
     data.variant = ".cphp";
-    test_acpi_one("-machine accel=tcg"
+    test_acpi_one("pc",
                   " -smp 2,cores=3,sockets=2,maxcpus=6",
                   &data);
     free_test_data(&data);
@@ -821,7 +824,7 @@ static void test_acpi_q35_tcg_cphp(void)
     memset(&data, 0, sizeof(data));
     data.machine = MACHINE_Q35;
     data.variant = ".cphp";
-    test_acpi_one("-machine q35,accel=tcg"
+    test_acpi_one("q35",
                   " -smp 2,cores=3,sockets=2,maxcpus=6",
                   &data);
     free_test_data(&data);
@@ -840,7 +843,7 @@ static void test_acpi_q35_tcg_ipmi(void)
     data.variant = ".ipmibt";
     data.required_struct_types = ipmi_required_struct_types;
     data.required_struct_types_len = ARRAY_SIZE(ipmi_required_struct_types);
-    test_acpi_one("-machine q35,accel=tcg -device ipmi-bmc-sim,id=bmc0"
+    test_acpi_one("q35", "-device ipmi-bmc-sim,id=bmc0"
                   " -device isa-ipmi-bt,bmc=bmc0",
                   &data);
     free_test_data(&data);
@@ -858,12 +861,22 @@ static void test_acpi_piix4_tcg_ipmi(void)
     data.variant = ".ipmikcs";
     data.required_struct_types = ipmi_required_struct_types;
     data.required_struct_types_len = ARRAY_SIZE(ipmi_required_struct_types);
-    test_acpi_one("-machine accel=tcg -device ipmi-bmc-sim,id=bmc0"
+    test_acpi_one("pc", "-device ipmi-bmc-sim,id=bmc0"
                   " -device isa-ipmi-kcs,irq=0,bmc=bmc0",
                   &data);
     free_test_data(&data);
 }
 
+static void check_kvm(void)
+{
+    int fd = qemu_open("/dev/kvm", O_RDWR);
+
+    if (fd > 0) {
+        kvm_enabled = true;
+        qemu_close(fd);
+    }
+}
+
 int main(int argc, char *argv[])
 {
     const char *arch = qtest_get_arch();
@@ -873,17 +886,19 @@ int main(int argc, char *argv[])
     if(ret)
         return ret;
 
+    check_kvm();
+
     g_test_init(&argc, &argv, NULL);
 
     if (strcmp(arch, "i386") == 0 || strcmp(arch, "x86_64") == 0) {
-        qtest_add_func("acpi/piix4/tcg", test_acpi_piix4_tcg);
-        qtest_add_func("acpi/piix4/tcg/bridge", test_acpi_piix4_tcg_bridge);
-        qtest_add_func("acpi/q35/tcg", test_acpi_q35_tcg);
-        qtest_add_func("acpi/q35/tcg/bridge", test_acpi_q35_tcg_bridge);
-        qtest_add_func("acpi/piix4/tcg/ipmi", test_acpi_piix4_tcg_ipmi);
-        qtest_add_func("acpi/q35/tcg/ipmi", test_acpi_q35_tcg_ipmi);
-        qtest_add_func("acpi/piix4/tcg/cpuhp", test_acpi_piix4_tcg_cphp);
-        qtest_add_func("acpi/q35/tcg/cpuhp", test_acpi_q35_tcg_cphp);
+        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/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);
     }
     ret = g_test_run();
     boot_sector_cleanup(disk);
#5 lore raw
Quoted 10 lines · Paolo Bonzini
Quoted 7 lines · Marcel Apfelbaum

Use kvm acceleration if available.

---

Hi,

Quoted 7 lines
Quoted 3 lines

It saves a few seconds so we'll be able to add more tests. I cc-ed Paolo to get his opinion on the correct way to look for the kvm support.

Just use "-machine accel=kvm:tcg" and let QEMU do the hard work. :)

Paolo

Sounds good, but we really need to skip it when gsi capability is not there (and when using kernel irqchip) (because in that case we can't override apic irq0).

Quoted 152 lines
Quoted 152 lines

Thanks,
Marcel

 tests/bios-tables-test.c | 51 +++++++++++++++++++++++++++++++-----------------
 1 file changed, 33 insertions(+), 18 deletions(-)
tests/bios-tables-test.c +33 -18
index de4019e..c10b356 100644
@@ -114,6 +114,7 @@ typedef struct {
 
 static const char *disk = "tests/acpi-test-disk.raw";
 static const char *data_dir = "tests/acpi-test-data";
+static bool kvm_enabled;
 #ifdef CONFIG_IASL
 static const char *iasl = stringify(CONFIG_IASL);
 #else
@@ -707,13 +708,15 @@ static void test_smbios_structs(test_data *data)
     }
 }
 
-static void test_acpi_one(const char *params, test_data *data)
+static void test_acpi_one(const char *machine, const char *params,
+                          test_data *data)
 {
     char *args;
 
-    args = g_strdup_printf("-net none -display none %s "
+    args = g_strdup_printf("-machine %s,accel=%s -net none -display none %s "
                            "-drive id=hd0,if=none,file=%s,format=raw "
                            "-device ide-hd,drive=hd0 ",
+                           machine, kvm_enabled ? "kvm" : "tcg",
                            params ? params : "", disk);
 
     qtest_start(args);
@@ -758,7 +761,7 @@ static void test_acpi_piix4_tcg(void)
     data.machine = MACHINE_PC;
     data.required_struct_types = base_required_struct_types;
     data.required_struct_types_len = ARRAY_SIZE(base_required_struct_types);
-    test_acpi_one("-machine accel=tcg", &data);
+    test_acpi_one("pc", NULL, &data);
     free_test_data(&data);
 }
 
@@ -771,7 +774,7 @@ static void test_acpi_piix4_tcg_bridge(void)
     data.variant = ".bridge";
     data.required_struct_types = base_required_struct_types;
     data.required_struct_types_len = ARRAY_SIZE(base_required_struct_types);
-    test_acpi_one("-machine accel=tcg -device pci-bridge,chassis_nr=1", &data);
+    test_acpi_one("pc", "-device pci-bridge,chassis_nr=1", &data);
     free_test_data(&data);
 }
 
@@ -783,7 +786,7 @@ static void test_acpi_q35_tcg(void)
     data.machine = MACHINE_Q35;
     data.required_struct_types = base_required_struct_types;
     data.required_struct_types_len = ARRAY_SIZE(base_required_struct_types);
-    test_acpi_one("-machine q35,accel=tcg", &data);
+    test_acpi_one("q35", NULL, &data);
     free_test_data(&data);
 }
 
@@ -796,7 +799,7 @@ static void test_acpi_q35_tcg_bridge(void)
     data.variant = ".bridge";
     data.required_struct_types = base_required_struct_types;
     data.required_struct_types_len = ARRAY_SIZE(base_required_struct_types);
-    test_acpi_one("-machine q35,accel=tcg -device pci-bridge,chassis_nr=1",
+    test_acpi_one("q35", "-device pci-bridge,chassis_nr=1",
                   &data);
     free_test_data(&data);
 }
@@ -808,7 +811,7 @@ static void test_acpi_piix4_tcg_cphp(void)
     memset(&data, 0, sizeof(data));
     data.machine = MACHINE_PC;
     data.variant = ".cphp";
-    test_acpi_one("-machine accel=tcg"
+    test_acpi_one("pc",
                   " -smp 2,cores=3,sockets=2,maxcpus=6",
                   &data);
     free_test_data(&data);
@@ -821,7 +824,7 @@ static void test_acpi_q35_tcg_cphp(void)
     memset(&data, 0, sizeof(data));
     data.machine = MACHINE_Q35;
     data.variant = ".cphp";
-    test_acpi_one("-machine q35,accel=tcg"
+    test_acpi_one("q35",
                   " -smp 2,cores=3,sockets=2,maxcpus=6",
                   &data);
     free_test_data(&data);
@@ -840,7 +843,7 @@ static void test_acpi_q35_tcg_ipmi(void)
     data.variant = ".ipmibt";
     data.required_struct_types = ipmi_required_struct_types;
     data.required_struct_types_len = ARRAY_SIZE(ipmi_required_struct_types);
-    test_acpi_one("-machine q35,accel=tcg -device ipmi-bmc-sim,id=bmc0"
+    test_acpi_one("q35", "-device ipmi-bmc-sim,id=bmc0"
                   " -device isa-ipmi-bt,bmc=bmc0",
                   &data);
     free_test_data(&data);
@@ -858,12 +861,22 @@ static void test_acpi_piix4_tcg_ipmi(void)
     data.variant = ".ipmikcs";
     data.required_struct_types = ipmi_required_struct_types;
     data.required_struct_types_len = ARRAY_SIZE(ipmi_required_struct_types);
-    test_acpi_one("-machine accel=tcg -device ipmi-bmc-sim,id=bmc0"
+    test_acpi_one("pc", "-device ipmi-bmc-sim,id=bmc0"
                   " -device isa-ipmi-kcs,irq=0,bmc=bmc0",
                   &data);
     free_test_data(&data);
 }
 
+static void check_kvm(void)
+{
+    int fd = qemu_open("/dev/kvm", O_RDWR);
+
+    if (fd > 0) {
+        kvm_enabled = true;
+        qemu_close(fd);
+    }
+}
+
 int main(int argc, char *argv[])
 {
     const char *arch = qtest_get_arch();
@@ -873,17 +886,19 @@ int main(int argc, char *argv[])
     if(ret)
         return ret;
 
+    check_kvm();
+
     g_test_init(&argc, &argv, NULL);
 
     if (strcmp(arch, "i386") == 0 || strcmp(arch, "x86_64") == 0) {
-        qtest_add_func("acpi/piix4/tcg", test_acpi_piix4_tcg);
-        qtest_add_func("acpi/piix4/tcg/bridge", test_acpi_piix4_tcg_bridge);
-        qtest_add_func("acpi/q35/tcg", test_acpi_q35_tcg);
-        qtest_add_func("acpi/q35/tcg/bridge", test_acpi_q35_tcg_bridge);
-        qtest_add_func("acpi/piix4/tcg/ipmi", test_acpi_piix4_tcg_ipmi);
-        qtest_add_func("acpi/q35/tcg/ipmi", test_acpi_q35_tcg_ipmi);
-        qtest_add_func("acpi/piix4/tcg/cpuhp", test_acpi_piix4_tcg_cphp);
-        qtest_add_func("acpi/q35/tcg/cpuhp", test_acpi_q35_tcg_cphp);
+        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/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);
     }
     ret = g_test_run();
     boot_sector_cleanup(disk);
#17 lore raw
In reply to Paolo Bonzini
Quoted 8 lines · Paolo Bonzini
Quoted 5 lines · Marcel Apfelbaum

Use kvm acceleration if available.

---

Quoted 8 lines
Quoted 5 lines

Hi,

It saves a few seconds so we'll be able to add more tests. I cc-ed Paolo to get his opinion on the correct way to look for the kvm support.

Just use "-machine accel=kvm:tcg" and let QEMU do the hard work. :)

Thanks Paolo,
That is really cool!

Would we still need Michael's kvm_allows_irq0_override check?

Thanks,
Marcel

Quoted 5 lines

Paolo

Quoted 3 lines

Thanks,
Marcel

[...]

#6 lore raw
In reply to Michael S. Tsirkin
Quoted 15 lines · Michael S. Tsirkin
Quoted 14 lines · Paolo Bonzini
Quoted 10 lines · Marcel Apfelbaum

Use kvm acceleration if available.

---

Hi,

It saves a few seconds so we'll be able to add more tests. I cc-ed Paolo to get his opinion on the correct way to look for the kvm support.

Quoted 7 lines
Quoted 3 lines

Just use "-machine accel=kvm:tcg" and let QEMU do the hard work. :)

Paolo

Sounds good, but we really need to skip it when gsi capability is not there (and when using kernel irqchip) (because in that case we can't override apic irq0).

Should it just use -machine kernel_irqchip=false?

Paolo

#7 lore raw
Quoted 22 lines · Paolo Bonzini
Quoted 19 lines · Michael S. Tsirkin
Quoted 17 lines · Paolo Bonzini
Quoted 10 lines · Marcel Apfelbaum

Use kvm acceleration if available.

---

Hi,

It saves a few seconds so we'll be able to add more tests. I cc-ed Paolo to get his opinion on the correct way to look for the kvm support.

Just use "-machine accel=kvm:tcg" and let QEMU do the hard work. :)

Paolo

Quoted 7 lines
Quoted 3 lines

Sounds good, but we really need to skip it when gsi capability is not there (and when using kernel irqchip) (because in that case we can't override apic irq0).

Should it just use -machine kernel_irqchip=false?

Paolo

Well that's not optimal, but still better than tcg I guess. Does it slow us a lot?

Signature · 1 line
MST
#8 lore raw
In reply to Michael S. Tsirkin
Quoted 7 lines · Michael S. Tsirkin
Quoted 3 lines

Just use "-machine accel=kvm:tcg" and let QEMU do the hard work. :)

Paolo

Sounds good, but we really need to skip it when gsi capability is not there (and when using kernel irqchip) (because in that case we can't override apic irq0).

We should just remove support for !kvm_has_gsi_routing on x86. It's been there since November 2008.

Paolo

#10 lore raw
In reply to Michael S. Tsirkin
Quoted 12 lines · Michael S. Tsirkin
Quoted 11 lines · Paolo Bonzini
Quoted 7 lines · Michael S. Tsirkin
Quoted 3 lines

Just use "-machine accel=kvm:tcg" and let QEMU do the hard work. :)

Paolo

Sounds good, but we really need to skip it when gsi capability is not there (and when using kernel irqchip) (because in that case we can't override apic irq0).

Quoted 8 lines
Quoted 4 lines

We should just remove support for !kvm_has_gsi_routing on x86. It's been there since November 2008.

Paolo

Fine by me. Can you post a patch that does this?
This one can be a follow-up, and we can also
drop the conditional handling from acpi-build.

Go ahead and merge Marcel's patch. I can remove kernel_irqchip=off once apic irq0 override is assumed.

Paolo

#9 lore raw
In reply to Paolo Bonzini
Quoted 7 lines · Paolo Bonzini
Quoted 4 lines · Michael S. Tsirkin
Quoted 3 lines

Just use "-machine accel=kvm:tcg" and let QEMU do the hard work. :)

Paolo

Quoted 8 lines
Quoted 3 lines

Sounds good, but we really need to skip it when gsi capability is not there (and when using kernel irqchip) (because in that case we can't override apic irq0).

We should just remove support for !kvm_has_gsi_routing on x86. It's been there since November 2008.

Paolo

Fine by me. Can you post a patch that does this?
This one can be a follow-up, and we can also
drop the conditional handling from acpi-build.

Signature · 1 line
MST
#11 lore raw
In reply to Paolo Bonzini
Quoted 20 lines · Paolo Bonzini
Quoted 17 lines · Michael S. Tsirkin
Quoted 15 lines · Paolo Bonzini
Quoted 7 lines · Michael S. Tsirkin
Quoted 3 lines

Just use "-machine accel=kvm:tcg" and let QEMU do the hard work. :)

Paolo

Sounds good, but we really need to skip it when gsi capability is not there (and when using kernel irqchip) (because in that case we can't override apic irq0).

We should just remove support for !kvm_has_gsi_routing on x86. It's been there since November 2008.

Paolo

Quoted 8 lines
Quoted 3 lines

Fine by me. Can you post a patch that does this?
This one can be a follow-up, and we can also
drop the conditional handling from acpi-build.

Go ahead and merge Marcel's patch. I can remove kernel_irqchip=off once apic irq0 override is assumed.

Paolo

OK

#12 lore raw
In reply to Paolo Bonzini
Quoted 20 lines · Paolo Bonzini
Quoted 17 lines · Michael S. Tsirkin
Quoted 15 lines · Paolo Bonzini
Quoted 7 lines · Michael S. Tsirkin
Quoted 3 lines

Just use "-machine accel=kvm:tcg" and let QEMU do the hard work. :)

Paolo

Sounds good, but we really need to skip it when gsi capability is not there (and when using kernel irqchip) (because in that case we can't override apic irq0).

We should just remove support for !kvm_has_gsi_routing on x86. It's been there since November 2008.

Paolo

Quoted 8 lines
Quoted 3 lines

Fine by me. Can you post a patch that does this?
This one can be a follow-up, and we can also
drop the conditional handling from acpi-build.

Go ahead and merge Marcel's patch. I can remove kernel_irqchip=off once apic irq0 override is assumed.

Paolo

I just noticed that this patch causes warnings:
GTESTER check-qtest-ppc64
"kvm" accelerator not found.
"kvm" accelerator not found.

On x86, when kvm module is removed, there are a bunch of other warnings:
Could not access KVM kernel module: No such file or directory failed to initialize KVM: No such file or directory Back to tcg accelerator.

Signature · 1 line
MST
#13 lore raw
In reply to Paolo Bonzini
Quoted 16 lines · Paolo Bonzini
Quoted 15 lines · Michael S. Tsirkin
Quoted 14 lines · Paolo Bonzini
Quoted 7 lines · Michael S. Tsirkin
Quoted 3 lines

Just use "-machine accel=kvm:tcg" and let QEMU do the hard work. :)

Paolo

Sounds good, but we really need to skip it when gsi capability is not there (and when using kernel irqchip) (because in that case we can't override apic irq0).

We should just remove support for !kvm_has_gsi_routing on x86. It's been there since November 2008.

Quoted 8 lines
Quoted 5 lines
Quoted 1 line

Paolo

Fine by me. Can you post a patch that does this?
This one can be a follow-up, and we can also
drop the conditional handling from acpi-build.

Go ahead and merge Marcel's patch. I can remove kernel_irqchip=off once apic irq0 override is assumed.

[4 years later]

Can we remove it now? I couldn't find out if we can assume kvm_has_gsi_routing() is true everywhere, or just on a few architectures.

Signature · 1 line
Eduardo
#14 lore raw
Quoted 7 lines · Eduardo Habkost
Quoted 2 lines

I can remove kernel_irqchip=off once
apic irq0 override is assumed.

[4 years later]

Can we remove it now? I couldn't find out if we can assume kvm_has_gsi_routing() is true everywhere, or just on a few architectures.

Yes, we can. Other architectures don't matter, what counts is that we can require kvm_has_gsi_routing() == true on x86.

Paolo

#15 lore raw
Quoted 11 lines · Paolo Bonzini
Quoted 7 lines · Eduardo Habkost
Quoted 2 lines

I can remove kernel_irqchip=off once
apic irq0 override is assumed.

[4 years later]

Can we remove it now? I couldn't find out if we can assume kvm_has_gsi_routing() is true everywhere, or just on a few architectures.

Yes, we can. Other architectures don't matter, what counts is that we can require kvm_has_gsi_routing() == true on x86.

Do we have other architectures where we can assume that? I'm in the mood for deleting some code today.

Signature · 1 line
Eduardo
#16 lore raw

Unfortunately my remark on this patch was only for the irq0 override thing, which is x86-specific. I think other architectures still need userspace irqchip in some cases.

Paolo

Il mar 22 set 2020, 19:29 Eduardo Habkost <[email protected]> ha scritto:

Quoted 20 lines · Paolo Bonzini
Quoted 11 lines · Eduardo Habkost
Quoted 7 lines
Quoted 2 lines

I can remove kernel_irqchip=off once
apic irq0 override is assumed.

[4 years later]

Can we remove it now? I couldn't find out if we can assume kvm_has_gsi_routing() is true everywhere, or just on a few architectures.

Yes, we can. Other architectures don't matter, what counts is that we can require kvm_has_gsi_routing() == true on x86.

Do we have other architectures where we can assume that? I'm in the mood for deleting some code today.

--
Eduardo