From nobody Mon Feb 9 06:33:57 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 Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 155177895895433.906628078181484; Tue, 5 Mar 2019 01:42:38 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 488BC3084042; Tue, 5 Mar 2019 09:42:37 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 203E460A9A; Tue, 5 Mar 2019 09:42:37 +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 D9AEA3FA4A; Tue, 5 Mar 2019 09:42:36 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x259erqJ026294 for ; Tue, 5 Mar 2019 04:40:53 -0500 Received: by smtp.corp.redhat.com (Postfix) id 1C4526013C; Tue, 5 Mar 2019 09:40:53 +0000 (UTC) Received: from virval.usersys.redhat.com (unknown [10.43.2.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id E2522600D7 for ; Tue, 5 Mar 2019 09:40:52 +0000 (UTC) Received: by virval.usersys.redhat.com (Postfix, from userid 500) id 3D108106FBA; Tue, 5 Mar 2019 10:40:47 +0100 (CET) From: Jiri Denemark To: libvir-list@redhat.com Date: Tue, 5 Mar 2019 10:40:30 +0100 Message-Id: <484332f6a2038a6452a49917617a88592a2f3f88.1551778706.git.jdenemar@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v2 14/30] cpu_x86: Allow multiple signatures for a CPU model 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.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.40]); Tue, 05 Mar 2019 09:42:37 +0000 (UTC) Content-Type: text/plain; charset="utf-8" CPU signatures in the cpu_map serve as a hint for CPUID to CPU model matching algorithm. If the CPU signatures matches any CPU model in the cpu_map, this model will be the preferred one. This works out well and solved several mismatches, but in real world CPUs which should match a single CPU model may be produced with several different signatures. For example, low voltage Broadwell CPUs for laptops and Broadwell CPUs for servers differ in CPU model numbers while we should detect them all as Broadwell CPU model. This patch adds support for storing several signatures for a single CPU model to make this hint useful for more CPUs. Later commits will provide additional signatures for existing CPU models, which will correct some results in our CPU test suite. Signed-off-by: Jiri Denemark Reviewed-by: J=C3=A1n Tomko --- Notes: Version 2: - split into several smaller patches src/cpu/cpu_x86.c | 31 +++++++++++++++++++++---------- 1 file changed, 21 insertions(+), 10 deletions(-) diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c index 3577f31aa0..08677ef7ff 100644 --- a/src/cpu/cpu_x86.c +++ b/src/cpu/cpu_x86.c @@ -1206,22 +1206,32 @@ x86ModelParseAncestor(virCPUx86ModelPtr model, =20 =20 static int -x86ModelParseSignature(virCPUx86ModelPtr model, - xmlXPathContextPtr ctxt) +x86ModelParseSignatures(virCPUx86ModelPtr model, + xmlXPathContextPtr ctxt) { + VIR_AUTOFREE(xmlNodePtr *) nodes =3D NULL; + xmlNodePtr root =3D ctxt->node; + size_t i; + int n; + + if ((n =3D virXPathNodeSet("./signature", ctxt, &nodes)) <=3D 0) + return n; + /* Remove inherited signatures. */ VIR_FREE(model->signatures); =20 - if (virXPathBoolean("boolean(./signature)", ctxt)) { + model->nsignatures =3D n; + if (VIR_ALLOC_N(model->signatures, n) < 0) + return -1; + + for (i =3D 0; i < n; i++) { unsigned int sigFamily =3D 0; unsigned int sigModel =3D 0; int rc; =20 - model->nsignatures =3D 1; - if (VIR_ALLOC_N(model->signatures, 1) < 0) - return -1; + ctxt->node =3D nodes[i]; =20 - rc =3D virXPathUInt("string(./signature/@family)", ctxt, &sigFamil= y); + rc =3D virXPathUInt("string(@family)", ctxt, &sigFamily); if (rc < 0 || sigFamily =3D=3D 0) { virReportError(VIR_ERR_INTERNAL_ERROR, _("Invalid CPU signature family in model %s"), @@ -1229,7 +1239,7 @@ x86ModelParseSignature(virCPUx86ModelPtr model, return -1; } =20 - rc =3D virXPathUInt("string(./signature/@model)", ctxt, &sigModel); + rc =3D virXPathUInt("string(@model)", ctxt, &sigModel); if (rc < 0 || sigModel =3D=3D 0) { virReportError(VIR_ERR_INTERNAL_ERROR, _("Invalid CPU signature model in model %s"), @@ -1237,9 +1247,10 @@ x86ModelParseSignature(virCPUx86ModelPtr model, return -1; } =20 - model->signatures[0] =3D x86MakeSignature(sigFamily, sigModel, 0); + model->signatures[i] =3D x86MakeSignature(sigFamily, sigModel, 0); } =20 + ctxt->node =3D root; return 0; } =20 @@ -1336,7 +1347,7 @@ x86ModelParse(xmlXPathContextPtr ctxt, if (x86ModelParseAncestor(model, ctxt, map) < 0) goto cleanup; =20 - if (x86ModelParseSignature(model, ctxt) < 0) + if (x86ModelParseSignatures(model, ctxt) < 0) goto cleanup; =20 if (x86ModelParseVendor(model, ctxt, map) < 0) --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list