From nobody Sun Feb 8 14:21:58 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 1554713010440283.4828600681758; Mon, 8 Apr 2019 01:43:30 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id C81F33087BD6; Mon, 8 Apr 2019 08:43:28 +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 9CFE4600D4; Mon, 8 Apr 2019 08:43:28 +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 54450181BA0A; Mon, 8 Apr 2019 08:43:28 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x388gwLC009163 for ; Mon, 8 Apr 2019 04:42:58 -0400 Received: by smtp.corp.redhat.com (Postfix) id D58C4109B79D; Mon, 8 Apr 2019 08:42:58 +0000 (UTC) Received: from virval.usersys.redhat.com (unknown [10.43.2.188]) by smtp.corp.redhat.com (Postfix) with ESMTPS id AA95A1092002 for ; Mon, 8 Apr 2019 08:42:58 +0000 (UTC) Received: by virval.usersys.redhat.com (Postfix, from userid 500) id 057D810366D; Mon, 8 Apr 2019 10:42:51 +0200 (CEST) From: Jiri Denemark To: libvir-list@redhat.com Date: Mon, 8 Apr 2019 10:42:25 +0200 Message-Id: <048d1abf04f5ce18f01467cfdddd399b74cec839.1554711784.git.jdenemar@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 21/36] cpu_x86: Make x86cpuidMatch more general 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.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.45]); Mon, 08 Apr 2019 08:43:29 +0000 (UTC) Content-Type: text/plain; charset="utf-8" The function now works on virtCPUx86DataItem and it's called virCPUx86DataItemMatch. Signed-off-by: Jiri Denemark Reviewed-by: J=C3=A1n Tomko --- src/cpu/cpu_x86.c | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c index b88cd83aed..62a7914160 100644 --- a/src/cpu/cpu_x86.c +++ b/src/cpu/cpu_x86.c @@ -37,8 +37,6 @@ VIR_LOG_INIT("cpu.cpu_x86"); =20 #define VENDOR_STRING_LENGTH 12 =20 -static const virCPUx86CPUID cpuidNull =3D { 0 }; - static const virArch archs[] =3D { VIR_ARCH_I686, VIR_ARCH_X86_64 }; =20 typedef struct _virCPUx86Vendor virCPUx86Vendor; @@ -194,13 +192,13 @@ struct _virCPUx86DataIterator { =20 =20 static bool -x86cpuidMatch(const virCPUx86CPUID *cpuid1, - const virCPUx86CPUID *cpuid2) +virCPUx86DataItemMatch(const virCPUx86DataItem *item1, + const virCPUx86DataItem *item2) { - return (cpuid1->eax =3D=3D cpuid2->eax && - cpuid1->ebx =3D=3D cpuid2->ebx && - cpuid1->ecx =3D=3D cpuid2->ecx && - cpuid1->edx =3D=3D cpuid2->edx); + return (item1->cpuid.eax =3D=3D item2->cpuid.eax && + item1->cpuid.ebx =3D=3D item2->cpuid.ebx && + item1->cpuid.ecx =3D=3D item2->cpuid.ecx && + item1->cpuid.edx =3D=3D item2->cpuid.edx); } =20 =20 @@ -319,6 +317,7 @@ static virCPUx86DataItemPtr virCPUx86DataNext(virCPUx86DataIteratorPtr iterator) { const virCPUx86Data *data =3D iterator->data; + virCPUx86DataItem zero =3D { 0 }; =20 if (!data) return NULL; @@ -326,7 +325,7 @@ virCPUx86DataNext(virCPUx86DataIteratorPtr iterator) while (++iterator->pos < data->len) { virCPUx86DataItemPtr item =3D data->items + iterator->pos; =20 - if (!x86cpuidMatch(&item->cpuid, &cpuidNull)) + if (!virCPUx86DataItemMatch(item, &zero)) return item; } =20 @@ -1156,7 +1155,7 @@ x86ModelCompare(virCPUx86ModelPtr model1, virCPUx86CompareResult match =3D SUPERSET; =20 if ((item2 =3D virCPUx86DataGet(&model2->data, item1))) { - if (x86cpuidMatch(&item1->cpuid, &item2->cpuid)) + if (virCPUx86DataItemMatch(item1, item2)) continue; else if (!virCPUx86DataItemMatchMasked(item1, item2)) match =3D SUBSET; @@ -1172,7 +1171,7 @@ x86ModelCompare(virCPUx86ModelPtr model1, virCPUx86CompareResult match =3D SUBSET; =20 if ((item1 =3D virCPUx86DataGet(&model1->data, item2))) { - if (x86cpuidMatch(&item2->cpuid, &item1->cpuid)) + if (virCPUx86DataItemMatch(item2, item1)) continue; else if (!virCPUx86DataItemMatchMasked(item2, item1)) match =3D SUPERSET; --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list