From nobody Thu Dec 26 20:56:08 2024 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=fail(p=reject dis=none) header.from=linux.ibm.com Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 17314335358961002.9673604953034; Tue, 12 Nov 2024 09:45:35 -0800 (PST) Received: by lists.libvirt.org (Postfix, from userid 996) id CF20017A5; Tue, 12 Nov 2024 12:45:34 -0500 (EST) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 0E6EE1976; Tue, 12 Nov 2024 12:43:12 -0500 (EST) Received: by lists.libvirt.org (Postfix, from userid 996) id AFA571450; Tue, 12 Nov 2024 12:43:02 -0500 (EST) Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id 0E676144B for ; Tue, 12 Nov 2024 12:43:01 -0500 (EST) Received: from pps.filterd (m0356517.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 4ACHe64u030157 for ; Tue, 12 Nov 2024 17:43:01 GMT Received: from ppma23.wdc07v.mail.ibm.com (5d.69.3da9.ip4.static.sl-reverse.com [169.61.105.93]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 42vbm5g0av-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Tue, 12 Nov 2024 17:43:00 +0000 (GMT) Received: from pps.filterd (ppma23.wdc07v.mail.ibm.com [127.0.0.1]) by ppma23.wdc07v.mail.ibm.com (8.18.1.2/8.18.1.2) with ESMTP id 4ACHZ2W8029698 for ; Tue, 12 Nov 2024 17:42:59 GMT Received: from smtprelay05.dal12v.mail.ibm.com ([172.16.1.7]) by ppma23.wdc07v.mail.ibm.com (PPS) with ESMTPS id 42tkjkue7q-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Tue, 12 Nov 2024 17:42:59 +0000 Received: from smtpav05.dal12v.mail.ibm.com (smtpav05.dal12v.mail.ibm.com [10.241.53.104]) by smtprelay05.dal12v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 4ACHgwSS28639590 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Tue, 12 Nov 2024 17:42:59 GMT Received: from smtpav05.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id E09E35805D for ; Tue, 12 Nov 2024 17:42:58 +0000 (GMT) Received: from smtpav05.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id B1D3358056 for ; Tue, 12 Nov 2024 17:42:58 +0000 (GMT) Received: from li-d664314c-3171-11b2-a85c-fa8047ef35bd.ibm.com.com (unknown [9.67.103.128]) by smtpav05.dal12v.mail.ibm.com (Postfix) with ESMTP for ; Tue, 12 Nov 2024 17:42:58 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-1.5 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,RCVD_IN_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_BLOCKED,SPF_HELO_NONE autolearn=unavailable autolearn_force=no version=3.4.4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h= content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=pp1; bh=uJdSZfz8iytkMbdoA vuf7SFW+ZzAEy0jo7ihLf3N7C4=; b=CE9170EuTy3Y/dgM9s1O2cCZ1mdxMNCvu XvPpiL+SPJ87E9KxDRwPBXOJT5C4VPP8polwA2sYuy3ogMq6ikppRUjv38LVIvj7 +bWmMnPkO8wNHzbELVdi10I1sB188Wr7FCBSgKLDSKVs2D9XACPGjI1AboCd2LYH cA+PO6tgWXCNDowp6+/8QlnG/CtHsf4KFuRsbVvcTHEizG87IwQbXUa4JiRRtdpj HsLxoAXSXhhpnG9nN8RkiJk+D+7WvPuNCAVOTjX4Gys7PAxknop2UuXJc104Q0yG FndVdIOKHo7Tvw+RnJP519U0gXa6rbpxLRol+sx2JVPPchAlrD+IA== From: Collin Walling To: devel@lists.libvirt.org Subject: [PATCH v1 1/5] qemuMonitorJSONGetCPUModelExpansion: refactor parsing functions Date: Tue, 12 Nov 2024 12:39:56 -0500 Message-ID: <20241112174000.27518-2-walling@linux.ibm.com> X-Mailer: git-send-email 2.45.1 In-Reply-To: <20241112174000.27518-1-walling@linux.ibm.com> References: <20241112174000.27518-1-walling@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: Z99v9VyYuUz2PUfS4qd_Rbkw35DwhH2h X-Proofpoint-GUID: Z99v9VyYuUz2PUfS4qd_Rbkw35DwhH2h X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1051,Hydra:6.0.680,FMLib:17.12.62.30 definitions=2024-10-15_01,2024-10-11_01,2024-09-30_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 bulkscore=0 suspectscore=0 phishscore=0 priorityscore=1501 impostorscore=0 adultscore=0 lowpriorityscore=0 clxscore=1015 mlxscore=0 mlxlogscore=872 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2409260000 definitions=main-2411120141 Content-Transfer-Encoding: quoted-printable Message-ID-Hash: JF22NE3AVLFA76XFIEMRX64JCS2LO3RU X-Message-ID-Hash: JF22NE3AVLFA76XFIEMRX64JCS2LO3RU X-MailFrom: walling@linux.ibm.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; header-match-config-2; header-match-config-3; header-match-devel.lists.libvirt.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header X-Mailman-Version: 3.2.2 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1731433536534116600 Content-Type: text/plain; charset="utf-8" Refactor the CPU Model parsing functions within qemuMonitorJSONGetCPUModelExpansion. The new functions, qemuMonitorJSONParseCPUModelExpansionData and qemuMonitorJSONParseCPUModelExpansion invoke the functions they replace and leave room for a subsequent patch to handle parsing the (optional) deprecated_props field resulting from the command. Signed-off-by: Collin Walling --- src/qemu/qemu_monitor_json.c | 46 ++++++++++++++++++++++++++++++------ 1 file changed, 39 insertions(+), 7 deletions(-) diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c index c594b33106..7c916efacf 100644 --- a/src/qemu/qemu_monitor_json.c +++ b/src/qemu/qemu_monitor_json.c @@ -5090,6 +5090,37 @@ qemuMonitorJSONParseCPUModel(const char *cpu_name, } =20 =20 +static int +qemuMonitorJSONParseCPUModelExpansionData(virJSONValue *data, + bool fail_no_props, + virJSONValue **cpu_model, + virJSONValue **cpu_props, + const char **cpu_name) +{ + if (qemuMonitorJSONParseCPUModelData(data, "query-cpu-model-expansion", + fail_no_props, cpu_model, cpu_pro= ps, + cpu_name) < 0) + return -1; + + return 0; +} + + +static int +qemuMonitorJSONParseCPUModelExpansion(const char *cpu_name, + virJSONValue *cpu_props, + qemuMonitorCPUModelInfo **model_info) +{ + g_autoptr(qemuMonitorCPUModelInfo) expanded_model =3D NULL; + + if (qemuMonitorJSONParseCPUModel(cpu_name, cpu_props, &expanded_model)= < 0) + return -1; + + *model_info =3D g_steal_pointer(&expanded_model); + return 0; +} + + static int qemuMonitorJSONQueryCPUModelExpansionOne(qemuMonitor *mon, qemuMonitorCPUModelExpansionType = type, @@ -5160,9 +5191,9 @@ qemuMonitorJSONGetCPUModelExpansion(qemuMonitor *mon, if ((rc =3D qemuMonitorJSONQueryCPUModelExpansionOne(mon, type, &model= , &data)) <=3D 0) return rc; =20 - if (qemuMonitorJSONParseCPUModelData(data, "query-cpu-model-expansion", - fail_no_props, &cpu_model, &cpu_p= rops, - &cpu_name) < 0) + if (qemuMonitorJSONParseCPUModelExpansionData(data, fail_no_props, + &cpu_model, &cpu_props, + &cpu_name) < 0) return -1; =20 /* QEMU_MONITOR_CPU_MODEL_EXPANSION_STATIC_FULL requests "full" expans= ion @@ -5178,13 +5209,14 @@ qemuMonitorJSONGetCPUModelExpansion(qemuMonitor *mo= n, if ((rc =3D qemuMonitorJSONQueryCPUModelExpansionOne(mon, type, &f= ullModel, &fullData)) <=3D 0) return rc; =20 - if (qemuMonitorJSONParseCPUModelData(fullData, "query-cpu-model-ex= pansion", - fail_no_props, &cpu_model, &c= pu_props, - &cpu_name) < 0) + if (qemuMonitorJSONParseCPUModelExpansionData(fullData, fail_no_pr= ops, + &cpu_model, &cpu_pro= ps, + &cpu_name) < 0) return -1; } =20 - return qemuMonitorJSONParseCPUModel(cpu_name, cpu_props, model_info); + return qemuMonitorJSONParseCPUModelExpansion(cpu_name, cpu_props, + model_info); } =20 =20 --=20 2.45.1 From nobody Thu Dec 26 20:56:08 2024 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=fail(p=reject dis=none) header.from=linux.ibm.com Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 173143357632082.68186410123008; Tue, 12 Nov 2024 09:46:16 -0800 (PST) Received: by lists.libvirt.org (Postfix, from userid 996) id 382A61950; Tue, 12 Nov 2024 12:46:15 -0500 (EST) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 7209117DD; Tue, 12 Nov 2024 12:43:13 -0500 (EST) Received: by lists.libvirt.org (Postfix, from userid 996) id 340241453; Tue, 12 Nov 2024 12:43:03 -0500 (EST) Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id 685451464 for ; Tue, 12 Nov 2024 12:43:02 -0500 (EST) Received: from pps.filterd (m0353729.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 4ACHbCaB031378 for ; Tue, 12 Nov 2024 17:43:01 GMT Received: from ppma22.wdc07v.mail.ibm.com (5c.69.3da9.ip4.static.sl-reverse.com [169.61.105.92]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 42v9dv0na3-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Tue, 12 Nov 2024 17:43:01 +0000 (GMT) Received: from pps.filterd (ppma22.wdc07v.mail.ibm.com [127.0.0.1]) by ppma22.wdc07v.mail.ibm.com (8.18.1.2/8.18.1.2) with ESMTP id 4ACGKrpF008404 for ; Tue, 12 Nov 2024 17:43:00 GMT Received: from smtprelay03.dal12v.mail.ibm.com ([172.16.1.5]) by ppma22.wdc07v.mail.ibm.com (PPS) with ESMTPS id 42tjeykyjh-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Tue, 12 Nov 2024 17:42:59 +0000 Received: from smtpav05.dal12v.mail.ibm.com (smtpav05.dal12v.mail.ibm.com [10.241.53.104]) by smtprelay03.dal12v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 4ACHgxIF47382968 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Tue, 12 Nov 2024 17:42:59 GMT Received: from smtpav05.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 35C1E58069 for ; Tue, 12 Nov 2024 17:42:59 +0000 (GMT) Received: from smtpav05.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 0488658056 for ; Tue, 12 Nov 2024 17:42:59 +0000 (GMT) Received: from li-d664314c-3171-11b2-a85c-fa8047ef35bd.ibm.com.com (unknown [9.67.103.128]) by smtpav05.dal12v.mail.ibm.com (Postfix) with ESMTP for ; Tue, 12 Nov 2024 17:42:58 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-1.5 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,RCVD_IN_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_BLOCKED,SPF_HELO_NONE autolearn=unavailable autolearn_force=no version=3.4.4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h= content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=pp1; bh=wO6HW6vWuPc/Qq/7B +4jTefqyYOwAQ1Oa3rgn35UZ7k=; b=c53ssdJaFnQ/xygrdMwUMPrBBGYCRm1Pr BC2+p5hj3sJcDZkn6aprAgwEskh4teQycZl4xrmb4VZlfOU0xMVXpk3dtDusH4cq nWAtj7I+dJzcy/HO0OVS9JKpfmQpsOoxleuTADmjfaAP+wdQBbR7klH9wlty4VpD uZBchDO7Xl8e+4lcjrcH+mk7FEE+6NFJPGIZVgEjWDNBh8SIAVfMYceRU/m38u/Q +oKvVe0NJIQ/pbwiOC78c0U4DY+pCUdTpdF9IpxPDhxvWsENYO1KJbJSDREEX7Po 0uqLo8tgwJgEx7FD7gRz6xcqh+NqNFpz8FH3SLyKI2rsXH8/nVxQQ== From: Collin Walling To: devel@lists.libvirt.org Subject: [PATCH v1 2/5] qemu: parse deprecated-props from query-cpu-model-expansion response Date: Tue, 12 Nov 2024 12:39:57 -0500 Message-ID: <20241112174000.27518-3-walling@linux.ibm.com> X-Mailer: git-send-email 2.45.1 In-Reply-To: <20241112174000.27518-1-walling@linux.ibm.com> References: <20241112174000.27518-1-walling@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: 3U7HsTUgC-cXDXtnZc4OViJidTTPiJHE X-Proofpoint-ORIG-GUID: 3U7HsTUgC-cXDXtnZc4OViJidTTPiJHE X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1051,Hydra:6.0.680,FMLib:17.12.62.30 definitions=2024-10-15_01,2024-10-11_01,2024-09-30_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 clxscore=1015 lowpriorityscore=0 phishscore=0 bulkscore=0 malwarescore=0 adultscore=0 priorityscore=1501 mlxscore=0 impostorscore=0 mlxlogscore=999 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2409260000 definitions=main-2411120141 Content-Transfer-Encoding: quoted-printable Message-ID-Hash: VXHTR3JLWZRHMVYTDLKQAFXW2PZD3VMH X-Message-ID-Hash: VXHTR3JLWZRHMVYTDLKQAFXW2PZD3VMH X-MailFrom: walling@linux.ibm.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; header-match-config-2; header-match-config-3; header-match-devel.lists.libvirt.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header X-Mailman-Version: 3.2.2 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1731433576770116600 Content-Type: text/plain; charset="utf-8" query-cpu-model-expansion may report an array of deprecated properties. This array is optional, and may not be supported for a particular architecture or reported for a particular CPU model. If the output is present, then capture it and store in a qemuMonitorCPUModelInfo struct for later use. The deprecated features will be retained in qemuCaps->kvm->hostCPU.info and will be stored in the capabilities cache file under the element using the following format: At this time the data is only queried, parsed, and cached. The data will be utilized in a subsequent patch. Signed-off-by: Collin Walling --- src/qemu/qemu_capabilities.c | 31 +++++++++++++++++++ src/qemu/qemu_monitor.c | 10 ++++++ src/qemu/qemu_monitor.h | 1 + src/qemu/qemu_monitor_json.c | 18 +++++++++++ .../qemucapabilitiesdata/caps_9.1.0_s390x.xml | 6 ++++ .../qemucapabilitiesdata/caps_9.2.0_s390x.xml | 6 ++++ 6 files changed, 72 insertions(+) diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index 6b67da30ec..9850ed8458 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -4013,6 +4013,7 @@ virQEMUCapsLoadHostCPUModelInfo(virQEMUCapsAccel *cap= s, const char *typeStr) { xmlNodePtr hostCPUNode; + xmlNodePtr deprecated_props; g_autofree xmlNodePtr *nodes =3D NULL; VIR_XPATH_NODE_AUTORESTORE(ctxt) g_autoptr(qemuMonitorCPUModelInfo) hostCPU =3D NULL; @@ -4105,6 +4106,24 @@ virQEMUCapsLoadHostCPUModelInfo(virQEMUCapsAccel *ca= ps, } } =20 + ctxt->node =3D hostCPUNode; + + if ((deprecated_props =3D virXPathNode("./deprecatedFeatures", ctxt)))= { + g_autoptr(GPtrArray) props =3D virXMLNodeGetSubelementList(depreca= ted_props, NULL); + + hostCPU->deprecated_props =3D g_new0(char *, props->len); + + for (i =3D 0; i < props->len; i++) { + xmlNodePtr prop =3D g_ptr_array_index(props, i); + + if (!(hostCPU->deprecated_props[i] =3D virXMLPropString(prop, = "name"))) { + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("missing 'name' attribute for a host CPU = model deprecated property in QEMU capabilities cache")); + return -1; + } + } + } + caps->hostCPU.info =3D g_steal_pointer(&hostCPU); return 0; } @@ -4837,6 +4856,18 @@ virQEMUCapsFormatHostCPUModelInfo(virQEMUCapsAccel *= caps, virBufferAddLit(buf, "/>\n"); } =20 + if (model->deprecated_props) { + virBufferAddLit(buf, "\n"); + virBufferAdjustIndent(buf, 2); + + for (i =3D 0; i < g_strv_length(model->deprecated_props); i++) + virBufferAsprintf(buf, "\n", + model->deprecated_props[i]); + + virBufferAdjustIndent(buf, -2); + virBufferAddLit(buf, "\n"); + } + virBufferAdjustIndent(buf, -2); virBufferAddLit(buf, "\n"); } diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c index fd888e2468..e5d231a867 100644 --- a/src/qemu/qemu_monitor.c +++ b/src/qemu/qemu_monitor.c @@ -3290,6 +3290,7 @@ qemuMonitorCPUModelInfoFree(qemuMonitorCPUModelInfo *= model_info) g_free(model_info->props[i].value.string); } =20 + g_strfreev(model_info->deprecated_props); g_free(model_info->props); g_free(model_info->name); g_free(model_info); @@ -3334,6 +3335,15 @@ qemuMonitorCPUModelInfoCopy(const qemuMonitorCPUMode= lInfo *orig) } } =20 + if (orig->deprecated_props) { + copy->deprecated_props =3D g_new0(char *, + g_strv_length(orig->deprecated_pro= ps)); + + for (i =3D 0; i < g_strv_length(orig->deprecated_props); i++) { + copy->deprecated_props[i] =3D g_strdup(orig->deprecated_props[= i]); + } + } + return copy; } =20 diff --git a/src/qemu/qemu_monitor.h b/src/qemu/qemu_monitor.h index 4341519cfe..97bc1d9a2c 100644 --- a/src/qemu/qemu_monitor.h +++ b/src/qemu/qemu_monitor.h @@ -1146,6 +1146,7 @@ struct _qemuMonitorCPUModelInfo { char *name; size_t nprops; qemuMonitorCPUProperty *props; + GStrv deprecated_props; bool migratability; }; =20 diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c index 7c916efacf..5216284c31 100644 --- a/src/qemu/qemu_monitor_json.c +++ b/src/qemu/qemu_monitor_json.c @@ -5095,6 +5095,7 @@ qemuMonitorJSONParseCPUModelExpansionData(virJSONValu= e *data, bool fail_no_props, virJSONValue **cpu_model, virJSONValue **cpu_props, + virJSONValue **cpu_deprecated_pr= ops, const char **cpu_name) { if (qemuMonitorJSONParseCPUModelData(data, "query-cpu-model-expansion", @@ -5102,6 +5103,12 @@ qemuMonitorJSONParseCPUModelExpansionData(virJSONVal= ue *data, cpu_name) < 0) return -1; =20 + /* + * Unconditionally check for the deprecated-props array, as + * it is not a guarantee response even if QEMU supports it. + */ + *cpu_deprecated_props =3D virJSONValueObjectGetArray(data, "deprecated= -props"); + return 0; } =20 @@ -5109,6 +5116,7 @@ qemuMonitorJSONParseCPUModelExpansionData(virJSONValu= e *data, static int qemuMonitorJSONParseCPUModelExpansion(const char *cpu_name, virJSONValue *cpu_props, + virJSONValue *cpu_deprecated_props, qemuMonitorCPUModelInfo **model_info) { g_autoptr(qemuMonitorCPUModelInfo) expanded_model =3D NULL; @@ -5116,6 +5124,12 @@ qemuMonitorJSONParseCPUModelExpansion(const char *cp= u_name, if (qemuMonitorJSONParseCPUModel(cpu_name, cpu_props, &expanded_model)= < 0) return -1; =20 + if (cpu_deprecated_props && + virJSONValueArraySize(cpu_deprecated_props) && + (!(expanded_model->deprecated_props =3D virJSONValueArrayToStringL= ist(cpu_deprecated_props)))) { + return -1; + } + *model_info =3D g_steal_pointer(&expanded_model); return 0; } @@ -5180,6 +5194,7 @@ qemuMonitorJSONGetCPUModelExpansion(qemuMonitor *mon, g_autoptr(virJSONValue) fullData =3D NULL; virJSONValue *cpu_model; virJSONValue *cpu_props =3D NULL; + virJSONValue *cpu_deprecated_props =3D NULL; const char *cpu_name =3D ""; int rc; =20 @@ -5193,6 +5208,7 @@ qemuMonitorJSONGetCPUModelExpansion(qemuMonitor *mon, =20 if (qemuMonitorJSONParseCPUModelExpansionData(data, fail_no_props, &cpu_model, &cpu_props, + &cpu_deprecated_props, &cpu_name) < 0) return -1; =20 @@ -5211,11 +5227,13 @@ qemuMonitorJSONGetCPUModelExpansion(qemuMonitor *mo= n, =20 if (qemuMonitorJSONParseCPUModelExpansionData(fullData, fail_no_pr= ops, &cpu_model, &cpu_pro= ps, + &cpu_deprecated_prop= s, &cpu_name) < 0) return -1; } =20 return qemuMonitorJSONParseCPUModelExpansion(cpu_name, cpu_props, + cpu_deprecated_props, model_info); } =20 diff --git a/tests/qemucapabilitiesdata/caps_9.1.0_s390x.xml b/tests/qemuca= pabilitiesdata/caps_9.1.0_s390x.xml index 50e9a60a1f..5e8db88e52 100644 --- a/tests/qemucapabilitiesdata/caps_9.1.0_s390x.xml +++ b/tests/qemucapabilitiesdata/caps_9.1.0_s390x.xml @@ -193,6 +193,12 @@ + + + + + + diff --git a/tests/qemucapabilitiesdata/caps_9.2.0_s390x.xml b/tests/qemuca= pabilitiesdata/caps_9.2.0_s390x.xml index 68a6778a25..0fa73e9918 100644 --- a/tests/qemucapabilitiesdata/caps_9.2.0_s390x.xml +++ b/tests/qemucapabilitiesdata/caps_9.2.0_s390x.xml @@ -195,6 +195,12 @@ + + + + + + --=20 2.45.1 From nobody Thu Dec 26 20:56:08 2024 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=fail(p=reject dis=none) header.from=linux.ibm.com Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1731433505348253.62049963145319; Tue, 12 Nov 2024 09:45:05 -0800 (PST) Received: by lists.libvirt.org (Postfix, from userid 996) id 371DF1879; Tue, 12 Nov 2024 12:45:04 -0500 (EST) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 400DC1798; Tue, 12 Nov 2024 12:43:10 -0500 (EST) Received: by lists.libvirt.org (Postfix, from userid 996) id AC0081461; Tue, 12 Nov 2024 12:43:02 -0500 (EST) Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id 624E71450 for ; Tue, 12 Nov 2024 12:43:01 -0500 (EST) Received: from pps.filterd (m0356516.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 4ACGedXK003515 for ; Tue, 12 Nov 2024 17:43:01 GMT Received: from ppma11.dal12v.mail.ibm.com (db.9e.1632.ip4.static.sl-reverse.com [50.22.158.219]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 42var408jd-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Tue, 12 Nov 2024 17:43:00 +0000 (GMT) Received: from pps.filterd (ppma11.dal12v.mail.ibm.com [127.0.0.1]) by ppma11.dal12v.mail.ibm.com (8.18.1.2/8.18.1.2) with ESMTP id 4AC7PQG4004153 for ; Tue, 12 Nov 2024 17:43:00 GMT Received: from smtprelay03.dal12v.mail.ibm.com ([172.16.1.5]) by ppma11.dal12v.mail.ibm.com (PPS) with ESMTPS id 42tms14hw2-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Tue, 12 Nov 2024 17:43:00 +0000 Received: from smtpav05.dal12v.mail.ibm.com (smtpav05.dal12v.mail.ibm.com [10.241.53.104]) by smtprelay03.dal12v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 4ACHgxHP50856206 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Tue, 12 Nov 2024 17:42:59 GMT Received: from smtpav05.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 99F8B58056 for ; Tue, 12 Nov 2024 17:42:59 +0000 (GMT) Received: from smtpav05.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 4CB8D58052 for ; Tue, 12 Nov 2024 17:42:59 +0000 (GMT) Received: from li-d664314c-3171-11b2-a85c-fa8047ef35bd.ibm.com.com (unknown [9.67.103.128]) by smtpav05.dal12v.mail.ibm.com (Postfix) with ESMTP for ; Tue, 12 Nov 2024 17:42:59 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-1.5 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,RCVD_IN_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_BLOCKED,SPF_HELO_NONE autolearn=unavailable autolearn_force=no version=3.4.4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h= content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=pp1; bh=xqm43GhTS/VX+898x OBXOYLNMSd+NA8q9NUAxiy34Zk=; b=poGfZqmzO3z6DE9ucjAkJnoOGBpxsIenJ 5XlftYWP5cGveO0zfXRO5n2jO650PcFNZIpUfv0OFfoS8j9WJwZ9MDs00Y8O999u SaVtgSg+sEo0kULuRgJBFGHKTJk8LvromqFWq1XzdHD9YjATT7/yF8xpxkazeeYP Voagey4uSmWQwpnHtIdCUiGfQd4hv7XXUebLuOWCwWEw5/BrQVgZNA93nAqWMmSo lgvCp1vOBtVGIohUzaB20Xag3NllBLCutNVm3AxZKJNQufBANr2NOppp/rTNajyK 2wm5H3MO76QKgQDFOyno0SxPIZYr6/l6Vv58TPk2nF9PYWgumEebQ== From: Collin Walling To: devel@lists.libvirt.org Subject: [PATCH v1 3/5] qemu_capabilities: query deprecated features for host-model Date: Tue, 12 Nov 2024 12:39:58 -0500 Message-ID: <20241112174000.27518-4-walling@linux.ibm.com> X-Mailer: git-send-email 2.45.1 In-Reply-To: <20241112174000.27518-1-walling@linux.ibm.com> References: <20241112174000.27518-1-walling@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: WT8r7YkQs0b9n40ORTOOpTIXFgnF9wIm X-Proofpoint-ORIG-GUID: WT8r7YkQs0b9n40ORTOOpTIXFgnF9wIm X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1051,Hydra:6.0.680,FMLib:17.12.62.30 definitions=2024-10-15_01,2024-10-11_01,2024-09-30_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 malwarescore=0 phishscore=0 priorityscore=1501 mlxscore=0 suspectscore=0 clxscore=1015 lowpriorityscore=0 mlxlogscore=999 bulkscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2409260000 definitions=main-2411120141 Content-Transfer-Encoding: quoted-printable Message-ID-Hash: UEW5G6HEKLR526EIXYB3D3O7NXAHX2BQ X-Message-ID-Hash: UEW5G6HEKLR526EIXYB3D3O7NXAHX2BQ X-MailFrom: walling@linux.ibm.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; header-match-config-2; header-match-config-3; header-match-devel.lists.libvirt.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header X-Mailman-Version: 3.2.2 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1731433506388116600 Content-Type: text/plain; charset="utf-8" Add QEMU_CAPS_QUERY_CPU_MODEL_EXPANSION_DEPRECATED_PROPS for detecting if query-cpu-model-expansion can report deprecated CPU model properties. QEMU introduced this capability in 9.1 release. Add flag and deprecated features to the capabilities test data for QEMU 9.1 and 9.2 replies/XML since it can now be accounted for. When probing for the host CPU, perform a full CPU model expansion to retrieve the list of features deprecated across the entire architecture. The list and count are stored in the host's CPU model info within the QEMU capabilities. Other info resulting from this query (e.g. model name, etc) is ignored. The new capabilities flag is used to fence off the extra query for architectures/QEMU binaries that do not report deprecated CPU model features. Signed-off-by: Collin Walling --- src/qemu/qemu_capabilities.c | 38 ++ src/qemu/qemu_capabilities.h | 1 + .../caps_9.1.0_s390x.replies | 348 +++++++++++++++++- .../qemucapabilitiesdata/caps_9.1.0_s390x.xml | 7 + .../caps_9.2.0_s390x.replies | 348 +++++++++++++++++- .../qemucapabilitiesdata/caps_9.2.0_s390x.xml | 7 + 6 files changed, 745 insertions(+), 4 deletions(-) diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index 9850ed8458..8a10816757 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -720,6 +720,7 @@ VIR_ENUM_IMPL(virQEMUCaps, "snapshot-internal-qmp", /* QEMU_CAPS_SNAPSHOT_INTERNAL_QMP = */ "chardev-reconnect-miliseconds", /* QEMU_CAPS_CHARDEV_RECONN= ECT_MILISECONDS */ "virtio-ccw.loadparm", /* QEMU_CAPS_VIRTIO_CCW_DEVICE_LOADPA= RM */ + "query-cpu-model-expansion.deprecated-props", /* QEMU_CAPS_Q= UERY_CPU_MODEL_EXPANSION_DEPRECATED_PROPS */ ); =20 =20 @@ -1592,6 +1593,7 @@ static struct virQEMUCapsStringFlags virQEMUCapsQMPSc= hemaQueries[] =3D { { "query-migrate/ret-type/blocked-reasons", QEMU_CAPS_MIGRATION_BLOCKE= D_REASONS }, { "screendump/arg-type/format/^png", QEMU_CAPS_SCREENSHOT_FORMAT_PNG }, { "netdev_add/arg-type/+user", QEMU_CAPS_NETDEV_USER }, + { "query-cpu-model-expansion/ret-type/deprecated-props", QEMU_CAPS_QUE= RY_CPU_MODEL_EXPANSION_DEPRECATED_PROPS }, }; =20 typedef struct _virQEMUCapsObjectTypeProps virQEMUCapsObjectTypeProps; @@ -3144,6 +3146,38 @@ virQEMUCapsProbeHypervCapabilities(virQEMUCaps *qemu= Caps, } =20 =20 +/** + * virQEMUCapsProbeFullDeprecatedProperties + * @mon: QEMU monitor + * @cpu: CPU definition to be expanded + * @props: the array to be filled with deprecated features + * + * Performs a full CPU model expansion to retrieve an array of deprecated + * properties. If the expansion succeeds, then data previously stored in + * @props is freed. + * + * Returns: -1 if the expansion failed; otherwise 0. + */ +static int +virQEMUCapsProbeFullDeprecatedProperties(qemuMonitor *mon, + virCPUDef *cpu, + GStrv *props) +{ + g_autoptr(qemuMonitorCPUModelInfo) propsInfo =3D NULL; + + if (qemuMonitorGetCPUModelExpansion(mon, QEMU_MONITOR_CPU_MODEL_EXPANS= ION_FULL, + cpu, true, false, false, &propsInf= o) < 0) + return -1; + + if (propsInfo && propsInfo->deprecated_props) { + g_free(*props); + *props =3D g_steal_pointer(&propsInfo->deprecated_props); + } + + return 0; +} + + static int virQEMUCapsProbeQMPHostCPU(virQEMUCaps *qemuCaps, virQEMUCapsAccel *accel, @@ -3225,6 +3259,10 @@ virQEMUCapsProbeQMPHostCPU(virQEMUCaps *qemuCaps, modelInfo->migratability =3D true; } =20 + if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_QUERY_CPU_MODEL_EXPANSION_DEPRE= CATED_PROPS) && + virQEMUCapsProbeFullDeprecatedProperties(mon, cpu, &modelInfo->dep= recated_props) < 0) + return -1; + if (virQEMUCapsTypeIsAccelerated(virtType) && (ARCH_IS_X86(qemuCaps->arch) || ARCH_IS_ARM(qemuCaps->arch))) { g_autoptr(qemuMonitorCPUModelInfo) fullQEMU =3D NULL; diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h index e49fda6721..3acb903478 100644 --- a/src/qemu/qemu_capabilities.h +++ b/src/qemu/qemu_capabilities.h @@ -699,6 +699,7 @@ typedef enum { /* virQEMUCapsFlags grouping marker for = syntax-check */ QEMU_CAPS_SNAPSHOT_INTERNAL_QMP, /* internal snapshot support via QMP = commands 'snapshot-save'/'snapshot-delete' */ QEMU_CAPS_CHARDEV_RECONNECT_MILISECONDS, /* 'reconnect-ms' option for = chardevs supported */ QEMU_CAPS_VIRTIO_CCW_DEVICE_LOADPARM, /* loadparm available on CCW dev= ice for multi device boot */ + QEMU_CAPS_QUERY_CPU_MODEL_EXPANSION_DEPRECATED_PROPS, /* query-cpu-mod= el-expansion may report deprecated CPU properties */ =20 QEMU_CAPS_LAST /* this must always be the last item */ } virQEMUCapsFlags; diff --git a/tests/qemucapabilitiesdata/caps_9.1.0_s390x.replies b/tests/qe= mucapabilitiesdata/caps_9.1.0_s390x.replies index 2d4ab8ed75..0a523ba47e 100644 --- a/tests/qemucapabilitiesdata/caps_9.1.0_s390x.replies +++ b/tests/qemucapabilitiesdata/caps_9.1.0_s390x.replies @@ -32252,6 +32252,89 @@ "id": "libvirt-40" } =20 +{ + "execute": "query-cpu-model-expansion", + "arguments": { + "type": "full", + "model": { + "name": "host" + } + }, + "id": "libvirt-41" +} + +{ + "return": { + "deprecated-props": [ + "bpb", + "te", + "cte", + "csske" + ], + "model": { + "name": "gen16a-base", + "props": { + "nnpa": true, + "aen": true, + "cmmnt": true, + "vxpdeh": true, + "aefsi": true, + "diag318": true, + "csske": true, + "mepoch": true, + "msa9": true, + "msa8": true, + "msa7": true, + "msa6": true, + "msa5": true, + "msa4": true, + "msa3": true, + "msa2": true, + "msa1": true, + "sthyi": true, + "edat": true, + "ri": true, + "deflate": true, + "edat2": true, + "etoken": true, + "vx": true, + "ipter": true, + "pai": true, + "paie": true, + "mepochptff": true, + "ap": true, + "vxeh": true, + "vxpd": true, + "esop": true, + "msa9_pckmo": true, + "vxeh2": true, + "esort": true, + "appv": true, + "apqi": true, + "apft": true, + "els": true, + "iep": true, + "appvi": true, + "apqci": true, + "cte": true, + "ais": true, + "bpb": true, + "ctop": true, + "gs": true, + "ppa15": true, + "zpci": true, + "rdp": true, + "sea_esop2": true, + "beareh": true, + "te": true, + "cmm": true, + "vxpdeh2": true + } + } + }, + "id": "libvirt-41" +} + { "execute": "qmp_capabilities", "id": "libvirt-1" @@ -36262,10 +36345,271 @@ } =20 { - "execute": "query-machines", + "execute": "query-cpu-model-expansion", + "arguments": { + "type": "full", + "model": { + "name": "max" + } + }, + "id": "libvirt-4" +} + +{ + "return": { + "deprecated-props": [ + "bpb", + "te", + "cte", + "csske" + ], + "model": { + "name": "gen15a-base", + "props": { + "pfmfi": false, + "exrl": true, + "stfle45": true, + "kmctr-etdea-192": false, + "kmctr-etdea-128": false, + "nnpa": false, + "cmma": false, + "dateh2": false, + "gen13ptff": false, + "aen": true, + "kmo-etdea-192": false, + "kmf-etdea-192": false, + "kmc-etdea-192": false, + "kmac-tdea-192": false, + "kimd-sha-512": true, + "dateh": true, + "km-aes-256": false, + "km-aes-192": false, + "kmctr-aes-256": false, + "kma-gcm-eaes-192": false, + "kmo-tdea-192": false, + "kmf-tdea-192": false, + "kmctr-tdea-192": false, + "kmctr-tdea-128": false, + "km-etdea-192": false, + "kmc-tdea-192": false, + "cmmnt": false, + "iacc2": true, + "parseh": false, + "klmd-sha-512": true, + "kma-gcm-eaes-128": false, + "csst": true, + "pcc-xts-aes-256": false, + "pcc-xts-aes-128": false, + "pckmo-aes-128": false, + "idter": false, + "idtes": true, + "prno-trng-qrtcr": false, + "pcc-cmac-eaes-128": false, + "vxpdeh": false, + "aefsi": true, + "pckmo-etdea-192": false, + "pckmo-etdea-128": false, + "diag318": false, + "pcc-cmac-eaes-256": false, + "msa-base": true, + "pcc-cmac-etdea-192": false, + "hpma2": false, + "kmctr-eaes-256": false, + "csske": false, + "csst2": true, + "mepoch": false, + "msa9": false, + "msa6": false, + "msa1": false, + "kmctr-aes-192": false, + "pckmo-aes-256": false, + "sthyi": false, + "stckf": true, + "stfle": true, + "edat": false, + "etf3": true, + "etf2": true, + "hfpm": false, + "ri": false, + "pcc-xts-eaes-256": false, + "deflate": false, + "km-xts-eaes-256": false, + "km-xts-eaes-128": false, + "edat2": false, + "hfpue": false, + "kmo-aes-192": false, + "kmf-aes-192": false, + "km-eaes-192": false, + "kmc-aes-192": false, + "unpack": false, + "dfp": false, + "kmo-aes-128": false, + "kmf-aes-128": false, + "km-eaes-128": false, + "kmctr-dea": false, + "mvcos": true, + "etoken": false, + "pcc-cmac-tdea-192": false, + "km-dea": false, + "sprogp": true, + "sigpif": false, + "kmac-eaes-128": false, + "ldisphp": true, + "pckmo-aes-192": false, + "ipter": false, + "vx": true, + "pai": false, + "kimd-ghash": false, + "emon": false, + "kimd-sha-1": false, + "cei": false, + "cmpsceh": false, + "kmctr-eaes-192": false, + "kmctr-eaes-128": false, + "ginste": true, + "km-xts-aes-256": false, + "kmac-eaes-256": false, + "kmo-eaes-128": false, + "kmf-eaes-128": false, + "kmc-eaes-128": false, + "kmac-aes-128": false, + "paie": false, + "dfppc": false, + "dfpzc": false, + "dfphp": false, + "kmo-eaes-256": false, + "kmf-eaes-256": false, + "kmc-eaes-256": false, + "kmac-aes-256": false, + "kmac-etdea-192": false, + "kmac-etdea-128": false, + "kmo-dea": false, + "kmf-dea": false, + "km-edea": false, + "kmc-dea": false, + "stfle49": true, + "klmd-sha-1": false, + "mepochptff": false, + "opc": false, + "ap": false, + "asnlxr": false, + "gpereh": false, + "minste2": true, + "pcc-cmac-dea": false, + "vxpd": false, + "vxeh": true, + "esop": true, + "ectg": true, + "ib": false, + "km-tdea-192": false, + "km-tdea-128": false, + "msa9_pckmo": false, + "siif": false, + "kma-gcm-aes-256": false, + "kma-gcm-aes-192": false, + "kma-gcm-aes-128": false, + "pcc-cmac-aes-256": false, + "tsi": false, + "vxeh2": true, + "tpei": false, + "esort": false, + "esan3": true, + "fpe": true, + "ibs": false, + "pcc-xts-eaes-128": false, + "kmac-eaes-192": false, + "zarch": true, + "kmo-edea": false, + "kmf-edea": false, + "kmc-edea": false, + "kmac-dea": false, + "appv": false, + "apqi": false, + "apft": false, + "stfle53": true, + "ppno-sha-512-drng": false, + "pcc-cmac-tdea-128": false, + "kmo-aes-256": false, + "kmf-aes-256": false, + "km-eaes-256": false, + "kmc-aes-256": false, + "els": false, + "sief2": false, + "eimm": true, + "pcc-cmac-etdea-128": false, + "iep": true, + "irbm": false, + "km-xts-aes-128": false, + "srs": true, + "appvi": false, + "apqci": false, + "kmo-tdea-128": false, + "kmf-tdea-128": false, + "km-etdea-128": false, + "kmc-tdea-128": false, + "kss": false, + "cte": false, + "kmac-edea": false, + "prno-trng": true, + "kma-gcm-eaes-256": false, + "ais": true, + "fpseh": true, + "ltlbc": true, + "ldisp": true, + "kmo-etdea-128": false, + "kmf-etdea-128": false, + "kmc-etdea-128": false, + "kmac-tdea-128": false, + "pcc-cmac-edea": false, + "bpb": false, + "kmctr-edea": false, + "64bscao": false, + "ctop": false, + "kmo-eaes-192": false, + "kmf-eaes-192": false, + "kmc-eaes-192": false, + "kmac-aes-192": false, + "gs": false, + "sema": false, + "etf3eh": true, + "etf2eh": true, + "eec": false, + "pcc-cmac-eaes-192": false, + "ppa15": false, + "kmc-prng": false, + "zpci": true, + "rdp": false, + "nonqks": false, + "sea_esop2": true, + "minste3": true, + "beareh": false, + "pfpo": false, + "te": false, + "msa8-base": true, + "msa4-base": true, + "msa3-base": true, + "msa5-base": true, + "pcc-cmac-aes-192": false, + "cmm": false, + "tods": false, + "pcc-cmac-aes-128": false, + "plo": true, + "pckmo-edea": false, + "gsls": false, + "kmctr-aes-128": false, + "skey": false, + "vxpdeh2": false + } + } + }, "id": "libvirt-4" } =20 +{ + "execute": "query-machines", + "id": "libvirt-5" +} + { "return": [ { @@ -36568,5 +36912,5 @@ "default-ram-id": "s390.ram" } ], - "id": "libvirt-4" + "id": "libvirt-5" } diff --git a/tests/qemucapabilitiesdata/caps_9.1.0_s390x.xml b/tests/qemuca= pabilitiesdata/caps_9.1.0_s390x.xml index 5e8db88e52..b3265dcc18 100644 --- a/tests/qemucapabilitiesdata/caps_9.1.0_s390x.xml +++ b/tests/qemucapabilitiesdata/caps_9.1.0_s390x.xml @@ -133,6 +133,7 @@ + 9001000 39100246 v9.1.0 @@ -356,6 +357,12 @@ + + + + + + diff --git a/tests/qemucapabilitiesdata/caps_9.2.0_s390x.replies b/tests/qe= mucapabilitiesdata/caps_9.2.0_s390x.replies index 91c9a049bf..9a58acaf08 100644 --- a/tests/qemucapabilitiesdata/caps_9.2.0_s390x.replies +++ b/tests/qemucapabilitiesdata/caps_9.2.0_s390x.replies @@ -32411,6 +32411,89 @@ "id": "libvirt-40" } =20 +{ + "execute": "query-cpu-model-expansion", + "arguments": { + "type": "full", + "model": { + "name": "host" + } + }, + "id": "libvirt-41" +} + +{ + "return": { + "deprecated-props": [ + "bpb", + "te", + "cte", + "csske" + ], + "model": { + "name": "gen16a-base", + "props": { + "nnpa": true, + "aen": true, + "cmmnt": true, + "vxpdeh": true, + "aefsi": true, + "diag318": true, + "csske": true, + "mepoch": true, + "msa9": true, + "msa8": true, + "msa7": true, + "msa6": true, + "msa5": true, + "msa4": true, + "msa3": true, + "msa2": true, + "msa1": true, + "sthyi": true, + "edat": true, + "ri": true, + "deflate": true, + "edat2": true, + "etoken": true, + "vx": true, + "ipter": true, + "pai": true, + "paie": true, + "mepochptff": true, + "ap": true, + "vxeh": true, + "vxpd": true, + "esop": true, + "msa9_pckmo": true, + "vxeh2": true, + "esort": true, + "appv": true, + "apqi": true, + "apft": true, + "els": true, + "iep": true, + "appvi": true, + "apqci": true, + "cte": true, + "ais": true, + "bpb": true, + "ctop": true, + "gs": true, + "ppa15": true, + "zpci": true, + "rdp": true, + "sea_esop2": true, + "beareh": true, + "te": true, + "cmm": true, + "vxpdeh2": true + } + } + }, + "id": "libvirt-41" +} + { "execute": "qmp_capabilities", "id": "libvirt-1" @@ -36421,10 +36504,271 @@ } =20 { - "execute": "query-machines", + "execute": "query-cpu-model-expansion", + "arguments": { + "type": "full", + "model": { + "name": "max" + } + }, + "id": "libvirt-4" +} + +{ + "return": { + "deprecated-props": [ + "bpb", + "te", + "cte", + "csske" + ], + "model": { + "name": "gen15a-base", + "props": { + "pfmfi": false, + "exrl": true, + "stfle45": true, + "kmctr-etdea-192": false, + "kmctr-etdea-128": false, + "nnpa": false, + "cmma": false, + "dateh2": false, + "gen13ptff": false, + "aen": true, + "kmo-etdea-192": false, + "kmf-etdea-192": false, + "kmc-etdea-192": false, + "kmac-tdea-192": false, + "kimd-sha-512": true, + "dateh": true, + "km-aes-256": false, + "km-aes-192": false, + "kmctr-aes-256": false, + "kma-gcm-eaes-192": false, + "kmo-tdea-192": false, + "kmf-tdea-192": false, + "kmctr-tdea-192": false, + "kmctr-tdea-128": false, + "km-etdea-192": false, + "kmc-tdea-192": false, + "cmmnt": false, + "iacc2": true, + "parseh": false, + "klmd-sha-512": true, + "kma-gcm-eaes-128": false, + "csst": true, + "pcc-xts-aes-256": false, + "pcc-xts-aes-128": false, + "pckmo-aes-128": false, + "idter": false, + "idtes": true, + "prno-trng-qrtcr": false, + "pcc-cmac-eaes-128": false, + "vxpdeh": false, + "aefsi": true, + "pckmo-etdea-192": false, + "pckmo-etdea-128": false, + "diag318": false, + "pcc-cmac-eaes-256": false, + "msa-base": true, + "pcc-cmac-etdea-192": false, + "hpma2": false, + "kmctr-eaes-256": false, + "csske": false, + "csst2": true, + "mepoch": false, + "msa9": false, + "msa6": false, + "msa1": false, + "kmctr-aes-192": false, + "pckmo-aes-256": false, + "sthyi": false, + "stckf": true, + "stfle": true, + "edat": false, + "etf3": true, + "etf2": true, + "hfpm": false, + "ri": false, + "pcc-xts-eaes-256": false, + "deflate": false, + "km-xts-eaes-256": false, + "km-xts-eaes-128": false, + "edat2": false, + "hfpue": false, + "kmo-aes-192": false, + "kmf-aes-192": false, + "km-eaes-192": false, + "kmc-aes-192": false, + "unpack": false, + "dfp": false, + "kmo-aes-128": false, + "kmf-aes-128": false, + "km-eaes-128": false, + "kmctr-dea": false, + "mvcos": true, + "etoken": false, + "pcc-cmac-tdea-192": false, + "km-dea": false, + "sprogp": true, + "sigpif": false, + "kmac-eaes-128": false, + "ldisphp": true, + "pckmo-aes-192": false, + "ipter": false, + "vx": true, + "pai": false, + "kimd-ghash": false, + "emon": false, + "kimd-sha-1": false, + "cei": false, + "cmpsceh": false, + "kmctr-eaes-192": false, + "kmctr-eaes-128": false, + "ginste": true, + "km-xts-aes-256": false, + "kmac-eaes-256": false, + "kmo-eaes-128": false, + "kmf-eaes-128": false, + "kmc-eaes-128": false, + "kmac-aes-128": false, + "paie": false, + "dfppc": false, + "dfpzc": false, + "dfphp": false, + "kmo-eaes-256": false, + "kmf-eaes-256": false, + "kmc-eaes-256": false, + "kmac-aes-256": false, + "kmac-etdea-192": false, + "kmac-etdea-128": false, + "kmo-dea": false, + "kmf-dea": false, + "km-edea": false, + "kmc-dea": false, + "stfle49": true, + "klmd-sha-1": false, + "mepochptff": false, + "opc": false, + "ap": false, + "asnlxr": false, + "gpereh": false, + "minste2": true, + "pcc-cmac-dea": false, + "vxpd": false, + "vxeh": true, + "esop": true, + "ectg": true, + "ib": false, + "km-tdea-192": false, + "km-tdea-128": false, + "msa9_pckmo": false, + "siif": false, + "kma-gcm-aes-256": false, + "kma-gcm-aes-192": false, + "kma-gcm-aes-128": false, + "pcc-cmac-aes-256": false, + "tsi": false, + "vxeh2": true, + "tpei": false, + "esort": false, + "esan3": true, + "fpe": true, + "ibs": false, + "pcc-xts-eaes-128": false, + "kmac-eaes-192": false, + "zarch": true, + "kmo-edea": false, + "kmf-edea": false, + "kmc-edea": false, + "kmac-dea": false, + "appv": false, + "apqi": false, + "apft": false, + "stfle53": true, + "ppno-sha-512-drng": false, + "pcc-cmac-tdea-128": false, + "kmo-aes-256": false, + "kmf-aes-256": false, + "km-eaes-256": false, + "kmc-aes-256": false, + "els": false, + "sief2": false, + "eimm": true, + "pcc-cmac-etdea-128": false, + "iep": true, + "irbm": false, + "km-xts-aes-128": false, + "srs": true, + "appvi": false, + "apqci": false, + "kmo-tdea-128": false, + "kmf-tdea-128": false, + "km-etdea-128": false, + "kmc-tdea-128": false, + "kss": false, + "cte": false, + "kmac-edea": false, + "prno-trng": true, + "kma-gcm-eaes-256": false, + "ais": true, + "fpseh": true, + "ltlbc": true, + "ldisp": true, + "kmo-etdea-128": false, + "kmf-etdea-128": false, + "kmc-etdea-128": false, + "kmac-tdea-128": false, + "pcc-cmac-edea": false, + "bpb": false, + "kmctr-edea": false, + "64bscao": false, + "ctop": false, + "kmo-eaes-192": false, + "kmf-eaes-192": false, + "kmc-eaes-192": false, + "kmac-aes-192": false, + "gs": false, + "sema": false, + "etf3eh": true, + "etf2eh": true, + "eec": false, + "pcc-cmac-eaes-192": false, + "ppa15": false, + "kmc-prng": false, + "zpci": true, + "rdp": false, + "nonqks": false, + "sea_esop2": true, + "minste3": true, + "beareh": false, + "pfpo": false, + "te": false, + "msa8-base": true, + "msa4-base": true, + "msa3-base": true, + "msa5-base": true, + "pcc-cmac-aes-192": false, + "cmm": false, + "tods": false, + "pcc-cmac-aes-128": false, + "plo": true, + "pckmo-edea": false, + "gsls": false, + "kmctr-aes-128": false, + "skey": false, + "vxpdeh2": false + } + } + }, "id": "libvirt-4" } =20 +{ + "execute": "query-machines", + "id": "libvirt-5" +} + { "return": [ { @@ -36737,5 +37081,5 @@ "default-ram-id": "s390.ram" } ], - "id": "libvirt-4" + "id": "libvirt-5" } diff --git a/tests/qemucapabilitiesdata/caps_9.2.0_s390x.xml b/tests/qemuca= pabilitiesdata/caps_9.2.0_s390x.xml index 0fa73e9918..330980de1c 100644 --- a/tests/qemucapabilitiesdata/caps_9.2.0_s390x.xml +++ b/tests/qemucapabilitiesdata/caps_9.2.0_s390x.xml @@ -135,6 +135,7 @@ + 9001050 39100247 v9.1.0-1348-g11b8920ed2 @@ -359,6 +360,12 @@ + + + + + + --=20 2.45.1 From nobody Thu Dec 26 20:56:08 2024 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=fail(p=reject dis=none) header.from=linux.ibm.com Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1731433445520406.4244386515137; Tue, 12 Nov 2024 09:44:05 -0800 (PST) Received: by lists.libvirt.org (Postfix, from userid 996) id 766B4188E; Tue, 12 Nov 2024 12:44:04 -0500 (EST) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 39A1D1939; Tue, 12 Nov 2024 12:43:07 -0500 (EST) Received: by lists.libvirt.org (Postfix, from userid 996) id 7B1B71461; Tue, 12 Nov 2024 12:43:02 -0500 (EST) Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id A59ED145B for ; Tue, 12 Nov 2024 12:43:01 -0500 (EST) Received: from pps.filterd (m0356516.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 4ACGeHTm002610 for ; Tue, 12 Nov 2024 17:43:01 GMT Received: from ppma12.dal12v.mail.ibm.com (dc.9e.1632.ip4.static.sl-reverse.com [50.22.158.220]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 42var408je-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Tue, 12 Nov 2024 17:43:00 +0000 (GMT) Received: from pps.filterd (ppma12.dal12v.mail.ibm.com [127.0.0.1]) by ppma12.dal12v.mail.ibm.com (8.18.1.2/8.18.1.2) with ESMTP id 4ACGFsGK010521 for ; Tue, 12 Nov 2024 17:43:00 GMT Received: from smtprelay03.dal12v.mail.ibm.com ([172.16.1.5]) by ppma12.dal12v.mail.ibm.com (PPS) with ESMTPS id 42tj2s4r4m-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Tue, 12 Nov 2024 17:43:00 +0000 Received: from smtpav05.dal12v.mail.ibm.com (smtpav05.dal12v.mail.ibm.com [10.241.53.104]) by smtprelay03.dal12v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 4ACHgxGs51184070 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Tue, 12 Nov 2024 17:43:00 GMT Received: from smtpav05.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id E1A0258056 for ; Tue, 12 Nov 2024 17:42:59 +0000 (GMT) Received: from smtpav05.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id B1AB45805D for ; Tue, 12 Nov 2024 17:42:59 +0000 (GMT) Received: from li-d664314c-3171-11b2-a85c-fa8047ef35bd.ibm.com.com (unknown [9.67.103.128]) by smtpav05.dal12v.mail.ibm.com (Postfix) with ESMTP for ; Tue, 12 Nov 2024 17:42:59 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-1.5 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,RCVD_IN_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_BLOCKED,SPF_HELO_NONE autolearn=unavailable autolearn_force=no version=3.4.4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h= content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=pp1; bh=mOHe9sbTEg8oN+2hO 8+gkfy0EsSw3/keL8hTk3jwx18=; b=OeG98akT3xqzMp5ki8wWAxB42X4k9c9Wf dHrCFYDxICAy/mnCguz0ZBKRi80rLwac2dz4KGd+l4aB3kOMTeidmTykiWNPllGL 3uqaPGSyu4UIx9YcMKFjglNhxj67LbbGxHws8gp/PYaj6MjPN3UOX/yI0iBmt63g yhrAZURc8/+iX/J2S6R/BF6ixU74gok+SfbGeWxAeU93HIFDd6NCZiVwtvIDrZNi btXiywpaFfNFtOfpLfnoNUHPqQ02cvGoKUtlLYgPCjiaItlxcF66vKWrtkNI7ixz oWyysvb28mTVUlq0ELMCMddC9xLzlAANOHUGsrFy+rlIn0sn+3QNg== From: Collin Walling To: devel@lists.libvirt.org Subject: [PATCH v1 4/5] virsh: add --disable-deprecated-features flag to domcapabilities Date: Tue, 12 Nov 2024 12:39:59 -0500 Message-ID: <20241112174000.27518-5-walling@linux.ibm.com> X-Mailer: git-send-email 2.45.1 In-Reply-To: <20241112174000.27518-1-walling@linux.ibm.com> References: <20241112174000.27518-1-walling@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: 75eE_BDOAF2HKpvFLrPa9X-mJFQGB0kQ X-Proofpoint-ORIG-GUID: 75eE_BDOAF2HKpvFLrPa9X-mJFQGB0kQ X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1051,Hydra:6.0.680,FMLib:17.12.62.30 definitions=2024-10-15_01,2024-10-11_01,2024-09-30_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 malwarescore=0 phishscore=0 priorityscore=1501 mlxscore=0 suspectscore=0 clxscore=1015 lowpriorityscore=0 mlxlogscore=919 bulkscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2409260000 definitions=main-2411120141 Content-Transfer-Encoding: quoted-printable Message-ID-Hash: ALW3HP6IKNVAXDDS4XIDVPXZF5ER63PH X-Message-ID-Hash: ALW3HP6IKNVAXDDS4XIDVPXZF5ER63PH X-MailFrom: walling@linux.ibm.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; header-match-config-2; header-match-config-3; header-match-devel.lists.libvirt.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header X-Mailman-Version: 3.2.2 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1731433446155116600 Content-Type: text/plain; charset="utf-8" Add a new flag, --disable-deprecated-features, to the domcapabilities command. This will modify the output to show the 'host-model' CPU with features flagged as deprecated paired with the 'disable' policy. virsh domcapabilities --disable-deprecated-features Signed-off-by: Collin Walling --- docs/manpages/virsh.rst | 6 ++++++ include/libvirt/libvirt-domain.h | 12 ++++++++++++ src/libvirt-domain.c | 2 +- src/qemu/qemu_capabilities.c | 20 ++++++++++++++++++++ src/qemu/qemu_capabilities.h | 3 +++ src/qemu/qemu_driver.c | 8 +++++++- tools/virsh-host.c | 9 ++++++++- 7 files changed, 57 insertions(+), 3 deletions(-) diff --git a/docs/manpages/virsh.rst b/docs/manpages/virsh.rst index 6776ea53d0..2700434dc4 100644 --- a/docs/manpages/virsh.rst +++ b/docs/manpages/virsh.rst @@ -568,6 +568,7 @@ domcapabilities =20 domcapabilities [virttype] [emulatorbin] [arch] [machine] [--xpath EXPRESSION] [--wrap] + [--disabled-deprecated-features] =20 =20 Print an XML document describing the domain capabilities for the @@ -609,6 +610,11 @@ a standalone document, however, for ease of additional= processing, the **--wrap** argument will cause the matching node to be wrapped in a common root node. =20 +The **--disabled-deprecated-features** argument will modify the contents +of host-model CPU XML, updating the features list with any features +flagged as deprecated for the CPU model by the hypervisor. These +features will be paired with the "disable" policy. + =20 pool-capabilities ----------------- diff --git a/include/libvirt/libvirt-domain.h b/include/libvirt/libvirt-dom= ain.h index 9232ce2e6b..47e06fe68e 100644 --- a/include/libvirt/libvirt-domain.h +++ b/include/libvirt/libvirt-domain.h @@ -1478,6 +1478,18 @@ int virDomainMigrateGetMaxSpeed(virDomainPtr domain, int virDomainMigrateStartPostCopy(virDomainPtr domain, unsigned int flags); =20 +/** + * virConnectGetDomainCapabilitiesFlags: + * + * Domain capabilities flags. + * + * Since: 10.10.0 + */ +typedef enum { + /* Report host model with deprecated features disabled. (Since: 10.10.= 0) */ + VIR_CONNECT_GET_DOMAIN_CAPABILITIES_DISABLE_DEPRECATED_FEATURES =3D (1= << 0), +} virConnectGetDomainCapabilitiesFlags; + char * virConnectGetDomainCapabilities(virConnectPtr conn, const char *emulatorbin, const char *arch, diff --git a/src/libvirt-domain.c b/src/libvirt-domain.c index 7c6b93963c..e8e5379672 100644 --- a/src/libvirt-domain.c +++ b/src/libvirt-domain.c @@ -12166,7 +12166,7 @@ virDomainSetUserPassword(virDomainPtr dom, * @arch: domain architecture * @machine: machine type * @virttype: virtualization type - * @flags: extra flags; not used yet, so callers should always pass 0 + * @flags: extra flags; bitwise-OR of virConnectGetDomainCapabilitiesFlags * * Prior creating a domain (for instance via virDomainCreateXML * or virDomainDefineXML) it may be suitable to know what the diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index 8a10816757..8f2c0c8f93 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -3324,6 +3324,26 @@ virQEMUCapsGetCPUFeatures(virQEMUCaps *qemuCaps, } =20 =20 +void +virQEMUCapsUpdateCPUDeprecatedFeatures(virQEMUCaps *qemuCaps, + virDomainVirtType virtType, + virCPUDef *cpu) +{ + qemuMonitorCPUModelInfo *modelInfo; + size_t i; + + modelInfo =3D virQEMUCapsGetCPUModelInfo(qemuCaps, virtType); + + if (!modelInfo || !modelInfo->deprecated_props) + return; + + for (i =3D 0; i < g_strv_length(modelInfo->deprecated_props); i++) { + virCPUDefUpdateFeature(cpu, modelInfo->deprecated_props[i], + VIR_CPU_FEATURE_DISABLE); + } +} + + struct tpmTypeToCaps { int type; virQEMUCapsFlags caps; diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h index 3acb903478..735db2b9af 100644 --- a/src/qemu/qemu_capabilities.h +++ b/src/qemu/qemu_capabilities.h @@ -763,6 +763,9 @@ int virQEMUCapsGetCPUFeatures(virQEMUCaps *qemuCaps, virDomainVirtType virtType, bool migratable, char ***features); +void virQEMUCapsUpdateCPUDeprecatedFeatures(virQEMUCaps *qemuCaps, + virDomainVirtType virtType, + virCPUDef *cpu); =20 virDomainVirtType virQEMUCapsGetVirtType(virQEMUCaps *qemuCaps); =20 diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 72a9542c0b..57e553cef3 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -16524,7 +16524,8 @@ qemuConnectGetDomainCapabilities(virConnectPtr conn, virDomainVirtType virttype; g_autoptr(virDomainCaps) domCaps =3D NULL; =20 - virCheckFlags(0, NULL); + virCheckFlags(VIR_CONNECT_GET_DOMAIN_CAPABILITIES_DISABLE_DEPRECATED_F= EATURES, + NULL); =20 if (virConnectGetDomainCapabilitiesEnsureACL(conn) < 0) return NULL; @@ -16543,6 +16544,11 @@ qemuConnectGetDomainCapabilities(virConnectPtr con= n, arch, virttype))) return NULL; =20 + if (flags & VIR_CONNECT_GET_DOMAIN_CAPABILITIES_DISABLE_DEPRECATED_FEA= TURES) { + virQEMUCapsUpdateCPUDeprecatedFeatures(qemuCaps, virttype, + domCaps->cpu.hostModel); + } + return virDomainCapsFormat(domCaps); } =20 diff --git a/tools/virsh-host.c b/tools/virsh-host.c index 2fe64e415f..f4e7324f42 100644 --- a/tools/virsh-host.c +++ b/tools/virsh-host.c @@ -114,6 +114,10 @@ static const vshCmdOptDef opts_domcapabilities[] =3D { .type =3D VSH_OT_BOOL, .help =3D N_("wrap xpath results in an common root element"), }, + {.name =3D "disable-deprecated-features", + .type =3D VSH_OT_BOOL, + .help =3D N_("report host CPU model with deprecated features disabled= "), + }, {.name =3D NULL} }; =20 @@ -126,10 +130,13 @@ cmdDomCapabilities(vshControl *ctl, const vshCmd *cmd) const char *arch =3D NULL; const char *machine =3D NULL; const char *xpath =3D NULL; - const unsigned int flags =3D 0; /* No flags so far */ + unsigned int flags =3D 0; bool wrap =3D vshCommandOptBool(cmd, "wrap"); virshControl *priv =3D ctl->privData; =20 + if (vshCommandOptBool(cmd, "disable-deprecated-features")) + flags |=3D VIR_CONNECT_GET_DOMAIN_CAPABILITIES_DISABLE_DEPRECATED_= FEATURES; + if (vshCommandOptString(ctl, cmd, "virttype", &virttype) < 0 || vshCommandOptString(ctl, cmd, "emulatorbin", &emulatorbin) < 0 || vshCommandOptString(ctl, cmd, "arch", &arch) < 0 || --=20 2.45.1 From nobody Thu Dec 26 20:56:08 2024 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=fail(p=reject dis=none) header.from=linux.ibm.com Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1731433597663745.6296352062668; Tue, 12 Nov 2024 09:46:37 -0800 (PST) Received: by lists.libvirt.org (Postfix, from userid 996) id 95EDA17EE; Tue, 12 Nov 2024 12:46:36 -0500 (EST) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 4AC9017F5; Tue, 12 Nov 2024 12:43:16 -0500 (EST) Received: by lists.libvirt.org (Postfix, from userid 996) id 4E0571450; Tue, 12 Nov 2024 12:43:03 -0500 (EST) Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id AC3E91468 for ; Tue, 12 Nov 2024 12:43:02 -0500 (EST) Received: from pps.filterd (m0353729.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 4ACF9wh3032504 for ; Tue, 12 Nov 2024 17:43:01 GMT Received: from ppma12.dal12v.mail.ibm.com (dc.9e.1632.ip4.static.sl-reverse.com [50.22.158.220]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 42v9dv0na5-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Tue, 12 Nov 2024 17:43:01 +0000 (GMT) Received: from pps.filterd (ppma12.dal12v.mail.ibm.com [127.0.0.1]) by ppma12.dal12v.mail.ibm.com (8.18.1.2/8.18.1.2) with ESMTP id 4ACAUM0f027901 for ; Tue, 12 Nov 2024 17:43:00 GMT Received: from smtprelay06.dal12v.mail.ibm.com ([172.16.1.8]) by ppma12.dal12v.mail.ibm.com (PPS) with ESMTPS id 42tj2s4r4n-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Tue, 12 Nov 2024 17:43:00 +0000 Received: from smtpav05.dal12v.mail.ibm.com (smtpav05.dal12v.mail.ibm.com [10.241.53.104]) by smtprelay06.dal12v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 4ACHh07v54788400 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Tue, 12 Nov 2024 17:43:00 GMT Received: from smtpav05.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 3391B58052 for ; Tue, 12 Nov 2024 17:43:00 +0000 (GMT) Received: from smtpav05.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 05F3D58067 for ; Tue, 12 Nov 2024 17:43:00 +0000 (GMT) Received: from li-d664314c-3171-11b2-a85c-fa8047ef35bd.ibm.com.com (unknown [9.67.103.128]) by smtpav05.dal12v.mail.ibm.com (Postfix) with ESMTP for ; Tue, 12 Nov 2024 17:42:59 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-1.5 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,RCVD_IN_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_BLOCKED,SPF_HELO_NONE autolearn=unavailable autolearn_force=no version=3.4.4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h= content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=pp1; bh=/xDW1f37nxbyiQ+Ag irJRwy7c3iSMiFuZdUERY8vZ10=; b=Ftn3Kz0ArMNyLFZkCp4/pizSg4zpJ6l/I JQtez8wQKXN+aK6aTTGcTrLPhleYwtDVBtZoOnGm0PpwyIONgU8fDiN+nyzDpuRS 3cClatjeXxNCsXQu0m2Kt3i+QMVaX8HmJjdtAfEnJLz64Qc3zw8VyAWuj6PCPjJX vedfC5FuM+oQeGVKjTIKirJKIxegJhgaaOdr1FmKTwOasN+B4LjHnUoZ2OvjAsdV Kex6OzYDm4ZBchiEHE1Ky+HE9pvsjSlg15n5NB4L8KE5Iy/sXAAvl/MHqsH29LXA GI5E/CDMxmoRi6auXQ0rg00GpIoHA4kP6bYfuiJdH0VBM77pBP+qA== From: Collin Walling To: devel@lists.libvirt.org Subject: [PATCH v1 5/5] conf: add deprecated_features attribute Date: Tue, 12 Nov 2024 12:40:00 -0500 Message-ID: <20241112174000.27518-6-walling@linux.ibm.com> X-Mailer: git-send-email 2.45.1 In-Reply-To: <20241112174000.27518-1-walling@linux.ibm.com> References: <20241112174000.27518-1-walling@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: 1YPUJwZhv4H3fe3wObtThRimDYUhzxmG X-Proofpoint-ORIG-GUID: 1YPUJwZhv4H3fe3wObtThRimDYUhzxmG X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1051,Hydra:6.0.680,FMLib:17.12.62.30 definitions=2024-10-15_01,2024-10-11_01,2024-09-30_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 clxscore=1015 lowpriorityscore=0 phishscore=0 bulkscore=0 malwarescore=0 adultscore=0 priorityscore=1501 mlxscore=0 impostorscore=0 mlxlogscore=999 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2409260000 definitions=main-2411120141 Content-Transfer-Encoding: quoted-printable Message-ID-Hash: TEV7CEO7ODSOJWCW5X3ISGU3QOC5ATSG X-Message-ID-Hash: TEV7CEO7ODSOJWCW5X3ISGU3QOC5ATSG X-MailFrom: walling@linux.ibm.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; header-match-config-2; header-match-config-3; header-match-devel.lists.libvirt.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header X-Mailman-Version: 3.2.2 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1731433598959116600 Content-Type: text/plain; charset="utf-8" Add a new a attribute, deprecated_features=3D'on|off' to the element. This is used to toggle features flagged as deprecated on the CPU model on or off. When this attribute is paired with 'on', deprecated features will not be filtered. When paired with 'off', any CPU features that are flagged as deprecated will be listed under the CPU model with the 'disable' policy. Example: The absence of this attribute is equivalent to the 'on' option. The deprecated features that will populate the domain XML are the same features that result in the virsh domcapabilities command with the --disable-deprecated-features argument present. It is recommended to define a domain XML with this attribute set to 'off' to ensure migration to machines that may outright drop these features in the future. Signed-off-by: Collin Walling --- src/conf/cpu_conf.c | 10 ++++++++++ src/conf/cpu_conf.h | 1 + src/conf/schemas/cputypes.rng | 12 ++++++++++++ src/qemu/qemu_process.c | 4 ++++ 4 files changed, 27 insertions(+) diff --git a/src/conf/cpu_conf.c b/src/conf/cpu_conf.c index dcc164d165..a9910e2195 100644 --- a/src/conf/cpu_conf.c +++ b/src/conf/cpu_conf.c @@ -238,6 +238,7 @@ virCPUDefCopyWithoutModel(const virCPUDef *cpu) copy->mode =3D cpu->mode; copy->match =3D cpu->match; copy->check =3D cpu->check; + copy->deprecated_feats =3D cpu->deprecated_feats; copy->fallback =3D cpu->fallback; copy->sockets =3D cpu->sockets; copy->dies =3D cpu->dies; @@ -450,6 +451,11 @@ virCPUDefParseXML(xmlXPathContextPtr ctxt, if (virXMLPropEnum(ctxt->node, "check", virCPUCheckTypeFromString, VIR_XML_PROP_NONE, &def->check) < 0) return -1; + + if (virXMLPropTristateSwitch(ctxt->node, "deprecated_features", + VIR_XML_PROP_NONE, + &def->deprecated_feats) < 0) + return -1; } =20 if (def->type =3D=3D VIR_CPU_TYPE_HOST) { @@ -748,6 +754,10 @@ virCPUDefFormatBufFull(virBuffer *buf, virBufferAsprintf(&attributeBuf, " migratable=3D'%s'", virTristateSwitchTypeToString(def->migratabl= e)); } + + if (def->deprecated_feats =3D=3D VIR_TRISTATE_SWITCH_OFF) { + virBufferAddLit(&attributeBuf, " deprecated_features=3D'off'"); + } } =20 /* Format children */ diff --git a/src/conf/cpu_conf.h b/src/conf/cpu_conf.h index f71d942ce6..28e26303ef 100644 --- a/src/conf/cpu_conf.h +++ b/src/conf/cpu_conf.h @@ -161,6 +161,7 @@ struct _virCPUDef { virCPUMaxPhysAddrDef *addr; virHostCPUTscInfo *tsc; virTristateSwitch migratable; /* for host-passthrough mode */ + virTristateSwitch deprecated_feats; }; =20 virCPUDef *virCPUDefNew(void); diff --git a/src/conf/schemas/cputypes.rng b/src/conf/schemas/cputypes.rng index 3a8910e09f..b94b08eb5a 100644 --- a/src/conf/schemas/cputypes.rng +++ b/src/conf/schemas/cputypes.rng @@ -34,6 +34,15 @@ =20 + + + + on + off + + + + @@ -439,6 +448,9 @@ + + + diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index 0815bffe3c..93376c6e6b 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -6302,6 +6302,10 @@ qemuProcessUpdateGuestCPU(virDomainDef *def, &def->os.arch) < 0) return -1; =20 + if (def->cpu->deprecated_feats =3D=3D VIR_TRISTATE_SWITCH_OFF) { + virQEMUCapsUpdateCPUDeprecatedFeatures(qemuCaps, def->virtType, de= f->cpu); + } + return 0; } =20 --=20 2.45.1