From nobody Mon Sep 8 20:24:51 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass(p=reject dis=none) header.from=lists.libvirt.org ARC-Seal: i=1; a=rsa-sha256; t=1756998462; cv=none; d=zohomail.com; s=zohoarc; b=M/XpFk9L1IHFFWVqKW6BxrqfqDqvURIY8cXwokh1MCPyOqhfUc8Ge0rlAL3Dw/VJ4nG0Rp8oA58K+JdFu1zfZWBjgt1WrpPgDbi6saI8wjBV7iuaWr5zqRXV4s+Y+WTE/WWQcZK6ocfZib3j2sMV3DbVh96st1hHcGu8nh8lYto= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1756998462; h=Content-Type:Content-Transfer-Encoding:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Owner:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Reply-To:References:Subject:Subject:To:To:Message-Id:Cc; bh=mLNOPnmF2qGK5uZ5Tpw5vrBr+9/5biLBI/1Qo0KSyao=; b=XLDktUTorCTNRVFCGcnG93iHn12eEpX4joRGSUFc82wYzOTFryaozEnMXZCvRDZ3nCI1Ug5Jv2C/FUF0IN1lng5q/SuCH8ndgvNFB/g29cW6QzkZN0wgeC/1I5gCjxTaWqcwYIdR4NjEMrgPO9l3yz2e0JQmttQ00cl0ly39O/c= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1756998462623944.3920267589679; Thu, 4 Sep 2025 08:07:42 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 993) id CB5EB442EF; Thu, 4 Sep 2025 11:07:41 -0400 (EDT) Received: from [172.19.199.3] (lists.libvirt.org [8.43.85.245]) by lists.libvirt.org (Postfix) with ESMTP id 0F67B44584; Thu, 4 Sep 2025 10:49:05 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 993) id DB13A44386; Thu, 4 Sep 2025 10:48:40 -0400 (EDT) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (3072 bits) server-digest SHA256) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id A83D04431B for ; Thu, 4 Sep 2025 10:47:23 -0400 (EDT) Received: from mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-157-NxVcjf17Nw-d62i3r1LzRw-1; Thu, 04 Sep 2025 10:47:21 -0400 Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id E92481800370 for ; Thu, 4 Sep 2025 14:47:20 +0000 (UTC) Received: from orkuz (unknown [10.43.3.115]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 75DB11955F24 for ; Thu, 4 Sep 2025 14:47:20 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-1.5 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, MAILING_LIST_MULTI,RCVD_IN_DNSWL_LOW, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_BLOCKED,SPF_PASS autolearn=unavailable autolearn_force=no version=4.0.1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1756997243; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=mLNOPnmF2qGK5uZ5Tpw5vrBr+9/5biLBI/1Qo0KSyao=; b=YHzpBjdWRT0wt4Lehf2lPMGx8/3b0+lkbZ182ZcSqpWHM8a2ZFdmDgYRM7AGCSyACKu7db 5iHuUCg3i3Bnl7aIZA1r2tfjkKxNIQ+qfTUEJH0c02h/03RrPsa/idaxmH56pXkZ6Ucafs gEDh8DTZgmYqIk032PutilYcKbJ3R4U= X-MC-Unique: NxVcjf17Nw-d62i3r1LzRw-1 X-Mimecast-MFC-AGG-ID: NxVcjf17Nw-d62i3r1LzRw_1756997241 To: devel@lists.libvirt.org Subject: [PATCH 07/14] qemu: Use qom-list-get for checking enabled CPU features Date: Thu, 4 Sep 2025 16:46:55 +0200 Message-ID: <4fa35acc6d7ad95dbfde66153c2d0998af478a87.1756996034.git.jdenemar@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: qfLNOJAIpPTJiwDQZBxn67GjcU7aV2yo3CLCBtGIVEg_1756997241 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: SFA5NXW2X5A2QVZVETMUNWPJTT6Z6PXA X-Message-ID-Hash: SFA5NXW2X5A2QVZVETMUNWPJTT6Z6PXA X-MailFrom: jdenemar@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; header-match-devel.lists.libvirt.org-0; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.10 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Jiri Denemark via Devel Reply-To: Jiri Denemark X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1756998467163124100 Content-Type: text/plain; charset="utf-8" From: Jiri Denemark qom-list-get is a new QMP command (since QEMU 10.1) that combines qom-list for listing properties of a specified object with qom-get for getting a value of a given property. The new command provides an array of all properties and their values, which allows us to dramatically reduce the number of QMP commands we have to call when starting a domain to check which CPU features were actually enabled. A simple domain with no disk can now be started with only 15 QMP commands in about 200 ms compared to 485 commands and 400 ms startup time without this patch. https://issues.redhat.com/browse/RHEL-7038 Signed-off-by: Jiri Denemark Reviewed-by: Peter Krempa --- src/qemu/qemu_capabilities.c | 2 + src/qemu/qemu_capabilities.h | 1 + src/qemu/qemu_monitor.c | 13 +++- src/qemu/qemu_monitor.h | 1 + src/qemu/qemu_monitor_json.c | 73 ++++++++++++++++--- src/qemu/qemu_monitor_json.h | 7 +- src/qemu/qemu_process.c | 1 + .../caps_10.1.0_x86_64.xml | 1 + .../caps_10.2.0_x86_64.xml | 1 + ...=3D> get-guest-cpu-SierraForest-legacy.json} | 0 ...> get-guest-cpu-SkylakeClient-legacy.json} | 0 tests/qemumonitorjsontest.c | 18 +++-- 12 files changed, 92 insertions(+), 26 deletions(-) rename tests/qemumonitorjsondata/{get-guest-cpu-SierraForest.json =3D> get= -guest-cpu-SierraForest-legacy.json} (100%) rename tests/qemumonitorjsondata/{get-guest-cpu-SkylakeClient.json =3D> ge= t-guest-cpu-SkylakeClient-legacy.json} (100%) diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index 688d100b01..b7174c657d 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -742,6 +742,7 @@ VIR_ENUM_IMPL(virQEMUCaps, "amd-iommu.pci-id", /* QEMU_CAPS_AMD_IOMMU_PCI_ID */ "usb-bot", /* QEMU_CAPS_DEVICE_USB_BOT */ "tdx-guest", /* QEMU_CAPS_TDX_GUEST */ + "qom-list-get", /* QEMU_CAPS_QOM_LIST_GET */ ); =20 =20 @@ -1256,6 +1257,7 @@ struct virQEMUCapsStringFlags virQEMUCapsCommands[] = =3D { { "query-stats-schemas", QEMU_CAPS_QUERY_STATS_SCHEMAS }, { "display-reload", QEMU_CAPS_DISPLAY_RELOAD }, { "blockdev-set-active", QEMU_CAPS_BLOCKDEV_SET_ACTIVE }, + { "qom-list-get", QEMU_CAPS_QOM_LIST_GET }, }; =20 struct virQEMUCapsStringFlags virQEMUCapsObjectTypes[] =3D { diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h index 8916973364..f50d908b3f 100644 --- a/src/qemu/qemu_capabilities.h +++ b/src/qemu/qemu_capabilities.h @@ -723,6 +723,7 @@ typedef enum { /* virQEMUCapsFlags grouping marker for = syntax-check */ QEMU_CAPS_AMD_IOMMU_PCI_ID, /* amd-iommu.pci-id */ QEMU_CAPS_DEVICE_USB_BOT, /* -device usb-bot */ QEMU_CAPS_TDX_GUEST, /* -object tdx-guest,... */ + QEMU_CAPS_QOM_LIST_GET, /* qom-list-get QMP command */ =20 QEMU_CAPS_LAST /* this must always be the last item */ } virQEMUCapsFlags; diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c index 0213bd5af8..176651eab4 100644 --- a/src/qemu/qemu_monitor.c +++ b/src/qemu/qemu_monitor.c @@ -3673,6 +3673,8 @@ qemuMonitorSetDomainLog(qemuMonitor *mon, * qemuMonitorGetGuestCPU: * @mon: Pointer to the monitor * @arch: CPU architecture + * @qomListGet: QEMU supports getting list of features and their values us= ing + * a single qom-list-get QMP command * @cpuQOMPath: QOM path of a CPU to probe * @translate: callback for translating CPU feature names from QEMU to lib= virt * @opaque: data for @translate callback @@ -3687,13 +3689,16 @@ qemuMonitorSetDomainLog(qemuMonitor *mon, int qemuMonitorGetGuestCPU(qemuMonitor *mon, virArch arch, + bool qomListGet, const char *cpuQOMPath, qemuMonitorCPUFeatureTranslationCallback translate, virCPUData **enabled, virCPUData **disabled) { - VIR_DEBUG("arch=3D%s cpuQOMPath=3D%s translate=3D%p enabled=3D%p disab= led=3D%p", - virArchToString(arch), cpuQOMPath, translate, enabled, disab= led); + VIR_DEBUG("arch=3D%s qomListGet%d cpuQOMPath=3D%s translate=3D%p " + "enabled=3D%p disabled=3D%p", + virArchToString(arch), qomListGet, cpuQOMPath, translate, + enabled, disabled); =20 QEMU_CHECK_MONITOR(mon); =20 @@ -3701,8 +3706,8 @@ qemuMonitorGetGuestCPU(qemuMonitor *mon, if (disabled) *disabled =3D NULL; =20 - return qemuMonitorJSONGetGuestCPU(mon, arch, cpuQOMPath, translate, - enabled, disabled); + return qemuMonitorJSONGetGuestCPU(mon, arch, qomListGet, cpuQOMPath, + translate, enabled, disabled); } =20 =20 diff --git a/src/qemu/qemu_monitor.h b/src/qemu/qemu_monitor.h index 689a587ec6..750e7444fc 100644 --- a/src/qemu/qemu_monitor.h +++ b/src/qemu/qemu_monitor.h @@ -1268,6 +1268,7 @@ typedef const char *(*qemuMonitorCPUFeatureTranslatio= nCallback)(virArch arch, =20 int qemuMonitorGetGuestCPU(qemuMonitor *mon, virArch arch, + bool qomListGet, const char *cpuQOMPath, qemuMonitorCPUFeatureTranslationCallback transl= ate, virCPUData **enabled, diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c index 76118ea664..8c70279f6d 100644 --- a/src/qemu/qemu_monitor_json.c +++ b/src/qemu/qemu_monitor_json.c @@ -6596,6 +6596,7 @@ qemuMonitorJSONGetDeviceAliases(qemuMonitor *mon, =20 struct _qemuMonitorJSONCPUPropsFilterData { qemuMonitor *mon; + bool values; const char *cpuQOMPath; }; =20 @@ -6604,17 +6605,32 @@ qemuMonitorJSONCPUPropsFilter(const char *name, virJSONValue *propData, void *opaque) { - qemuMonitorJSONObjectProperty prop =3D { .type =3D QEMU_MONITOR_OBJECT= _PROPERTY_BOOLEAN }; struct _qemuMonitorJSONCPUPropsFilterData *data =3D opaque; + bool enabled =3D false; =20 if (STRNEQ_NULLABLE(virJSONValueObjectGetString(propData, "type"), "bo= ol")) return 1; =20 - if (qemuMonitorJSONGetObjectProperty(data->mon, data->cpuQOMPath, - name, &prop) < 0) - return -1; + if (data->values) { + if (virJSONValueObjectGetBoolean(propData, "value", &enabled) < 0)= { + virReportError(VIR_ERR_INTERNAL_ERROR, + _("property '%1$s' in reply data was missing va= lue"), + name); + return -1; + } + } else { + qemuMonitorJSONObjectProperty prop =3D { + .type =3D QEMU_MONITOR_OBJECT_PROPERTY_BOOLEAN + }; =20 - if (!prop.val.b) + if (qemuMonitorJSONGetObjectProperty(data->mon, data->cpuQOMPath, + name, &prop) < 0) + return -1; + + enabled =3D prop.val.b; + } + + if (!enabled) return 1; =20 return 0; @@ -6623,6 +6639,7 @@ qemuMonitorJSONCPUPropsFilter(const char *name, =20 static int qemuMonitorJSONGetCPUProperties(qemuMonitor *mon, + bool qomListGet, const char *cpuQOMPath, char ***props) { @@ -6631,14 +6648,29 @@ qemuMonitorJSONGetCPUProperties(qemuMonitor *mon, virJSONValue *array; struct _qemuMonitorJSONCPUPropsFilterData filterData =3D { .mon =3D mon, + .values =3D qomListGet, .cpuQOMPath =3D cpuQOMPath, }; =20 *props =3D NULL; =20 - if (!(cmd =3D qemuMonitorJSONMakeCommand("qom-list", - "s:path", cpuQOMPath, - NULL))) + if (qomListGet) { + g_autoptr(virJSONValue) paths =3D virJSONValueNewArray(); + g_autoptr(virJSONValue) path =3D virJSONValueNewString(g_strdup(cp= uQOMPath)); + + if (virJSONValueArrayAppend(paths, &path) < 0) + return -1; + + cmd =3D qemuMonitorJSONMakeCommand("qom-list-get", + "a:paths", &paths, + NULL); + } else { + cmd =3D qemuMonitorJSONMakeCommand("qom-list", + "s:path", cpuQOMPath, + NULL); + } + + if (!cmd) return -1; =20 if (qemuMonitorJSONCommand(mon, cmd, &reply) < 0) @@ -6650,6 +6682,22 @@ qemuMonitorJSONGetCPUProperties(qemuMonitor *mon, if (!(array =3D qemuMonitorJSONGetReply(cmd, reply, VIR_JSON_TYPE_ARRA= Y))) return -1; =20 + if (qomListGet) { + if (virJSONValueArraySize(array) !=3D 1) { + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("'qom-list-get' returned unexpected number of= paths")); + return -1; + } + + array =3D virJSONValueObjectGetArray(virJSONValueArrayGet(array, 0= ), + "properties"); + if (!array) { + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("reply data was missing 'properties' array")); + return -1; + } + } + return qemuMonitorJSONParsePropsList(array, qemuMonitorJSONCPUPropsFil= ter, &filterData, props); } @@ -6657,6 +6705,7 @@ qemuMonitorJSONGetCPUProperties(qemuMonitor *mon, =20 static int qemuMonitorJSONGetCPUData(qemuMonitor *mon, + bool qomListGet, const char *cpuQOMPath, qemuMonitorCPUFeatureTranslationCallback transla= te, virCPUData *data) @@ -6664,7 +6713,7 @@ qemuMonitorJSONGetCPUData(qemuMonitor *mon, g_auto(GStrv) props =3D NULL; char **p; =20 - if (qemuMonitorJSONGetCPUProperties(mon, cpuQOMPath, &props) < 0) + if (qemuMonitorJSONGetCPUProperties(mon, qomListGet, cpuQOMPath, &prop= s) < 0) return -1; =20 for (p =3D props; p && *p; p++) { @@ -6712,6 +6761,8 @@ qemuMonitorJSONGetCPUDataDisabled(qemuMonitor *mon, * qemuMonitorJSONGetGuestCPU: * @mon: Pointer to the monitor * @arch: CPU architecture + * @qomListGet: QEMU supports getting list of features and their values us= ing + * a single qom-list-get QMP command * @cpuQOMPath: QOM path of a CPU to probe * @translate: callback for translating CPU feature names from QEMU to lib= virt * @opaque: data for @translate callback @@ -6726,6 +6777,7 @@ qemuMonitorJSONGetCPUDataDisabled(qemuMonitor *mon, int qemuMonitorJSONGetGuestCPU(qemuMonitor *mon, virArch arch, + bool qomListGet, const char *cpuQOMPath, qemuMonitorCPUFeatureTranslationCallback transl= ate, virCPUData **enabled, @@ -6738,7 +6790,8 @@ qemuMonitorJSONGetGuestCPU(qemuMonitor *mon, !(cpuDisabled =3D virCPUDataNew(arch))) return -1; =20 - if (qemuMonitorJSONGetCPUData(mon, cpuQOMPath, translate, cpuEnabled) = < 0) + if (qemuMonitorJSONGetCPUData(mon, qomListGet, cpuQOMPath, + translate, cpuEnabled) < 0) return -1; =20 if (disabled && diff --git a/src/qemu/qemu_monitor_json.h b/src/qemu/qemu_monitor_json.h index f076e637ba..f17769f7fe 100644 --- a/src/qemu/qemu_monitor_json.h +++ b/src/qemu/qemu_monitor_json.h @@ -558,15 +558,10 @@ int qemuMonitorJSONGetDeviceAliases(qemuMonitor *mon, char ***aliases); =20 -int -qemuMonitorJSONGetGuestCPUx86(qemuMonitor *mon, - const char *cpuQOMPath, - virCPUData **data, - virCPUData **disabled); - int qemuMonitorJSONGetGuestCPU(qemuMonitor *mon, virArch arch, + bool qomListGet, const char *cpuQOMPath, qemuMonitorCPUFeatureTranslationCallback transl= ate, virCPUData **enabled, diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index 2988ffb157..ead5bf3e48 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -4592,6 +4592,7 @@ qemuProcessFetchGuestCPU(virDomainObj *vm, =20 rc =3D qemuMonitorGetGuestCPU(priv->mon, vm->def->os.arch, + virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_Q= OM_LIST_GET), cpuQOMPath, virQEMUCapsCPUFeatureFromQEMU, &dataEnabled, &dataDisabled); diff --git a/tests/qemucapabilitiesdata/caps_10.1.0_x86_64.xml b/tests/qemu= capabilitiesdata/caps_10.1.0_x86_64.xml index dc3088ba2c..8c53b72b47 100644 --- a/tests/qemucapabilitiesdata/caps_10.1.0_x86_64.xml +++ b/tests/qemucapabilitiesdata/caps_10.1.0_x86_64.xml @@ -213,6 +213,7 @@ + 10001000 43100286 v10.1.0 diff --git a/tests/qemucapabilitiesdata/caps_10.2.0_x86_64.xml b/tests/qemu= capabilitiesdata/caps_10.2.0_x86_64.xml index 07826b1a6e..c7452772da 100644 --- a/tests/qemucapabilitiesdata/caps_10.2.0_x86_64.xml +++ b/tests/qemucapabilitiesdata/caps_10.2.0_x86_64.xml @@ -213,6 +213,7 @@ + 10001050 43100287 v10.1.0-1-ge771ba98de diff --git a/tests/qemumonitorjsondata/get-guest-cpu-SierraForest.json b/te= sts/qemumonitorjsondata/get-guest-cpu-SierraForest-legacy.json similarity index 100% rename from tests/qemumonitorjsondata/get-guest-cpu-SierraForest.json rename to tests/qemumonitorjsondata/get-guest-cpu-SierraForest-legacy.json diff --git a/tests/qemumonitorjsondata/get-guest-cpu-SkylakeClient.json b/t= ests/qemumonitorjsondata/get-guest-cpu-SkylakeClient-legacy.json similarity index 100% rename from tests/qemumonitorjsondata/get-guest-cpu-SkylakeClient.json rename to tests/qemumonitorjsondata/get-guest-cpu-SkylakeClient-legacy.json diff --git a/tests/qemumonitorjsontest.c b/tests/qemumonitorjsontest.c index c3e83fc728..9c857a209e 100644 --- a/tests/qemumonitorjsontest.c +++ b/tests/qemumonitorjsontest.c @@ -2773,6 +2773,7 @@ testQemuMonitorJSONGetSEVInfo(const void *opaque) =20 struct testQemuMonitorJSONGetGuestCPUData { const char *name; + bool qomListGet; virQEMUDriver driver; GHashTable *schema; }; @@ -2791,8 +2792,9 @@ testQemuMonitorJSONGetGuestCPU(const void *opaque) g_autofree char *enabled =3D NULL; g_autofree char *disabled =3D NULL; bool failed =3D false; + const char *legacy =3D data->qomListGet ? "" : "-legacy"; =20 - fileJSON =3D g_strdup_printf("%s-%s.json", base, data->name); + fileJSON =3D g_strdup_printf("%s-%s%s.json", base, data->name, legacy); fileEnabled =3D g_strdup_printf("%s-%s-enabled.xml", base, data->name); fileDisabled =3D g_strdup_printf("%s-%s-disabled.xml", base, data->nam= e); =20 @@ -2802,6 +2804,7 @@ testQemuMonitorJSONGetGuestCPU(const void *opaque) =20 if (qemuMonitorJSONGetGuestCPU(qemuMonitorTestGetMonitor(mon), VIR_ARCH_X86_64, + data->qomListGet, "/machine/unattached/device[0]", virQEMUCapsCPUFeatureFromQEMU, &dataEnabled, &dataDisabled) < 0) @@ -2884,11 +2887,14 @@ mymain(void) ret =3D -1; \ } while (0) =20 -#define DO_TEST_GET_GUEST_CPU(name) \ +#define DO_TEST_GET_GUEST_CPU(name, qomListGet) \ do { \ struct testQemuMonitorJSONGetGuestCPUData data =3D { \ - name, driver, qapiData.schema }; \ - if (virTestRun("GetGuestCPU(" name ")", \ + name, qomListGet, driver, qapiData.schema }; \ + g_autofree char *label =3D NULL; \ + label =3D g_strdup_printf("GetGuestCPU(%s, legacy=3D%s)", \ + name, qomListGet ? "false" : "true"); \ + if (virTestRun(label, \ testQemuMonitorJSONGetGuestCPU, \ &data) < 0) \ ret =3D -1; \ @@ -2984,8 +2990,8 @@ mymain(void) =20 DO_TEST_CPU_INFO("s390", 2); =20 - DO_TEST_GET_GUEST_CPU("SierraForest"); - DO_TEST_GET_GUEST_CPU("SkylakeClient"); + DO_TEST_GET_GUEST_CPU("SierraForest", false); + DO_TEST_GET_GUEST_CPU("SkylakeClient", false); =20 =20 #define DO_TEST_QAPI_QUERY(nme, qry, scc, rplobj) \ --=20 2.51.0