From nobody Mon Feb 9 01:47:42 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1489768647224951.4049352858024; Fri, 17 Mar 2017 09:37:27 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 53B187971D; Fri, 17 Mar 2017 16:37:25 +0000 (UTC) Received: from colo-mx.corp.redhat.com (unknown [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id C7D4317DF1; Fri, 17 Mar 2017 16:37:24 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 4C8765EC6A; Fri, 17 Mar 2017 16:37:21 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v2HGb2WQ007166 for ; Fri, 17 Mar 2017 12:37:02 -0400 Received: by smtp.corp.redhat.com (Postfix) id D74AB1711E; Fri, 17 Mar 2017 16:37:02 +0000 (UTC) Received: from mamuti.net (ovpn-204-109.brq.redhat.com [10.40.204.109]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 7B64B1713F for ; Fri, 17 Mar 2017 16:37:00 +0000 (UTC) Received: by mamuti.net (Postfix, from userid 500) id 2E4771061C7; Fri, 17 Mar 2017 17:36:55 +0100 (CET) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 53B187971D Authentication-Results: ext-mx01.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx01.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=libvir-list-bounces@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 53B187971D From: Jiri Denemark To: libvir-list@redhat.com Date: Fri, 17 Mar 2017 17:36:43 +0100 Message-Id: <8525e6d837f091b28b58985d58d42bd3fa1e0024.1489768416.git.jdenemar@redhat.com> In-Reply-To: References: In-Reply-To: References: Mail-Followup-To: libvir-list@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 05/14] cpu: Do not pass virConnectBaselineCPUFlags to cpuBaseline X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Fri, 17 Mar 2017 16:37:27 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" The public API flags are handled by the cpuBaselineXML wrapper. The internal cpuBaseline API only needs to know whether it is supposed to drop non-migratable features. Signed-off-by: Jiri Denemark --- src/cpu/cpu.c | 14 +++++--------- src/cpu/cpu.h | 4 ++-- src/cpu/cpu_arm.c | 5 +---- src/cpu/cpu_ppc64.c | 5 +---- src/cpu/cpu_x86.c | 18 ++++++------------ tests/cputest.c | 3 ++- 6 files changed, 17 insertions(+), 32 deletions(-) diff --git a/src/cpu/cpu.c b/src/cpu/cpu.c index d53a7ef2c..8e07e0ce4 100644 --- a/src/cpu/cpu.c +++ b/src/cpu/cpu.c @@ -539,7 +539,8 @@ cpuBaselineXML(const char **xmlCPUs, doc =3D NULL; } =20 - if (!(cpu =3D cpuBaseline(cpus, ncpus, models, nmodels, flags))) + if (!(cpu =3D cpuBaseline(cpus, ncpus, models, nmodels, + !!(flags & VIR_CONNECT_BASELINE_CPU_MIGRATABLE= )))) goto error; =20 if ((flags & VIR_CONNECT_BASELINE_CPU_EXPAND_FEATURES) && @@ -573,18 +574,13 @@ cpuBaselineXML(const char **xmlCPUs, * @ncpus: number of CPUs in @cpus * @models: list of CPU models that can be considered for the baseline CPU * @nmodels: number of CPU models in @models - * @flags: bitwise-OR of virConnectBaselineCPUFlags + * @migratable: requests non-migratable features to be removed from the re= sult * * Computes the most feature-rich CPU which is compatible with all given * host CPUs. If @models array is NULL, all models supported by libvirt wi= ll * be considered when computing the baseline CPU model, otherwise the base= line * CPU model will be one of the provided CPU @models. * - * If @flags includes VIR_CONNECT_BASELINE_CPU_EXPAND_FEATURES then libvirt - * will explicitly list all CPU features that are part of the host CPU, - * without this flag features that are part of the CPU model will not be - * listed. - * * Returns baseline CPU definition or NULL on error. */ virCPUDefPtr @@ -592,7 +588,7 @@ cpuBaseline(virCPUDefPtr *cpus, unsigned int ncpus, const char **models, unsigned int nmodels, - unsigned int flags) + bool migratable) { struct cpuArchDriver *driver; size_t i; @@ -647,7 +643,7 @@ cpuBaseline(virCPUDefPtr *cpus, return NULL; } =20 - return driver->baseline(cpus, ncpus, models, nmodels, flags); + return driver->baseline(cpus, ncpus, models, nmodels, migratable); } =20 =20 diff --git a/src/cpu/cpu.h b/src/cpu/cpu.h index 92b0f788e..096eabe4c 100644 --- a/src/cpu/cpu.h +++ b/src/cpu/cpu.h @@ -79,7 +79,7 @@ typedef virCPUDefPtr unsigned int ncpus, const char **models, unsigned int nmodels, - unsigned int flags); + bool migratable); =20 typedef int (*virCPUArchUpdate)(virCPUDefPtr guest, @@ -198,7 +198,7 @@ cpuBaseline (virCPUDefPtr *cpus, unsigned int ncpus, const char **models, unsigned int nmodels, - unsigned int flags) + bool migratable) ATTRIBUTE_NONNULL(1); =20 int diff --git a/src/cpu/cpu_arm.c b/src/cpu/cpu_arm.c index a1aba2554..474777656 100644 --- a/src/cpu/cpu_arm.c +++ b/src/cpu/cpu_arm.c @@ -77,13 +77,10 @@ armBaseline(virCPUDefPtr *cpus, unsigned int ncpus ATTRIBUTE_UNUSED, const char **models ATTRIBUTE_UNUSED, unsigned int nmodels ATTRIBUTE_UNUSED, - unsigned int flags) + bool migratable ATTRIBUTE_UNUSED) { virCPUDefPtr cpu =3D NULL; =20 - virCheckFlags(VIR_CONNECT_BASELINE_CPU_EXPAND_FEATURES | - VIR_CONNECT_BASELINE_CPU_MIGRATABLE, NULL); - if (VIR_ALLOC(cpu) < 0 || VIR_STRDUP(cpu->model, cpus[0]->model) < 0) { virCPUDefFree(cpu); diff --git a/src/cpu/cpu_ppc64.c b/src/cpu/cpu_ppc64.c index 0ad8d17d4..f64592b55 100644 --- a/src/cpu/cpu_ppc64.c +++ b/src/cpu/cpu_ppc64.c @@ -768,7 +768,7 @@ ppc64DriverBaseline(virCPUDefPtr *cpus, unsigned int ncpus, const char **models ATTRIBUTE_UNUSED, unsigned int nmodels ATTRIBUTE_UNUSED, - unsigned int flags) + bool migratable ATTRIBUTE_UNUSED) { struct ppc64_map *map; const struct ppc64_model *model; @@ -776,9 +776,6 @@ ppc64DriverBaseline(virCPUDefPtr *cpus, virCPUDefPtr cpu =3D NULL; size_t i; =20 - virCheckFlags(VIR_CONNECT_BASELINE_CPU_EXPAND_FEATURES | - VIR_CONNECT_BASELINE_CPU_MIGRATABLE, NULL); - if (!(map =3D ppc64LoadMap())) goto error; =20 diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c index 388102f35..48648a7f4 100644 --- a/src/cpu/cpu_x86.c +++ b/src/cpu/cpu_x86.c @@ -1823,7 +1823,7 @@ x86Decode(virCPUDefPtr cpu, const char **models, unsigned int nmodels, const char *preferred, - unsigned int flags) + bool migratable) { int ret =3D -1; virCPUx86MapPtr map; @@ -1839,9 +1839,6 @@ x86Decode(virCPUDefPtr cpu, ssize_t i; int rc; =20 - virCheckFlags(VIR_CONNECT_BASELINE_CPU_EXPAND_FEATURES | - VIR_CONNECT_BASELINE_CPU_MIGRATABLE, -1); - if (!cpuData || x86DataCopy(&data, cpuData) < 0) return -1; =20 @@ -1913,7 +1910,7 @@ x86Decode(virCPUDefPtr cpu, /* Remove non-migratable features if requested * Note: this only works as long as no CPU model contains non-migratab= le * features directly */ - if (flags & VIR_CONNECT_BASELINE_CPU_MIGRATABLE) { + if (migratable) { i =3D 0; while (i < cpuModel->nfeatures) { if (x86FeatureIsMigratable(cpuModel->features[i].name, map)) { @@ -1953,7 +1950,7 @@ x86DecodeCPUData(virCPUDefPtr cpu, unsigned int nmodels, const char *preferred) { - return x86Decode(cpu, &data->data.x86, models, nmodels, preferred, 0); + return x86Decode(cpu, &data->data.x86, models, nmodels, preferred, fal= se); } =20 =20 @@ -2432,7 +2429,7 @@ x86Baseline(virCPUDefPtr *cpus, unsigned int ncpus, const char **models, unsigned int nmodels, - unsigned int flags) + bool migratable) { virCPUx86MapPtr map =3D NULL; virCPUx86ModelPtr base_model =3D NULL; @@ -2444,9 +2441,6 @@ x86Baseline(virCPUDefPtr *cpus, const char *modelName; bool matchingNames =3D true; =20 - virCheckFlags(VIR_CONNECT_BASELINE_CPU_EXPAND_FEATURES | - VIR_CONNECT_BASELINE_CPU_MIGRATABLE, NULL); - if (!(map =3D virCPUx86GetMap())) goto error; =20 @@ -2529,7 +2523,7 @@ x86Baseline(virCPUDefPtr *cpus, virCPUx86DataAddCPUIDInt(&base_model->data, &vendor->cpuid) < 0) goto error; =20 - if (x86Decode(cpu, &base_model->data, models, nmodels, modelName, flag= s) < 0) + if (x86Decode(cpu, &base_model->data, models, nmodels, modelName, migr= atable) < 0) goto error; =20 if (STREQ_NULLABLE(cpu->model, modelName)) @@ -2838,7 +2832,7 @@ virCPUx86Translate(virCPUDefPtr cpu, if (!(translated =3D virCPUDefCopyWithoutModel(cpu))) goto cleanup; =20 - if (x86Decode(translated, &model->data, models, nmodels, NULL, 0) < 0) + if (x86Decode(translated, &model->data, models, nmodels, NULL, false) = < 0) goto cleanup; =20 for (i =3D 0; i < cpu->nfeatures; i++) { diff --git a/tests/cputest.c b/tests/cputest.c index 6396e8670..4a4d427e1 100644 --- a/tests/cputest.c +++ b/tests/cputest.c @@ -324,7 +324,8 @@ cpuTestBaseline(const void *arg) if (!(cpus =3D cpuTestLoadMultiXML(data->arch, data->name, &ncpus))) goto cleanup; =20 - baseline =3D cpuBaseline(cpus, ncpus, NULL, 0, data->flags); + baseline =3D cpuBaseline(cpus, ncpus, NULL, 0, + !!(data->flags & VIR_CONNECT_BASELINE_CPU_MIGRA= TABLE)); =20 if (baseline && (data->flags & VIR_CONNECT_BASELINE_CPU_EXPAND_FEATURES) && --=20 2.12.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list