Skip to contentSkip to conversation

target/ppc: Add ibm, purr and ibm, spurr device-tree properties

PATCH In review Suraj Jitindar Singh 2 participants 4 messages May 6, 2019 – May 7, 2019

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 target/ppc: Add ibm, purr and ibm, spurr device-tree properties

The ibm,purr and ibm,spurr device tree properties are used to indicate that the processor implements the Processor Utilisation of Resources Register (PURR) and Scaled Processor Utilisation of Resources Registers (SPURR), respectively. Each property has a single value which represents the level of architecture supported. A value of 1 for ibm,purr means support for the version of the PURR defined in book 3 in version 2.02 of the architecture. A value of 1 for ibm,spurr means support for the version of the SPURR defined in version 2.05 of the architecture.

Add these properties for all processors for which the PURR and SPURR registers are generated.

---
 hw/ppc/spapr.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
hw/ppc/spapr.c +4 -1
index 2ef3ce4362..8580a8dc67 100644
@@ -500,7 +500,10 @@ static void spapr_populate_cpu_dt(CPUState *cs, void *fdt, int offset,
     _FDT((fdt_setprop(fdt, offset, "64-bit", NULL, 0)));
 
     if (env->spr_cb[SPR_PURR].oea_read) {
-        _FDT((fdt_setprop(fdt, offset, "ibm,purr", NULL, 0)));
+        _FDT((fdt_setprop_cell(fdt, offset, "ibm,purr", 1)));
+    }
+    if (env->spr_cb[SPR_SPURR].oea_read) {
+        _FDT((fdt_setprop_cell(fdt, offset, "ibm,spurr", 1)));
     }
 
     if (ppc_hash64_has(cpu, PPC_HASH64_1TSEG)) {
Signature · 1 line
2.13.6
#1 lore raw
Quoted 11 lines · Suraj Jitindar Singh

The ibm,purr and ibm,spurr device tree properties are used to indicate that the processor implements the Processor Utilisation of Resources Register (PURR) and Scaled Processor Utilisation of Resources Registers (SPURR), respectively. Each property has a single value which represents the level of architecture supported. A value of 1 for ibm,purr means support for the version of the PURR defined in book 3 in version 2.02 of the architecture. A value of 1 for ibm,spurr means support for the version of the SPURR defined in version 2.05 of the architecture.

Add these properties for all processors for which the PURR and SPURR registers are generated.

So.. what does the current empty property mean? Is it just wrong by spec, or does it actually mean something incorrect?

Quoted 22 lines
---
 hw/ppc/spapr.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
hw/ppc/spapr.c +4 -1
index 2ef3ce4362..8580a8dc67 100644
@@ -500,7 +500,10 @@ static void spapr_populate_cpu_dt(CPUState *cs, void *fdt, int offset,
     _FDT((fdt_setprop(fdt, offset, "64-bit", NULL, 0)));
 
     if (env->spr_cb[SPR_PURR].oea_read) {
-        _FDT((fdt_setprop(fdt, offset, "ibm,purr", NULL, 0)));
+        _FDT((fdt_setprop_cell(fdt, offset, "ibm,purr", 1)));
+    }
+    if (env->spr_cb[SPR_SPURR].oea_read) {
+        _FDT((fdt_setprop_cell(fdt, offset, "ibm,spurr", 1)));
     }
 
     if (ppc_hash64_has(cpu, PPC_HASH64_1TSEG)) {
Signature · 4 lines
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson
#2 lore raw
Quoted 16 lines · David Gibson
Quoted 15 lines · Suraj Jitindar Singh

The ibm,purr and ibm,spurr device tree properties are used to indicate
that the processor implements the Processor Utilisation of Resources
Register (PURR) and Scaled Processor Utilisation of Resources Registers
(SPURR), respectively. Each property has a single value which represents
the level of architecture supported. A value of 1 for ibm,purr means
support for the version of the PURR defined in book 3 in version 2.02 of
the architecture. A value of 1 for ibm,spurr means support for the version of the SPURR defined in version 2.05 of the architecture.

Quoted 6 lines
Quoted 3 lines

Add these properties for all processors for which the PURR and SPURR
registers are generated.

So.. what does the current empty property mean? Is it just wrong by spec, or does it actually mean something incorrect?

Af far as I can tell, an empty property is invalid according to PAPR. A level value is required to communicate the level of purr implemented.

Should probably have:

Fixes 0da6f3fef9a "spapr: Reorganize CPU dt generation code"
Quoted 26 lines
Quoted 24 lines
---
 hw/ppc/spapr.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
hw/ppc/spapr.c +4 -1
index 2ef3ce4362..8580a8dc67 100644
@@ -500,7 +500,10 @@ static void spapr_populate_cpu_dt(CPUState
 *cs, void *fdt, int offset,
     _FDT((fdt_setprop(fdt, offset, "64-bit", NULL, 0)));
 
     if (env->spr_cb[SPR_PURR].oea_read) {
-        _FDT((fdt_setprop(fdt, offset, "ibm,purr", NULL, 0)));
+        _FDT((fdt_setprop_cell(fdt, offset, "ibm,purr", 1)));
+    }
+    if (env->spr_cb[SPR_SPURR].oea_read) {
+        _FDT((fdt_setprop_cell(fdt, offset, "ibm,spurr", 1)));
     }
 
     if (ppc_hash64_has(cpu, PPC_HASH64_1TSEG)) {
#3 lore raw
Quoted 21 lines · Suraj Jitindar Singh
Quoted 20 lines · David Gibson
Quoted 18 lines · Suraj Jitindar Singh

The ibm,purr and ibm,spurr device tree properties are used to indicate
that the processor implements the Processor Utilisation of Resources
Register (PURR) and Scaled Processor Utilisation of Resources Registers
(SPURR), respectively. Each property has a single value which represents
the level of architecture supported. A value of 1 for ibm,purr means
support for the version of the PURR defined in book 3 in version 2.02 of
the architecture. A value of 1 for ibm,spurr means support for the version of the SPURR defined in version 2.05 of the architecture.

Add these properties for all processors for which the PURR and SPURR
registers are generated.

Quoted 6 lines
Quoted 2 lines

So.. what does the current empty property mean? Is it just wrong by spec, or does it actually mean something incorrect?

Af far as I can tell, an empty property is invalid according to PAPR. A level value is required to communicate the level of purr implemented.

Ok, makes sense. Applied.

Quoted 4 lines

Should probably have:

Fixes 0da6f3fef9a "spapr: Reorganize CPU dt generation code"

I've folded that in.

Quoted 28 lines
Quoted 27 lines
Quoted 25 lines
---
 hw/ppc/spapr.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
hw/ppc/spapr.c +4 -1
index 2ef3ce4362..8580a8dc67 100644
@@ -500,7 +500,10 @@ static void spapr_populate_cpu_dt(CPUState
 *cs, void *fdt, int offset,
     _FDT((fdt_setprop(fdt, offset, "64-bit", NULL, 0)));
 
     if (env->spr_cb[SPR_PURR].oea_read) {
-        _FDT((fdt_setprop(fdt, offset, "ibm,purr", NULL, 0)));
+        _FDT((fdt_setprop_cell(fdt, offset, "ibm,purr", 1)));
+    }
+    if (env->spr_cb[SPR_SPURR].oea_read) {
+        _FDT((fdt_setprop_cell(fdt, offset, "ibm,spurr", 1)));
     }
 
     if (ppc_hash64_has(cpu, PPC_HASH64_1TSEG)) {
Signature · 4 lines
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson