[PATCH 10/18] cpu: CPU model names have to match on ppc64

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Limitations of the POWER architecture mean that you can't run
eg. a POWER7 guest on a POWER8 host when using KVM. This applies
to all guests, not just those using VIR_CPU_MATCH_STRICT in the
CPU definition; in fact, exact and strict CPU matching are
basically the same on ppc64.

This means, of course, that hosts using different CPUs have to be
considered incompatible as well.

Change ppc64Compute(), called by cpuGuestData(), to reflect this
fact and update test cases accordingly.
---
 src/cpu/cpu_ppc64.c                                                  | 5 +----
 tests/cputest.c                                                      | 4 ++--
 tests/cputestdata/ppc64-guest.xml                                    | 2 +-
 tests/cputestdata/ppc64-host+guest,ppc_models-result.xml             | 2 +-
 .../ppc64-host+guest-nofallback,ppc_models,POWER7_v2.1-result.xml    | 5 -----
 5 files changed, 5 insertions(+), 13 deletions(-)
 delete mode 100644 tests/cputestdata/ppc64-host+guest-nofallback,ppc_models,POWER7_v2.1-result.xml

diff --git a/src/cpu/cpu_ppc64.c b/src/cpu/cpu_ppc64.c
index 633515f..09ff386 100644
--- a/src/cpu/cpu_ppc64.c
+++ b/src/cpu/cpu_ppc64.c
@@ -361,7 +361,6 @@ ppc64Compute(virCPUDefPtr host,
              const virCPUDef *cpu,
              virCPUDataPtr *guestData,
              char **message)
-
 {
     struct ppc64_map *map = NULL;
     struct ppc64_model *host_model = NULL;
@@ -418,9 +417,7 @@ ppc64Compute(virCPUDefPtr host,
         !(guest_model = ppc64ModelFromCPU(cpu, map)))
         goto cleanup;
 
-    if (cpu->type == VIR_CPU_TYPE_GUEST &&
-        cpu->match == VIR_CPU_MATCH_STRICT &&
-        STRNEQ(guest_model->name, host_model->name)) {
+    if (STRNEQ(guest_model->name, host_model->name)) {
         VIR_DEBUG("host CPU model does not match required CPU model %s",
                   guest_model->name);
         if (message &&
diff --git a/tests/cputest.c b/tests/cputest.c
index 5b7de0f..ec867a7 100644
--- a/tests/cputest.c
+++ b/tests/cputest.c
@@ -493,7 +493,7 @@ static const char *model486[]   = { "486" };
 static const char *nomodel[]    = { "nomodel" };
 static const char *models[]     = { "qemu64", "core2duo", "Nehalem" };
 static const char *haswell[]    = { "SandyBridge", "Haswell" };
-static const char *ppc_models[]     = { "POWER7", "POWER7_v2.1", "POWER8_v1.0"};
+static const char *ppc_models[] = { "POWER7", "POWER7_v2.1", "POWER7_v2.3", "POWER8_v1.0"};
 
 static int
 mymain(void)
@@ -654,7 +654,7 @@ mymain(void)
                       NULL, "Haswell-noTSX", 0);
 
     DO_TEST_GUESTDATA("ppc64", "host", "guest", ppc_models, NULL, 0);
-    DO_TEST_GUESTDATA("ppc64", "host", "guest-nofallback", ppc_models, "POWER7_v2.1", 0);
+    DO_TEST_GUESTDATA("ppc64", "host", "guest-nofallback", ppc_models, "POWER7_v2.1", -1);
 
     return ret == 0 ? EXIT_SUCCESS : EXIT_FAILURE;
 }
diff --git a/tests/cputestdata/ppc64-guest.xml b/tests/cputestdata/ppc64-guest.xml
index ac81ec0..9e91501 100644
--- a/tests/cputestdata/ppc64-guest.xml
+++ b/tests/cputestdata/ppc64-guest.xml
@@ -1,4 +1,4 @@
 <cpu match='exact'>
-  <model>POWER8_v1.0</model>
+  <model>POWER7_v2.3</model>
   <topology sockets='2' cores='4' threads='1'/>
 </cpu>
diff --git a/tests/cputestdata/ppc64-host+guest,ppc_models-result.xml b/tests/cputestdata/ppc64-host+guest,ppc_models-result.xml
index 0cb0830..3e55f68 100644
--- a/tests/cputestdata/ppc64-host+guest,ppc_models-result.xml
+++ b/tests/cputestdata/ppc64-host+guest,ppc_models-result.xml
@@ -1,5 +1,5 @@
 <cpu mode='custom' match='exact'>
   <arch>ppc64</arch>
-  <model fallback='allow'>POWER8_v1.0</model>
+  <model fallback='allow'>POWER7_v2.3</model>
   <vendor>IBM</vendor>
 </cpu>
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
deleted file mode 100644
index 7e58361..0000000
--- a/tests/cputestdata/ppc64-host+guest-nofallback,ppc_models,POWER7_v2.1-result.xml
+++ /dev/null
@@ -1,5 +0,0 @@
-<cpu mode='custom' match='exact'>
-  <arch>ppc64</arch>
-  <model fallback='forbid'>POWER7_v2.1</model>
-  <vendor>IBM</vendor>
-</cpu>
-- 
2.4.3

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]