|
|
c480ed |
From 759fe35a1acdccf68577de62752c087aea4b8268 Mon Sep 17 00:00:00 2001
|
|
|
c480ed |
Message-Id: <759fe35a1acdccf68577de62752c087aea4b8268@dist-git>
|
|
|
c480ed |
From: Jiri Denemark <jdenemar@redhat.com>
|
|
|
c480ed |
Date: Fri, 21 Jun 2019 09:25:37 +0200
|
|
|
c480ed |
Subject: [PATCH] cpu_x86: Make x86cpuidMatch more general
|
|
|
c480ed |
MIME-Version: 1.0
|
|
|
c480ed |
Content-Type: text/plain; charset=UTF-8
|
|
|
c480ed |
Content-Transfer-Encoding: 8bit
|
|
|
c480ed |
|
|
|
c480ed |
The function now works on virCPUx86DataItem and it's called
|
|
|
c480ed |
virCPUx86DataItemMatch.
|
|
|
c480ed |
|
|
|
c480ed |
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
|
|
c480ed |
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
|
|
c480ed |
(cherry picked from commit 10b80165dba31f99306f39e348e3a6335feec5ef)
|
|
|
c480ed |
|
|
|
c480ed |
https://bugzilla.redhat.com/show_bug.cgi?id=1697627
|
|
|
c480ed |
|
|
|
c480ed |
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
|
|
c480ed |
Message-Id: <0b829eb945561e54c1fc4d333c59af53759edf19.1561068591.git.jdenemar@redhat.com>
|
|
|
c480ed |
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
|
|
c480ed |
---
|
|
|
c480ed |
src/cpu/cpu_x86.c | 21 ++++++++++-----------
|
|
|
c480ed |
1 file changed, 10 insertions(+), 11 deletions(-)
|
|
|
c480ed |
|
|
|
c480ed |
diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c
|
|
|
c480ed |
index 1bb35ec4e8..11c023ac31 100644
|
|
|
c480ed |
--- a/src/cpu/cpu_x86.c
|
|
|
c480ed |
+++ b/src/cpu/cpu_x86.c
|
|
|
c480ed |
@@ -41,8 +41,6 @@ VIR_LOG_INIT("cpu.cpu_x86");
|
|
|
c480ed |
|
|
|
c480ed |
#define VENDOR_STRING_LENGTH 12
|
|
|
c480ed |
|
|
|
c480ed |
-static const virCPUx86CPUID cpuidNull = { 0 };
|
|
|
c480ed |
-
|
|
|
c480ed |
static const virArch archs[] = { VIR_ARCH_I686, VIR_ARCH_X86_64 };
|
|
|
c480ed |
|
|
|
c480ed |
typedef struct _virCPUx86Vendor virCPUx86Vendor;
|
|
|
c480ed |
@@ -192,13 +190,13 @@ struct _virCPUx86DataIterator {
|
|
|
c480ed |
|
|
|
c480ed |
|
|
|
c480ed |
static bool
|
|
|
c480ed |
-x86cpuidMatch(const virCPUx86CPUID *cpuid1,
|
|
|
c480ed |
- const virCPUx86CPUID *cpuid2)
|
|
|
c480ed |
+virCPUx86DataItemMatch(const virCPUx86DataItem *item1,
|
|
|
c480ed |
+ const virCPUx86DataItem *item2)
|
|
|
c480ed |
{
|
|
|
c480ed |
- return (cpuid1->eax == cpuid2->eax &&
|
|
|
c480ed |
- cpuid1->ebx == cpuid2->ebx &&
|
|
|
c480ed |
- cpuid1->ecx == cpuid2->ecx &&
|
|
|
c480ed |
- cpuid1->edx == cpuid2->edx);
|
|
|
c480ed |
+ return (item1->cpuid.eax == item2->cpuid.eax &&
|
|
|
c480ed |
+ item1->cpuid.ebx == item2->cpuid.ebx &&
|
|
|
c480ed |
+ item1->cpuid.ecx == item2->cpuid.ecx &&
|
|
|
c480ed |
+ item1->cpuid.edx == item2->cpuid.edx);
|
|
|
c480ed |
}
|
|
|
c480ed |
|
|
|
c480ed |
|
|
|
c480ed |
@@ -317,6 +315,7 @@ static virCPUx86DataItemPtr
|
|
|
c480ed |
virCPUx86DataNext(virCPUx86DataIteratorPtr iterator)
|
|
|
c480ed |
{
|
|
|
c480ed |
const virCPUx86Data *data = iterator->data;
|
|
|
c480ed |
+ virCPUx86DataItem zero = { 0 };
|
|
|
c480ed |
|
|
|
c480ed |
if (!data)
|
|
|
c480ed |
return NULL;
|
|
|
c480ed |
@@ -324,7 +323,7 @@ virCPUx86DataNext(virCPUx86DataIteratorPtr iterator)
|
|
|
c480ed |
while (++iterator->pos < data->len) {
|
|
|
c480ed |
virCPUx86DataItemPtr item = data->items + iterator->pos;
|
|
|
c480ed |
|
|
|
c480ed |
- if (!x86cpuidMatch(&item->cpuid, &cpuidNull))
|
|
|
c480ed |
+ if (!virCPUx86DataItemMatch(item, &zero))
|
|
|
c480ed |
return item;
|
|
|
c480ed |
}
|
|
|
c480ed |
|
|
|
c480ed |
@@ -1155,7 +1154,7 @@ x86ModelCompare(virCPUx86ModelPtr model1,
|
|
|
c480ed |
virCPUx86CompareResult match = SUPERSET;
|
|
|
c480ed |
|
|
|
c480ed |
if ((item2 = virCPUx86DataGet(&model2->data, item1))) {
|
|
|
c480ed |
- if (x86cpuidMatch(&item1->cpuid, &item2->cpuid))
|
|
|
c480ed |
+ if (virCPUx86DataItemMatch(item1, item2))
|
|
|
c480ed |
continue;
|
|
|
c480ed |
else if (!virCPUx86DataItemMatchMasked(item1, item2))
|
|
|
c480ed |
match = SUBSET;
|
|
|
c480ed |
@@ -1171,7 +1170,7 @@ x86ModelCompare(virCPUx86ModelPtr model1,
|
|
|
c480ed |
virCPUx86CompareResult match = SUBSET;
|
|
|
c480ed |
|
|
|
c480ed |
if ((item1 = virCPUx86DataGet(&model1->data, item2))) {
|
|
|
c480ed |
- if (x86cpuidMatch(&item2->cpuid, &item1->cpuid))
|
|
|
c480ed |
+ if (virCPUx86DataItemMatch(item2, item1))
|
|
|
c480ed |
continue;
|
|
|
c480ed |
else if (!virCPUx86DataItemMatchMasked(item2, item1))
|
|
|
c480ed |
match = SUPERSET;
|
|
|
c480ed |
--
|
|
|
c480ed |
2.22.0
|
|
|
c480ed |
|