7a3408
From f9bb279a947c2b296a05bfe77881a8dda3b01e31 Mon Sep 17 00:00:00 2001
7a3408
Message-Id: <f9bb279a947c2b296a05bfe77881a8dda3b01e31@dist-git>
7a3408
From: Andrea Bolognani <abologna@redhat.com>
7a3408
Date: Tue, 11 Aug 2015 17:16:01 +0200
7a3408
Subject: [PATCH] cpu: CPU model names have to match on ppc64
7a3408
7a3408
Limitations of the POWER architecture mean that you can't run
7a3408
eg. a POWER7 guest on a POWER8 host when using KVM. This applies
7a3408
to all guests, not just those using VIR_CPU_MATCH_STRICT in the
7a3408
CPU definition; in fact, exact and strict CPU matching are
7a3408
basically the same on ppc64.
7a3408
7a3408
This means, of course, that hosts using different CPUs have to be
7a3408
considered incompatible as well.
7a3408
7a3408
Change ppc64Compute(), called by cpuGuestData(), to reflect this
7a3408
fact and update test cases accordingly.
7a3408
7a3408
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1250977
7a3408
(cherry picked from commit 96b2c7459cb689a27996c2d69131e245940bc533)
7a3408
7a3408
Bug: https://bugzilla.redhat.com/show_bug.cgi?id=1250977
7a3408
7a3408
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
7a3408
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
7a3408
---
7a3408
 src/cpu/cpu_ppc64.c                                                  | 5 +----
7a3408
 tests/cputest.c                                                      | 4 ++--
7a3408
 tests/cputestdata/ppc64-guest.xml                                    | 2 +-
7a3408
 tests/cputestdata/ppc64-host+guest,ppc_models-result.xml             | 2 +-
7a3408
 .../ppc64-host+guest-nofallback,ppc_models,POWER7_v2.1-result.xml    | 5 -----
7a3408
 5 files changed, 5 insertions(+), 13 deletions(-)
7a3408
 delete mode 100644 tests/cputestdata/ppc64-host+guest-nofallback,ppc_models,POWER7_v2.1-result.xml
7a3408
7a3408
diff --git a/src/cpu/cpu_ppc64.c b/src/cpu/cpu_ppc64.c
7a3408
index 53d8fb0..0769956 100644
7a3408
--- a/src/cpu/cpu_ppc64.c
7a3408
+++ b/src/cpu/cpu_ppc64.c
7a3408
@@ -350,7 +350,6 @@ ppc64Compute(virCPUDefPtr host,
7a3408
              const virCPUDef *cpu,
7a3408
              virCPUDataPtr *guestData,
7a3408
              char **message)
7a3408
-
7a3408
 {
7a3408
     struct ppc64_map *map = NULL;
7a3408
     struct ppc64_model *host_model = NULL;
7a3408
@@ -407,9 +406,7 @@ ppc64Compute(virCPUDefPtr host,
7a3408
         !(guest_model = ppc64ModelFromCPU(cpu, map)))
7a3408
         goto cleanup;
7a3408
 
7a3408
-    if (cpu->type == VIR_CPU_TYPE_GUEST &&
7a3408
-        cpu->match == VIR_CPU_MATCH_STRICT &&
7a3408
-        STRNEQ(guest_model->name, host_model->name)) {
7a3408
+    if (STRNEQ(guest_model->name, host_model->name)) {
7a3408
         VIR_DEBUG("host CPU model does not match required CPU model %s",
7a3408
                   guest_model->name);
7a3408
         if (message &&
7a3408
diff --git a/tests/cputest.c b/tests/cputest.c
7a3408
index 93f9d2e..1e84fd3 100644
7a3408
--- a/tests/cputest.c
7a3408
+++ b/tests/cputest.c
7a3408
@@ -501,7 +501,7 @@ static const char *model486[]   = { "486" };
7a3408
 static const char *nomodel[]    = { "nomodel" };
7a3408
 static const char *models[]     = { "qemu64", "core2duo", "Nehalem" };
7a3408
 static const char *haswell[]    = { "SandyBridge", "Haswell" };
7a3408
-static const char *ppc_models[]     = { "POWER7", "POWER7_v2.1", "POWER8_v1.0"};
7a3408
+static const char *ppc_models[] = { "POWER7", "POWER7_v2.1", "POWER7_v2.3", "POWER8_v1.0"};
7a3408
 
7a3408
 static int
7a3408
 mymain(void)
7a3408
@@ -662,7 +662,7 @@ mymain(void)
7a3408
                       NULL, "Haswell-noTSX", 0);
7a3408
 
7a3408
     DO_TEST_GUESTDATA("ppc64", "host", "guest", ppc_models, NULL, 0);
7a3408
-    DO_TEST_GUESTDATA("ppc64", "host", "guest-nofallback", ppc_models, "POWER7_v2.1", 0);
7a3408
+    DO_TEST_GUESTDATA("ppc64", "host", "guest-nofallback", ppc_models, "POWER7_v2.1", -1);
7a3408
 
7a3408
     return ret == 0 ? EXIT_SUCCESS : EXIT_FAILURE;
7a3408
 }
7a3408
diff --git a/tests/cputestdata/ppc64-guest.xml b/tests/cputestdata/ppc64-guest.xml
7a3408
index ac81ec0..9e91501 100644
7a3408
--- a/tests/cputestdata/ppc64-guest.xml
7a3408
+++ b/tests/cputestdata/ppc64-guest.xml
7a3408
@@ -1,4 +1,4 @@
7a3408
 <cpu match='exact'>
7a3408
-  <model>POWER8_v1.0</model>
7a3408
+  <model>POWER7_v2.3</model>
7a3408
   <topology sockets='2' cores='4' threads='1'/>
7a3408
 </cpu>
7a3408
diff --git a/tests/cputestdata/ppc64-host+guest,ppc_models-result.xml b/tests/cputestdata/ppc64-host+guest,ppc_models-result.xml
7a3408
index 0cb0830..3e55f68 100644
7a3408
--- a/tests/cputestdata/ppc64-host+guest,ppc_models-result.xml
7a3408
+++ b/tests/cputestdata/ppc64-host+guest,ppc_models-result.xml
7a3408
@@ -1,5 +1,5 @@
7a3408
 <cpu mode='custom' match='exact'>
7a3408
   <arch>ppc64</arch>
7a3408
-  <model fallback='allow'>POWER8_v1.0</model>
7a3408
+  <model fallback='allow'>POWER7_v2.3</model>
7a3408
   <vendor>IBM</vendor>
7a3408
 </cpu>
7a3408
diff --git a/tests/cputestdata/ppc64-host+guest-nofallback,ppc_models,POWER7_v2.1-result.xml b/tests/cputestdata/ppc64-host+guest-nofallback,ppc_models,POWER7_v2.1-result.xml
7a3408
deleted file mode 100644
7a3408
index 7e58361..0000000
7a3408
--- a/tests/cputestdata/ppc64-host+guest-nofallback,ppc_models,POWER7_v2.1-result.xml
7a3408
+++ /dev/null
7a3408
@@ -1,5 +0,0 @@
7a3408
-<cpu mode='custom' match='exact'>
7a3408
-  <arch>ppc64</arch>
7a3408
-  <model fallback='forbid'>POWER7_v2.1</model>
7a3408
-  <vendor>IBM</vendor>
7a3408
-</cpu>
7a3408
-- 
7a3408
2.5.0
7a3408