From nobody Sun Feb 8 14:59:27 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.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 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=1560937327; cv=none; d=zoho.com; s=zohoarc; b=BfOxEkQfc4pwYs+XD8elDgxJyApXIm6JQJm+87MRQHIoQDefSONN4s8M1GvoAATogirQWDOP1j9FWH0uPsFDVv1sGuIy4AmGxaj972A+Vsz0KEbaPKm4XK6G6gJzBUCT+Kj0dqrwZ9RxNc750broaakNirCAN4nrSuHw+BOB51c= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1560937327; 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:ARC-Authentication-Results; bh=8ywZ9yU9+KSXUGDT+PdZZnvIXfcoSiWrqaNMea83y44=; b=Z/0O+976dMHrwpYDE9oPvc6bQqah2NdJLI/NorV5HIN+6QQzhcW+A5JJNa/blTrCrSunoUiK7kQoxUrqK8WsurAyNnTTY8LsFPrLe6e/NDRA+/oFBqCmB/0tLDChlI0QR/mikYKq1MFqEYIAzsMRaIh4YSs6vD6M3k7/2iVF6wY= ARC-Authentication-Results: i=1; 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; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1560937327825197.5772076241209; Wed, 19 Jun 2019 02:42:07 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 36D6830872CF; Wed, 19 Jun 2019 09:42:06 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 0A49F60FDE; Wed, 19 Jun 2019 09:42:06 +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 B3D581806B1C; Wed, 19 Jun 2019 09:42:05 +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 x5J9cVtY024378 for ; Wed, 19 Jun 2019 05:38:31 -0400 Received: by smtp.corp.redhat.com (Postfix) id 70D435C207; Wed, 19 Jun 2019 09:38:31 +0000 (UTC) Received: from orkuz.int.mamuti.net (ovpn-204-21.brq.redhat.com [10.40.204.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 1BD765C221 for ; Wed, 19 Jun 2019 09:38:31 +0000 (UTC) Received: by orkuz.int.mamuti.net (Postfix, from userid 500) id ACCA92A4120; Wed, 19 Jun 2019 11:38:23 +0200 (CEST) From: Jiri Denemark To: libvir-list@redhat.com Date: Wed, 19 Jun 2019 11:38:13 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 16/24] qemu: Translate feature names from query-cpu-model-expansion 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: , 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.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.47]); Wed, 19 Jun 2019 09:42:06 +0000 (UTC) Content-Type: text/plain; charset="utf-8" By default query-cpu-model-expansion only reports canonical names of all CPU features. We do some magic and call the command twice to get all possible spellings of the features, but being able to consume canonical names will allow us to drop this magic. Signed-off-by: Jiri Denemark --- src/qemu/qemu_capabilities.c | 19 +++++++++++-------- src/qemu/qemu_capspriv.h | 3 ++- tests/cputest.c | 2 +- 3 files changed, 14 insertions(+), 10 deletions(-) diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index c742838383..ada2bae18f 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -2961,11 +2961,12 @@ virQEMUCapsInitCPUModelS390(virQEMUCapsPtr qemuCaps, for (i =3D 0; i < modelInfo->nprops; i++) { virCPUFeatureDefPtr feature =3D cpu->features + cpu->nfeatures; qemuMonitorCPUPropertyPtr prop =3D modelInfo->props + i; + const char *name =3D virQEMUCapsCPUFeatureFromQEMU(qemuCaps, prop-= >name); =20 if (prop->type !=3D QEMU_MONITOR_CPU_PROPERTY_BOOLEAN) continue; =20 - if (VIR_STRDUP(feature->name, prop->name) < 0) + if (VIR_STRDUP(feature->name, name) < 0) return -1; =20 if (!prop->value.boolean || @@ -2981,7 +2982,8 @@ virQEMUCapsInitCPUModelS390(virQEMUCapsPtr qemuCaps, =20 =20 virCPUDataPtr -virQEMUCapsGetCPUModelX86Data(qemuMonitorCPUModelInfoPtr model, +virQEMUCapsGetCPUModelX86Data(virQEMUCapsPtr qemuCaps, + qemuMonitorCPUModelInfoPtr model, bool migratable) { unsigned long long sigFamily =3D 0; @@ -2996,6 +2998,7 @@ virQEMUCapsGetCPUModelX86Data(qemuMonitorCPUModelInfo= Ptr model, =20 for (i =3D 0; i < model->nprops; i++) { qemuMonitorCPUPropertyPtr prop =3D model->props + i; + const char *name =3D virQEMUCapsCPUFeatureFromQEMU(qemuCaps, prop-= >name); =20 switch (prop->type) { case QEMU_MONITOR_CPU_PROPERTY_BOOLEAN: @@ -3003,23 +3006,23 @@ virQEMUCapsGetCPUModelX86Data(qemuMonitorCPUModelIn= foPtr model, (migratable && prop->migratable =3D=3D VIR_TRISTATE_BOOL_N= O)) continue; =20 - if (virCPUx86DataAddFeature(data, prop->name) < 0) + if (virCPUx86DataAddFeature(data, name) < 0) goto cleanup; =20 break; =20 case QEMU_MONITOR_CPU_PROPERTY_STRING: - if (STREQ(prop->name, "vendor") && + if (STREQ(name, "vendor") && virCPUx86DataSetVendor(data, prop->value.string) < 0) goto cleanup; break; =20 case QEMU_MONITOR_CPU_PROPERTY_NUMBER: - if (STREQ(prop->name, "family")) + if (STREQ(name, "family")) sigFamily =3D prop->value.number; - else if (STREQ(prop->name, "model")) + else if (STREQ(name, "model")) sigModel =3D prop->value.number; - else if (STREQ(prop->name, "stepping")) + else if (STREQ(name, "stepping")) sigStepping =3D prop->value.number; break; =20 @@ -3057,7 +3060,7 @@ virQEMUCapsInitCPUModelX86(virQEMUCapsPtr qemuCaps, if (!model) return 1; =20 - if (!(data =3D virQEMUCapsGetCPUModelX86Data(model, migratable))) + if (!(data =3D virQEMUCapsGetCPUModelX86Data(qemuCaps, model, migratab= le))) goto cleanup; =20 if (cpuDecode(cpu, data, virQEMUCapsGetCPUDefinitions(qemuCaps, type))= < 0) diff --git a/src/qemu/qemu_capspriv.h b/src/qemu/qemu_capspriv.h index 3c129cbf6c..255722d8d1 100644 --- a/src/qemu/qemu_capspriv.h +++ b/src/qemu/qemu_capspriv.h @@ -78,7 +78,8 @@ virQEMUCapsSetCPUModelInfo(virQEMUCapsPtr qemuCaps, qemuMonitorCPUModelInfoPtr modelInfo); =20 virCPUDataPtr -virQEMUCapsGetCPUModelX86Data(qemuMonitorCPUModelInfoPtr model, +virQEMUCapsGetCPUModelX86Data(virQEMUCapsPtr qemuCaps, + qemuMonitorCPUModelInfoPtr model, bool migratable); =20 virCPUDefPtr diff --git a/tests/cputest.c b/tests/cputest.c index e176739965..6e28e05756 100644 --- a/tests/cputest.c +++ b/tests/cputest.c @@ -935,7 +935,7 @@ cpuTestJSONSignature(const void *arg) goto cleanup; =20 modelInfo =3D virQEMUCapsGetCPUModelInfo(qemuCaps, VIR_DOMAIN_VIRT_KVM= ); - if (!(hostData =3D virQEMUCapsGetCPUModelX86Data(modelInfo, false))) + if (!(hostData =3D virQEMUCapsGetCPUModelX86Data(qemuCaps, modelInfo, = false))) goto cleanup; =20 ret =3D cpuTestCompareSignature(data, hostData); --=20 2.22.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list