From nobody Sun Dec 22 08:40:01 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 1734390557705850.7269876699057; Mon, 16 Dec 2024 15:09:17 -0800 (PST) Received: by lists.libvirt.org (Postfix, from userid 996) id 1CE4E150C; Mon, 16 Dec 2024 18:09:02 -0500 (EST) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 51077154F; Mon, 16 Dec 2024 18:04:45 -0500 (EST) Received: by lists.libvirt.org (Postfix, from userid 996) id B40D21511; Mon, 16 Dec 2024 18:04:38 -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 A48F91533 for ; Mon, 16 Dec 2024 18:04:23 -0500 (EST) Received: from pps.filterd (m0360083.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 4BGFJgVs011580; Mon, 16 Dec 2024 23:04:22 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 43jcpb54f6-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 16 Dec 2024 23:04:22 +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 4BGM3Wc9005523; Mon, 16 Dec 2024 23:04:21 GMT Received: from smtprelay04.wdc07v.mail.ibm.com ([172.16.1.71]) by ppma21.wdc07v.mail.ibm.com (PPS) with ESMTPS id 43hnbn03wd-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 16 Dec 2024 23:04:21 +0000 Received: from smtpav04.wdc07v.mail.ibm.com (smtpav04.wdc07v.mail.ibm.com [10.39.53.231]) by smtprelay04.wdc07v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 4BGN4KNJ27197968 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 16 Dec 2024 23:04:20 GMT Received: from smtpav04.wdc07v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 0564A58088; Mon, 16 Dec 2024 23:04:20 +0000 (GMT) Received: from smtpav04.wdc07v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 56A9658086; Mon, 16 Dec 2024 23:04:19 +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:19 +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=mG0jVHE2bTBWL+vzN RLX3CbR+14E5UeAr4W6w5/RaKs=; b=mPNKglkq/cu5H6EvkHqblzQXfTs9f/TBO AYPE7RxvHLYiZinReJo7DYi3i6PBy8/lGoloe6nX+YUCLS3RESQseN4WOlNJM7UV 5VebR+KWhLMYTKiIvcNiPn1736wM+IAjrsXA+A0ldCyWwhE12vsdCHHis7P6Z2j0 gT6S8f0G/u8u1kRQhC8I8wy6gHOLxO6bOPW1CEjNfsOdBT3iDQtKUU5AeMIgSHwr x/LRpWaIeWQEdcii5Y3hlqdv+Btx+i3CFH1YQiFryma0tVp61yoDJPjAShBTAj6u 0SZm/Wabyoel1+z0xODpPygd52Ny3BMTKuweb21AdfvWVFqP0c6qA== From: Collin Walling To: devel@lists.libvirt.org Subject: [PATCH v3 7/7] conf: add deprecated_features attribute Date: Mon, 16 Dec 2024 18:03:58 -0500 Message-ID: <20241216230358.60940-8-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-ORIG-GUID: EaL6M1Pds0lST4a1D7Sxt9YIE7NieE36 X-Proofpoint-GUID: EaL6M1Pds0lST4a1D7Sxt9YIE7NieE36 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 malwarescore=0 clxscore=1015 lowpriorityscore=0 impostorscore=0 spamscore=0 mlxscore=0 adultscore=0 mlxlogscore=999 suspectscore=0 bulkscore=0 phishscore=0 priorityscore=1501 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2411120000 definitions=main-2412160188 Content-Transfer-Encoding: quoted-printable Message-ID-Hash: OK324WDXRFWGNNZ3DRN5WB5VKZ37PJPU X-Message-ID-Hash: OK324WDXRFWGNNZ3DRN5WB5VKZ37PJPU 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: 1734390559785116600 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 | 11 +++++++ src/conf/cpu_conf.h | 1 + src/conf/schemas/cputypes.rng | 5 +++ src/qemu/qemu_process.c | 11 +++++++ ...el-deprecated-features-off.s390x-8.2.0.err | 1 + ...el-deprecated-features-off.s390x-8.2.0.xml | 25 +++++++++++++++ ...-deprecated-features-off.s390x-latest.args | 32 +++++++++++++++++++ ...l-deprecated-features-off.s390x-latest.xml | 25 +++++++++++++++ .../cpu-model-deprecated-features-off.xml | 15 +++++++++ tests/qemuxmlconftest.c | 3 ++ 10 files changed, 129 insertions(+) create mode 100644 tests/qemuxmlconfdata/cpu-model-deprecated-features-off= .s390x-8.2.0.err create mode 100644 tests/qemuxmlconfdata/cpu-model-deprecated-features-off= .s390x-8.2.0.xml create mode 100644 tests/qemuxmlconfdata/cpu-model-deprecated-features-off= .s390x-latest.args create mode 100644 tests/qemuxmlconfdata/cpu-model-deprecated-features-off= .s390x-latest.xml create mode 100644 tests/qemuxmlconfdata/cpu-model-deprecated-features-off= .xml diff --git a/src/conf/cpu_conf.c b/src/conf/cpu_conf.c index dcc164d165..31425783ba 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,11 @@ virCPUDefFormatBufFull(virBuffer *buf, virBufferAsprintf(&attributeBuf, " migratable=3D'%s'", virTristateSwitchTypeToString(def->migratabl= e)); } + + if (def->deprecated_feats) { + virBufferAsprintf(&attributeBuf, " deprecated_features=3D'%s'", + virTristateSwitchTypeToString(def->deprecate= d_feats)); + } } =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..8edf1d14e3 100644 --- a/src/conf/schemas/cputypes.rng +++ b/src/conf/schemas/cputypes.rng @@ -439,6 +439,11 @@ + + + + + diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index bee7a39e4e..5f2e278156 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -6399,6 +6399,17 @@ 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", + _("toggling deprecated features for CPU model is un= supported")); + return -1; + } + + if (def->cpu->deprecated_feats =3D=3D VIR_TRISTATE_SWITCH_OFF) { + virQEMUCapsUpdateCPUDeprecatedFeatures(qemuCaps, def->virtType, de= f->cpu); + } + return 0; } =20 diff --git a/tests/qemuxmlconfdata/cpu-model-deprecated-features-off.s390x-= 8.2.0.err b/tests/qemuxmlconfdata/cpu-model-deprecated-features-off.s390x-8= .2.0.err new file mode 100644 index 0000000000..936d1d5a46 --- /dev/null +++ b/tests/qemuxmlconfdata/cpu-model-deprecated-features-off.s390x-8.2.0.e= rr @@ -0,0 +1 @@ +unsupported configuration: toggling deprecated features for CPU model is u= nsupported diff --git a/tests/qemuxmlconfdata/cpu-model-deprecated-features-off.s390x-= 8.2.0.xml b/tests/qemuxmlconfdata/cpu-model-deprecated-features-off.s390x-8= .2.0.xml new file mode 100644 index 0000000000..e1f7ba3857 --- /dev/null +++ b/tests/qemuxmlconfdata/cpu-model-deprecated-features-off.s390x-8.2.0.x= ml @@ -0,0 +1,25 @@ + + guest + 22782664-6b93-46bf-9595-317220dd2d1c + 219100 + 219100 + 1 + + hvm + + + + + destroy + restart + destroy + + /usr/bin/qemu-system-s390x + +