[Skiboot] [PATCH v4 3/9] Device-Tree(DT) entry for per-chip homer offset

Madhavan Srinivasan maddy at linux.vnet.ibm.com
Mon Aug 17 03:19:21 AEST 2015


OPAL sends two set of information
1) per-chip pore_slw_ima homer offset and size
2) supported nest units and their events

device tree layout for nest instrumentation:

/ibm,opal/nest-counters
 |
 -compatible ("ibm,opal-in-memory-counters")
 -homer-offset@<chip-id>
   |
   -compatible ("ibm,opal-chip-homer-slw-offset")
   -offset
   -size
   -ibm,chip-id
 -alink <one of the nest units>
   |
   -compatible ("ibm,nest-counters-chip")
   -alink0  <event offset in homer slw memeory region for counter data>
   -alink0,scale <event related>
   -alink0,unit <event related>
   -.....

we pass per-chip pore_slw_ima homer offset to kernel
as part of device tree entry under "homer-offset@<chip-id>" directory
with a "compatible" field, "offset" and "size" properties.

The nest units information are added to the device tree in the nest patch.
Signed-off-by: Madhavan Srinivasan <maddy at linux.vnet.ibm.com>

Signed-off-by: Madhavan Srinivasan <maddy at linux.vnet.ibm.com>
---
 hw/nest.c | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 52 insertions(+)

diff --git a/hw/nest.c b/hw/nest.c
index 3c08eb58ad57..77fa271b71f7 100644
--- a/hw/nest.c
+++ b/hw/nest.c
@@ -115,10 +115,62 @@ int load_catalog_lid(int loaded)
 
 void nest_pmu_init(int loaded)
 {
+	struct proc_chip *chip;
+	struct dt_node *dev, *chip_dev;
+	u64 addr = 0;
 
 	if (load_catalog_lid(loaded) != OPAL_SUCCESS) {
 		prerror("nest-counters: Catalog failed to load\n");
 		return;
 	}
 
+	/*
+	 * Now that we have catalog loaded and verified for nest counter
+	 * support, lets create device tree entries.
+	 *
+	 * Top level device node called "nest-counters" created under
+	 * "/ibm,opal" folder to contain all the nest unit informations with a
+	 * compatible field.
+	 */
+	dev = dt_new(opal_node, "nest-counters");
+	if (!dev) {
+		prerror("nest-counters: device node creation failed\n");
+		return;
+	}
+	dt_add_property_strings(dev, "compatible", "ibm,opal-in-memory-counters");
+
+	/*
+	 * Top level device node "nest-counters" will have two types for nodes
+	 * in it, they are, nest unit nodes and per-chip nodes
+	 *
+	 * per-chip nodes:
+	 *
+	 * pore_slw_ima firmware will program nest counters with
+	 * pre-defined set of events (provided in catalog) and accumulate
+	 * counter data in a fixed homer offset called
+	 * "SLW 24x7 Counters Data Area (per chip)"
+	 *
+	 * For homer memory layout refer "p8_homer_map.h" in hostboot git tree
+	 * of open-power github
+	 */
+	for_each_chip(chip) {
+		chip_dev = dt_new_addr(dev, "homer-offset", chip->id);
+		if (!chip_dev) {
+			prerror("nest-counters:homer-offset creation failed\n");
+			goto fail;
+		}
+
+		dt_add_property_cells(chip_dev, "ibm,chip-id", chip->id);
+		dt_add_property_strings(chip_dev, "compatible",
+					"ibm,opal-chip-homer-slw-offset");
+		addr = chip->homer_base + SLW_IMA_OFFSET;
+		dt_add_property_u64(chip_dev, "offset", addr);
+		dt_add_property_u64(chip_dev, "size", SLW_IMA_SIZE);
+	}
+
+	return;
+
+fail:
+	dt_free(dev);
+	return;
 }
-- 
1.9.1



More information about the Skiboot mailing list