99cbc7
From fe175a3b2ab1176f26116e909a5014611c52339b Mon Sep 17 00:00:00 2001
99cbc7
Message-Id: <fe175a3b2ab1176f26116e909a5014611c52339b@dist-git>
99cbc7
From: Jiri Denemark <jdenemar@redhat.com>
99cbc7
Date: Tue, 4 Jun 2019 13:04:31 +0200
99cbc7
Subject: [PATCH] cpu_x86: Fix placement of *CheckFeature functions
99cbc7
MIME-Version: 1.0
99cbc7
Content-Type: text/plain; charset=UTF-8
99cbc7
Content-Transfer-Encoding: 8bit
99cbc7
99cbc7
Commit 0a97486e09 moved them outside #ifdef, but after virCPUx86GetHost,
99cbc7
which will start calling them in the following patch.
99cbc7
99cbc7
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
99cbc7
(cherry picked from commit 32f577ab10aefda6c4666abd07814c5c39f57788)
99cbc7
99cbc7
https://bugzilla.redhat.com/show_bug.cgi?id=1641702
99cbc7
99cbc7
Conflicts:
99cbc7
	src/cpu/cpu_x86.c
99cbc7
            - only the last commit (from three upstream commits) moving
99cbc7
              these functions was backported
99cbc7
99cbc7
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
99cbc7
Message-Id: <60813074ba13f616ac2be224f4f800c98b169ec2.1559646067.git.jdenemar@redhat.com>
99cbc7
Reviewed-by: Ján Tomko <jtomko@redhat.com>
99cbc7
---
99cbc7
 src/cpu/cpu_x86.c | 69 ++++++++++++++++++++++++-----------------------
99cbc7
 1 file changed, 35 insertions(+), 34 deletions(-)
99cbc7
99cbc7
diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c
99cbc7
index 1acd8c4f49..bd10862f57 100644
99cbc7
--- a/src/cpu/cpu_x86.c
99cbc7
+++ b/src/cpu/cpu_x86.c
99cbc7
@@ -2212,6 +2212,41 @@ x86Encode(virArch arch,
99cbc7
 }
99cbc7
 
99cbc7
 
99cbc7
+static int
99cbc7
+virCPUx86CheckFeature(const virCPUDef *cpu,
99cbc7
+                      const char *name)
99cbc7
+{
99cbc7
+    int ret = -1;
99cbc7
+    virCPUx86MapPtr map;
99cbc7
+    virCPUx86ModelPtr model = NULL;
99cbc7
+
99cbc7
+    if (!(map = virCPUx86GetMap()))
99cbc7
+        return -1;
99cbc7
+
99cbc7
+    if (!(model = x86ModelFromCPU(cpu, map, -1)))
99cbc7
+        goto cleanup;
99cbc7
+
99cbc7
+    ret = x86FeatureInData(name, &model->data, map);
99cbc7
+
99cbc7
+ cleanup:
99cbc7
+    x86ModelFree(model);
99cbc7
+    return ret;
99cbc7
+}
99cbc7
+
99cbc7
+
99cbc7
+static int
99cbc7
+virCPUx86DataCheckFeature(const virCPUData *data,
99cbc7
+                          const char *name)
99cbc7
+{
99cbc7
+    virCPUx86MapPtr map;
99cbc7
+
99cbc7
+    if (!(map = virCPUx86GetMap()))
99cbc7
+        return -1;
99cbc7
+
99cbc7
+    return x86FeatureInData(name, &data->data.x86, map);
99cbc7
+}
99cbc7
+
99cbc7
+
99cbc7
 #if defined(__i386__) || defined(__x86_64__)
99cbc7
 static inline void
99cbc7
 cpuidCall(virCPUx86CPUID *cpuid)
99cbc7
@@ -2888,40 +2923,6 @@ virCPUx86UpdateLive(virCPUDefPtr cpu,
99cbc7
 }
99cbc7
 
99cbc7
 
99cbc7
-static int
99cbc7
-virCPUx86CheckFeature(const virCPUDef *cpu,
99cbc7
-                      const char *name)
99cbc7
-{
99cbc7
-    int ret = -1;
99cbc7
-    virCPUx86MapPtr map;
99cbc7
-    virCPUx86ModelPtr model = NULL;
99cbc7
-
99cbc7
-    if (!(map = virCPUx86GetMap()))
99cbc7
-        return -1;
99cbc7
-
99cbc7
-    if (!(model = x86ModelFromCPU(cpu, map, -1)))
99cbc7
-        goto cleanup;
99cbc7
-
99cbc7
-    ret = x86FeatureInData(name, &model->data, map);
99cbc7
-
99cbc7
- cleanup:
99cbc7
-    x86ModelFree(model);
99cbc7
-    return ret;
99cbc7
-}
99cbc7
-
99cbc7
-
99cbc7
-static int
99cbc7
-virCPUx86DataCheckFeature(const virCPUData *data,
99cbc7
-                          const char *name)
99cbc7
-{
99cbc7
-    virCPUx86MapPtr map;
99cbc7
-
99cbc7
-    if (!(map = virCPUx86GetMap()))
99cbc7
-        return -1;
99cbc7
-
99cbc7
-    return x86FeatureInData(name, &data->data.x86, map);
99cbc7
-}
99cbc7
-
99cbc7
 static int
99cbc7
 virCPUx86GetModels(char ***models)
99cbc7
 {
99cbc7
-- 
99cbc7
2.21.0
99cbc7