From nobody Sun Dec 22 08:41:15 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 1734390461199592.2098909871476; Mon, 16 Dec 2024 15:07:41 -0800 (PST) Received: by lists.libvirt.org (Postfix, from userid 996) id 35BB61528; Mon, 16 Dec 2024 18:07:40 -0500 (EST) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id B9B871586; Mon, 16 Dec 2024 18:04:32 -0500 (EST) Received: by lists.libvirt.org (Postfix, from userid 996) id C998714B5; Mon, 16 Dec 2024 18:04:21 -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 4C91614AA for ; Mon, 16 Dec 2024 18:04:21 -0500 (EST) Received: from pps.filterd (m0353725.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 4BGE6MjK011349; Mon, 16 Dec 2024 23:04:21 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 43jnp4jbab-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 16 Dec 2024 23:04:20 +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 4BGKFTfa029728; Mon, 16 Dec 2024 23:04:20 GMT Received: from smtprelay02.wdc07v.mail.ibm.com ([172.16.1.69]) by ppma12.dal12v.mail.ibm.com (PPS) with ESMTPS id 43hmbsgakp-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 16 Dec 2024 23:04:20 +0000 Received: from smtpav04.wdc07v.mail.ibm.com (smtpav04.wdc07v.mail.ibm.com [10.39.53.231]) by smtprelay02.wdc07v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 4BGN4ILM32244306 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 16 Dec 2024 23:04:18 GMT Received: from smtpav04.wdc07v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 85CC558088; Mon, 16 Dec 2024 23:04:18 +0000 (GMT) Received: from smtpav04.wdc07v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 1475958086; Mon, 16 Dec 2024 23:04:18 +0000 (GMT) Received: from li-d664314c-3171-11b2-a85c-fa8047ef35bd.ibm.com.com (unknown [9.67.33.76]) by smtpav04.wdc07v.mail.ibm.com (Postfix) with ESMTP; Mon, 16 Dec 2024 23:04:17 +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=-2.4 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2,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=cc :content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=pp1; bh=UaWBR3E94bC0kDXR3 sDklEsmCBTt0cR/Z7DmXyoMCEI=; b=BGdj9qtO3fXDhB48CNif2Hum7nTqVQxmC k84CL2udK7F78/7t4KID4AUvQaBBd/RgQI8mNWjha0s/xvoE74aW+OVd428xAlu4 fGLn15/WbvtlEKLGFHRvBqVa4Psm6mHWG9enbLROUOrfuhCARGcYGBTfVG5s6tKo uC8zMD2XmfpHp2HUx9nwr5uSuWn88SSAZ90N1oFryGp4vYXDTV5vm1ccfZKGHAbj 74cNHB6eKwM/z7QNkrrTC++RubTLj3MRoxPXdiffGm04Rxm33TywYnDizgwaxg+n ugnjRWVZKOhwOz3HBAUnch9OTO2PvZgixTPeJClrHENkJVc4U82sg== From: Collin Walling To: devel@lists.libvirt.org Subject: [PATCH v3 5/7] qemu_capabilities: filter deprecated features if requested Date: Mon, 16 Dec 2024 18:03:56 -0500 Message-ID: <20241216230358.60940-6-walling@linux.ibm.com> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20241216230358.60940-1-walling@linux.ibm.com> References: <20241216230358.60940-1-walling@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: ldXDpOaCoqp8nsj-_l5QrX8nagL5yn_9 X-Proofpoint-ORIG-GUID: ldXDpOaCoqp8nsj-_l5QrX8nagL5yn_9 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 impostorscore=0 clxscore=1015 malwarescore=0 adultscore=0 bulkscore=0 mlxscore=0 spamscore=0 priorityscore=1501 phishscore=0 suspectscore=0 mlxlogscore=777 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2411120000 definitions=main-2412160188 Content-Transfer-Encoding: quoted-printable Message-ID-Hash: EQN4OKMBI6U44ESV5TQXHL6T5KTYMPLI X-Message-ID-Hash: EQN4OKMBI6U44ESV5TQXHL6T5KTYMPLI 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 CC: fiuczy@linux.ibm.com, jdenemar@redhat.com 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: 1734390461558116600 Content-Type: text/plain; charset="utf-8" If flag VIR_CONNECT_GET_DOMAIN_CAPABILITIES_DISABLE_DEPRECATED_FEATURES is passed to qemuConnectGetDomainCapabilities, then the domain's CPU model features will be updated to set any deprecated features to the 'disabled' policy. Signed-off-by: Collin Walling --- src/qemu/qemu_capabilities.c | 20 ++++++++++++++++++++ src/qemu/qemu_capabilities.h | 3 +++ src/qemu/qemu_driver.c | 8 +++++++- 3 files changed, 30 insertions(+), 1 deletion(-) diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index 04017ceda7..eda3e6a4df 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -3330,6 +3330,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 8347fd7fbb..6bfe99fce4 100644 --- a/src/qemu/qemu_capabilities.h +++ b/src/qemu/qemu_capabilities.h @@ -764,6 +764,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 f1a633fdd3..672b42b44e 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -16530,7 +16530,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; @@ -16549,6 +16550,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 --=20 2.47.1