[Skiboot] [PATCH v2 4/5] occ: Export per-chip Vid in device tree

Shilpasri G Bhat shilpa.bhat at linux.vnet.ibm.com
Fri Apr 1 00:34:56 AEDT 2016


Each chip can have a distinctive Voltage identifier, so export this
as a per-chip information so that it can be readily consumed for
characterization. This data is exported in newly created 'occ' node
under /ibm,opal/power-mgt node.

Signed-off-by: Shilpasri G Bhat <shilpa.bhat at linux.vnet.ibm.com>
---
This patch moves ibm,pstate-vcss and ibm,pstate-vdds property
from /ibm,opal/power-mgt to /ibm,opal/power-mgt/occ@<addr> node.
Should these properties be retained in 'power-mgt' node to avoid
breakage?

Changes from v1:
- Add documentation for the device tree changes. Create new file
  doc/device-tree/ibm,opal/power-mgt/occ.txt 
- Add "reg" property to store the address of OCC-OPAL shared memory
  region of the chip in 'occ' node.
- Add "address-cells" and "size-cells"

 doc/device-tree/ibm,opal/power-mgt.txt     |  7 ------
 doc/device-tree/ibm,opal/power-mgt/occ.txt | 31 +++++++++++++++++++++++++
 hw/occ.c                                   | 36 +++++++++++++++++++++++++-----
 3 files changed, 61 insertions(+), 13 deletions(-)
 create mode 100644 doc/device-tree/ibm,opal/power-mgt/occ.txt

diff --git a/doc/device-tree/ibm,opal/power-mgt.txt b/doc/device-tree/ibm,opal/power-mgt.txt
index d9cadb8..b689363 100644
--- a/doc/device-tree/ibm,opal/power-mgt.txt
+++ b/doc/device-tree/ibm,opal/power-mgt.txt
@@ -48,13 +48,6 @@ These properties give the maximum, minimum and nominal pstate values, as an id
 specified in the ibm,pstate-ids file.
 
 
-ibm,pstate-vcss ibm,pstate-vdds
--------------------------------
-
-These properties list a voltage-identifier of each of the pstates listed in
-ibm,pstate-ids for the Vcs and Vdd values used for that pstate. Each VID is a
-single byte.
-
 ibm,pstate-ultra-turbo ibm,pstate-turbo
 ---------------------------------------
 
diff --git a/doc/device-tree/ibm,opal/power-mgt/occ.txt b/doc/device-tree/ibm,opal/power-mgt/occ.txt
new file mode 100644
index 0000000..3f36641
--- /dev/null
+++ b/doc/device-tree/ibm,opal/power-mgt/occ.txt
@@ -0,0 +1,31 @@
+ibm,opal/power-mgt/ device tree nodes
+----------------------------------------
+
+The Voltage Identifiers of different chips is exported in
+ibm,opal/power-mgt/occ@<shared_memory_address> node.
+The 'shared_memory_address' here points to the OCC-OPAL shared
+memory region in HOMER.
+
+Example:
+	occ at 3fd9f8000 {
+		reg = <0x3 0xfd9f8000>;
+		ibm,chip-id = <0x0>;
+		ibm,pstate-vdds = [73 73 72 72 71 71 70 70 6f 6f 6e 6d 6d 6c 6c 6b 6b 6a 6a 69 69 68 67 67 66 66 65 65 64 64 63 63 62 61 61 60 60 5f 5f 5e 5e 5d 5d 5c 5b 5b 5a 5a 59 59 58 58 57 57 56 55 55 54 54 53 53 51 50 4e 4c 4b 49 48 46];
+		ibm,pstate-vcss = [5e 5e 5d 5d 5d 5c 5c 5c 5b 5b 5b 5a 5a 5a 59 59 59 58 58 57 57 57 56 56 56 55 55 55 54 54 54 53 53 53 52 52 52 51 51 51 50 50 50 4f 4f 4f 4e 4e 4e 4d 4d 4d 4c 4c 4c 4b 4b 4b 4a 4a 4a 48 47 46 44 43 41 40 3f];
+		phandle = <0x10000128>;
+		linux,phandle = <0x10000128>;
+	};
+
+Each occ node has the below properties:
+
+ibm,chip-id	: Processor ID
+reg		: OCC-OPAL shared memory address in HOMER
+
+ibm,pstate-vcss ibm,pstate-vdds
+-------------------------------
+
+These properties list a voltage-identifier of each of the pstates listed in
+ibm,pstate-ids for the Vcs and Vdd values used for that pstate. Each VID is a
+single byte.
+
+
diff --git a/hw/occ.c b/hw/occ.c
index 03240b3..3762726 100644
--- a/hw/occ.c
+++ b/hw/occ.c
@@ -243,11 +243,9 @@ static bool add_cpu_pstate_properties(s8 *pstate_nom)
 			dt_core_max[i] = occ_data->core_max[i];
 	}
 
-	for( i=0; i < nr_pstates; i++) {
+	for (i = 0; i < nr_pstates; i++) {
 		dt_id[i] = occ_data->pstates[i].id;
-		dt_freq[i] = occ_data->pstates[i].freq_khz/1000;
-		dt_vdd[i] = occ_data->pstates[i].vdd;
-		dt_vcs[i] = occ_data->pstates[i].vcs;
+		dt_freq[i] = occ_data->pstates[i].freq_khz / 1000;
 	}
 
 	/* Add the device-tree entries */
@@ -255,8 +253,6 @@ static bool add_cpu_pstate_properties(s8 *pstate_nom)
 			nr_pstates * sizeof(u32));
 	dt_add_property(power_mgt, "ibm,pstate-frequencies-mhz", dt_freq,
 			nr_pstates * sizeof(u32));
-	dt_add_property(power_mgt, "ibm,pstate-vdds", dt_vdd, nr_pstates);
-	dt_add_property(power_mgt, "ibm,pstate-vcss", dt_vcs, nr_pstates);
 	dt_add_property_cells(power_mgt, "ibm,pstate-min", occ_data->pstate_min);
 	dt_add_property_cells(power_mgt, "ibm,pstate-nominal", occ_data->pstate_nom);
 	dt_add_property_cells(power_mgt, "ibm,pstate-max", pmax);
@@ -273,6 +269,34 @@ static bool add_cpu_pstate_properties(s8 *pstate_nom)
 
 	/* Return pstate to set for each core */
 	*pstate_nom = occ_data->pstate_nom;
+
+	dt_add_property_cells(power_mgt, "#address-cells", 2);
+	dt_add_property_cells(power_mgt, "#size-cells", 0);
+	for_each_chip(chip) {
+		struct dt_node *occ_node;
+
+		occ_data = chip_occ_data(chip);
+		occ_node = dt_new_addr(power_mgt, "occ", (uint64_t)occ_data);
+		if (!occ_node) {
+			prerror("OCC: Failed to create /ibm,opal/power-mgt/occ@%llx\n",
+				(uint64_t)occ_data);
+			goto out_free_vcs;
+		}
+
+		for (i = 0; i < nr_pstates; i++) {
+			dt_vdd[i] = occ_data->pstates[i].vdd;
+			dt_vcs[i] = occ_data->pstates[i].vcs;
+		}
+
+		dt_add_property_cells(occ_node, "reg", hi32((uint64_t)occ_data),
+				      lo32((uint64_t)occ_data));
+		dt_add_property_cells(occ_node, "ibm,chip-id", chip->id);
+		dt_add_property(occ_node, "ibm,pstate-vdds", dt_vdd,
+				nr_pstates);
+		dt_add_property(occ_node, "ibm,pstate-vcss", dt_vcs,
+				nr_pstates);
+	}
+
 	rc = true;
 
 out_free_vcs:
-- 
1.9.3



More information about the Skiboot mailing list