From 9735457a78394c2428e6aa48c52afb4cf440cfcf Mon Sep 17 00:00:00 2001 From: Prerna Saxena Date: Tue, 4 Nov 2014 22:58:33 +0530 Subject: [PATCH 5/7] PowerPC:Improve PVR handling to fall back to cpu generation. 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. Hence, there will no longer be a need to add each PowerPC CPU model to cpu_map.xml; just adding entry for the matching ISA generation will suffice. It also contains changes to cpu_map.xml since processor generations as understood by QEMU compat mode go as "power6", "power7" or "power8" [Reference : QEMU commit 8dfa3a5e85 ] Signed-off-by: Prerna Saxena Signed-off-by: Pradipta Kr. Banerjee Signed-off-by: Anton Blanchard Reviewed-by: Michal Privoznik --- src/cpu/cpu_map.xml | 30 ++++++++++++++++++++++++++++++ src/cpu/cpu_powerpc.c | 8 ++++++++ 2 files changed, 38 insertions(+) diff --git a/src/cpu/cpu_map.xml b/src/cpu/cpu_map.xml index 12987a0..d29639d 100644 --- a/src/cpu/cpu_map.xml +++ b/src/cpu/cpu_map.xml @@ -627,5 +627,35 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/cpu/cpu_powerpc.c b/src/cpu/cpu_powerpc.c index 35b7f3c..6960176 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.9.3