From nobody Sun Feb 8 19:03:00 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) client-ip=170.10.129.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 170.10.129.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=1665163335; cv=none; d=zohomail.com; s=zohoarc; b=MBAMwgV4ZvWTNpfOEi8mxBX/0MlJaMwKi47KxH5URe3wAYlhnM29CmRr+5fyvIeQBw12qpn6RyaGU9IoyDYGsbbMKiF+sEYFsKHwjxOb7exsj/ltU+iPkSV+nMI9v/C+NcyIhh6+l0fZjpvchFd6HdUdkHH7u3QAKNviEK8yyu0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1665163335; 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=9rAUMUPCVe1nTE7zjOMwyePm6SB9BR9WyYwsTvVWNuw=; b=Ny0GB8akXXh1p/MAUKrb20z+Pk1jVIwGprX8eDLvNq5s+OsOEDCszYnozLvHQ7SfPaeuFbRsAWGTq7kOCUKpRzB90B6dKJV3nUVPHMp4vSB1wWk0gkygj76o2Re72iEydRv3UZu0Q3RWr5wpU3JtYwMwB+pnqk3ov5jpaurenBk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mx.zohomail.com with SMTPS id 1665163335246606.5041725502506; Fri, 7 Oct 2022 10:22:15 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-593-QW_Yoe-eMdCU48QmqtTsSw-1; Fri, 07 Oct 2022 13:22:08 -0400 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id EBA8695D680; Fri, 7 Oct 2022 17:21:59 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (unknown [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id D7C1E53595F; Fri, 7 Oct 2022 17:21:59 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 61F58194705C; Fri, 7 Oct 2022 17:21:58 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 3EF611946595 for ; Fri, 7 Oct 2022 17:21:56 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 21CAF4B4010; Fri, 7 Oct 2022 17:21:56 +0000 (UTC) Received: from rein.int.mamuti.net (unknown [10.40.194.60]) by smtp.corp.redhat.com (Postfix) with ESMTPS id B990D4B400F for ; Fri, 7 Oct 2022 17:21:55 +0000 (UTC) Received: by rein.int.mamuti.net (Postfix, from userid 500) id 24A041800F1; Fri, 7 Oct 2022 19:21:54 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1665163334; 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=9rAUMUPCVe1nTE7zjOMwyePm6SB9BR9WyYwsTvVWNuw=; b=Mlbg0N7B9oh4Rxa68xr2xNWIKw6//Ap+ZGWj4WhAdHbi/EyqNFXiHzTqIe6b5FPlELFjMw pKM7xJm222lluma9ezmvYJETANAoV5NeWtOfR6n3VGZmIGA7gzf538ikvhZc1QBVw8WX3Y d8mVsb441Zf+wMvNrJ61tdmvtf/RaEw= X-MC-Unique: QW_Yoe-eMdCU48QmqtTsSw-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Jiri Denemark To: libvir-list@redhat.com Subject: [libvirt PATCH v2 04/14] domain_capabilities: Add vendor attribute for CPU models Date: Fri, 7 Oct 2022 19:21:41 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.9 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.10 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1665163336778100010 Even though several CPU models from various vendors are reported as usable on a given host, user may still want to use only those that match the host vendor. Currently the only place where users can check the vendor of each CPU model is our CPU map, which is considered internal and users should not really be using it directly. So to allow for such filtering we now advertise the vendor of each CPU model in domain capabilities. Signed-off-by: Jiri Denemark Reviewed-by: J=C3=A1n Tomko --- Notes: Version 2: - no change docs/formatdomaincaps.rst | 12 +- src/conf/domain_capabilities.c | 13 +- src/conf/domain_capabilities.h | 4 +- src/conf/schemas/domaincaps.rng | 3 + src/qemu/qemu_capabilities.c | 2 +- tests/cputest.c | 5 +- .../domaincapsdata/qemu_4.2.0-q35.x86_64.xml | 104 ++++++------ .../domaincapsdata/qemu_4.2.0-tcg.x86_64.xml | 104 ++++++------ .../qemu_4.2.0-virt.aarch64.xml | 72 ++++----- tests/domaincapsdata/qemu_4.2.0.aarch64.xml | 72 ++++----- tests/domaincapsdata/qemu_4.2.0.ppc64.xml | 6 +- tests/domaincapsdata/qemu_4.2.0.s390x.xml | 148 +++++++++--------- tests/domaincapsdata/qemu_4.2.0.x86_64.xml | 104 ++++++------ .../domaincapsdata/qemu_5.0.0-q35.x86_64.xml | 108 ++++++------- .../domaincapsdata/qemu_5.0.0-tcg.x86_64.xml | 108 ++++++------- .../qemu_5.0.0-virt.aarch64.xml | 74 ++++----- tests/domaincapsdata/qemu_5.0.0.aarch64.xml | 74 ++++----- tests/domaincapsdata/qemu_5.0.0.ppc64.xml | 8 +- tests/domaincapsdata/qemu_5.0.0.x86_64.xml | 108 ++++++------- .../domaincapsdata/qemu_5.1.0-q35.x86_64.xml | 108 ++++++------- .../domaincapsdata/qemu_5.1.0-tcg.x86_64.xml | 108 ++++++------- tests/domaincapsdata/qemu_5.1.0.x86_64.xml | 108 ++++++------- .../domaincapsdata/qemu_5.2.0-q35.x86_64.xml | 108 ++++++------- .../domaincapsdata/qemu_5.2.0-tcg.x86_64.xml | 108 ++++++------- .../qemu_5.2.0-virt.aarch64.xml | 74 ++++----- tests/domaincapsdata/qemu_5.2.0.aarch64.xml | 74 ++++----- tests/domaincapsdata/qemu_5.2.0.ppc64.xml | 8 +- tests/domaincapsdata/qemu_5.2.0.s390x.xml | 148 +++++++++--------- tests/domaincapsdata/qemu_5.2.0.x86_64.xml | 108 ++++++------- .../domaincapsdata/qemu_6.0.0-q35.x86_64.xml | 110 ++++++------- .../domaincapsdata/qemu_6.0.0-tcg.x86_64.xml | 110 ++++++------- .../qemu_6.0.0-virt.aarch64.xml | 76 ++++----- tests/domaincapsdata/qemu_6.0.0.aarch64.xml | 76 ++++----- tests/domaincapsdata/qemu_6.0.0.s390x.xml | 148 +++++++++--------- tests/domaincapsdata/qemu_6.0.0.x86_64.xml | 110 ++++++------- .../domaincapsdata/qemu_6.1.0-q35.x86_64.xml | 110 ++++++------- .../domaincapsdata/qemu_6.1.0-tcg.x86_64.xml | 110 ++++++------- tests/domaincapsdata/qemu_6.1.0.x86_64.xml | 110 ++++++------- .../domaincapsdata/qemu_6.2.0-q35.x86_64.xml | 110 ++++++------- .../domaincapsdata/qemu_6.2.0-tcg.x86_64.xml | 110 ++++++------- .../qemu_6.2.0-virt.aarch64.xml | 78 ++++----- tests/domaincapsdata/qemu_6.2.0.aarch64.xml | 78 ++++----- tests/domaincapsdata/qemu_6.2.0.ppc64.xml | 8 +- tests/domaincapsdata/qemu_6.2.0.x86_64.xml | 110 ++++++------- .../domaincapsdata/qemu_7.0.0-q35.x86_64.xml | 110 ++++++------- .../domaincapsdata/qemu_7.0.0-tcg.x86_64.xml | 110 ++++++------- .../qemu_7.0.0-virt.aarch64.xml | 78 ++++----- tests/domaincapsdata/qemu_7.0.0.aarch64.xml | 78 ++++----- tests/domaincapsdata/qemu_7.0.0.ppc64.xml | 8 +- tests/domaincapsdata/qemu_7.0.0.x86_64.xml | 110 ++++++------- .../domaincapsdata/qemu_7.1.0-q35.x86_64.xml | 106 ++++++------- .../domaincapsdata/qemu_7.1.0-tcg.x86_64.xml | 106 ++++++------- tests/domaincapsdata/qemu_7.1.0.x86_64.xml | 106 ++++++------- 53 files changed, 2183 insertions(+), 2164 deletions(-) diff --git a/docs/formatdomaincaps.rst b/docs/formatdomaincaps.rst index 70f46b972a..6ce780fb69 100644 --- a/docs/formatdomaincaps.rst +++ b/docs/formatdomaincaps.rst @@ -191,9 +191,10 @@ CPUs `__. - Broadwell - Broadwell-noTSX - Haswell + Broadwell= + Broadwel= l-noTSX + Haswell<= /model> + EPYC-Milan<= /model> ... @@ -226,7 +227,10 @@ more details about it: CPU of such model is expected to have. A special value ``unknown`` indi= cates libvirt does not have enough information to provide the usability data.= The ``deprecated`` attribute reflects the hypervisor's policy on usage of t= his - model :since:`(since 7.1.0)` . + model :since:`(since 7.1.0)`. The ``vendor`` attribute :since:`(since 8= .9.0)` + contains the vendor of the CPU model for users who want to use CPU mode= ls + with specific vendors only. CPU models with undefined vendor will be li= sted + with ``vendor=3D'unkwnown'``. =20 I/O Threads ~~~~~~~~~~~ diff --git a/src/conf/domain_capabilities.c b/src/conf/domain_capabilities.c index 123c80a560..b5d8288982 100644 --- a/src/conf/domain_capabilities.c +++ b/src/conf/domain_capabilities.c @@ -105,6 +105,7 @@ virDomainCapsCPUModelsDispose(void *obj) for (i =3D 0; i < cpuModels->nmodels; i++) { g_free(cpuModels->models[i].name); g_strfreev(cpuModels->models[i].blockers); + g_free(cpuModels->models[i].vendor); } =20 g_free(cpuModels->models); @@ -166,7 +167,8 @@ virDomainCapsCPUModelsCopy(virDomainCapsCPUModels *old) old->models[i].name, old->models[i].usable, old->models[i].blockers, - old->models[i].deprecated); + old->models[i].deprecated, + old->models[i].vendor); } =20 return cpuModels; @@ -178,7 +180,8 @@ virDomainCapsCPUModelsAdd(virDomainCapsCPUModels *cpuMo= dels, const char *name, virDomainCapsCPUUsable usable, char **blockers, - bool deprecated) + bool deprecated, + const char *vendor) { virDomainCapsCPUModel *cpu; =20 @@ -192,6 +195,7 @@ virDomainCapsCPUModelsAdd(virDomainCapsCPUModels *cpuMo= dels, cpu->name =3D g_strdup(name); cpu->blockers =3D g_strdupv(blockers); cpu->deprecated =3D deprecated; + cpu->vendor =3D g_strdup(vendor); } =20 =20 @@ -377,6 +381,11 @@ virDomainCapsCPUCustomFormat(virBuffer *buf, if (model->deprecated) virBufferAddLit(buf, " deprecated=3D'yes'"); =20 + if (model->vendor) + virBufferAsprintf(buf, " vendor=3D'%s'", model->vendor); + else + virBufferAddLit(buf, " vendor=3D'unknown'"); + virBufferAsprintf(buf, ">%s\n", model->name); } =20 diff --git a/src/conf/domain_capabilities.h b/src/conf/domain_capabilities.h index 7333276231..f5fa1fb8e3 100644 --- a/src/conf/domain_capabilities.h +++ b/src/conf/domain_capabilities.h @@ -159,6 +159,7 @@ struct _virDomainCapsCPUModel { virDomainCapsCPUUsable usable; char **blockers; /* NULL-terminated list of usability blockers */ bool deprecated; + char *vendor; }; =20 typedef struct _virDomainCapsCPUModels virDomainCapsCPUModels; @@ -249,7 +250,8 @@ virDomainCapsCPUModelsAdd(virDomainCapsCPUModels *cpuMo= dels, const char *name, virDomainCapsCPUUsable usable, char **blockers, - bool deprecated); + bool deprecated, + const char *vendor); virDomainCapsCPUModel * virDomainCapsCPUModelsGet(virDomainCapsCPUModels *cpuModels, const char *name); diff --git a/src/conf/schemas/domaincaps.rng b/src/conf/schemas/domaincaps.= rng index 9cbc2467ab..c4cb9afeba 100644 --- a/src/conf/schemas/domaincaps.rng +++ b/src/conf/schemas/domaincaps.rng @@ -159,6 +159,9 @@ + + + diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index f366e6797c..5af5de8fc5 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -2195,7 +2195,7 @@ virQEMUCapsCPUDefsToModels(qemuMonitorCPUDefs *defs, continue; =20 virDomainCapsCPUModelsAdd(cpuModels, cpu->name, cpu->usable, - cpu->blockers, cpu->deprecated); + cpu->blockers, cpu->deprecated, NULL); } =20 return cpuModels; diff --git a/tests/cputest.c b/tests/cputest.c index 9d24b9d0f5..52e0022ac3 100644 --- a/tests/cputest.c +++ b/tests/cputest.c @@ -824,7 +824,7 @@ cpuTestUpdateLive(const void *arg) } =20 virDomainCapsCPUModelsAdd(models, expected->model, - usable, blockers, false); + usable, blockers, false, expected->vendo= r); =20 cpu->fallback =3D VIR_CPU_FALLBACK_ALLOW; ignore_value(virCPUTranslate(data->arch, cpu, models)); @@ -902,7 +902,8 @@ cpuTestInitModels(const char **list) =20 for (model =3D list; *model; model++) { virDomainCapsCPUModelsAdd(cpus, *model, - VIR_DOMCAPS_CPU_USABLE_UNKNOWN, NULL, fa= lse); + VIR_DOMCAPS_CPU_USABLE_UNKNOWN, + NULL, false, NULL); } =20 return cpus; diff --git a/tests/domaincapsdata/qemu_4.2.0-q35.x86_64.xml b/tests/domainc= apsdata/qemu_4.2.0-q35.x86_64.xml index 0ec4c570ac..fa86554892 100644 --- a/tests/domaincapsdata/qemu_4.2.0-q35.x86_64.xml +++ b/tests/domaincapsdata/qemu_4.2.0-q35.x86_64.xml @@ -61,58 +61,58 @@ - qemu64 - qemu32 - phenom - pentium3 - pentium2 - pentium - n270 - kvm64 - kvm32 - coreduo - core2duo - athlon - Westmere-IBRS - Westmere - Snowridge - Skylake-Server-noTSX-IBRS - Skylake-Server-IBRS - Skylake-Server - Skylake-Client-noTSX-IBRS - Skylake-Client-IBRS - Skylake-Client - SandyBridge-IBRS - SandyBridge - Penryn - Opteron_G5 - Opteron_G4 - Opteron_G3 - Opteron_G2 - Opteron_G1 - Nehalem-IBRS - Nehalem - IvyBridge-IBRS - IvyBridge - Icelake-Server-noTSX - Icelake-Server - Icelake-Client-noTSX - Icelake-Client - Haswell-noTSX-IBRS - Haswell-noTSX - Haswell-IBRS - Haswell - EPYC-IBPB - EPYC - Dhyana - Conroe - Cascadelake-Server-noTSX - Cascadelake-Server - Broadwell-noTSX-IBRS - Broadwell-noTSX - Broadwell-IBRS - Broadwell - 486 + qemu64 + qemu32 + phenom + pentium3 + pentium2 + pentium + n270 + kvm64 + kvm32 + coreduo + core2duo + athlon + Westmere-IBRS + Westmere + Snowridge + Skylake-Server-noTSX-IBRS + Skylake-Server-IBRS + Skylake-Server + Skylake-Client-noTSX-IBRS + Skylake-Client-IBRS + Skylake-Client + SandyBridge-IBRS + SandyBridge + Penryn + Opteron_G5 + Opteron_G4 + Opteron_G3 + Opteron_G2 + Opteron_G1 + Nehalem-IBRS + Nehalem + IvyBridge-IBRS + IvyBridge + Icelake-Server-noTSX + Icelake-Server + Icelake-Client-noTSX + Icelake-Client + Haswell-noTSX-IBRS + Haswell-noTSX + Haswell-IBRS + Haswell + EPYC-IBPB + EPYC + Dhyana + Conroe + Cascadelake-Server-noTSX + Cascadelake-Server + Broadwell-noTSX-IBRS + Broadwell-noTSX + Broadwell-IBRS + Broadwell + 486 ... --=20 2.38.0