forked from rpms/libvirt
89 lines
3.5 KiB
Diff
89 lines
3.5 KiB
Diff
From 920ac610bc68ffd7de1ac14c401c7f8c37f3337e Mon Sep 17 00:00:00 2001
|
|
Message-Id: <920ac610bc68ffd7de1ac14c401c7f8c37f3337e@dist-git>
|
|
From: Jiri Denemark <jdenemar@redhat.com>
|
|
Date: Fri, 21 Jun 2019 09:25:36 +0200
|
|
Subject: [PATCH] cpu_x86: Make x86cpuidMatchMasked more general
|
|
MIME-Version: 1.0
|
|
Content-Type: text/plain; charset=UTF-8
|
|
Content-Transfer-Encoding: 8bit
|
|
|
|
The function is renamed as virCPUx86DataItemMatchMasked to reflect the
|
|
change in parameter types.
|
|
|
|
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
|
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
|
(cherry picked from commit 2eea67a98eab58b46dbf4275819c06c90bc4c5b6)
|
|
|
|
https://bugzilla.redhat.com/show_bug.cgi?id=1697627
|
|
|
|
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
|
Message-Id: <7c0a54c618d67d64663eb92d5eeb1d8a2270be16.1561068591.git.jdenemar@redhat.com>
|
|
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
|
---
|
|
src/cpu/cpu_x86.c | 20 ++++++++++----------
|
|
1 file changed, 10 insertions(+), 10 deletions(-)
|
|
|
|
diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c
|
|
index 54da9a985c..1bb35ec4e8 100644
|
|
--- a/src/cpu/cpu_x86.c
|
|
+++ b/src/cpu/cpu_x86.c
|
|
@@ -203,13 +203,13 @@ x86cpuidMatch(const virCPUx86CPUID *cpuid1,
|
|
|
|
|
|
static bool
|
|
-x86cpuidMatchMasked(const virCPUx86CPUID *cpuid,
|
|
- const virCPUx86CPUID *mask)
|
|
+virCPUx86DataItemMatchMasked(const virCPUx86DataItem *item,
|
|
+ const virCPUx86DataItem *mask)
|
|
{
|
|
- return ((cpuid->eax & mask->eax) == mask->eax &&
|
|
- (cpuid->ebx & mask->ebx) == mask->ebx &&
|
|
- (cpuid->ecx & mask->ecx) == mask->ecx &&
|
|
- (cpuid->edx & mask->edx) == mask->edx);
|
|
+ return ((item->cpuid.eax & mask->cpuid.eax) == mask->cpuid.eax &&
|
|
+ (item->cpuid.ebx & mask->cpuid.ebx) == mask->cpuid.ebx &&
|
|
+ (item->cpuid.ecx & mask->cpuid.ecx) == mask->cpuid.ecx &&
|
|
+ (item->cpuid.edx & mask->cpuid.edx) == mask->cpuid.edx);
|
|
}
|
|
|
|
|
|
@@ -474,7 +474,7 @@ x86DataIsSubset(const virCPUx86Data *data,
|
|
|
|
while ((itemSubset = virCPUx86DataNext(&iter))) {
|
|
if (!(item = virCPUx86DataGet(data, itemSubset)) ||
|
|
- !x86cpuidMatchMasked(&item->cpuid, &itemSubset->cpuid))
|
|
+ !virCPUx86DataItemMatchMasked(item, itemSubset))
|
|
return false;
|
|
}
|
|
|
|
@@ -515,7 +515,7 @@ x86DataToVendor(const virCPUx86Data *data,
|
|
for (i = 0; i < map->nvendors; i++) {
|
|
virCPUx86VendorPtr vendor = map->vendors[i];
|
|
if ((item = virCPUx86DataGet(data, &vendor->data)) &&
|
|
- x86cpuidMatchMasked(&item->cpuid, &vendor->data.cpuid)) {
|
|
+ virCPUx86DataItemMatchMasked(item, &vendor->data)) {
|
|
virCPUx86DataItemClearBits(item, &vendor->data);
|
|
return vendor;
|
|
}
|
|
@@ -1157,7 +1157,7 @@ x86ModelCompare(virCPUx86ModelPtr model1,
|
|
if ((item2 = virCPUx86DataGet(&model2->data, item1))) {
|
|
if (x86cpuidMatch(&item1->cpuid, &item2->cpuid))
|
|
continue;
|
|
- else if (!x86cpuidMatchMasked(&item1->cpuid, &item2->cpuid))
|
|
+ else if (!virCPUx86DataItemMatchMasked(item1, item2))
|
|
match = SUBSET;
|
|
}
|
|
|
|
@@ -1173,7 +1173,7 @@ x86ModelCompare(virCPUx86ModelPtr model1,
|
|
if ((item1 = virCPUx86DataGet(&model1->data, item2))) {
|
|
if (x86cpuidMatch(&item2->cpuid, &item1->cpuid))
|
|
continue;
|
|
- else if (!x86cpuidMatchMasked(&item2->cpuid, &item1->cpuid))
|
|
+ else if (!virCPUx86DataItemMatchMasked(item2, item1))
|
|
match = SUPERSET;
|
|
}
|
|
|
|
--
|
|
2.22.0
|
|
|