|
|
7a3408 |
From 9407ad274bb1494c343fedb2894faf9bd2e18618 Mon Sep 17 00:00:00 2001
|
|
|
7a3408 |
Message-Id: <9407ad274bb1494c343fedb2894faf9bd2e18618@dist-git>
|
|
|
7a3408 |
From: Andrea Bolognani <abologna@redhat.com>
|
|
|
7a3408 |
Date: Tue, 11 Aug 2015 17:16:07 +0200
|
|
|
7a3408 |
Subject: [PATCH] cpu: Parse and use PVR masks in the ppc64 driver
|
|
|
7a3408 |
|
|
|
7a3408 |
Instead of relying on a hard-coded mask value, read it from the CPU
|
|
|
7a3408 |
map XML and use it when looking up models by PVR.
|
|
|
7a3408 |
|
|
|
7a3408 |
(cherry picked from commit 5d0aa93c509a93b7e60b1066e5a912b42f575916)
|
|
|
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_map.xml | 14 +++++++-------
|
|
|
7a3408 |
src/cpu/cpu_ppc64.c | 23 +++++++++++++----------
|
|
|
7a3408 |
src/cpu/cpu_ppc64_data.h | 1 +
|
|
|
7a3408 |
3 files changed, 21 insertions(+), 17 deletions(-)
|
|
|
7a3408 |
|
|
|
7a3408 |
diff --git a/src/cpu/cpu_map.xml b/src/cpu/cpu_map.xml
|
|
|
7a3408 |
index 9474a1b..4e7ca2a 100644
|
|
|
7a3408 |
--- a/src/cpu/cpu_map.xml
|
|
|
7a3408 |
+++ b/src/cpu/cpu_map.xml
|
|
|
7a3408 |
@@ -630,30 +630,30 @@
|
|
|
7a3408 |
|
|
|
7a3408 |
<model name='POWER6'>
|
|
|
7a3408 |
<vendor name='IBM'/>
|
|
|
7a3408 |
- <pvr value='0x003e0000'/>
|
|
|
7a3408 |
+ <pvr value='0x003e0000' mask='0xffff0000'/>
|
|
|
7a3408 |
</model>
|
|
|
7a3408 |
|
|
|
7a3408 |
<model name='POWER7'>
|
|
|
7a3408 |
<vendor name='IBM'/>
|
|
|
7a3408 |
- <pvr value='0x003f0000'/>
|
|
|
7a3408 |
- <pvr value='0x004a0000'/>
|
|
|
7a3408 |
+ <pvr value='0x003f0000' mask='0xffff0000'/>
|
|
|
7a3408 |
+ <pvr value='0x004a0000' mask='0xffff0000'/>
|
|
|
7a3408 |
</model>
|
|
|
7a3408 |
|
|
|
7a3408 |
<model name='POWER8'>
|
|
|
7a3408 |
<vendor name='IBM'/>
|
|
|
7a3408 |
- <pvr value='0x004b0000'/>
|
|
|
7a3408 |
- <pvr value='0x004d0000'/>
|
|
|
7a3408 |
+ <pvr value='0x004b0000' mask='0xffff0000'/>
|
|
|
7a3408 |
+ <pvr value='0x004d0000' mask='0xffff0000'/>
|
|
|
7a3408 |
</model>
|
|
|
7a3408 |
|
|
|
7a3408 |
|
|
|
7a3408 |
<model name='POWERPC_e5500'>
|
|
|
7a3408 |
<vendor name='Freescale'/>
|
|
|
7a3408 |
- <pvr value='0x80240000'/>
|
|
|
7a3408 |
+ <pvr value='0x80240000' mask='0xffff0000'/>
|
|
|
7a3408 |
</model>
|
|
|
7a3408 |
|
|
|
7a3408 |
<model name='POWERPC_e6500'>
|
|
|
7a3408 |
<vendor name='Freescale'/>
|
|
|
7a3408 |
- <pvr value='0x80400000'/>
|
|
|
7a3408 |
+ <pvr value='0x80400000' mask='0xffff0000'/>
|
|
|
7a3408 |
</model>
|
|
|
7a3408 |
|
|
|
7a3408 |
</arch>
|
|
|
7a3408 |
diff --git a/src/cpu/cpu_ppc64.c b/src/cpu/cpu_ppc64.c
|
|
|
7a3408 |
index ba33e05..fafd84c 100644
|
|
|
7a3408 |
--- a/src/cpu/cpu_ppc64.c
|
|
|
7a3408 |
+++ b/src/cpu/cpu_ppc64.c
|
|
|
7a3408 |
@@ -81,8 +81,10 @@ ppc64DataCopy(const virCPUppc64Data *data)
|
|
|
7a3408 |
|
|
|
7a3408 |
copy->len = data->len;
|
|
|
7a3408 |
|
|
|
7a3408 |
- for (i = 0; i < data->len; i++)
|
|
|
7a3408 |
+ for (i = 0; i < data->len; i++) {
|
|
|
7a3408 |
copy->pvr[i].value = data->pvr[i].value;
|
|
|
7a3408 |
+ copy->pvr[i].mask = data->pvr[i].mask;
|
|
|
7a3408 |
+ }
|
|
|
7a3408 |
|
|
|
7a3408 |
return copy;
|
|
|
7a3408 |
|
|
|
7a3408 |
@@ -179,20 +181,12 @@ ppc64ModelFindPVR(const struct ppc64_map *map,
|
|
|
7a3408 |
model = map->models;
|
|
|
7a3408 |
while (model) {
|
|
|
7a3408 |
for (i = 0; i < model->data->len; i++) {
|
|
|
7a3408 |
- if (model->data->pvr[i].value == pvr)
|
|
|
7a3408 |
+ if ((pvr & model->data->pvr[i].mask) == model->data->pvr[i].value)
|
|
|
7a3408 |
return model;
|
|
|
7a3408 |
}
|
|
|
7a3408 |
model = model->next;
|
|
|
7a3408 |
}
|
|
|
7a3408 |
|
|
|
7a3408 |
- /* PowerPC Processor Version Register is interpreted as follows :
|
|
|
7a3408 |
- * Higher order 16 bits : Power ISA generation.
|
|
|
7a3408 |
- * Lower order 16 bits : CPU chip version number.
|
|
|
7a3408 |
- * If the exact CPU isn't found, return the nearest matching CPU generation
|
|
|
7a3408 |
- */
|
|
|
7a3408 |
- if (pvr & 0x0000FFFFul)
|
|
|
7a3408 |
- return ppc64ModelFindPVR(map, (pvr & 0xFFFF0000ul));
|
|
|
7a3408 |
-
|
|
|
7a3408 |
return NULL;
|
|
|
7a3408 |
}
|
|
|
7a3408 |
|
|
|
7a3408 |
@@ -345,6 +339,14 @@ ppc64ModelLoad(xmlXPathContextPtr ctxt,
|
|
|
7a3408 |
goto ignore;
|
|
|
7a3408 |
}
|
|
|
7a3408 |
model->data->pvr[i].value = pvr;
|
|
|
7a3408 |
+
|
|
|
7a3408 |
+ if (virXPathULongHex("string(./@mask)", ctxt, &pvr) < 0) {
|
|
|
7a3408 |
+ virReportError(VIR_ERR_INTERNAL_ERROR,
|
|
|
7a3408 |
+ _("Missing or invalid PVR mask in CPU model %s"),
|
|
|
7a3408 |
+ model->name);
|
|
|
7a3408 |
+ goto ignore;
|
|
|
7a3408 |
+ }
|
|
|
7a3408 |
+ model->data->pvr[i].mask = pvr;
|
|
|
7a3408 |
}
|
|
|
7a3408 |
|
|
|
7a3408 |
if (!map->models) {
|
|
|
7a3408 |
@@ -608,6 +610,7 @@ ppc64DriverNodeData(virArch arch)
|
|
|
7a3408 |
asm("mfpvr %0"
|
|
|
7a3408 |
: "=r" (data->pvr[0].value));
|
|
|
7a3408 |
#endif
|
|
|
7a3408 |
+ data->pvr[0].mask = 0xfffffffful;
|
|
|
7a3408 |
|
|
|
7a3408 |
nodeData->arch = arch;
|
|
|
7a3408 |
|
|
|
7a3408 |
diff --git a/src/cpu/cpu_ppc64_data.h b/src/cpu/cpu_ppc64_data.h
|
|
|
7a3408 |
index 0d3cb0b..c0a130e 100644
|
|
|
7a3408 |
--- a/src/cpu/cpu_ppc64_data.h
|
|
|
7a3408 |
+++ b/src/cpu/cpu_ppc64_data.h
|
|
|
7a3408 |
@@ -29,6 +29,7 @@
|
|
|
7a3408 |
typedef struct _virCPUppc64PVR virCPUppc64PVR;
|
|
|
7a3408 |
struct _virCPUppc64PVR {
|
|
|
7a3408 |
uint32_t value;
|
|
|
7a3408 |
+ uint32_t mask;
|
|
|
7a3408 |
};
|
|
|
7a3408 |
|
|
|
7a3408 |
typedef struct _virCPUppc64Data virCPUppc64Data;
|
|
|
7a3408 |
--
|
|
|
7a3408 |
2.5.0
|
|
|
7a3408 |
|