From nobody Sun Feb 8 15:42:46 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1605901179; cv=none; d=zohomail.com; s=zohoarc; b=h1tFtPk4+GM4QkicU+L6PVkPjYjD9cfUaLAf3lbxrjFSKYOXX/8FPBWKYn7c7ZI+689efcxm0rlAwdb+/Q91E+gbWwdVLJifaZVQHwRRWgPTIahXqJgXEFdaUpAyWswdLJbLEmthhCn5foyCK3uN8VRw1UT8Oz+a3K0Kmnzr0UE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1605901179; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=fu1t+Inv1UhCruaVxpspQ6kXY8Oi54EfF8RUN7nxoqM=; b=g/j0rXWGhvlSQOGc97b7HJPbka6vKHjiQ+WPELn9iVSmKp8/mywFCgQVR3i8p6uAQ/RnjCVmlYzY+5r3FwEdALBzlEbh/PEk2YnxnBtv4dYresfVU5Og73uB6FlFjzDc3OXRwbsheS6jDxVFPFp9iVchPjlgv8vJcPYBlmgtq94= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1605901179789123.14138670224861; Fri, 20 Nov 2020 11:39:39 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-525-8e2HgVqmNl6P8no2Z_jUUQ-1; Fri, 20 Nov 2020 14:39:36 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id D3637100A642; Fri, 20 Nov 2020 19:39:29 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id B15C11349A; Fri, 20 Nov 2020 19:39:29 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 7D8801809CA2; Fri, 20 Nov 2020 19:39:29 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 0AKJdEga023269 for ; Fri, 20 Nov 2020 14:39:14 -0500 Received: by smtp.corp.redhat.com (Postfix) id F371E60853; Fri, 20 Nov 2020 19:39:13 +0000 (UTC) Received: from virval.usersys.redhat.com (unknown [10.40.194.72]) by smtp.corp.redhat.com (Postfix) with ESMTPS id C6FF16085A for ; Fri, 20 Nov 2020 19:39:13 +0000 (UTC) Received: by virval.usersys.redhat.com (Postfix, from userid 500) id E723A2437F4; Fri, 20 Nov 2020 20:39:07 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1605901178; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=fu1t+Inv1UhCruaVxpspQ6kXY8Oi54EfF8RUN7nxoqM=; b=QWf+8poCzbUmEBG/ozlSlZK3zXYstPDkXOZb0D+JBRJ6JpXZqU3zEf2kYq5iIJyJVGaSiP V56XMjQNJowcBT1qMF5j+QiMy+Tz3hd1jH+lfL4b5kxEetwEKEmfwsutK2vaUfOWYt0r0B /U+Oc0BFo/gW+RVkkFnWY6Dp8l/pW9k= X-MC-Unique: 8e2HgVqmNl6P8no2Z_jUUQ-1 From: Jiri Denemark To: libvir-list@redhat.com Subject: [libvirt PATCH 6/8] cpu_x86: Add support for marking features as removed from a CPU model Date: Fri, 20 Nov 2020 20:39:05 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" The patch adds a new attribute for the 'feature' element in CPU model specification to indicate that a given feature was removed from a CPU model. In other words, older versions of libvirt would consider such feature to be included in the CPU model. Signed-off-by: Jiri Denemark --- src/cpu/cpu_x86.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c index a7ff095456..40bf5b68d0 100644 --- a/src/cpu/cpu_x86.c +++ b/src/cpu/cpu_x86.c @@ -144,6 +144,7 @@ struct _virCPUx86Model { virCPUx86VendorPtr vendor; virCPUx86SignaturesPtr signatures; virCPUx86Data data; + GStrv removedFeatures; }; =20 typedef struct _virCPUx86Map virCPUx86Map; @@ -1241,6 +1242,7 @@ x86ModelFree(virCPUx86ModelPtr model) g_free(model->name); virCPUx86SignaturesFree(model->signatures); virCPUx86DataClear(&model->data); + g_strfreev(model->removedFeatures); g_free(model); } G_DEFINE_AUTOPTR_CLEANUP_FUNC(virCPUx86Model, x86ModelFree); @@ -1255,6 +1257,7 @@ x86ModelCopy(virCPUx86ModelPtr model) copy->name =3D g_strdup(model->name); copy->signatures =3D virCPUx86SignaturesCopy(model->signatures); x86DataCopy(©->data, &model->data); + copy->removedFeatures =3D g_strdupv(model->removedFeatures); copy->vendor =3D model->vendor; =20 return g_steal_pointer(©); @@ -1575,6 +1578,7 @@ x86ModelParseFeatures(virCPUx86ModelPtr model, =20 for (i =3D 0; i < n; i++) { g_autofree char *ftname =3D NULL; + g_autofree char *removed =3D NULL; virCPUx86FeaturePtr feature; =20 if (!(ftname =3D virXMLPropString(nodes[i], "name"))) { @@ -1591,6 +1595,24 @@ x86ModelParseFeatures(virCPUx86ModelPtr model, return -1; } =20 + if ((removed =3D virXMLPropString(nodes[i], "removed"))) { + int rem; + + if ((rem =3D virTristateBoolTypeFromString(removed)) < 0) { + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Invalid 'removed' attribute for feature = %s " + "in model %s"), + ftname, model->name); + return -1; + } + + if (rem =3D=3D VIR_TRISTATE_BOOL_YES) { + if (virStringListAdd(&model->removedFeatures, ftname) < 0) + return -1; + continue; + } + } + if (x86DataAdd(&model->data, &feature->data)) return -1; } --=20 2.29.2