[libvirt] [PATCH v3 3/3] PowerPC: Improve PVR handling to fall back to the respective CPU generation.

Prerna Saxena prerna at linux.vnet.ibm.com
Sun Oct 26 11:11:39 UTC 2014


>From 24608d7df3ec29604a8862a9a646983cb7f686fa Mon Sep 17 00:00:00 2001
From: Prerna Saxena <prerna at linux.vnet.ibm.com>
Date: Tue, 21 Oct 2014 08:09:19 -0400

IBM Power processors differ uniquely across generations (such as power6,
power7, power8). Each generation signifies a new PowerISA version
that exhibits features unique to that generation.
The higher 16 bits of PVR for IBM Power processors encode the CPU generation,
while the CPU chip (sub)version is encoded in lower 16 bits.

For all practical purposes of launching a VM, we care about the
generation which the vCPU will belong to, and not specifically the chip
version. This patch updates the libvirt PVR check to reflect this
relationship. It allows libvirt to select the right CPU generation
in case the exact match for a a specific CPU is not found.

It also contains addition to cpu_map.xml for various generations of
PowerISA-compatible IBM Power CPUs. This is required to account for processor generations as understood by QEMU compat mode, which go as "power6", "power7" or "power8"
[Reference : QEMU commit 8dfa3a5e85 ]

Signed-off-by: Pradipta Kr. Banerjee <bpradip at in.ibm.com>
Signed-off-by: Prerna Saxena <prerna at linux.vnet.ibm.com>
---
 src/cpu/cpu_map.xml   | 24 ++++++++++++++++++++++++
 src/cpu/cpu_powerpc.c |  8 ++++++++
 2 files changed, 32 insertions(+)

diff --git a/src/cpu/cpu_map.xml b/src/cpu/cpu_map.xml
index 18c7b0d..f9d8d38 100644
--- a/src/cpu/cpu_map.xml
+++ b/src/cpu/cpu_map.xml
@@ -627,5 +627,29 @@
       <pvr value='0x004b0100'/>
     </model>
 
+    <model name='power6'>
+      <vendor name='IBM'/>
+      <compat isa='2.05'/>
+      <pvr value='0x003e0000'/>
+    </model>
+
+    <model name='power7'>
+      <vendor name='IBM'/>
+      <compat isa='2.06'/>
+      <pvr value='0x003f0000'/>
+    </model>
+
+    <model name='power7+'>
+      <vendor name='IBM'/>
+      <compat isa='2.06B'/>
+      <pvr value='0x004a0000'/>
+    </model>
+
+    <model name='power8'>
+      <vendor name='IBM'/>
+      <compat isa='2.07'/>
+      <pvr value='0x004b0000'/>
+    </model>
+
   </arch>
 </cpus>
diff --git a/src/cpu/cpu_powerpc.c b/src/cpu/cpu_powerpc.c
index ad887fe..d0b79ff 100644
--- a/src/cpu/cpu_powerpc.c
+++ b/src/cpu/cpu_powerpc.c
@@ -99,6 +99,14 @@ ppcModelFindPVR(const struct ppc_map *map,
         model = model->next;
     }
 
+    /* PowerPC Processor Version Register is interpreted as follows :
+     * Higher order 16 bits : Power ISA generation.
+     * Lower order 16 bits : CPU chip version number.
+     * If the exact CPU isnt found, return the nearest matching CPU generation
+     */
+    if (pvr & 0x0000FFFFul)
+        return ppcModelFindPVR(map, (pvr & 0xFFFF0000ul));
+
     return NULL;
 }
 
-- 
1.8.3.1


-- 
Prerna Saxena

Linux Technology Centre,
IBM Systems and Technology Lab,
Bangalore, India




More information about the libvir-list mailing list