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