qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/4] qtests: Check accelerator available at runtime via QMP 'query-accels'
@ 2021-03-16 17:24 Philippe Mathieu-Daudé
  2021-03-16 17:24 ` [PATCH v2 1/4] accel: Introduce 'query-accels' QMP command Philippe Mathieu-Daudé
                   ` (3 more replies)
  0 siblings, 4 replies; 10+ messages in thread
From: Philippe Mathieu-Daudé @ 2021-03-16 17:24 UTC (permalink / raw)
  To: qemu-devel
  Cc: Laurent Vivier, Thomas Huth, Andrew Jones, Eduardo Habkost,
	Michael S. Tsirkin, Daniel P . Berrangé,
	Richard Henderson, Markus Armbruster, Philippe Mathieu-Daudé,
	qemu-arm, Claudio Fontana, Igor Mammedov, Paolo Bonzini

Hi,

This series aims at having accelerator-independent qtests
by querying a QEMU instance at runtime to check the list
of built-in accelerators.

First we add the 'query-accels' QMP command,
then we add the qtest_has_accel() method to libqtest,
finally we use this new method to allow running
bios-tables-test on KVM-only builds.

Since v1:
- kept over-engineered union (I don't how to do simple enum)
- dropped arm-cpu-features patches for now
- fixed typos (Eric)
- rename qtest_has_accel (Thomas)
- probe accel with machine none previous qtest (Paolo)
- iterate over QAPI enum (Markus)

Eric's suggestion of conditional QAPI didn't worked out,
as accelerator definitions are poisoned.

Please review,

Phil.

Philippe Mathieu-Daudé (4):
  accel: Introduce 'query-accels' QMP command
  tests/qtest: Add qtest_has_accel() method
  qtest/bios-tables-test: Make test build-independent from accelerator
  tests/qtest: Do not restrict bios-tables-test to Aarch64 hosts anymore

 qapi/machine.json              | 55 +++++++++++++++++++
 tests/qtest/libqos/libqtest.h  |  8 +++
 accel/accel-qmp.c              | 49 +++++++++++++++++
 tests/qtest/bios-tables-test.c | 99 ++++++++++++++++++----------------
 tests/qtest/libqtest.c         | 29 ++++++++++
 accel/meson.build              |  2 +-
 tests/qtest/meson.build        |  3 +-
 7 files changed, 195 insertions(+), 50 deletions(-)
 create mode 100644 accel/accel-qmp.c

-- 
2.26.2




^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH v2 1/4] accel: Introduce 'query-accels' QMP command
  2021-03-16 17:24 [PATCH v2 0/4] qtests: Check accelerator available at runtime via QMP 'query-accels' Philippe Mathieu-Daudé
@ 2021-03-16 17:24 ` Philippe Mathieu-Daudé
  2021-03-16 17:29   ` Eric Blake
  2021-03-16 17:24 ` [PATCH v2 2/4] tests/qtest: Add qtest_has_accel() method Philippe Mathieu-Daudé
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 10+ messages in thread
From: Philippe Mathieu-Daudé @ 2021-03-16 17:24 UTC (permalink / raw)
  To: qemu-devel
  Cc: Laurent Vivier, Thomas Huth, Andrew Jones, Eduardo Habkost,
	Michael S. Tsirkin, Daniel P . Berrangé,
	Richard Henderson, Markus Armbruster, Philippe Mathieu-Daudé,
	qemu-arm, Claudio Fontana, Igor Mammedov, Paolo Bonzini

Introduce the 'query-accels' QMP command which returns a list
of built-in accelerator names.

- Accelerator is a QAPI enum of all existing accelerators,

- AcceleratorInfo is a QAPI structure providing accelerator
  specific information. Currently the common structure base
  provides the name of the accelerator, while the specific
  part is empty, but each accelerator can expand it.

- 'query-accels' QMP command returns a list of @AcceleratorInfo

For example on a KVM-only build we get:

    { "execute": "query-accels" }
    {
        "return": [
            {
                "name": "qtest"
            },
            {
                "name": "kvm"
            }
        ]
    }

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
Since v1: 'type' -> 'name' in comments
---
 qapi/machine.json | 55 +++++++++++++++++++++++++++++++++++++++++++++++
 accel/accel-qmp.c | 49 +++++++++++++++++++++++++++++++++++++++++
 accel/meson.build |  2 +-
 3 files changed, 105 insertions(+), 1 deletion(-)
 create mode 100644 accel/accel-qmp.c

diff --git a/qapi/machine.json b/qapi/machine.json
index 330189efe3d..610252fc25c 100644
--- a/qapi/machine.json
+++ b/qapi/machine.json
@@ -1471,3 +1471,58 @@
 ##
 { 'event': 'MEM_UNPLUG_ERROR',
   'data': { 'device': 'str', 'msg': 'str' } }
+
+##
+# @Accelerator:
+#
+# An enumeration of accelerator names.
+#
+# Since: 6.0
+##
+{ 'enum': 'Accelerator',
+  'data': [ { 'name': 'qtest' },
+            { 'name': 'tcg' },
+            { 'name': 'kvm' },
+            { 'name': 'hax' },
+            { 'name': 'hvf' },
+            { 'name': 'whpx' },
+            { 'name': 'xen' } ] }
+
+##
+# @AcceleratorInfo:
+#
+# Accelerator information.
+#
+# @name: The accelerator name.
+#
+# Since: 6.0
+##
+{ 'union': 'AcceleratorInfo',
+  'base': {'name': 'Accelerator'},
+  'discriminator': 'name',
+  'data': { } }
+
+##
+# @query-accels:
+#
+# Get a list of AcceleratorInfo for all built-in accelerators.
+#
+# Returns: a list of @AcceleratorInfo describing each accelerator.
+#
+# Since: 6.0
+#
+# Example:
+#
+# -> { "execute": "query-accels" }
+# <- { "return": [
+#        {
+#            "name": "qtest"
+#        },
+#        {
+#            "name": "kvm"
+#        }
+#    ] }
+#
+##
+{ 'command': 'query-accels',
+  'returns': ['AcceleratorInfo'] }
diff --git a/accel/accel-qmp.c b/accel/accel-qmp.c
new file mode 100644
index 00000000000..426737b3f9a
--- /dev/null
+++ b/accel/accel-qmp.c
@@ -0,0 +1,49 @@
+/*
+ * QEMU accelerators, QMP commands
+ *
+ * Copyright (c) 2021 Red Hat Inc.
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ */
+
+#include "qemu/osdep.h"
+#include "qapi/qapi-commands-machine.h"
+
+static const bool accel_builtin_list[ACCELERATOR__MAX] = {
+    [ACCELERATOR_QTEST] = true,
+#ifdef CONFIG_TCG
+    [ACCELERATOR_TCG] = true,
+#endif
+#ifdef CONFIG_KVM
+    [ACCELERATOR_KVM] = true,
+#endif
+#ifdef CONFIG_HAX
+    [ACCELERATOR_HAX] = true,
+#endif
+#ifdef CONFIG_HVF
+    [ACCELERATOR_HVF] = true,
+#endif
+#ifdef CONFIG_WHPX
+    [ACCELERATOR_WHPX] = true,
+#endif
+#ifdef CONFIG_XEN_BACKEND
+    [ACCELERATOR_XEN] = true,
+#endif
+};
+
+AcceleratorInfoList *qmp_query_accels(Error **errp)
+{
+    AcceleratorInfoList *list = NULL, **tail = &list;
+
+    for (Accelerator accel = 0; accel < ACCELERATOR__MAX; accel++) {
+        if (accel_builtin_list[accel]) {
+            AcceleratorInfo *info = g_new0(AcceleratorInfo, 1);
+
+            info->name = accel;
+
+            QAPI_LIST_APPEND(tail, info);
+        }
+    }
+
+    return list;
+}
diff --git a/accel/meson.build b/accel/meson.build
index b44ba30c864..7a48f6d568d 100644
--- a/accel/meson.build
+++ b/accel/meson.build
@@ -1,4 +1,4 @@
-specific_ss.add(files('accel-common.c'))
+specific_ss.add(files('accel-common.c', 'accel-qmp.c'))
 softmmu_ss.add(files('accel-softmmu.c'))
 user_ss.add(files('accel-user.c'))
 
-- 
2.26.2



^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH v2 2/4] tests/qtest: Add qtest_has_accel() method
  2021-03-16 17:24 [PATCH v2 0/4] qtests: Check accelerator available at runtime via QMP 'query-accels' Philippe Mathieu-Daudé
  2021-03-16 17:24 ` [PATCH v2 1/4] accel: Introduce 'query-accels' QMP command Philippe Mathieu-Daudé
@ 2021-03-16 17:24 ` Philippe Mathieu-Daudé
  2021-03-16 17:31   ` Eric Blake
  2021-03-16 17:24 ` [PATCH v2 3/4] qtest/bios-tables-test: Make test build-independent from accelerator Philippe Mathieu-Daudé
  2021-03-16 17:24 ` [PATCH v2 4/4] tests/qtest: Do not restrict bios-tables-test to Aarch64 hosts anymore Philippe Mathieu-Daudé
  3 siblings, 1 reply; 10+ messages in thread
From: Philippe Mathieu-Daudé @ 2021-03-16 17:24 UTC (permalink / raw)
  To: qemu-devel
  Cc: Laurent Vivier, Thomas Huth, Andrew Jones, Eduardo Habkost,
	Michael S. Tsirkin, Daniel P . Berrangé,
	Richard Henderson, Markus Armbruster, Philippe Mathieu-Daudé,
	qemu-arm, Claudio Fontana, Igor Mammedov, Paolo Bonzini

Introduce the qtest_has_accel() method which allows
to query at runtime if a QEMU instance has an accelerator
built-in.

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
Since v1:
- rename qtest_probe_accel() -> qtest_has_accel()
- run with -machine none before creating QTestState
---
 tests/qtest/libqos/libqtest.h |  8 ++++++++
 tests/qtest/libqtest.c        | 29 +++++++++++++++++++++++++++++
 2 files changed, 37 insertions(+)

diff --git a/tests/qtest/libqos/libqtest.h b/tests/qtest/libqos/libqtest.h
index a68dcd79d44..d80c618c18d 100644
--- a/tests/qtest/libqos/libqtest.h
+++ b/tests/qtest/libqos/libqtest.h
@@ -763,6 +763,14 @@ void qmp_expect_error_and_unref(QDict *rsp, const char *class);
  */
 bool qtest_probe_child(QTestState *s);
 
+/**
+ * qtest_has_accel:
+ * @accel_name: Accelerator name to check for.
+ *
+ * Returns: true if the accelerator is built in.
+ */
+bool qtest_has_accel(const char *accel_name);
+
 /**
  * qtest_set_expected_status:
  * @s: QTestState instance to operate on.
diff --git a/tests/qtest/libqtest.c b/tests/qtest/libqtest.c
index 71e359efcd3..2156b7e3972 100644
--- a/tests/qtest/libqtest.c
+++ b/tests/qtest/libqtest.c
@@ -393,6 +393,35 @@ QTestState *qtest_init_with_serial(const char *extra_args, int *sock_fd)
     return qts;
 }
 
+bool qtest_has_accel(const char *accel_name)
+{
+    bool has_accel = false;
+    QDict *response;
+    QList *accels;
+    QListEntry *accel;
+    QTestState *qts;
+
+    qts = qtest_initf("-accel qtest -machine none");
+    response = qtest_qmp(qts, "{'execute': 'query-accels'}");
+    accels = qdict_get_qlist(response, "return");
+
+    QLIST_FOREACH_ENTRY(accels, accel) {
+        QDict *accel_dict = qobject_to(QDict, qlist_entry_obj(accel));
+        const char *name = qdict_get_str(accel_dict, "name");
+
+        if (g_str_equal(name, accel_name)) {
+            has_accel = true;
+            break;
+        }
+    }
+    qobject_unref(response);
+
+    qtest_quit(qts);
+
+    return has_accel;
+}
+
+
 void qtest_quit(QTestState *s)
 {
     qtest_remove_abrt_handler(s);
-- 
2.26.2



^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH v2 3/4] qtest/bios-tables-test: Make test build-independent from accelerator
  2021-03-16 17:24 [PATCH v2 0/4] qtests: Check accelerator available at runtime via QMP 'query-accels' Philippe Mathieu-Daudé
  2021-03-16 17:24 ` [PATCH v2 1/4] accel: Introduce 'query-accels' QMP command Philippe Mathieu-Daudé
  2021-03-16 17:24 ` [PATCH v2 2/4] tests/qtest: Add qtest_has_accel() method Philippe Mathieu-Daudé
@ 2021-03-16 17:24 ` Philippe Mathieu-Daudé
  2021-03-16 17:32   ` Eric Blake
  2021-03-16 17:24 ` [PATCH v2 4/4] tests/qtest: Do not restrict bios-tables-test to Aarch64 hosts anymore Philippe Mathieu-Daudé
  3 siblings, 1 reply; 10+ messages in thread
From: Philippe Mathieu-Daudé @ 2021-03-16 17:24 UTC (permalink / raw)
  To: qemu-devel
  Cc: Laurent Vivier, Thomas Huth, Andrew Jones, Eduardo Habkost,
	Michael S. Tsirkin, Daniel P . Berrangé,
	Richard Henderson, Markus Armbruster, Philippe Mathieu-Daudé,
	qemu-arm, Claudio Fontana, Igor Mammedov, Paolo Bonzini

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.

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
v2: use global tcg_accel_available, call qtest_has_accel() once
---
 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 e020c83d2a5..52587aeb6b1 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();
-- 
2.26.2



^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH v2 4/4] tests/qtest: Do not restrict bios-tables-test to Aarch64 hosts anymore
  2021-03-16 17:24 [PATCH v2 0/4] qtests: Check accelerator available at runtime via QMP 'query-accels' Philippe Mathieu-Daudé
                   ` (2 preceding siblings ...)
  2021-03-16 17:24 ` [PATCH v2 3/4] qtest/bios-tables-test: Make test build-independent from accelerator Philippe Mathieu-Daudé
@ 2021-03-16 17:24 ` Philippe Mathieu-Daudé
  2021-03-16 17:33   ` Eric Blake
  3 siblings, 1 reply; 10+ messages in thread
From: Philippe Mathieu-Daudé @ 2021-03-16 17:24 UTC (permalink / raw)
  To: qemu-devel
  Cc: Laurent Vivier, Thomas Huth, Andrew Jones, Eduardo Habkost,
	Michael S. Tsirkin, Daniel P . Berrangé,
	Richard Henderson, Markus Armbruster, Philippe Mathieu-Daudé,
	qemu-arm, Claudio Fontana, Igor Mammedov, Paolo Bonzini

Since commit 82bf7ae84ce ("target/arm: Remove KVM support for
32-bit Arm hosts") we can remove the comment / check added in
commit ab6b6a77774 and directly run the bios-tables-test.

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
 tests/qtest/meson.build | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/tests/qtest/meson.build b/tests/qtest/meson.build
index 66ee9fbf450..82e92d33f82 100644
--- a/tests/qtest/meson.build
+++ b/tests/qtest/meson.build
@@ -173,14 +173,13 @@
    'boot-serial-test',
    'hexloader-test']
 
-# TODO: once aarch64 TCG is fixed on ARM 32 bit host, make bios-tables-test unconditional
 qtests_aarch64 = \
-  (cpu != 'arm' ? ['bios-tables-test'] : []) +                                                  \
   (config_all_devices.has_key('CONFIG_TPM_TIS_SYSBUS') ? ['tpm-tis-device-test'] : []) +        \
   (config_all_devices.has_key('CONFIG_TPM_TIS_SYSBUS') ? ['tpm-tis-device-swtpm-test'] : []) +  \
   ['arm-cpu-features',
    'numa-test',
    'boot-serial-test',
+   'bios-tables-test',
    'xlnx-can-test',
    'migration-test']
 
-- 
2.26.2



^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH v2 1/4] accel: Introduce 'query-accels' QMP command
  2021-03-16 17:24 ` [PATCH v2 1/4] accel: Introduce 'query-accels' QMP command Philippe Mathieu-Daudé
@ 2021-03-16 17:29   ` Eric Blake
  2021-03-16 18:00     ` Philippe Mathieu-Daudé
  0 siblings, 1 reply; 10+ messages in thread
From: Eric Blake @ 2021-03-16 17:29 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé, qemu-devel
  Cc: Laurent Vivier, Thomas Huth, Andrew Jones, Eduardo Habkost,
	Michael S. Tsirkin, Daniel P . Berrangé,
	Richard Henderson, Markus Armbruster, qemu-arm, Claudio Fontana,
	Igor Mammedov, Paolo Bonzini

On 3/16/21 12:24 PM, Philippe Mathieu-Daudé wrote:
> Introduce the 'query-accels' QMP command which returns a list
> of built-in accelerator names.
> 
> - Accelerator is a QAPI enum of all existing accelerators,
> 
> - AcceleratorInfo is a QAPI structure providing accelerator
>   specific information. Currently the common structure base
>   provides the name of the accelerator, while the specific
>   part is empty, but each accelerator can expand it.
> 

> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> ---
> Since v1: 'type' -> 'name' in comments
> ---
>  qapi/machine.json | 55 +++++++++++++++++++++++++++++++++++++++++++++++
>  accel/accel-qmp.c | 49 +++++++++++++++++++++++++++++++++++++++++
>  accel/meson.build |  2 +-
>  3 files changed, 105 insertions(+), 1 deletion(-)
>  create mode 100644 accel/accel-qmp.c
> 
> diff --git a/qapi/machine.json b/qapi/machine.json
> index 330189efe3d..610252fc25c 100644
> --- a/qapi/machine.json
> +++ b/qapi/machine.json
> @@ -1471,3 +1471,58 @@
>  ##
>  { 'event': 'MEM_UNPLUG_ERROR',
>    'data': { 'device': 'str', 'msg': 'str' } }
> +
> +##
> +# @Accelerator:
> +#
> +# An enumeration of accelerator names.
> +#
> +# Since: 6.0
> +##
> +{ 'enum': 'Accelerator',
> +  'data': [ { 'name': 'qtest' },
> +            { 'name': 'tcg' },
> +            { 'name': 'kvm' },
> +            { 'name': 'hax' },
> +            { 'name': 'hvf' },
> +            { 'name': 'whpx' },
> +            { 'name': 'xen' } ] }

Shorter, but semantically equivalent:
{ 'enum': 'Accelerator', 'data': [ 'qtest', 'tcg', ... ] }

I'd mention in the commit message body that we can't make the enum
values or union branches conditional because of target-specific
poisoning.  With that,

Reviewed-by: Eric Blake <eblake@redhat.com>

If we're trying to get it into 6.0, it is a new feature, and so we
should get it in a pull request before feature freeze today.  Otherwise
we'll have to s/6.0/6.1/

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3226
Virtualization:  qemu.org | libvirt.org



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH v2 2/4] tests/qtest: Add qtest_has_accel() method
  2021-03-16 17:24 ` [PATCH v2 2/4] tests/qtest: Add qtest_has_accel() method Philippe Mathieu-Daudé
@ 2021-03-16 17:31   ` Eric Blake
  0 siblings, 0 replies; 10+ messages in thread
From: Eric Blake @ 2021-03-16 17:31 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé, qemu-devel
  Cc: Laurent Vivier, Thomas Huth, Andrew Jones, Eduardo Habkost,
	Michael S. Tsirkin, Daniel P . Berrangé,
	Richard Henderson, Markus Armbruster, qemu-arm, Claudio Fontana,
	Igor Mammedov, Paolo Bonzini

On 3/16/21 12:24 PM, Philippe Mathieu-Daudé wrote:
> Introduce the qtest_has_accel() method which allows
> to query at runtime if a QEMU instance has an accelerator

which allows a runtime query on whether a QEMU instance

> built-in.
> 
> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> ---
> Since v1:
> - rename qtest_probe_accel() -> qtest_has_accel()
> - run with -machine none before creating QTestState
> ---
>  tests/qtest/libqos/libqtest.h |  8 ++++++++
>  tests/qtest/libqtest.c        | 29 +++++++++++++++++++++++++++++
>  2 files changed, 37 insertions(+)
> 

Reviewed-by: Eric Blake <eblake@redhat.com>

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3226
Virtualization:  qemu.org | libvirt.org



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH v2 3/4] qtest/bios-tables-test: Make test build-independent from accelerator
  2021-03-16 17:24 ` [PATCH v2 3/4] qtest/bios-tables-test: Make test build-independent from accelerator Philippe Mathieu-Daudé
@ 2021-03-16 17:32   ` Eric Blake
  0 siblings, 0 replies; 10+ messages in thread
From: Eric Blake @ 2021-03-16 17:32 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé, qemu-devel
  Cc: Laurent Vivier, Thomas Huth, Andrew Jones, Eduardo Habkost,
	Michael S. Tsirkin, Daniel P . Berrangé,
	Richard Henderson, Markus Armbruster, qemu-arm, Claudio Fontana,
	Igor Mammedov, Paolo Bonzini

On 3/16/21 12:24 PM, Philippe Mathieu-Daudé 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.
> 
> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> ---
> v2: use global tcg_accel_available, call qtest_has_accel() once
> ---
>  tests/qtest/bios-tables-test.c | 99 ++++++++++++++++++----------------
>  1 file changed, 52 insertions(+), 47 deletions(-)
> 
Reviewed-by: Eric Blake <eblake@redhat.com>

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3226
Virtualization:  qemu.org | libvirt.org



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH v2 4/4] tests/qtest: Do not restrict bios-tables-test to Aarch64 hosts anymore
  2021-03-16 17:24 ` [PATCH v2 4/4] tests/qtest: Do not restrict bios-tables-test to Aarch64 hosts anymore Philippe Mathieu-Daudé
@ 2021-03-16 17:33   ` Eric Blake
  0 siblings, 0 replies; 10+ messages in thread
From: Eric Blake @ 2021-03-16 17:33 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé, qemu-devel
  Cc: Laurent Vivier, Thomas Huth, Andrew Jones, Eduardo Habkost,
	Michael S. Tsirkin, Daniel P . Berrangé,
	Richard Henderson, Markus Armbruster, qemu-arm, Claudio Fontana,
	Igor Mammedov, Paolo Bonzini

On 3/16/21 12:24 PM, Philippe Mathieu-Daudé wrote:
> Since commit 82bf7ae84ce ("target/arm: Remove KVM support for
> 32-bit Arm hosts") we can remove the comment / check added in
> commit ab6b6a77774 and directly run the bios-tables-test.
> 
> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> ---
>  tests/qtest/meson.build | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 

Reviewed-by: Eric Blake <eblake@redhat.com>

> diff --git a/tests/qtest/meson.build b/tests/qtest/meson.build
> index 66ee9fbf450..82e92d33f82 100644
> --- a/tests/qtest/meson.build
> +++ b/tests/qtest/meson.build
> @@ -173,14 +173,13 @@
>     'boot-serial-test',
>     'hexloader-test']
>  
> -# TODO: once aarch64 TCG is fixed on ARM 32 bit host, make bios-tables-test unconditional
>  qtests_aarch64 = \
> -  (cpu != 'arm' ? ['bios-tables-test'] : []) +                                                  \
>    (config_all_devices.has_key('CONFIG_TPM_TIS_SYSBUS') ? ['tpm-tis-device-test'] : []) +        \
>    (config_all_devices.has_key('CONFIG_TPM_TIS_SYSBUS') ? ['tpm-tis-device-swtpm-test'] : []) +  \
>    ['arm-cpu-features',
>     'numa-test',
>     'boot-serial-test',
> +   'bios-tables-test',
>     'xlnx-can-test',
>     'migration-test']
>  
> 

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3226
Virtualization:  qemu.org | libvirt.org



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH v2 1/4] accel: Introduce 'query-accels' QMP command
  2021-03-16 17:29   ` Eric Blake
@ 2021-03-16 18:00     ` Philippe Mathieu-Daudé
  0 siblings, 0 replies; 10+ messages in thread
From: Philippe Mathieu-Daudé @ 2021-03-16 18:00 UTC (permalink / raw)
  To: Eric Blake, qemu-devel
  Cc: Laurent Vivier, Thomas Huth, Andrew Jones, Eduardo Habkost,
	Michael S. Tsirkin, Daniel P . Berrangé,
	Richard Henderson, Markus Armbruster, qemu-arm, Claudio Fontana,
	Igor Mammedov, Paolo Bonzini

On 3/16/21 6:29 PM, Eric Blake wrote:
> On 3/16/21 12:24 PM, Philippe Mathieu-Daudé wrote:
>> Introduce the 'query-accels' QMP command which returns a list
>> of built-in accelerator names.
>>
>> - Accelerator is a QAPI enum of all existing accelerators,
>>
>> - AcceleratorInfo is a QAPI structure providing accelerator
>>   specific information. Currently the common structure base
>>   provides the name of the accelerator, while the specific
>>   part is empty, but each accelerator can expand it.
>>
> 
>> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
>> ---
>> Since v1: 'type' -> 'name' in comments
>> ---
>>  qapi/machine.json | 55 +++++++++++++++++++++++++++++++++++++++++++++++
>>  accel/accel-qmp.c | 49 +++++++++++++++++++++++++++++++++++++++++
>>  accel/meson.build |  2 +-
>>  3 files changed, 105 insertions(+), 1 deletion(-)
>>  create mode 100644 accel/accel-qmp.c
>>
>> diff --git a/qapi/machine.json b/qapi/machine.json
>> index 330189efe3d..610252fc25c 100644
>> --- a/qapi/machine.json
>> +++ b/qapi/machine.json
>> @@ -1471,3 +1471,58 @@
>>  ##
>>  { 'event': 'MEM_UNPLUG_ERROR',
>>    'data': { 'device': 'str', 'msg': 'str' } }
>> +
>> +##
>> +# @Accelerator:
>> +#
>> +# An enumeration of accelerator names.
>> +#
>> +# Since: 6.0
>> +##
>> +{ 'enum': 'Accelerator',
>> +  'data': [ { 'name': 'qtest' },
>> +            { 'name': 'tcg' },
>> +            { 'name': 'kvm' },
>> +            { 'name': 'hax' },
>> +            { 'name': 'hvf' },
>> +            { 'name': 'whpx' },
>> +            { 'name': 'xen' } ] }
> 
> Shorter, but semantically equivalent:
> { 'enum': 'Accelerator', 'data': [ 'qtest', 'tcg', ... ] }
> 
> I'd mention in the commit message body that we can't make the enum
> values or union branches conditional because of target-specific
> poisoning.

Good idea.

> With that,
> 
> Reviewed-by: Eric Blake <eblake@redhat.com>
> 
> If we're trying to get it into 6.0, it is a new feature, and so we
> should get it in a pull request before feature freeze today.  Otherwise
> we'll have to s/6.0/6.1/

There is no rush for this, I posted it to scratch it from my today's
TODO list and be able to focus on the next task.

I'll wait for other review and repost with 6.1 (except if someone judge
it is useful to get this for 6.0).

Thanks for your review!

Phil.



^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2021-03-16 18:30 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-16 17:24 [PATCH v2 0/4] qtests: Check accelerator available at runtime via QMP 'query-accels' Philippe Mathieu-Daudé
2021-03-16 17:24 ` [PATCH v2 1/4] accel: Introduce 'query-accels' QMP command Philippe Mathieu-Daudé
2021-03-16 17:29   ` Eric Blake
2021-03-16 18:00     ` Philippe Mathieu-Daudé
2021-03-16 17:24 ` [PATCH v2 2/4] tests/qtest: Add qtest_has_accel() method Philippe Mathieu-Daudé
2021-03-16 17:31   ` Eric Blake
2021-03-16 17:24 ` [PATCH v2 3/4] qtest/bios-tables-test: Make test build-independent from accelerator Philippe Mathieu-Daudé
2021-03-16 17:32   ` Eric Blake
2021-03-16 17:24 ` [PATCH v2 4/4] tests/qtest: Do not restrict bios-tables-test to Aarch64 hosts anymore Philippe Mathieu-Daudé
2021-03-16 17:33   ` Eric Blake

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).