From nobody Tue Sep 9 09:47:43 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=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 1746130756614284.7646119340644; Thu, 1 May 2025 13:19:16 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 996) id ADF9513CF; Thu, 1 May 2025 16:19:15 -0400 (EDT) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id DE07F14AA; Thu, 1 May 2025 16:17:38 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 5FC231389; Thu, 1 May 2025 16:17:31 -0400 (EDT) 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 48F3413A1 for ; Thu, 1 May 2025 16:17:30 -0400 (EDT) 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 541BppG2019522 for ; Thu, 1 May 2025 20:17:29 GMT Received: from ppma21.wdc07v.mail.ibm.com (5b.69.3da9.ip4.static.sl-reverse.com [169.61.105.91]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 46bwu1chws-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 01 May 2025 20:17:28 +0000 (GMT) Received: from pps.filterd (ppma21.wdc07v.mail.ibm.com [127.0.0.1]) by ppma21.wdc07v.mail.ibm.com (8.18.1.2/8.18.1.2) with ESMTP id 541H11av000666 for ; Thu, 1 May 2025 20:17:28 GMT Received: from smtprelay03.dal12v.mail.ibm.com ([172.16.1.5]) by ppma21.wdc07v.mail.ibm.com (PPS) with ESMTPS id 469atpps23-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 01 May 2025 20:17:28 +0000 Received: from smtpav06.wdc07v.mail.ibm.com (smtpav06.wdc07v.mail.ibm.com [10.39.53.233]) by smtprelay03.dal12v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 541KHRhV29622858 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 1 May 2025 20:17:27 GMT Received: from smtpav06.wdc07v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 2FCAA5804E for ; Thu, 1 May 2025 20:17:27 +0000 (GMT) Received: from smtpav06.wdc07v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id AA3E558066 for ; Thu, 1 May 2025 20:17:26 +0000 (GMT) Received: from li-d664314c-3171-11b2-a85c-fa8047ef35bd.ibm.com.com (unknown [9.67.18.203]) by smtpav06.wdc07v.mail.ibm.com (Postfix) with ESMTP for ; Thu, 1 May 2025 20:17:26 +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_H5,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=tYBCtvofx6p6aZcjx Bu719kghambkNrXYFu7CQUduCs=; b=n+LZ06mMmpHW+DjG/afBXsihyx1jxnMTY SsM3QLm4065i8pInZxbTk9IcXo17tIWSjzEzWydu8iIP7groORmqS3A0PmbXRzSB 1uqcPX8pzOiEyJmovUF9FS2az+UnF3emuuv7I1tnZa0nC7dorzk/yqDxBXEpwO1f L9bybl751qKe1iXlvPdv3NBBrM33Z+UWdVgElbaW8PGhgdCvqyq9Z55Z2DQ02TQT mhZtqlBmC3K+nAlJHtM93lUwN9zCAG5HEYZaofRtGH8NeD9CRQOU4NeksiT9IKYL +OGJlmTW02gKNnSnIts7717y02sVyrAIf9xAiHH6nQrclhY8+KTjQ== From: Collin Walling To: devel@lists.libvirt.org Subject: [PATCH v1 1/2] qemu: caps: add virCPUFeaturePolicy param to virQEMUCapsUpdateCPUDeprecatedFeatures Date: Thu, 1 May 2025 16:17:12 -0400 Message-ID: <20250501201713.44172-2-walling@linux.ibm.com> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20250501201713.44172-1-walling@linux.ibm.com> References: <20250501201713.44172-1-walling@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: CDpDCJYVT4wvQMcdG5FR9h3kroeEiGYi X-Authority-Analysis: v=2.4 cv=e7QGSbp/ c=1 sm=1 tr=0 ts=6813d6d8 cx=c_pps a=GFwsV6G8L6GxiO2Y/PsHdQ==:117 a=GFwsV6G8L6GxiO2Y/PsHdQ==:17 a=dt9VzEwgFbYA:10 a=VnNF1IyMAAAA:8 a=tucZJfYFxNPaZtbU29AA:9 X-Proofpoint-ORIG-GUID: CDpDCJYVT4wvQMcdG5FR9h3kroeEiGYi X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUwNTAxMDE1MyBTYWx0ZWRfXwJJaQX1Dr6/0 CLX1Ickfku4xbukMwvBL14UIJsN8f4vx+NNcHzEpg3tdBP0HTQO/vhDaQJ9mF4sh+E4WHjoA8+L CCEczyG9iPvLZZj88pdZ7yFVwcTcsQH9GpC/6tcXgPjlkHHAI0W65RhYmW+2PCN/8D/oc27hymA almCA4BR8TKnZ69YtwSP48ts+fr1nmlKB4n7dN3JWwjQdoYJf0zEO/WHm6hLmACzb8k0uuRgV16 zCskjnS4z6Bcjw8yfFjv3lI54S4kj/n5iT6VzDOQ3pIjFBhbP5Sui7pcUA0NCweltEPru1rQwgJ jL9g5XU9nLUWrMm2MlofGDTBaj+8Xi/5D6LOuX47XkBFoD3mH7cVJbmcKbyWhEfCJ947heEXdpH dpoQZqYI8LKNXVoRFiY4OrnaAn0kZVtVJx3X44Pi+rY+9sWGQa2CKRpDF4CjKx5wDJHvcIIn X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1099,Hydra:6.0.736,FMLib:17.12.80.40 definitions=2025-05-01_06,2025-04-24_02,2025-02-21_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 suspectscore=0 adultscore=0 spamscore=0 mlxscore=0 priorityscore=1501 malwarescore=0 lowpriorityscore=0 impostorscore=0 phishscore=0 mlxlogscore=971 bulkscore=0 classifier=spam authscore=0 authtc=n/a authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.19.0-2504070000 definitions=main-2505010153 Content-Transfer-Encoding: quoted-printable Message-ID-Hash: QCFPPMGOPYXDSVTKKHMOMKXECXZ6UAAW X-Message-ID-Hash: QCFPPMGOPYXDSVTKKHMOMKXECXZ6UAAW 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: 1746130758488019100 Content-Type: text/plain; charset="utf-8" Currently, virQEMUCapsUpdateCPUDeprecatedFeatures only allows for disabling deprecated features. This locks the deprecated_features attribute to only do something if set to 'off'. Let's add a virCPUFeaturePolicy to the function's parameters which will allow the caller to decide what happens to these features. Additionally, group the relevant code in qemu_process.c. Signed-off-by: Collin Walling --- src/qemu/qemu_capabilities.c | 6 +++--- src/qemu/qemu_capabilities.h | 3 ++- src/qemu/qemu_driver.c | 3 ++- src/qemu/qemu_process.c | 19 ++++++++++++------- 4 files changed, 19 insertions(+), 12 deletions(-) diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index a804335c85..5f94863818 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -3341,7 +3341,8 @@ virQEMUCapsGetCPUFeatures(virQEMUCaps *qemuCaps, void virQEMUCapsUpdateCPUDeprecatedFeatures(virQEMUCaps *qemuCaps, virDomainVirtType virtType, - virCPUDef *cpu) + virCPUDef *cpu, + virCPUFeaturePolicy policy) { qemuMonitorCPUModelInfo *modelInfo; size_t i; @@ -3352,8 +3353,7 @@ virQEMUCapsUpdateCPUDeprecatedFeatures(virQEMUCaps *q= emuCaps, return; =20 for (i =3D 0; i < g_strv_length(modelInfo->deprecated_props); i++) { - virCPUDefUpdateFeature(cpu, modelInfo->deprecated_props[i], - VIR_CPU_FEATURE_DISABLE); + virCPUDefUpdateFeature(cpu, modelInfo->deprecated_props[i], policy= ); } } =20 diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h index ea7c14daa9..e4d8b0b6b6 100644 --- a/src/qemu/qemu_capabilities.h +++ b/src/qemu/qemu_capabilities.h @@ -778,7 +778,8 @@ int virQEMUCapsGetCPUFeatures(virQEMUCaps *qemuCaps, char ***features); void virQEMUCapsUpdateCPUDeprecatedFeatures(virQEMUCaps *qemuCaps, virDomainVirtType virtType, - virCPUDef *cpu); + virCPUDef *cpu, + virCPUFeaturePolicy policy); =20 virDomainVirtType virQEMUCapsGetVirtType(virQEMUCaps *qemuCaps); =20 diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index a34d6f1437..677b4b72a8 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -16722,7 +16722,8 @@ qemuConnectGetDomainCapabilities(virConnectPtr conn, =20 if (flags & VIR_CONNECT_GET_DOMAIN_CAPABILITIES_DISABLE_DEPRECATED_FEA= TURES) { virQEMUCapsUpdateCPUDeprecatedFeatures(qemuCaps, virttype, - domCaps->cpu.hostModel); + domCaps->cpu.hostModel, + VIR_CPU_FEATURE_DISABLE); } =20 return virDomainCapsFormat(domCaps); diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index 1af91c5909..5820499710 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -6588,15 +6588,20 @@ qemuProcessUpdateGuestCPU(virDomainDef *def, &def->os.arch) < 0) return -1; =20 - if (def->cpu->deprecated_feats && - !virQEMUCapsGet(qemuCaps, QEMU_CAPS_QUERY_CPU_MODEL_EXPANSION_DEPR= ECATED_PROPS)) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + if (def->cpu->deprecated_feats) { + virCPUFeaturePolicy policy =3D VIR_CPU_FEATURE_REQUIRE; + + if (def->cpu->deprecated_feats =3D=3D VIR_TRISTATE_SWITCH_OFF) + policy =3D VIR_CPU_FEATURE_DISABLE; + + if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_QUERY_CPU_MODEL_EXPANSION_= DEPRECATED_PROPS)) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", _("toggling deprecated features for CPU model is un= supported")); - return -1; - } + return -1; + } =20 - if (def->cpu->deprecated_feats =3D=3D VIR_TRISTATE_SWITCH_OFF) { - virQEMUCapsUpdateCPUDeprecatedFeatures(qemuCaps, def->virtType, de= f->cpu); + virQEMUCapsUpdateCPUDeprecatedFeatures(qemuCaps, def->virtType, + def->cpu, policy); } =20 return 0; --=20 2.47.1