From nobody Mon May 6 09:54:07 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.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.133.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=ZU1GzmoBFpKS9KbUD6N0Dk4O5ICi3SwIgBJBnSCLiO0hjWF6L069eDa1Mj/W46/bZFlRptbETg4isnFLgJVfeGKjWatyuhl59bznC2Xs/Nfwr9RvD6QVvsfkQeo89FTk69GgCThE/rOBQHDyH/o0Y60UMkIxaVIdI/F2qBFn+/Y= 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=K/nOElfiKmP2RTRcGY5s2ym226ZEdOqNRIlQngnio0Y=; b=cAaubde2M/kT7V5mm55etRq7VgMjKgjWxS/Lf0bDY9FCp4QlKy8VDQMWT/wlq5qZlv3yFlTx99M+FsNeoO2oouiCwxH4OjmHfGIQi3n6axZHVTA00iHCefiISD5BC41zZjUhMwl96fkxkQnDQ3ax5aD5xcFPw1jcGtJBQoYxOF8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.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.133.124]) by mx.zohomail.com with SMTPS id 1665163335210479.3748074861195; Fri, 7 Oct 2022 10:22:15 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-612-BZsF7KJ3PV6l3sCR6t47yA-1; Fri, 07 Oct 2022 13:22:08 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 9E72F2823802; 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 84789145BA5A; 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 235991947046; Fri, 7 Oct 2022 17:21:58 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 261D21946A51 for ; Fri, 7 Oct 2022 17:21:56 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 06BA5535D26; 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 B9D5F53595F for ; Fri, 7 Oct 2022 17:21:55 +0000 (UTC) Received: by rein.int.mamuti.net (Postfix, from userid 500) id 1CFDA1800E7; 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=1665163333; 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=K/nOElfiKmP2RTRcGY5s2ym226ZEdOqNRIlQngnio0Y=; b=IdQ2CO0yqdNJZP8fIaTD0iM+gMQqHOanGPG4Rmvfjnsl9RuAk1/uKiW+FJnkcbFov+Om91 bfKBLdmTwHyFgfzhSsqsvb/05mrXFhIFmY5hLmBAGMWJCnhwyZ3oXvZIgASxiCBrCHslUn kYyQWPjsA0BcQRUKdntMBx2SlXFo2CQ= X-MC-Unique: BZsF7KJ3PV6l3sCR6t47yA-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Jiri Denemark To: libvir-list@redhat.com Subject: [libvirt PATCH v2 01/14] conf: virDomainCapsCPUModelsAdd never fails Date: Fri, 7 Oct 2022 19:21:38 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.10 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.7 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: 1665163336760100008 Since the function always returns 0, we can just return void and make callers simpler. Signed-off-by: Jiri Denemark Reviewed-by: J=C3=A1n Tomko --- Notes: Version 2: - no change src/conf/domain_capabilities.c | 24 +++++++++--------------- src/conf/domain_capabilities.h | 11 ++++++----- src/qemu/qemu_capabilities.c | 9 ++++----- tests/cputest.c | 14 ++++---------- 4 files changed, 23 insertions(+), 35 deletions(-) diff --git a/src/conf/domain_capabilities.c b/src/conf/domain_capabilities.c index 653123f293..123c80a560 100644 --- a/src/conf/domain_capabilities.c +++ b/src/conf/domain_capabilities.c @@ -155,37 +155,33 @@ virDomainCapsCPUModelsNew(size_t nmodels) virDomainCapsCPUModels * virDomainCapsCPUModelsCopy(virDomainCapsCPUModels *old) { - g_autoptr(virDomainCapsCPUModels) cpuModels =3D NULL; + virDomainCapsCPUModels *cpuModels =3D NULL; size_t i; =20 if (!(cpuModels =3D virDomainCapsCPUModelsNew(old->nmodels))) return NULL; =20 for (i =3D 0; i < old->nmodels; i++) { - if (virDomainCapsCPUModelsAdd(cpuModels, - old->models[i].name, - old->models[i].usable, - old->models[i].blockers, - old->models[i].deprecated) < 0) - return NULL; + virDomainCapsCPUModelsAdd(cpuModels, + old->models[i].name, + old->models[i].usable, + old->models[i].blockers, + old->models[i].deprecated); } =20 - return g_steal_pointer(&cpuModels); + return cpuModels; } =20 =20 -int +void virDomainCapsCPUModelsAdd(virDomainCapsCPUModels *cpuModels, const char *name, virDomainCapsCPUUsable usable, char **blockers, bool deprecated) { - g_autofree char * nameCopy =3D NULL; virDomainCapsCPUModel *cpu; =20 - nameCopy =3D g_strdup(name); - VIR_RESIZE_N(cpuModels->models, cpuModels->nmodels_max, cpuModels->nmodels, 1); =20 @@ -193,11 +189,9 @@ virDomainCapsCPUModelsAdd(virDomainCapsCPUModels *cpuM= odels, cpuModels->nmodels++; =20 cpu->usable =3D usable; - cpu->name =3D g_steal_pointer(&nameCopy); + cpu->name =3D g_strdup(name); cpu->blockers =3D g_strdupv(blockers); cpu->deprecated =3D deprecated; - - return 0; } =20 =20 diff --git a/src/conf/domain_capabilities.h b/src/conf/domain_capabilities.h index a526969cda..7333276231 100644 --- a/src/conf/domain_capabilities.h +++ b/src/conf/domain_capabilities.h @@ -244,11 +244,12 @@ virDomainCaps *virDomainCapsNew(const char *path, =20 virDomainCapsCPUModels *virDomainCapsCPUModelsNew(size_t nmodels); virDomainCapsCPUModels *virDomainCapsCPUModelsCopy(virDomainCapsCPUModels = *old); -int virDomainCapsCPUModelsAdd(virDomainCapsCPUModels *cpuModels, - const char *name, - virDomainCapsCPUUsable usable, - char **blockers, - bool deprecated); +void +virDomainCapsCPUModelsAdd(virDomainCapsCPUModels *cpuModels, + const char *name, + virDomainCapsCPUUsable usable, + char **blockers, + bool deprecated); virDomainCapsCPUModel * virDomainCapsCPUModelsGet(virDomainCapsCPUModels *cpuModels, const char *name); diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index 68aefe1d86..c12e6dac69 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -2179,7 +2179,7 @@ virQEMUCapsCPUDefsToModels(qemuMonitorCPUDefs *defs, const char **modelAllowed, const char **modelForbidden) { - g_autoptr(virDomainCapsCPUModels) cpuModels =3D NULL; + virDomainCapsCPUModels *cpuModels =3D NULL; size_t i; =20 if (!(cpuModels =3D virDomainCapsCPUModelsNew(defs->ncpus))) @@ -2194,12 +2194,11 @@ virQEMUCapsCPUDefsToModels(qemuMonitorCPUDefs *defs, if (modelForbidden && g_strv_contains(modelForbidden, cpu->name)) continue; =20 - if (virDomainCapsCPUModelsAdd(cpuModels, cpu->name, cpu->usable, - cpu->blockers, cpu->deprecated) < 0) - return NULL; + virDomainCapsCPUModelsAdd(cpuModels, cpu->name, cpu->usable, + cpu->blockers, cpu->deprecated); } =20 - return g_steal_pointer(&cpuModels); + return cpuModels; } =20 =20 diff --git a/tests/cputest.c b/tests/cputest.c index b7ec79dfc6..9d24b9d0f5 100644 --- a/tests/cputest.c +++ b/tests/cputest.c @@ -823,9 +823,8 @@ cpuTestUpdateLive(const void *arg) usable =3D hvModel->usable; } =20 - if (virDomainCapsCPUModelsAdd(models, expected->model, - usable, blockers, false) < 0) - return -1; + virDomainCapsCPUModelsAdd(models, expected->model, + usable, blockers, false); =20 cpu->fallback =3D VIR_CPU_FALLBACK_ALLOW; ignore_value(virCPUTranslate(data->arch, cpu, models)); @@ -902,16 +901,11 @@ cpuTestInitModels(const char **list) return NULL; =20 for (model =3D list; *model; model++) { - if (virDomainCapsCPUModelsAdd(cpus, *model, - VIR_DOMCAPS_CPU_USABLE_UNKNOWN, NULL= , false) < 0) - goto error; + virDomainCapsCPUModelsAdd(cpus, *model, + VIR_DOMCAPS_CPU_USABLE_UNKNOWN, NULL, fa= lse); } =20 return cpus; - - error: - virObjectUnref(cpus); - return NULL; } =20 =20 --=20 2.38.0 From nobody Mon May 6 09:54:07 2024 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=1665163388; cv=none; d=zohomail.com; s=zohoarc; b=EFgS52z1LrRRMBpIScEmDeMmR6piJxpnCnq7C0WRVYfnRe5sS/IUS44dY6lxt+Ub1Cdaw+D56I0jLA6hkZCdW4CjTPKAQwGlTD0BaJ6fV8fJNw0QcESGP/iqB7dSlGeKcUMDuj3rJU48SiEsDU9jNSr592TSffxmuggSfAeHisc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1665163388; 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=k0ynwHXHJlSYH63RzjU3pcVbTco4fDk9VhtuSfSPcMU=; b=ldO6PPCdhoQOJpnrSy3GqG3vbrP9lgRdgQ8VRceYOoK6OZnx+/krAKmWHSj428oZhVJPNptKThBsE6YvVEO0wjP07ck/FFt8jlDlXaisa1OKmIfNGlZlSR/2XNaiEPrkc8OGaKgopQ/SM+Odgt9BsWSLhauRvwa8dIg0i95qfsc= 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 1665163388739918.5330175667976; Fri, 7 Oct 2022 10:23:08 -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-669-RCrusMQCMSO-3cSTVZY7LQ-1; Fri, 07 Oct 2022 13:22:10 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 8647286EB39; Fri, 7 Oct 2022 17:22:00 +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 69D28145BA5D; Fri, 7 Oct 2022 17:22:00 +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 B2962194707B; Fri, 7 Oct 2022 17:21:58 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 061471946595 for ; Fri, 7 Oct 2022 17:21:56 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id DD383C2C8CE; Fri, 7 Oct 2022 17:21:55 +0000 (UTC) Received: from rein.int.mamuti.net (unknown [10.40.194.60]) by smtp.corp.redhat.com (Postfix) with ESMTPS id B954DC2C7D9 for ; Fri, 7 Oct 2022 17:21:55 +0000 (UTC) Received: by rein.int.mamuti.net (Postfix, from userid 500) id 1F6111800E8; 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=1665163386; 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=k0ynwHXHJlSYH63RzjU3pcVbTco4fDk9VhtuSfSPcMU=; b=b7W6F1F55Z7UA/TnFVJIPv42kFd0hgvSs87WJE+Ye0V2m3YgjSEyaxmHWMNVyORwdSXD3t uNx/mpt8gemhadUctd2hq9WKIjAyhAobuEGPJwK2kjWy2Ov5EefKefN9RzrR2tVD0S6gns CvIT9088cxSr1U83rfD7rkvLJZFpewc= X-MC-Unique: RCrusMQCMSO-3cSTVZY7LQ-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Jiri Denemark To: libvir-list@redhat.com Subject: [libvirt PATCH v2 02/14] cpu_ppc64: Avoid repeated loading of CPU map Date: Fri, 7 Oct 2022 19:21:39 +0200 Message-Id: <31c5667546e9cf2900b7239aab4953376aabd1b2.1665162978.git.jdenemar@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8 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.7 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: 1665163389028100003 The ppc64 CPU code still has to load and parse the CPU map everytime it needs to look at it, which can make some operations pretty slow. Other archs already switched to loading the CPU map once and keeping the parsed structure in memory. Let's switch ppc64 as well. Signed-off-by: Jiri Denemark Reviewed-by: J=C3=A1n Tomko --- Notes: Version 2: - no change src/cpu/cpu_ppc64.c | 47 +++++++++++++++++++++++++++++++++++---------- 1 file changed, 37 insertions(+), 10 deletions(-) diff --git a/src/cpu/cpu_ppc64.c b/src/cpu/cpu_ppc64.c index cd2df4ba4a..9997e14a89 100644 --- a/src/cpu/cpu_ppc64.c +++ b/src/cpu/cpu_ppc64.c @@ -53,6 +53,12 @@ struct _ppc64_map { struct _ppc64_model **models; }; =20 +static virCPUppc64Map *cpuMap; + +int virCPUppc64DriverOnceInit(void); +VIR_ONCE_GLOBAL_INIT(virCPUppc64Driver); + + /* Convert a legacy CPU definition by transforming * model names to generation names: * POWER7_v2.1 =3D> POWER7 @@ -365,8 +371,8 @@ ppc64ModelParse(xmlXPathContextPtr ctxt, } =20 =20 -static struct _ppc64_map * -ppc64LoadMap(void) +static virCPUppc64Map * +virCPUppc64LoadMap(void) { g_autoptr(virCPUppc64Map) map =3D NULL; =20 @@ -378,12 +384,33 @@ ppc64LoadMap(void) return g_steal_pointer(&map); } =20 + +int +virCPUppc64DriverOnceInit(void) +{ + if (!(cpuMap =3D virCPUppc64LoadMap())) + return -1; + + return 0; +} + + +static virCPUppc64Map * +virCPUppc64GetMap(void) +{ + if (virCPUppc64DriverInitialize() < 0) + return NULL; + + return cpuMap; +} + + static virCPUCompareResult ppc64Compute(virCPUDef *host, const virCPUDef *other, char **message) { - g_autoptr(virCPUppc64Map) map =3D NULL; + virCPUppc64Map *map =3D NULL; g_autoptr(virCPUppc64Model) host_model =3D NULL; g_autoptr(virCPUppc64Model) guest_model =3D NULL; g_autoptr(virCPUDef) cpu =3D NULL; @@ -428,7 +455,7 @@ ppc64Compute(virCPUDef *host, return VIR_CPU_COMPARE_INCOMPATIBLE; } =20 - if (!(map =3D ppc64LoadMap())) + if (!(map =3D virCPUppc64GetMap())) return VIR_CPU_COMPARE_ERROR; =20 /* Host CPU information */ @@ -526,10 +553,10 @@ ppc64DriverDecode(virCPUDef *cpu, const virCPUData *data, virDomainCapsCPUModels *models) { - g_autoptr(virCPUppc64Map) map =3D NULL; + virCPUppc64Map *map =3D NULL; const virCPUppc64Model *model; =20 - if (!data || !(map =3D ppc64LoadMap())) + if (!data || !(map =3D virCPUppc64GetMap())) return -1; =20 if (!(model =3D ppc64ModelFindPVR(map, data->data.ppc64.pvr[0].value))= ) { @@ -656,13 +683,13 @@ virCPUppc64Baseline(virCPUDef **cpus, const char **features G_GNUC_UNUSED, bool migratable G_GNUC_UNUSED) { - g_autoptr(virCPUppc64Map) map =3D NULL; + virCPUppc64Map *map =3D NULL; const virCPUppc64Model *model; const virCPUppc64Vendor *vendor =3D NULL; g_autoptr(virCPUDef) cpu =3D NULL; size_t i; =20 - if (!(map =3D ppc64LoadMap())) + if (!(map =3D virCPUppc64GetMap())) return NULL; =20 if (!(model =3D ppc64ModelFind(map, cpus[0]->model))) { @@ -737,10 +764,10 @@ virCPUppc64Baseline(virCPUDef **cpus, static int virCPUppc64DriverGetModels(char ***models) { - g_autoptr(virCPUppc64Map) map =3D NULL; + virCPUppc64Map *map =3D NULL; size_t i; =20 - if (!(map =3D ppc64LoadMap())) + if (!(map =3D virCPUppc64GetMap())) return -1; =20 if (models) { --=20 2.38.0 From nobody Mon May 6 09:54:07 2024 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=1665163388; cv=none; d=zohomail.com; s=zohoarc; b=em3fR3g3pcWejKdanOTBtCxvV8XcEOeRhSLYJF6w3ArfCaRYcpxnur7HznEOwCemtkc70TBJzcXCfpluHTwhLnUyYYbGANOLSN980X7FTaJ+F8DZyKeAkj2GPn7jWqWp8UsmUCeF8ynXUGzWu9ZVL58oshE+9Vn7fgutD8jizl0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1665163388; 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=tAd3EOuSuIkTBZnhZ2VLglODBJGL6mAb572TfVy4IDA=; b=X2LSTep9A8vWLRywyZ4w87X6qWvK9LVqWXMKNNzIpODb3df9AG8pc4fnRt8di12MqexAbS7MKk7SlGtdPADMf+vZBVmA9yOtUqtFuX+holEtQzh3SdYxqCaT1byvm1jQ1jSuq4P9mLtSQVjFq5QWl5VYWmh00BMQlbETtOLHJT0= 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 1665163388470725.6434640063442; Fri, 7 Oct 2022 10:23:08 -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-49-Bb_xFg-MO6OPIVudAhQFgg-1; Fri, 07 Oct 2022 13:22:06 -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 772C71012470; 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 19D57535D29; 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 CD5151946A76; Fri, 7 Oct 2022 17:21:57 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 2483F1946A49 for ; Fri, 7 Oct 2022 17:21:56 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 06478535D28; 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 B9CAF53593C for ; Fri, 7 Oct 2022 17:21:55 +0000 (UTC) Received: by rein.int.mamuti.net (Postfix, from userid 500) id 21F301800F0; 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=1665163387; 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=tAd3EOuSuIkTBZnhZ2VLglODBJGL6mAb572TfVy4IDA=; b=a253Gr7QKvQ2oQ9LRwQ9EW3XIl570ixJ7Uw+3+kiqQ/KOkMEtdG2J49EP8bmWzKcMntwph pMRqiGr7mrPN1UKGXLj6Q5kLHXHpejBADtAqypRNF7z8pOBQE+Q4ZGR3l1GGZbYqlC3cOP O8+ptZ+OrkjK12pLq2oy1xIDWGjVn9U= X-MC-Unique: Bb_xFg-MO6OPIVudAhQFgg-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Jiri Denemark To: libvir-list@redhat.com Subject: [libvirt PATCH v2 03/14] qemu: Do not pass qemuCaps to virQEMUCapsCPUFeature{To, From}QEMU Date: Fri, 7 Oct 2022 19:21:40 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.10 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: 1665163389030100004 The only part of qemuCaps both functions are interested in is the CPU architecture. Changing them to expect just virArch makes the functions more reusable. Signed-off-by: Jiri Denemark Reviewed-by: J=C3=A1n Tomko --- Notes: Version 2: - no change src/qemu/qemu_capabilities.c | 18 +++++++++--------- src/qemu/qemu_capabilities.h | 4 ++-- src/qemu/qemu_command.c | 2 +- src/qemu/qemu_monitor.c | 7 +++---- src/qemu/qemu_monitor.h | 5 ++--- src/qemu/qemu_monitor_json.c | 11 ++++------- src/qemu/qemu_monitor_json.h | 1 - src/qemu/qemu_process.c | 12 +----------- 8 files changed, 22 insertions(+), 38 deletions(-) diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index c12e6dac69..f366e6797c 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -3108,7 +3108,7 @@ virQEMUCapsGetCPUFeatures(virQEMUCaps *qemuCaps, if (migratable && prop->migratable =3D=3D VIR_TRISTATE_BOOL_NO) continue; =20 - list[n++] =3D g_strdup(virQEMUCapsCPUFeatureFromQEMU(qemuCaps, pro= p->name)); + list[n++] =3D g_strdup(virQEMUCapsCPUFeatureFromQEMU(qemuCaps->arc= h, prop->name)); } =20 *features =3D g_steal_pointer(&list); @@ -3434,14 +3434,14 @@ virQEMUCapsCPUFeatureTranslationTable virQEMUCapsCP= UFeaturesX86[] =3D { =20 =20 static const char * -virQEMUCapsCPUFeatureTranslate(virQEMUCaps *qemuCaps, +virQEMUCapsCPUFeatureTranslate(virArch arch, const char *feature, bool reversed) { virQEMUCapsCPUFeatureTranslationTable *table =3D NULL; virQEMUCapsCPUFeatureTranslationTable *entry; =20 - if (ARCH_IS_X86(qemuCaps->arch)) + if (ARCH_IS_X86(arch)) table =3D virQEMUCapsCPUFeaturesX86; =20 if (!table || @@ -3460,18 +3460,18 @@ virQEMUCapsCPUFeatureTranslate(virQEMUCaps *qemuCap= s, =20 =20 const char * -virQEMUCapsCPUFeatureToQEMU(virQEMUCaps *qemuCaps, +virQEMUCapsCPUFeatureToQEMU(virArch arch, const char *feature) { - return virQEMUCapsCPUFeatureTranslate(qemuCaps, feature, false); + return virQEMUCapsCPUFeatureTranslate(arch, feature, false); } =20 =20 const char * -virQEMUCapsCPUFeatureFromQEMU(virQEMUCaps *qemuCaps, +virQEMUCapsCPUFeatureFromQEMU(virArch arch, const char *feature) { - return virQEMUCapsCPUFeatureTranslate(qemuCaps, feature, true); + return virQEMUCapsCPUFeatureTranslate(arch, feature, true); } =20 =20 @@ -3510,7 +3510,7 @@ virQEMUCapsInitCPUModelS390(virQEMUCaps *qemuCaps, for (i =3D 0; i < modelInfo->nprops; i++) { virCPUFeatureDef *feature =3D cpu->features + cpu->nfeatures; qemuMonitorCPUProperty *prop =3D modelInfo->props + i; - const char *name =3D virQEMUCapsCPUFeatureFromQEMU(qemuCaps, prop-= >name); + const char *name =3D virQEMUCapsCPUFeatureFromQEMU(qemuCaps->arch,= prop->name); =20 if (prop->type !=3D QEMU_MONITOR_CPU_PROPERTY_BOOLEAN) continue; @@ -3545,7 +3545,7 @@ virQEMUCapsGetCPUModelX86Data(virQEMUCaps *qemuCaps, =20 for (i =3D 0; i < model->nprops; i++) { qemuMonitorCPUProperty *prop =3D model->props + i; - const char *name =3D virQEMUCapsCPUFeatureFromQEMU(qemuCaps, prop-= >name); + const char *name =3D virQEMUCapsCPUFeatureFromQEMU(qemuCaps->arch,= prop->name); =20 switch (prop->type) { case QEMU_MONITOR_CPU_PROPERTY_BOOLEAN: diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h index ca919ff368..904ee54f60 100644 --- a/src/qemu/qemu_capabilities.h +++ b/src/qemu/qemu_capabilities.h @@ -838,11 +838,11 @@ bool virQEMUCapsCPUFilterFeatures(const char *name, void *opaque); =20 const char * -virQEMUCapsCPUFeatureToQEMU(virQEMUCaps *qemuCaps, +virQEMUCapsCPUFeatureToQEMU(virArch arch, const char *feature); =20 const char * -virQEMUCapsCPUFeatureFromQEMU(virQEMUCaps *qemuCaps, +virQEMUCapsCPUFeatureFromQEMU(virArch arch, const char *feature); =20 virSEVCapability * diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 7ec44736d3..150824f2e1 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -6111,7 +6111,7 @@ qemuBuildCpuModelArgStr(virQEMUDriver *driver, =20 for (i =3D 0; i < cpu->nfeatures; i++) { const char *featname =3D - virQEMUCapsCPUFeatureToQEMU(qemuCaps, cpu->features[i].name); + virQEMUCapsCPUFeatureToQEMU(def->os.arch, cpu->features[i].nam= e); switch ((virCPUFeaturePolicy) cpu->features[i].policy) { case VIR_CPU_FEATURE_FORCE: case VIR_CPU_FEATURE_REQUIRE: diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c index c2808c75a3..5eba154d96 100644 --- a/src/qemu/qemu_monitor.c +++ b/src/qemu/qemu_monitor.c @@ -3633,12 +3633,11 @@ qemuMonitorGetGuestCPU(qemuMonitor *mon, virArch arch, const char *cpuQOMPath, qemuMonitorCPUFeatureTranslationCallback translate, - void *opaque, virCPUData **enabled, virCPUData **disabled) { - VIR_DEBUG("arch=3D%s cpuQOMPath=3D%s translate=3D%p opaque=3D%p enable= d=3D%p disabled=3D%p", - virArchToString(arch), cpuQOMPath, translate, opaque, enable= d, disabled); + VIR_DEBUG("arch=3D%s cpuQOMPath=3D%s translate=3D%p enabled=3D%p disab= led=3D%p", + virArchToString(arch), cpuQOMPath, translate, enabled, disab= led); =20 QEMU_CHECK_MONITOR(mon); =20 @@ -3646,7 +3645,7 @@ qemuMonitorGetGuestCPU(qemuMonitor *mon, if (disabled) *disabled =3D NULL; =20 - return qemuMonitorJSONGetGuestCPU(mon, arch, cpuQOMPath, translate, op= aque, + return qemuMonitorJSONGetGuestCPU(mon, arch, cpuQOMPath, translate, enabled, disabled); } =20 diff --git a/src/qemu/qemu_monitor.h b/src/qemu/qemu_monitor.h index 4d770486be..4fead0a998 100644 --- a/src/qemu/qemu_monitor.h +++ b/src/qemu/qemu_monitor.h @@ -1219,14 +1219,13 @@ int qemuMonitorGetGuestCPUx86(qemuMonitor *mon, virCPUData **data, virCPUData **disabled); =20 -typedef const char *(*qemuMonitorCPUFeatureTranslationCallback)(const char= *name, - void *opaq= ue); +typedef const char *(*qemuMonitorCPUFeatureTranslationCallback)(virArch ar= ch, + const char= *name); =20 int qemuMonitorGetGuestCPU(qemuMonitor *mon, virArch arch, const char *cpuQOMPath, qemuMonitorCPUFeatureTranslationCallback transl= ate, - void *opaque, virCPUData **enabled, virCPUData **disabled); =20 diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c index b63400354b..f54b4609a9 100644 --- a/src/qemu/qemu_monitor_json.c +++ b/src/qemu/qemu_monitor_json.c @@ -6781,7 +6781,6 @@ static int qemuMonitorJSONGetCPUData(qemuMonitor *mon, const char *cpuQOMPath, qemuMonitorCPUFeatureTranslationCallback transla= te, - void *opaque, virCPUData *data) { qemuMonitorJSONObjectProperty prop =3D { .type =3D QEMU_MONITOR_OBJECT= _PROPERTY_BOOLEAN }; @@ -6801,7 +6800,7 @@ qemuMonitorJSONGetCPUData(qemuMonitor *mon, continue; =20 if (translate) - name =3D translate(name, opaque); + name =3D translate(data->arch, name); =20 if (virCPUDataAddFeature(data, name) < 0) return -1; @@ -6815,7 +6814,6 @@ static int qemuMonitorJSONGetCPUDataDisabled(qemuMonitor *mon, const char *cpuQOMPath, qemuMonitorCPUFeatureTranslationCallback= translate, - void *opaque, virCPUData *data) { g_auto(GStrv) props =3D NULL; @@ -6829,7 +6827,7 @@ qemuMonitorJSONGetCPUDataDisabled(qemuMonitor *mon, const char *name =3D *p; =20 if (translate) - name =3D translate(name, opaque); + name =3D translate(data->arch, name); =20 if (virCPUDataAddFeature(data, name) < 0) return -1; @@ -6859,7 +6857,6 @@ qemuMonitorJSONGetGuestCPU(qemuMonitor *mon, virArch arch, const char *cpuQOMPath, qemuMonitorCPUFeatureTranslationCallback transl= ate, - void *opaque, virCPUData **enabled, virCPUData **disabled) { @@ -6870,11 +6867,11 @@ qemuMonitorJSONGetGuestCPU(qemuMonitor *mon, !(cpuDisabled =3D virCPUDataNew(arch))) return -1; =20 - if (qemuMonitorJSONGetCPUData(mon, cpuQOMPath, translate, opaque, cpuE= nabled) < 0) + if (qemuMonitorJSONGetCPUData(mon, cpuQOMPath, translate, cpuEnabled) = < 0) return -1; =20 if (disabled && - qemuMonitorJSONGetCPUDataDisabled(mon, cpuQOMPath, translate, opaq= ue, cpuDisabled) < 0) + qemuMonitorJSONGetCPUDataDisabled(mon, cpuQOMPath, translate, cpuD= isabled) < 0) return -1; =20 *enabled =3D g_steal_pointer(&cpuEnabled); diff --git a/src/qemu/qemu_monitor_json.h b/src/qemu/qemu_monitor_json.h index a53e6423df..f14d0b5bae 100644 --- a/src/qemu/qemu_monitor_json.h +++ b/src/qemu/qemu_monitor_json.h @@ -605,7 +605,6 @@ qemuMonitorJSONGetGuestCPU(qemuMonitor *mon, virArch arch, const char *cpuQOMPath, qemuMonitorCPUFeatureTranslationCallback transl= ate, - void *opaque, virCPUData **enabled, virCPUData **disabled); =20 diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index cec4a64526..d78e91efed 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -4295,16 +4295,6 @@ qemuProcessVerifyCPUFeatures(virDomainDef *def, } =20 =20 -static const char * -qemuProcessTranslateCPUFeatures(const char *name, - void *opaque) -{ - virQEMUCaps *qemuCaps =3D opaque; - - return virQEMUCapsCPUFeatureFromQEMU(qemuCaps, name); -} - - /* returns the QOM path to the first vcpu */ static const char * qemuProcessGetVCPUQOMPath(virDomainObj *vm) @@ -4349,7 +4339,7 @@ qemuProcessFetchGuestCPU(virDomainObj *vm, rc =3D qemuMonitorGetGuestCPU(priv->mon, vm->def->os.arch, cpuQOMPath, - qemuProcessTranslateCPUFeatures, priv-= >qemuCaps, + virQEMUCapsCPUFeatureFromQEMU, &dataEnabled, &dataDisabled); } else { rc =3D qemuMonitorGetGuestCPUx86(priv->mon, cpuQOMPath, &dataEnabl= ed, &dataDisabled); --=20 2.38.0 From nobody Mon May 6 09:54:07 2024 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 From nobody Mon May 6 09:54:07 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.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.133.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=iu/WS7gOj1Op6hRtPeP85/I1j3mLVk3KKDMkEw9hmvN9A6tEKrjFhMFMngRt4uQEnJZUaxUBCeFmjs/cHXNk0KFSmg9C7rgI1UXAKv1bzAbuU9NfffpdbCqfsM+CeQ+tp9oic54C/mnJrs3/YCvnuKGjM6avr/betOFbf2TUewQ= 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=f9cTXDrKHmmCEaOw/rhgKch1dVuqdHzPDeltCHG0WD8=; b=PXQkF2f95fugyVBHH8kPLWvohElgjo27ZzI+cIUx5k8CmMJ6k8IyT7WRRsBdxKgp22571g2DFhNgG3fs6rvErNmrYj3It8ZKPgnrXseN2qJWwb502VX1mU7JPO2dbZln6ilqOqiDPkpcuis4j7H/zQmN9i2p8RBUtrAF/Uenxrw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.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.133.124]) by mx.zohomail.com with SMTPS id 1665163335885186.12693667519966; 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-12-BR71xXycP1OIV3a23qSRZg-1; Fri, 07 Oct 2022 13:22:12 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 7B7DE80280D; Fri, 7 Oct 2022 17:22:01 +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 5B631145BA58; Fri, 7 Oct 2022 17:22:01 +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 44C661947B8B; Fri, 7 Oct 2022 17:21:59 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 402D31946A51 for ; Fri, 7 Oct 2022 17:21:57 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 252B9C2C7D9; Fri, 7 Oct 2022 17:21:57 +0000 (UTC) Received: from rein.int.mamuti.net (unknown [10.40.194.60]) by smtp.corp.redhat.com (Postfix) with ESMTPS id D7438C2C8D3 for ; Fri, 7 Oct 2022 17:21:56 +0000 (UTC) Received: by rein.int.mamuti.net (Postfix, from userid 500) id 2708F1800F9; 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=f9cTXDrKHmmCEaOw/rhgKch1dVuqdHzPDeltCHG0WD8=; b=dHaHqZ12scpg58chdqau351cq0doP7wfCctAkLV6FBtI8fwOrxF7XfhD6/ixO4hCyIDQht FrA7/vJm0b0LkHmJ+bNQRAQDCvsSoBVm8HcAgcHqvoXnzToXRsNQi9rDXwq3mEDJhS5bmB OiauE3IGK8M/nwgP64Kmt3ElypWW9js= X-MC-Unique: BR71xXycP1OIV3a23qSRZg-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Jiri Denemark To: libvir-list@redhat.com Subject: [libvirt PATCH v2 05/14] Introduce virCPUGetVendorForModel and use it in QEMU driver Date: Fri, 7 Oct 2022 19:21:42 +0200 Message-Id: <152a1d4bb3ed3b8c1ff554898b51421bd127d161.1665162978.git.jdenemar@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8 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.7 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: 1665163336761100009 So far QEMU driver does not get CPU model vendor from QEMU directly and it has to ask the CPU driver for the info stored in CPU map. Signed-off-by: Jiri Denemark Reviewed-by: J=C3=A1n Tomko --- Notes: Version 2: - no change src/cpu/cpu.c | 25 +++++++++++++++++++++++++ src/cpu/cpu.h | 8 ++++++++ src/libvirt_private.syms | 1 + src/qemu/qemu_capabilities.c | 18 +++++++++++++----- 4 files changed, 47 insertions(+), 5 deletions(-) diff --git a/src/cpu/cpu.c b/src/cpu/cpu.c index d97ef5e873..7f3caf7a27 100644 --- a/src/cpu/cpu.c +++ b/src/cpu/cpu.c @@ -923,6 +923,31 @@ virCPUGetModels(virArch arch, char ***models) } =20 =20 +/** virCPUGetVendorForModel: + * + * @arch: CPU architecture + * @model: CPU model to be checked + * + * Returns @model's vendor or NULL if the vendor is unknown. + */ +const char * +virCPUGetVendorForModel(virArch arch, + const char *model) +{ + struct cpuArchDriver *driver; + + VIR_DEBUG("arch=3D%s", virArchToString(arch)); + + if (!(driver =3D cpuGetSubDriver(arch))) + return NULL; + + if (!driver->getVendorForModel) + return NULL; + + return driver->getVendorForModel(model); +} + + /** * virCPUTranslate: * diff --git a/src/cpu/cpu.h b/src/cpu/cpu.h index 41a62ce486..a4cdb37f03 100644 --- a/src/cpu/cpu.h +++ b/src/cpu/cpu.h @@ -105,6 +105,9 @@ typedef virCPUData * typedef int (*virCPUArchGetModels)(char ***models); =20 +typedef const char * +(*virCPUArchGetVendorForModel)(const char *model); + typedef int (*virCPUArchTranslate)(virCPUDef *cpu, virDomainCapsCPUModels *models); @@ -150,6 +153,7 @@ struct cpuArchDriver { virCPUArchDataFormat dataFormat; virCPUArchDataParse dataParse; virCPUArchGetModels getModels; + virCPUArchGetVendorForModel getVendorForModel; virCPUArchTranslate translate; virCPUArchConvertLegacy convertLegacy; virCPUArchExpandFeatures expandFeatures; @@ -262,6 +266,10 @@ virCPUModelIsAllowed(const char *model, int virCPUGetModels(virArch arch, char ***models); =20 +const char * +virCPUGetVendorForModel(virArch arch, + const char *model); + int virCPUTranslate(virArch arch, virCPUDef *cpu, diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index 00cb07709d..9cf5c0de7c 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -1500,6 +1500,7 @@ virCPUExpandFeatures; virCPUGetHost; virCPUGetHostIsSupported; virCPUGetModels; +virCPUGetVendorForModel; virCPUProbeHost; virCPUTranslate; virCPUUpdate; diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index 5af5de8fc5..ccd274b80d 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -2175,9 +2175,11 @@ virQEMUCapsAddCPUDefinitions(virQEMUCaps *qemuCaps, =20 =20 static virDomainCapsCPUModels * -virQEMUCapsCPUDefsToModels(qemuMonitorCPUDefs *defs, +virQEMUCapsCPUDefsToModels(virArch arch, + qemuMonitorCPUDefs *defs, const char **modelAllowed, - const char **modelForbidden) + const char **modelForbidden, + bool vendors) { virDomainCapsCPUModels *cpuModels =3D NULL; size_t i; @@ -2187,6 +2189,7 @@ virQEMUCapsCPUDefsToModels(qemuMonitorCPUDefs *defs, =20 for (i =3D 0; i < defs->ncpus; i++) { qemuMonitorCPUDefInfo *cpu =3D defs->cpus + i; + char *vendor =3D NULL; =20 if (modelAllowed && !g_strv_contains(modelAllowed, cpu->name)) continue; @@ -2194,8 +2197,11 @@ virQEMUCapsCPUDefsToModels(qemuMonitorCPUDefs *defs, if (modelForbidden && g_strv_contains(modelForbidden, cpu->name)) continue; =20 + if (vendors) + vendor =3D g_strdup(virCPUGetVendorForModel(arch, cpu->name)); + virDomainCapsCPUModelsAdd(cpuModels, cpu->name, cpu->usable, - cpu->blockers, cpu->deprecated, NULL); + cpu->blockers, cpu->deprecated, vendor); } =20 return cpuModels; @@ -2213,7 +2219,8 @@ virQEMUCapsGetCPUModels(virQEMUCaps *qemuCaps, if (!(defs =3D virQEMUCapsGetAccel(qemuCaps, type)->cpuModels)) return NULL; =20 - return virQEMUCapsCPUDefsToModels(defs, modelAllowed, modelForbidden); + return virQEMUCapsCPUDefsToModels(qemuCaps->arch, defs, + modelAllowed, modelForbidden, true); } =20 =20 @@ -2946,7 +2953,8 @@ virQEMUCapsFetchCPUModels(qemuMonitor *mon, if (virQEMUCapsFetchCPUDefinitions(mon, arch, &defs) < 0) return -1; =20 - if (defs && !(*cpuModels =3D virQEMUCapsCPUDefsToModels(defs, NULL, NU= LL))) + if (defs && + !(*cpuModels =3D virQEMUCapsCPUDefsToModels(arch, defs, NULL, NULL= , false))) return -1; =20 return 0; --=20 2.38.0 From nobody Mon May 6 09:54:07 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.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.133.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=1665163330; cv=none; d=zohomail.com; s=zohoarc; b=oCx8Ye9MHO89aDgKOnVQzZLAAwoDkkaY/TfeToZxFBD1xUjW8UAetbBgSX4l8JwNX0/31UvLO3aYyNicz/2HokPAMM+9El4/unAQuFSrQseTcOhLbgTy8IscK2GRvOKliTAfmXpKvRwsjJOBmUX27lDQ/cAjiFjAJtIUzbW8ZMI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1665163330; 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=Yo3xYVxEDPfeoJycSRjbnLPRAak5xYdREAtruQRQpNE=; b=KeDl6O14q/ykFzNBsNOKA4E6eFyyeIgZNxqTtZCepgdOf4TTtJeRrVcT/bIoujlNWZNt02sOLVYB7HiIt8UbyZfGdi1HefOG5A0p8wHgA8EMWidxD5jNbs5h6cOBkX1W8squrX/Pa7OTzEEfwmwyEvA69lky4eiSWjpHwNFv60s= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.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.133.124]) by mx.zohomail.com with SMTPS id 1665163330921552.8704277064558; Fri, 7 Oct 2022 10:22:10 -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-602-_49JTWDBOkWTJFrVeO7GsA-1; Fri, 07 Oct 2022 13:22:07 -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 642B8185A78F; Fri, 7 Oct 2022 17:22:01 +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 4FE64535D29; Fri, 7 Oct 2022 17:22:01 +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 41A361947B89; Fri, 7 Oct 2022 17:21:59 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 484DC1946A52 for ; Fri, 7 Oct 2022 17:21:57 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 2B90A20290AE; Fri, 7 Oct 2022 17:21:57 +0000 (UTC) Received: from rein.int.mamuti.net (unknown [10.40.194.60]) by smtp.corp.redhat.com (Postfix) with ESMTPS id DF643200C0DE for ; Fri, 7 Oct 2022 17:21:56 +0000 (UTC) Received: by rein.int.mamuti.net (Postfix, from userid 500) id 29AB81800FE; 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=1665163329; 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=Yo3xYVxEDPfeoJycSRjbnLPRAak5xYdREAtruQRQpNE=; b=H6t7yow8RWclCAjO0UMqApOJ3jtzMK3xxdgVUSQWwLwYoakZq/sOgNtgN3IvQQnZNkeqD6 e4CB4PbveOZfiiieR2pbR3Y5DjpiHba2JLX0JN45YI89p0pXLeaFD6mz5fFjlKwIxAlG8N NLzb1O6n5vmPBw2CJLboQagjZ26NEKE= X-MC-Unique: _49JTWDBOkWTJFrVeO7GsA-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Jiri Denemark To: libvir-list@redhat.com Subject: [libvirt PATCH v2 06/14] cpu_x86: Implement virCPUGetVendorForModel Date: Fri, 7 Oct 2022 19:21:43 +0200 Message-Id: <2de938e76adb3cadbca56e8881cbce537e98bd1c.1665162978.git.jdenemar@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.4 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: 1665163332740100001 Signed-off-by: Jiri Denemark Reviewed-by: J=C3=A1n Tomko --- Notes: Version 2: - no change src/cpu/cpu_x86.c | 19 ++++ .../domaincapsdata/qemu_4.2.0-q35.x86_64.xml | 88 ++++++++--------- .../domaincapsdata/qemu_4.2.0-tcg.x86_64.xml | 88 ++++++++--------- tests/domaincapsdata/qemu_4.2.0.x86_64.xml | 88 ++++++++--------- .../domaincapsdata/qemu_5.0.0-q35.x86_64.xml | 92 +++++++++--------- .../domaincapsdata/qemu_5.0.0-tcg.x86_64.xml | 92 +++++++++--------- tests/domaincapsdata/qemu_5.0.0.x86_64.xml | 92 +++++++++--------- .../domaincapsdata/qemu_5.1.0-q35.x86_64.xml | 92 +++++++++--------- .../domaincapsdata/qemu_5.1.0-tcg.x86_64.xml | 92 +++++++++--------- tests/domaincapsdata/qemu_5.1.0.x86_64.xml | 92 +++++++++--------- .../domaincapsdata/qemu_5.2.0-q35.x86_64.xml | 92 +++++++++--------- .../domaincapsdata/qemu_5.2.0-tcg.x86_64.xml | 92 +++++++++--------- tests/domaincapsdata/qemu_5.2.0.x86_64.xml | 92 +++++++++--------- .../domaincapsdata/qemu_6.0.0-q35.x86_64.xml | 94 +++++++++---------- .../domaincapsdata/qemu_6.0.0-tcg.x86_64.xml | 94 +++++++++---------- tests/domaincapsdata/qemu_6.0.0.x86_64.xml | 94 +++++++++---------- .../domaincapsdata/qemu_6.1.0-q35.x86_64.xml | 94 +++++++++---------- .../domaincapsdata/qemu_6.1.0-tcg.x86_64.xml | 94 +++++++++---------- tests/domaincapsdata/qemu_6.1.0.x86_64.xml | 94 +++++++++---------- .../domaincapsdata/qemu_6.2.0-q35.x86_64.xml | 94 +++++++++---------- .../domaincapsdata/qemu_6.2.0-tcg.x86_64.xml | 94 +++++++++---------- tests/domaincapsdata/qemu_6.2.0.x86_64.xml | 94 +++++++++---------- .../domaincapsdata/qemu_7.0.0-q35.x86_64.xml | 94 +++++++++---------- .../domaincapsdata/qemu_7.0.0-tcg.x86_64.xml | 94 +++++++++---------- tests/domaincapsdata/qemu_7.0.0.x86_64.xml | 94 +++++++++---------- .../domaincapsdata/qemu_7.1.0-q35.x86_64.xml | 90 +++++++++--------- .../domaincapsdata/qemu_7.1.0-tcg.x86_64.xml | 90 +++++++++--------- tests/domaincapsdata/qemu_7.1.0.x86_64.xml | 90 +++++++++--------- 28 files changed, 1264 insertions(+), 1245 deletions(-) diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c index 9fcd6b8add..4d2379803c 100644 --- a/src/cpu/cpu_x86.c +++ b/src/cpu/cpu_x86.c @@ -3137,6 +3137,24 @@ virCPUx86GetModels(char ***models) } =20 =20 +static const char * +virCPUx86GetVendorForModel(const char *modelName) +{ + virCPUx86Map *map; + virCPUx86Model *model; + + if (!(map =3D virCPUx86GetMap())) + return NULL; + + model =3D x86ModelFind(map, modelName); + + if (!model || !model->vendor) + return NULL; + + return model->vendor->name; +} + + static int virCPUx86Translate(virCPUDef *cpu, virDomainCapsCPUModels *models) @@ -3539,6 +3557,7 @@ struct cpuArchDriver cpuDriverX86 =3D { .dataFormat =3D virCPUx86DataFormat, .dataParse =3D virCPUx86DataParse, .getModels =3D virCPUx86GetModels, + .getVendorForModel =3D virCPUx86GetVendorForModel, .translate =3D virCPUx86Translate, .expandFeatures =3D virCPUx86ExpandFeatures, .copyMigratable =3D virCPUx86CopyMigratable, 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 fa86554892..dab12e5888 100644 --- a/tests/domaincapsdata/qemu_4.2.0-q35.x86_64.xml +++ b/tests/domaincapsdata/qemu_4.2.0-q35.x86_64.xml @@ -63,55 +63,55 @@ qemu64 qemu32 - phenom + phenom pentium3 pentium2 pentium - n270 + 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 + 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 From nobody Mon May 6 09:54:07 2024 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=gtWfkfnDO8MbGVqZnTyEUGUbyi3mlFtNpy0wFPaCh1tyP2vvo6ck3xS9MLbN2R35+HL6N35c2fNZwh8zeGPDJGbdSwOrzI7JXeGrJEufkTq8cqepxi14twJbM4wG91B5H/eNmwln4HoAqmPG1R988Ee5nS49UR2Sw2V7ud/wwRM= 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=PQEnloBTVqO0sOwpaQOPkPFRdiEBNT8hAVovzJjcg6M=; b=g6yvEoJTg++mfB3K/FTB9qYz1vs0iY0LP7pbx2GJmbMgHLBEPanAVel3A/AKSiAyfVZqwGxw2h/4p0tPQXjC5vW74iL4gwrmKKuQ/NwLkXuCNsrGmDOGHAe6s6W86O72AVt04ikFk1wGSN9qkUNhjdPPr5eUnlIStIUQYajzi8E= 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 166516333501699.71825992926222; Fri, 7 Oct 2022 10:22:15 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-269-XCQh-tjnNc6WemnOXAzmrw-1; Fri, 07 Oct 2022 13:22:09 -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 805363C10245; Fri, 7 Oct 2022 17:22:02 +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 1CE88535D3B; Fri, 7 Oct 2022 17:22:02 +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 BC02E1947B95; Fri, 7 Oct 2022 17:21:59 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 50FE41946595 for ; Fri, 7 Oct 2022 17:21:57 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 4334140C94CE; Fri, 7 Oct 2022 17:21:57 +0000 (UTC) Received: from rein.int.mamuti.net (unknown [10.40.194.60]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 0224F40C94D1 for ; Fri, 7 Oct 2022 17:21:56 +0000 (UTC) Received: by rein.int.mamuti.net (Postfix, from userid 500) id 2C1C51800FF; 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=PQEnloBTVqO0sOwpaQOPkPFRdiEBNT8hAVovzJjcg6M=; b=UGe0UKnWavH08KnjNvRmC2t+Ay0I97KOwhRYC/BdTqusFpithrUjcDPZY3sHet5KQXyq8a Hh0ilRt7MAbPaeVcZB1emLwbC3LFq9RXEvmP0Ha2npvjudHPzD1B0OPf37Qik4ajsHfmj4 dxzS1YsOxiNJkv4x503wbEtfFEfV7Ak= X-MC-Unique: XCQh-tjnNc6WemnOXAzmrw-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Jiri Denemark To: libvir-list@redhat.com Subject: [libvirt PATCH v2 07/14] cpu_ppc64: Implement virCPUGetVendorForModel Date: Fri, 7 Oct 2022 19:21:44 +0200 Message-Id: <4476d349f400e2d657a0aef4bef617a4d57348f9.1665162978.git.jdenemar@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.2 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: 1665163336756100007 Signed-off-by: Jiri Denemark Reviewed-by: J=C3=A1n Tomko --- Notes: Version 2: - no change src/cpu/cpu_ppc64.c | 20 ++++++++++++++++++++ tests/domaincapsdata/qemu_4.2.0.ppc64.xml | 6 +++--- tests/domaincapsdata/qemu_5.0.0.ppc64.xml | 8 ++++---- tests/domaincapsdata/qemu_5.2.0.ppc64.xml | 8 ++++---- tests/domaincapsdata/qemu_6.2.0.ppc64.xml | 8 ++++---- tests/domaincapsdata/qemu_7.0.0.ppc64.xml | 8 ++++---- 6 files changed, 39 insertions(+), 19 deletions(-) diff --git a/src/cpu/cpu_ppc64.c b/src/cpu/cpu_ppc64.c index 9997e14a89..7da67ec94a 100644 --- a/src/cpu/cpu_ppc64.c +++ b/src/cpu/cpu_ppc64.c @@ -780,6 +780,25 @@ virCPUppc64DriverGetModels(char ***models) return map->nmodels; } =20 + +static const char * +virCPUppc64GetVendorForModel(const char *modelName) +{ + virCPUppc64Map *map =3D NULL; + virCPUppc64Model *model; + + if (!(map =3D virCPUppc64GetMap())) + return NULL; + + model =3D ppc64ModelFind(map, modelName); + + if (!model || !model->vendor) + return NULL; + + return model->vendor->name; +} + + struct cpuArchDriver cpuDriverPPC64 =3D { .name =3D "ppc64", .arch =3D archs, @@ -793,6 +812,7 @@ struct cpuArchDriver cpuDriverPPC64 =3D { .baseline =3D virCPUppc64Baseline, .update =3D virCPUppc64Update, .getModels =3D virCPUppc64DriverGetModels, + .getVendorForModel =3D virCPUppc64GetVendorForModel, .convertLegacy =3D virCPUppc64ConvertLegacy, .dataIsIdentical =3D virCPUppc64DataIsIdentical, }; diff --git a/tests/domaincapsdata/qemu_4.2.0.ppc64.xml b/tests/domaincapsda= ta/qemu_4.2.0.ppc64.xml index 6d09c5ae4e..7093c35355 100644 --- a/tests/domaincapsdata/qemu_4.2.0.ppc64.xml +++ b/tests/domaincapsdata/qemu_4.2.0.ppc64.xml @@ -40,9 +40,9 @@ POWER8 - POWER9 - POWER8 - POWER7 + POWER9 + POWER8 + POWER7 diff --git a/tests/domaincapsdata/qemu_5.0.0.ppc64.xml b/tests/domaincapsda= ta/qemu_5.0.0.ppc64.xml index 032a4f4e19..b944723885 100644 --- a/tests/domaincapsdata/qemu_5.0.0.ppc64.xml +++ b/tests/domaincapsdata/qemu_5.0.0.ppc64.xml @@ -40,10 +40,10 @@ POWER8 - POWER10 - POWER9 - POWER8 - POWER7 + POWER10 + POWER9 + POWER8 + POWER7 diff --git a/tests/domaincapsdata/qemu_5.2.0.ppc64.xml b/tests/domaincapsda= ta/qemu_5.2.0.ppc64.xml index 570d88235b..71f47c8748 100644 --- a/tests/domaincapsdata/qemu_5.2.0.ppc64.xml +++ b/tests/domaincapsdata/qemu_5.2.0.ppc64.xml @@ -40,10 +40,10 @@ POWER8 - POWER10 - POWER9 - POWER8 - POWER7 + POWER10 + POWER9 + POWER8 + POWER7 diff --git a/tests/domaincapsdata/qemu_6.2.0.ppc64.xml b/tests/domaincapsda= ta/qemu_6.2.0.ppc64.xml index c2fe03d227..bf2c679c51 100644 --- a/tests/domaincapsdata/qemu_6.2.0.ppc64.xml +++ b/tests/domaincapsdata/qemu_6.2.0.ppc64.xml @@ -40,10 +40,10 @@ POWER8 - POWER10 - POWER9 - POWER8 - POWER7 + POWER10 + POWER9 + POWER8 + POWER7 diff --git a/tests/domaincapsdata/qemu_7.0.0.ppc64.xml b/tests/domaincapsda= ta/qemu_7.0.0.ppc64.xml index 06e713373e..8f6f9f57e1 100644 --- a/tests/domaincapsdata/qemu_7.0.0.ppc64.xml +++ b/tests/domaincapsdata/qemu_7.0.0.ppc64.xml @@ -40,10 +40,10 @@ POWER8 - POWER10 - POWER9 - POWER8 - POWER7 + POWER10 + POWER9 + POWER8 + POWER7 --=20 2.38.0 From nobody Mon May 6 09:54:07 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.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.133.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=1665163392; cv=none; d=zohomail.com; s=zohoarc; b=a83e1hvQTAzX3JvMvbd3B/mZbB+Zc00cA2QaME+cZll4e2Zv4H1xN+AYB8+jg9B0lG/E6lefV9Izd4/2JMYR6+OAlc7KHuiV9lDdmIzreuALo85eBW2GclvPaLcRe/4DYsoEN06BGHvIoUKqmj6kosLokzXXfiKYE8OjB6gR63s= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1665163392; 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=9ZYJaxXGG1/UKGNKLdVeIeGuL8qw7fwpX8pfNA4a5dM=; b=c73p6a2vuFRVhBzu9/5A1u4xdDEeR4BozErj38VNu+DxdGf6mQvhiV0tvgzI54ldBgxOLvUcSPPk8hYWigdYwJ7Urj8BhwNldqblWOGRyyiTVbSzTsMr9oLFkMDD20hwRtChir4LPXj+m1qmeBJVGcnIuAfGP19Ao/U68gwMq1c= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.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.133.124]) by mx.zohomail.com with SMTPS id 1665163392378762.4448712316615; Fri, 7 Oct 2022 10:23:12 -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-556-ng81fFcvOQm0R692pBr4Rg-1; Fri, 07 Oct 2022 13:22:12 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id B3EE7100EDC3; Fri, 7 Oct 2022 17:22:04 +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 A051CAB585; Fri, 7 Oct 2022 17:22:04 +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 A289F1946A66; Fri, 7 Oct 2022 17:22:01 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 339721946595 for ; Fri, 7 Oct 2022 17:21:57 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 26320535D26; Fri, 7 Oct 2022 17:21:57 +0000 (UTC) Received: from rein.int.mamuti.net (unknown [10.40.194.60]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 00CB553595F for ; Fri, 7 Oct 2022 17:21:56 +0000 (UTC) Received: by rein.int.mamuti.net (Postfix, from userid 500) id 2EBA0180101; 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=1665163391; 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=9ZYJaxXGG1/UKGNKLdVeIeGuL8qw7fwpX8pfNA4a5dM=; b=AAZUO0tlXUQXw/koUw3501i5trUIssJVqfmvcS2aSEv017TbMTJwjmm93k/YyEnuq1Lnr3 G0S/AO0q8i87WN+4JoiCKJefBATzaicnxEtjV/TWgAIiYd7lhHn/HTgmDdgFxe6Kam/aFj 6V0nYXgmc3c8fx1aagZcybJACaJYqJE= X-MC-Unique: ng81fFcvOQm0R692pBr4Rg-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Jiri Denemark To: libvir-list@redhat.com Subject: [libvirt PATCH v2 08/14] cpu_arm: Don't implement virCPUGetVendorForModel Date: Fri, 7 Oct 2022 19:21:45 +0200 Message-Id: <39cb473ab7d1eb331c25b1ba91ef715d58f8a9ee.1665162978.git.jdenemar@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.10 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.5 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: 1665163393166100001 This patch is effectively a no-op, but I wanted to initialize .getVendorForModel explicitly as implementing this function does not even make sense on ARM. The CPU models in our CPU map are only used for describing host CPU in capabilities XML and cannot be used for guest CPU definition in domain XML anyway. The CPU models listed as supported in domain capabilities XML are just passed through from QEMU. Signed-off-by: Jiri Denemark Reviewed-by: J=C3=A1n Tomko --- Notes: Version 2: - no change src/cpu/cpu_arm.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/cpu/cpu_arm.c b/src/cpu/cpu_arm.c index 599bb836ed..409b397155 100644 --- a/src/cpu/cpu_arm.c +++ b/src/cpu/cpu_arm.c @@ -714,6 +714,7 @@ struct cpuArchDriver cpuDriverArm =3D { #endif .decode =3D NULL, .encode =3D NULL, + .getVendorForModel =3D NULL, .dataCopyNew =3D virCPUarmDataCopyNew, .dataFree =3D virCPUarmDataFree, .baseline =3D virCPUarmBaseline, --=20 2.38.0 From nobody Mon May 6 09:54:07 2024 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=1665163390; cv=none; d=zohomail.com; s=zohoarc; b=foBZKQud01HggAZGsIt9eN7FYrMbWfXzq96Q1GtrgHwV3EFg1uhqSYwUHku3t8XvPbl6IqxTHX8APufgbrUG2fxwaJHa0ZWNv4K1Lkj2KH6A1BFQgMFU0aJOtcaIk5HY5gXk/6qyKSqMCQC52+/tnDPqZBL0SJSEIq+Lot8wFMk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1665163390; 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=C3eq6Tq6R1bsPWPGXlQCJbIVOyvdwESHBCy53GKK4ks=; b=M+MmpJbc+KooewtJfrbCPZML5nHpB1GDmF3jaRa8jT6jcY0xRK/adUXbejFs//7C0mHs8iC92V8ORBtQBM4YghvT/FvDFsE8+Irhdp/oEJ+bx99M87OIJA7IXMHmqqyHAm1X0NLvdYqB/l2R10sjjeXWgzBjUjlSQJUQsEsHWkI= 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 166516339019752.30336325321639; Fri, 7 Oct 2022 10:23:10 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-271-JZpMN6qNO9SZ6LHute1NlA-1; Fri, 07 Oct 2022 13:22:09 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 770392823823; Fri, 7 Oct 2022 17:22:00 +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 6381A20290AE; Fri, 7 Oct 2022 17:22:00 +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 AE8151947079; Fri, 7 Oct 2022 17:21:58 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 36E1F1946A49 for ; Fri, 7 Oct 2022 17:21:57 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 2754040C94D2; Fri, 7 Oct 2022 17:21:57 +0000 (UTC) Received: from rein.int.mamuti.net (unknown [10.40.194.60]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 01F6840C94CE for ; Fri, 7 Oct 2022 17:21:56 +0000 (UTC) Received: by rein.int.mamuti.net (Postfix, from userid 500) id 31203180104; 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=1665163389; 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=C3eq6Tq6R1bsPWPGXlQCJbIVOyvdwESHBCy53GKK4ks=; b=ORhsNqn1rYvskUGdZr1L2DHyk/3h4yzBSSgnIbiQ55r5zeKc1qMXjpFxVun2KAwdxPJtJf L4knO0w94dDKFvkwpSL6dC6MSmb3hm05f5SXYb5sHi6ID7MJ2zG7vQyehXYenWTIXRYMeO ezrxSJ21y4VO4m/UI0oU2im3ZmmIyYo= X-MC-Unique: JZpMN6qNO9SZ6LHute1NlA-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Jiri Denemark To: libvir-list@redhat.com Subject: [libvirt PATCH v2 09/14] docs: Enhance documentation of CPU models in domain caps Date: Fri, 7 Oct 2022 19:21:46 +0200 Message-Id: <3db22de90c9f5cb63992fc2ac5df3d2300b8b43d.1665162978.git.jdenemar@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.2 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.4 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1665163391042100007 Content-Type: text/plain; charset="utf-8" Signed-off-by: Jiri Denemark Reviewed-by: J=C3=A1n Tomko --- Notes: Version 2: - new patch docs/formatdomaincaps.rst | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/docs/formatdomaincaps.rst b/docs/formatdomaincaps.rst index 6ce780fb69..afade16bc0 100644 --- a/docs/formatdomaincaps.rst +++ b/docs/formatdomaincaps.rst @@ -222,10 +222,20 @@ more details about it: ``custom`` The ``mode`` element contains a list of supported CPU models, each desc= ribed by a dedicated ``model`` element. The ``usable`` attribute specifies wh= ether - the model can be used directly on the host. When usable=3D'no' the - corresponding model cannot be used without disabling some features that= the - 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 + the model can be used directly on the host. A special value ``unknown`` + indicates libvirt does not have enough information to provide the usabi= lity + data. When ``usable=3D'no'`` the corresponding model cannot be used wit= hout + disabling some features that the CPU of such model is expected to have.= The + list of features blocking usability of a particular CPU model is return= ed + as disabled features in the result of ``virConnectBaselineHypervisorCPU= `` + API (or ``virsh hypervisor-cpu-baseline``) when called on a CPU definit= ion + using the CPU model and no additional feature elements. Models marked as + usable (``usable=3D'yes'``) can be safely used in domain XMLs with + ``check=3D'none'`` as the hypervisor guarantees the model can be used o= n the + current host and additional checks done by libvirt are redundant. In fa= ct, + disabling libvirt checks via ``check=3D'none'`` for such models is reco= mmended + to avoid needless issues with starting domains when libvirt's definitio= n of + a particular model differs from hypervisor's definition. The ``deprecated`` attribute reflects the hypervisor's policy on usage of t= his 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 --=20 2.38.0 From nobody Mon May 6 09:54:07 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.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.133.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=1665163386; cv=none; d=zohomail.com; s=zohoarc; b=TvA82l5BDSg9glWXJApIXBBpboHc9TkkjPL7AfR0QLeKFeZPDHAzPq9gZn/HPBa55MAz8OLn+PRcvVieR1EW0dKkUvZdIgRNVCZItVLCLQRyB/WcaIcuG2EGKGSQ82hmKygUQ4vwHz5eZqiBuWj40y6gLKYRauKniWOjKqtOAWk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1665163386; 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=0flfjKdA+As13RvDPLEQO9uvASxnfQ9q4yOEGD/UNUM=; b=RZjiCTZeB63Tq5WuEjk/FGRbhVS4TRdbLcI+z4Q84vbIiztsFxM/+Y9CqyzRy7Art51Sq5KzLcDyxt/d+ahL7yeqkSgSHzeqIfD9+u7a4dBeodqe8gppYWYp8MDR28zcyFddUyMQsVfIwKD6Qz2vOMNCXVyqwi+NNXf2gYld8q0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.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.133.124]) by mx.zohomail.com with SMTPS id 1665163386337566.5975028432315; Fri, 7 Oct 2022 10:23:06 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-13-foTFxe2INUmcspA43rmfVg-1; Fri, 07 Oct 2022 13:22:14 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id E64802801A40; Fri, 7 Oct 2022 17:22:03 +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 CE696145BA60; Fri, 7 Oct 2022 17:22:03 +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 9C3421947069; Fri, 7 Oct 2022 17:22:00 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 523191946A49 for ; Fri, 7 Oct 2022 17:21:57 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 32990112C06E; Fri, 7 Oct 2022 17:21:57 +0000 (UTC) Received: from rein.int.mamuti.net (unknown [10.40.194.60]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 0DD70112C067 for ; Fri, 7 Oct 2022 17:21:57 +0000 (UTC) Received: by rein.int.mamuti.net (Postfix, from userid 500) id 33971180105; 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=1665163384; 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=0flfjKdA+As13RvDPLEQO9uvASxnfQ9q4yOEGD/UNUM=; b=aSBhzYoljOVCeBxrjXIukKHAUd+e/B7N238t8FXB2XwAV4eOX5M9KI6FuKnRGuv9vg0Hj7 kUS6IHd/Wnxp4/04U87erVRGyfjbekRYF3FMWlROKdU1hWTi8rzNedGPckNfNVjgfgE0iE xpvELIkBPneKI09Spl11M63sDpg9rhE= X-MC-Unique: foTFxe2INUmcspA43rmfVg-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Jiri Denemark To: libvir-list@redhat.com Subject: [libvirt PATCH v2 10/14] Document specifics of virConnectBaselineHypervisorCPU Date: Fri, 7 Oct 2022 19:21:47 +0200 Message-Id: <541b01d5b38da27ad813446582ddae29808a91dc.1665162978.git.jdenemar@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.3 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.7 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1665163387028100001 Content-Type: text/plain; charset="utf-8" The API can be used to get usability blockers for an unusable CPU model, which is not obvious. Let's explicitly document this behavior as it is now mentioned in the documentation of domain capabilities XML. Signed-off-by: Jiri Denemark Reviewed-by: J=C3=A1n Tomko --- Notes: Version 2: - new patch src/libvirt-host.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/libvirt-host.c b/src/libvirt-host.c index 2ee6370bce..c02222346c 100644 --- a/src/libvirt-host.c +++ b/src/libvirt-host.c @@ -1319,6 +1319,15 @@ virConnectBaselineCPU(virConnectPtr conn, * This is different from virConnectBaselineCPU() which doesn't consider a= ny * hypervisor abilities when computing the best CPU. * + * If @ncpus =3D=3D 1, the result will be the first (and only) CPU in @xml= CPUs + * tailored to what the hypervisor can support on the current host. + * Specifically if this single CPU definition contains no feature elements= and + * a CPU model listed as usable=3D'no' in domain capabilities XML, the res= ult + * will contain a list usability blockers, i.e., a list of features that w= ould + * need to be disabled to for the model to be usable on this host. This li= st + * may contain more features than what the hypervisor reports as blockers = in + * case the CPU model definition in libvirt differs from QEMU definition. + * * If @flags includes VIR_CONNECT_BASELINE_CPU_EXPAND_FEATURES then libvirt * will explicitly list all CPU features that are part of the computed CPU, * without this flag features that are part of the CPU model will not be --=20 2.38.0 From nobody Mon May 6 09:54:07 2024 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=1665163338; cv=none; d=zohomail.com; s=zohoarc; b=dPb3xxOcJn2VZTK2mVNuhbEzXUo7cIlwZE/yq15S2dJ5etb0zS/1vN1mwA87YWYjQ8rVoQmp9pdIAORYbJniOaa9imKl8QDbFYJxoMC60+s4ZXGC1xCWow3+MYvysLsES9ANZBBYZLN6sR2eB3Buawl7FFs5ur8sHYMnI/okWzw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1665163338; 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=5pzsreINY2lNeO33cX9nyTQkQ9flH6Y+0Z/1edCKgBQ=; b=WJiaRD8dIA09JZSutN/GgsvJpzMZx3c17RxnEPRDN5HO/DZz8EwI9jEO2Ipi0U0i86I0I+fSdSgJQ+/CcGb0pZz7OX3wQkIdggtWm3YupDtYKk8d/AG5ulm6mD425XZdNxuficXcNoO2RZELL4PFd26Cwu0lvzmErxT0TKytvtw= 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 1665163338102329.55584536699143; Fri, 7 Oct 2022 10:22:18 -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-549-Jru_9WN7NGCATrvdcqAibQ-1; Fri, 07 Oct 2022 13:22:13 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id F213A10115EF; Fri, 7 Oct 2022 17:22:02 +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 DE47B40FF5E4; Fri, 7 Oct 2022 17:22:02 +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 31B791947BA8; Fri, 7 Oct 2022 17:22:00 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 744731946A70 for ; Fri, 7 Oct 2022 17:21:57 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 56D5314583FB; Fri, 7 Oct 2022 17:21:57 +0000 (UTC) Received: from rein.int.mamuti.net (unknown [10.40.194.60]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 161A8145BA51 for ; Fri, 7 Oct 2022 17:21:57 +0000 (UTC) Received: by rein.int.mamuti.net (Postfix, from userid 500) id 35F81180106; 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=1665163337; 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=5pzsreINY2lNeO33cX9nyTQkQ9flH6Y+0Z/1edCKgBQ=; b=ET3WILr25UxJnRprLNKOPtuqfIv8OZAiheMHXo8SQCFA3BW5qxXtN38H4KY4SdotnB5ecB pID+TiaxXLQib33tHlvWLBrfcKGOYIi3MlURRTn7r4sDHG0Ga+bP1pWoZq26XUqgvfgQb6 s7CfA2HW2VLl6uGj9Lx14yKHp/aKBXY= X-MC-Unique: Jru_9WN7NGCATrvdcqAibQ-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Jiri Denemark To: libvir-list@redhat.com Subject: [libvirt PATCH v2 11/14] qemu_capabilities: Translate CPU blockers Date: Fri, 7 Oct 2022 19:21:48 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.7 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.1 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1665163338809100016 Content-Type: text/plain; charset="utf-8" Since commit "cpu_x86: Disable blockers from unusable CPU models" (v3.8.0-99-g9c9620af1d) we explicitly disable CPU features reported by QEMU as usability blockers for a particular CPU model when creating baseline or host-model CPU definition. When QEMU changed canonical names for some features (mostly those with '_' in their names), we forgot to translate the blocker lists to names used by libvirt and the renamed features would no longer be explicitly disabled in the created CPU model even if they were reported as blockers by QEMU. For example, on a host where EPYC CPU model has the following blockers we would fail to disable 'fxsr-opt': EPYC The 'monitor' feature is disabled even though it is not reported as a blocker by QEMU because libvirt's definition of EPYC includes the feature while it is missing in EPYC definition in QEMU. Signed-off-by: Jiri Denemark Reviewed-by: J=C3=A1n Tomko --- Notes: Version 2: - also translate blockers when fetching them from QEMU (in virQEMUCapsFetchCPUDefinitions) - rewritten commit message src/qemu/qemu_capabilities.c | 42 ++++++++++++++++++++++++++++++------ src/qemu/qemu_capabilities.h | 4 ++++ 2 files changed, 40 insertions(+), 6 deletions(-) diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index ccd274b80d..6f3ff7f43f 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -2936,6 +2936,17 @@ virQEMUCapsFetchCPUDefinitions(qemuMonitor *mon, } } =20 + for (i =3D 0; i < defs->ncpus; i++) { + qemuMonitorCPUDefInfo *cpu =3D &defs->cpus[i]; + char **blocker; + + if (!cpu->blockers) + continue; + + for (blocker =3D cpu->blockers; *blocker; blocker++) + virQEMUCapsCPUFeatureFromQEMUInPlace(arch, blocker); + } + *cpuDefs =3D g_steal_pointer(&defs); return 0; } @@ -3483,6 +3494,19 @@ virQEMUCapsCPUFeatureFromQEMU(virArch arch, } =20 =20 +void +virQEMUCapsCPUFeatureFromQEMUInPlace(virArch arch, + char **feature) +{ + const char *tmp =3D virQEMUCapsCPUFeatureFromQEMU(arch, *feature); + + if (tmp !=3D *feature) { + VIR_FREE(*feature); + *feature =3D g_strdup(tmp); + } +} + + /** * Returns 0 when host CPU model provided by QEMU was filled in qemuCaps, * 1 when the caller should fall back to using virCaps *->host.cp= u, @@ -3907,7 +3931,8 @@ virQEMUCapsLoadHostCPUModelInfo(virQEMUCapsAccel *cap= s, =20 =20 static int -virQEMUCapsLoadCPUModels(virQEMUCapsAccel *caps, +virQEMUCapsLoadCPUModels(virArch arch, + virQEMUCapsAccel *caps, xmlXPathContextPtr ctxt, const char *typeStr) { @@ -3978,6 +4003,8 @@ virQEMUCapsLoadCPUModels(virQEMUCapsAccel *caps, "capabilities cache")); return -1; } + + virQEMUCapsCPUFeatureFromQEMUInPlace(arch, &cpu->blockers[= j]); } } =20 @@ -4072,7 +4099,7 @@ virQEMUCapsLoadAccel(virQEMUCaps *qemuCaps, if (virQEMUCapsLoadHostCPUModelInfo(caps, ctxt, typeStr) < 0) return -1; =20 - if (virQEMUCapsLoadCPUModels(caps, ctxt, typeStr) < 0) + if (virQEMUCapsLoadCPUModels(qemuCaps->arch, caps, ctxt, typeStr) < 0) return -1; =20 if (virQEMUCapsLoadMachines(caps, ctxt, typeStr) < 0) @@ -4534,7 +4561,8 @@ virQEMUCapsFormatHostCPUModelInfo(virQEMUCapsAccel *c= aps, =20 =20 static void -virQEMUCapsFormatCPUModels(virQEMUCapsAccel *caps, +virQEMUCapsFormatCPUModels(virArch arch, + virQEMUCapsAccel *caps, virBuffer *buf, const char *typeStr) { @@ -4563,8 +4591,10 @@ virQEMUCapsFormatCPUModels(virQEMUCapsAccel *caps, virBufferAddLit(buf, ">\n"); virBufferAdjustIndent(buf, 2); =20 - for (j =3D 0; cpu->blockers[j]; j++) - virBufferAsprintf(buf, "\n", cpu->bl= ockers[j]); + for (j =3D 0; cpu->blockers[j]; j++) { + virBufferAsprintf(buf, "\n", + virQEMUCapsCPUFeatureToQEMU(arch, cpu->b= lockers[j])); + } =20 virBufferAdjustIndent(buf, -2); virBufferAddLit(buf, "\n"); @@ -4616,7 +4646,7 @@ virQEMUCapsFormatAccel(virQEMUCaps *qemuCaps, const char *typeStr =3D virQEMUCapsAccelStr(type); =20 virQEMUCapsFormatHostCPUModelInfo(caps, buf, typeStr); - virQEMUCapsFormatCPUModels(caps, buf, typeStr); + virQEMUCapsFormatCPUModels(qemuCaps->arch, caps, buf, typeStr); virQEMUCapsFormatMachines(caps, buf, typeStr); =20 } diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h index 904ee54f60..4b2782c462 100644 --- a/src/qemu/qemu_capabilities.h +++ b/src/qemu/qemu_capabilities.h @@ -845,6 +845,10 @@ const char * virQEMUCapsCPUFeatureFromQEMU(virArch arch, const char *feature); =20 +void +virQEMUCapsCPUFeatureFromQEMUInPlace(virArch arch, + char **feature); + virSEVCapability * virQEMUCapsGetSEVCapabilities(virQEMUCaps *qemuCaps); =20 --=20 2.38.0 From nobody Mon May 6 09:54:07 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.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.133.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=1665163338; cv=none; d=zohomail.com; s=zohoarc; b=CrJTsYLQF7YPR0lEXA7pG2pMX0ts1/s3tTiJZVcGVkBfnkGSuyMmZgkRPFAuUB+YRRBRzWZ4wHt2aqV8Jo5mEpsa7y/ex3LWAMm75j+6fDSDuLXPmbepyUfow2o4un0f8ddGFMShfz5a/qKFk18X0xkZzzxR+n8iI1sNcXeE7rE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1665163338; 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=xOJv5/ebFotvPwKqcTNjhJ75A+MPycbkCPMAZJnbhs4=; b=ccX0pqOp9PEexLr0LxrRQ6eo4Ofv3R9wB7ygVwS0WJ7SPD7zTCggMOhGFNkZMnV/7EG1fwm44KI1ItMIarHp5+sGJwg/JuYoDMtj9+6zfzr5oOE7JqxuRKe6cgVzWE8ZvNTVD8+WKwCLaozZRa5U7ZgSnAJLEJ1Ru98uZ/sGMCs= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.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.133.124]) by mx.zohomail.com with SMTPS id 1665163338849456.2715700849342; Fri, 7 Oct 2022 10:22:18 -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-436-ucwlvAk8O2Gz6oIorAwG_A-1; Fri, 07 Oct 2022 13:22:11 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 2ED06805AC8; Fri, 7 Oct 2022 17:22:02 +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 19FA540C955C; Fri, 7 Oct 2022 17:22:02 +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 BBE881947B93; Fri, 7 Oct 2022 17:21:59 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 5FD2F1946A69 for ; Fri, 7 Oct 2022 17:21:57 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 52C29112C067; Fri, 7 Oct 2022 17:21:57 +0000 (UTC) Received: from rein.int.mamuti.net (unknown [10.40.194.60]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 1295F112C069 for ; Fri, 7 Oct 2022 17:21:57 +0000 (UTC) Received: by rein.int.mamuti.net (Postfix, from userid 500) id 3899918010B; 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=1665163338; 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=xOJv5/ebFotvPwKqcTNjhJ75A+MPycbkCPMAZJnbhs4=; b=Hvnug0tI3qeXcdA+gh5ADyKdOziPx5dn+Sc5/z4P394ai7G0wD0nE5qxcmjKH8sTd4vU73 WvCvEKtxzS7BBFDJQEEiMUJ6aW7NJDSO1JkhaaNF5izx12EVls9euaTLi+bwetaAc+1Eyr yjI8uMiQ0qTyvFpMdZ2AhoBb5SfK50g= X-MC-Unique: ucwlvAk8O2Gz6oIorAwG_A-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Jiri Denemark To: libvir-list@redhat.com Subject: [libvirt PATCH v2 12/14] virsh: Add --model option for hypervisor-cpu-baseline Date: Fri, 7 Oct 2022 19:21:49 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.3 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.2 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1665163340822100019 Content-Type: text/plain; charset="utf-8" This option can be used as a shortcut for creating a single XML with just a CPU model name and no features: $ virsh hypervisor-cpu-baseline --model Skylake-Server Skylake-Server Signed-off-by: Jiri Denemark Reviewed-by: J=C3=A1n Tomko --- Notes: Version 2: - new patch docs/manpages/virsh.rst | 14 +++++++++++--- tools/virsh-host.c | 23 +++++++++++++++++++---- tools/virsh.h | 7 +++++-- tools/vsh.h | 27 +++++++++++++++++++++++++++ 4 files changed, 62 insertions(+), 9 deletions(-) diff --git a/docs/manpages/virsh.rst b/docs/manpages/virsh.rst index 5d11c48803..61fcb2e9ca 100644 --- a/docs/manpages/virsh.rst +++ b/docs/manpages/virsh.rst @@ -962,13 +962,18 @@ hypervisor-cpu-baseline =20 :: =20 - hypervisor-cpu-baseline FILE [virttype] [emulator] [arch] [machine] [--= features] [--migratable] + hypervisor-cpu-baseline [FILE] [virttype] [emulator] [arch] [machine] + [--features] [--migratable] [model] =20 Compute a baseline CPU which will be compatible with all CPUs defined in a= n XML *file* and with the CPU the hypervisor is able to provide on the host. (Th= is is different from ``cpu-baseline`` which does not consider any hypervisor abilities when computing the baseline CPU.) =20 +As an alternative for *FILE* in case the XML would only contain a CPU model +with no additional features the CPU model name itself can be passed as *mo= del*. +Exactly one of *FILE* and *model* must be used. + The XML *FILE* may contain either host or guest CPU definitions describing= the host CPU model. The host CPU definition is the element and its conte= nts as printed by ``capabilities`` command. The guest CPU definition may be cr= eated @@ -981,10 +986,13 @@ fail or provide unexpected results. =20 When *FILE* contains only a single CPU definition, the command will print = the same CPU with restrictions imposed by the capabilities of the hypervisor. -Specifically, running th ``virsh hypervisor-cpu-baseline`` command with no +Specifically, running the ``virsh hypervisor-cpu-baseline`` command with no additional options on the result of ``virsh domcapabilities`` will transfo= rm the host CPU model from domain capabilities XML to a form directly usable in d= omain -XML. +XML. Running the command with *model* (or *FILE* containing just a single = CPU +definition with model and no feature elements) which is marked as unusable= in +``virsh domcapabilities`` will provide a list of features that block this = CPU +model from being usable. =20 The *virttype* option specifies the virtualization type (usable in the 'ty= pe' attribute of the top level element from the domain XML). *emulato= r* diff --git a/tools/virsh-host.c b/tools/virsh-host.c index ead966b500..16c3585a1a 100644 --- a/tools/virsh-host.c +++ b/tools/virsh-host.c @@ -1689,7 +1689,8 @@ static const vshCmdInfo info_hypervisor_cpu_baseline[= ] =3D { }; =20 static const vshCmdOptDef opts_hypervisor_cpu_baseline[] =3D { - VIRSH_COMMON_OPT_FILE(N_("file containing XML CPU descriptions")), + VIRSH_COMMON_OPT_FILE_FULL(N_("file containing XML CPU descriptions"), + false), {.name =3D "virttype", .type =3D VSH_OT_STRING, .completer =3D virshDomainVirtTypeCompleter, @@ -1716,6 +1717,11 @@ static const vshCmdOptDef opts_hypervisor_cpu_baseli= ne[] =3D { .type =3D VSH_OT_BOOL, .help =3D N_("Do not include features that block migration") }, + {.name =3D "model", + .type =3D VSH_OT_STRING, + .help =3D N_("Shortcut for calling the command with a single CPU mode= l " + "and no additional features") + }, {.name =3D NULL} }; =20 @@ -1728,6 +1734,7 @@ cmdHypervisorCPUBaseline(vshControl *ctl, const char *emulator =3D NULL; const char *arch =3D NULL; const char *machine =3D NULL; + const char *model =3D NULL; bool ret =3D false; g_autofree char *result =3D NULL; g_auto(GStrv) list =3D NULL; @@ -1743,11 +1750,19 @@ cmdHypervisorCPUBaseline(vshControl *ctl, vshCommandOptStringReq(ctl, cmd, "virttype", &virttype) < 0 || vshCommandOptStringReq(ctl, cmd, "emulator", &emulator) < 0 || vshCommandOptStringReq(ctl, cmd, "arch", &arch) < 0 || - vshCommandOptStringReq(ctl, cmd, "machine", &machine) < 0) + vshCommandOptStringReq(ctl, cmd, "machine", &machine) < 0 || + vshCommandOptStringReq(ctl, cmd, "model", &model) < 0) return false; =20 - if (!(list =3D vshExtractCPUDefXMLs(ctl, from))) - return false; + VSH_ALTERNATIVE_OPTIONS_EXPR("file", from, "model", model); + + if (from) { + if (!(list =3D vshExtractCPUDefXMLs(ctl, from))) + return false; + } else { + list =3D g_new0(char *, 2); + list[0] =3D g_strdup_printf("%s", model); + } =20 result =3D virConnectBaselineHypervisorCPU(priv->conn, emulator, arch, machine, virttype, diff --git a/tools/virsh.h b/tools/virsh.h index f9841c8da2..6acefa7f9d 100644 --- a/tools/virsh.h +++ b/tools/virsh.h @@ -96,9 +96,12 @@ =20 /* Use this only for files which are existing and used locally by virsh */ #define VIRSH_COMMON_OPT_FILE(_helpstr) \ + VIRSH_COMMON_OPT_FILE_FULL(_helpstr, true) + +#define VIRSH_COMMON_OPT_FILE_FULL(_helpstr, required) \ {.name =3D "file", \ - .type =3D VSH_OT_DATA, \ - .flags =3D VSH_OFLAG_REQ, \ + .type =3D required ? VSH_OT_DATA : VSH_OT_STRING, \ + .flags =3D required ? VSH_OFLAG_REQ : VSH_OFLAG_NONE, \ .completer =3D virshCompletePathLocalExisting, \ .help =3D _helpstr \ } diff --git a/tools/vsh.h b/tools/vsh.h index a43660b63d..657a1e7a93 100644 --- a/tools/vsh.h +++ b/tools/vsh.h @@ -520,6 +520,33 @@ void vshReadlineHistoryAdd(const char *cmd); #define VSH_EXCLUSIVE_OPTIONS_VAR(VARNAME1, VARNAME2) \ VSH_EXCLUSIVE_OPTIONS_EXPR(#VARNAME1, VARNAME1, #VARNAME2, VARNAME2) =20 +/* Macros to help dealing with alternative mutually exclusive options. */ + +/* VSH_ALTERNATIVE_OPTIONS_EXPR: + * + * @NAME1: String containing the name of the option. + * @EXPR1: Expression to validate the variable (must evaluate to bool). + * @NAME2: String containing the name of the option. + * @EXPR2: Expression to validate the variable (must evaluate to bool). + * + * Require exactly one of the command options in virsh. Use the provided + * expression to check the variables. + * + * This helper does an early return and therefore it has to be called + * before anything that would require cleanup. + */ +#define VSH_ALTERNATIVE_OPTIONS_EXPR(NAME1, EXPR1, NAME2, EXPR2) \ + do { \ + bool _expr1 =3D EXPR1; \ + bool _expr2 =3D EXPR2; \ + VSH_EXCLUSIVE_OPTIONS_EXPR(NAME1, _expr1, NAME2, _expr2); \ + if (!_expr1 && !_expr2) { \ + vshError(ctl, _("Either --%s or --%s must be provided"), \ + NAME1, NAME2); \ + return false; \ + } \ + } while (0) + /* Macros to help dealing with required options. */ =20 /* VSH_REQUIRE_OPTION_EXPR: --=20 2.38.0 From nobody Mon May 6 09:54:07 2024 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=1665163337; cv=none; d=zohomail.com; s=zohoarc; b=RJtC1eHmm4I0YRWyKOxK5Zjtk4MgwmRyYGBvaPIAC4Tb0W3GjUwVN92JkuiaRww1M/wCFWHVijjh/+riAyILmQOOVTiEMUTZQopLXVD9itoR0cgcN4tIeo+40pe0ekspwB8J0+bDzyGxfEK6T/QYi0k5nKPwqDsxbVasfE7qGrc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1665163337; 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=IkPu+H25etQjVgoj/Bc9k0wnFIzr4tCW277HJbTiM5I=; b=OZg+poXjGvWQihCG6J/lfVxkxYmGLhvX9DZDCG/CrOvQegB9LeAavgmU0rqQc3+jTygKRg+Q9BNUJO+GBvLrAWfWwqAYvWi9HP1zejSs3SLB3wrBOqoycuAe6Rdq0gO1gXDVzv8jWqWeOVvuCl7ELk0e4N+dOl6TSAB59cKiyvs= 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 1665163337246542.8247429725436; Fri, 7 Oct 2022 10:22:17 -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-297-3HJhgDjzMbuQenx3-L7J7Q-1; Fri, 07 Oct 2022 13:22:11 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 7A56A185A7A4; Fri, 7 Oct 2022 17:22:04 +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 5C540145BA5C; Fri, 7 Oct 2022 17:22:04 +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 E006E1949763; Fri, 7 Oct 2022 17:22:00 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 52AE81946A66 for ; Fri, 7 Oct 2022 17:21:57 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 43C1E145BA57; Fri, 7 Oct 2022 17:21:57 +0000 (UTC) Received: from rein.int.mamuti.net (unknown [10.40.194.60]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 1E800145BA56 for ; Fri, 7 Oct 2022 17:21:57 +0000 (UTC) Received: by rein.int.mamuti.net (Postfix, from userid 500) id 3B12818010D; 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=1665163336; 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=IkPu+H25etQjVgoj/Bc9k0wnFIzr4tCW277HJbTiM5I=; b=M8jW5c9yixVcJ0y2Vc8VRA8XDzixqDsBR9Ow6Mm8eLvWzm/WPfUuynwnOOHY1R+cV3a1w5 Cy+lwBOADgVQp+HlgUeDIa3haO2TzoqOY0rjxm1NUGG7nEadnDYmy4exE9KX5+kkbOHwTl 2t06eI/B4bL8SVcaC53Gi+gOg4zYlSY= X-MC-Unique: 3HJhgDjzMbuQenx3-L7J7Q-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Jiri Denemark To: libvir-list@redhat.com Subject: [libvirt PATCH v2 13/14] virsh: Add completer for hypervisor-cpu-baseline --model Date: Fri, 7 Oct 2022 19:21:50 +0200 Message-Id: <8b9a6c0e4e5817daafeea28c4fcc9143f8e33415.1665162978.git.jdenemar@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.7 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.7 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1665163338789100015 Content-Type: text/plain; charset="utf-8" Signed-off-by: Jiri Denemark Reviewed-by: J=C3=A1n Tomko --- Notes: Version 2: - new patch tools/virsh-completer-host.c | 50 ++++++++++++++++++++++++++++++++++++ tools/virsh-completer-host.h | 5 ++++ tools/virsh-host.c | 1 + 3 files changed, 56 insertions(+) diff --git a/tools/virsh-completer-host.c b/tools/virsh-completer-host.c index 05a84a43bb..93b633eb64 100644 --- a/tools/virsh-completer-host.c +++ b/tools/virsh-completer-host.c @@ -205,3 +205,53 @@ virshArchCompleter(vshControl *ctl G_GNUC_UNUSED, return virshEnumComplete(VIR_ARCH_LAST, (const char *(*)(int))virArchToString); } + + +char ** +virshCPUModelCompleter(vshControl *ctl, + const vshCmd *cmd, + unsigned int flags) +{ + virshControl *priv =3D ctl->privData; + const char *virttype =3D NULL; + const char *emulator =3D NULL; + const char *arch =3D NULL; + const char *machine =3D NULL; + g_autofree char *domcaps =3D NULL; + g_autoptr(xmlDoc) xml =3D NULL; + g_autoptr(xmlXPathContext) ctxt =3D NULL; + g_autofree xmlNodePtr *nodes =3D NULL; + g_auto(GStrv) models =3D NULL; + int nmodels =3D 0; + size_t i; + + virCheckFlags(0, NULL); + + if (vshCommandOptStringReq(ctl, cmd, "virttype", &virttype) < 0 || + vshCommandOptStringReq(ctl, cmd, "emulator", &emulator) < 0 || + vshCommandOptStringReq(ctl, cmd, "arch", &arch) < 0 || + vshCommandOptStringReq(ctl, cmd, "machine", &machine) < 0) + return NULL; + + if (!priv->conn || virConnectIsAlive(priv->conn) <=3D 0) + return NULL; + + if (!(domcaps =3D virConnectGetDomainCapabilities(priv->conn, emulator= , arch, + machine, virttype, 0))) + return NULL; + + if (!(xml =3D virXMLParseStringCtxt(domcaps, _("domain capabilities"),= &ctxt))) + return NULL; + + nmodels =3D virXPathNodeSet("/domainCapabilities/cpu/mode[@name=3D'cus= tom']/model", + ctxt, &nodes); + if (nmodels <=3D 0) + return NULL; + + models =3D g_new0(char *, nmodels + 1); + + for (i =3D 0; i < nmodels; i++) + models[i] =3D virXMLNodeContentString(nodes[i]); + + return g_steal_pointer(&models); +} diff --git a/tools/virsh-completer-host.h b/tools/virsh-completer-host.h index b182661cde..608ae9e3e7 100644 --- a/tools/virsh-completer-host.h +++ b/tools/virsh-completer-host.h @@ -51,3 +51,8 @@ char ** virshArchCompleter(vshControl *ctl, const vshCmd *cmd, unsigned int flags); + +char ** +virshCPUModelCompleter(vshControl *ctl, + const vshCmd *cmd, + unsigned int flags); diff --git a/tools/virsh-host.c b/tools/virsh-host.c index 16c3585a1a..21d479fd01 100644 --- a/tools/virsh-host.c +++ b/tools/virsh-host.c @@ -1719,6 +1719,7 @@ static const vshCmdOptDef opts_hypervisor_cpu_baselin= e[] =3D { }, {.name =3D "model", .type =3D VSH_OT_STRING, + .completer =3D virshCPUModelCompleter, .help =3D N_("Shortcut for calling the command with a single CPU mode= l " "and no additional features") }, --=20 2.38.0 From nobody Mon May 6 09:54:07 2024 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=1665163333; cv=none; d=zohomail.com; s=zohoarc; b=HwS0UIRABivV0tmUhZLXvpzAs9n7vmBmvGJCWcQmU419N+hCsu98pi1OqRHQZgaMcek3j91uS2w6VxTVP3BdsFSfhGdutrfyeowAKFhxlseFCQ5xh3ew2Ccj7TglL3hAEX1Vjazxt21S4RuZEMtkhJAO1kwCNkP3I1h8s+ZhMas= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1665163333; 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=Nh5HB5wFjcRH0oDuQ9paz8iA1J9UgZR1L/xpTNkT1Cs=; b=IjHVdYLpsJyn8BHYmBDs7ptcSgk4uUzjoRKqmgZTrAMTTvTMIv0bHwjW/1xvZYYoReHoGJby8GBNY36LZhU2C98M34NNIGKX66Q+RKKUkucw+/+cIylSeXE5l9vUbSMVt14AosONSMaRUIODD7TzmH+jlm+0EEDVA6xEo4Mm9+8= 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 1665163333640239.37590056298723; Fri, 7 Oct 2022 10:22:13 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-639-SM1z-KE1Ok-8JEop1zsJbw-1; Fri, 07 Oct 2022 13:22:09 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 07B653814965; Fri, 7 Oct 2022 17:22:03 +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 DE1EF112C077; Fri, 7 Oct 2022 17:22:02 +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 2F6071947BA1; Fri, 7 Oct 2022 17:22:00 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 729B91946A6F for ; Fri, 7 Oct 2022 17:21:57 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 5331020290AE; Fri, 7 Oct 2022 17:21:57 +0000 (UTC) Received: from rein.int.mamuti.net (unknown [10.40.194.60]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 2F7A520290AF for ; Fri, 7 Oct 2022 17:21:57 +0000 (UTC) Received: by rein.int.mamuti.net (Postfix, from userid 500) id 3D7C518011C; 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=1665163332; 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=Nh5HB5wFjcRH0oDuQ9paz8iA1J9UgZR1L/xpTNkT1Cs=; b=QVsXm/sfR6tUmcaz19ELm0osf4pMzPVMIYudZm+w5BKYqjgVy2hqfpRg802SH7YvRtlwYb Z1/aAFbdJc21grfmVkybSxnVmc62sJwJQ/9K+YW7CLaHDRGLvcTleqwt8FyjqVS4h12z5k oIx2x6ocVlJTmntEhi3VVhMZ7nyJxug= X-MC-Unique: SM1z-KE1Ok-8JEop1zsJbw-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Jiri Denemark To: libvir-list@redhat.com Subject: [libvirt PATCH v2 14/14] NEWS: Document CPU reporting improvements Date: Fri, 7 Oct 2022 19:21:51 +0200 Message-Id: <061b69607eecf5d2f87e9652137cffddaaed3174.1665162978.git.jdenemar@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.4 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.3 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1665163334756100004 Content-Type: text/plain; charset="utf-8" Signed-off-by: Jiri Denemark Reviewed-by: J=C3=A1n Tomko --- Notes: Version 2: - patch 10/11 from v1 and the corresponding section in NEWS dropped - mention --model for virsh hypervisor-cpu-baseline - mention CPU blockers translation bug - mention docs improvements NEWS.rst | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/NEWS.rst b/NEWS.rst index 3049aa83f9..b6bcb5524d 100644 --- a/NEWS.rst +++ b/NEWS.rst @@ -19,8 +19,30 @@ v8.9.0 (unreleased) =20 * **Improvements** =20 + * Add ``vendor`` attribute for CPU models in domain capabilities + + Users can now see the vendor of each CPU model in domain capabilities = and + use it, e.g., for filtering usable CPU models based on host CPU vendor. + + * virsh: Add ``--model`` option for ``hypervisor-cpu-baseline`` + + This is a shortcut for calling ``hypervisor-cpu-baseline`` with a sing= le + CPU model and no additional features. It can be used for determining w= hich + features block a particular CPU model from being usable. + + * Improved documentation of CPU ``usable`` attribute in domain capabilit= ies + * **Bug fixes** =20 + * qemu: Disable all blocker features in CPU baseline + + Three years ago QEMU renamed some CPU features (mostly those containing + an underscore). When such renamed feature was reported by QEMU as bloc= king + usability of a CPU model, we would fail to explicitly disable it when + creating a baseline CPU definition using this model. This bug did not = have + any functional impact when the default ``check=3D'partial'`` attribute= was + used for guest CPU definition in domain XML, but it could have caused + failures to start a domain with ``check=3D'full'`` in some cases. =20 v8.8.0 (2022-10-03) =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --=20 2.38.0