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