[Skiboot] [PATCH v7 7/9] nest powerbus unit support

Madhavan Srinivasan maddy at linux.vnet.ibm.com
Tue Mar 1 21:40:31 AEDT 2016


Add support for nest powerbus(pb) unit. Powerbus internal and external
bandwidth events with corresponding unit and scale file in
device-tree entry, "powerbus cycles" and "total retires" events are exported.

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

diff --git a/hw/nest.c b/hw/nest.c
index 1b5c935ebc1f..18780ea7f874 100644
--- a/hw/nest.c
+++ b/hw/nest.c
@@ -167,6 +167,31 @@ static int dt_create_nest_mcs_node(struct dt_node *type,
 	return 0;
 }
 
+static int dt_create_nest_powerbus_node(struct dt_node *type,
+					struct nest_catalog_group_data *gptr)
+{
+	u32 offset;
+	const char *unit = "MiB", *scale = "4.883e-4";
+
+	/* Catalog names for events are not valid device tree names */
+	offset = get_chip_event_offset(gptr->event_index[0], DOMAIN_CHIP);
+	dt_create_nest_unit_events(type, -1, offset, "pb_cycles", NULL, NULL);
+
+	offset = get_chip_event_offset(gptr->event_index[1], DOMAIN_CHIP);
+	dt_create_nest_unit_events(type, -1, offset, "total_retries_dinc",
+								NULL, NULL);
+
+	offset = get_chip_event_offset(gptr->event_index[2], DOMAIN_CHIP);
+	dt_create_nest_unit_events(type, -1, offset, "internal_bw", scale,
+									unit);
+
+	offset = get_chip_event_offset(gptr->event_index[3], DOMAIN_CHIP);
+	dt_create_nest_unit_events(type, -1, offset, "external_bw", scale,
+									unit);
+
+	return 0;
+}
+
 /*
  * Wrapper function to call corresponding nest unit functions
  * for event dt creation. Not all the chip groups in the catalog are
@@ -189,6 +214,9 @@ dt_create_nest_unit(struct dt_node *ima,
 	} else if (strstr(name, "MCS_Write_BW")) {
 		if (dt_create_nest_mcs_node(ima, gptr, "write_mc"))
 			goto out;
+	} else if (strstr(name, "PowerBus_BW")) {
+		if (dt_create_nest_powerbus_node(ima, gptr))
+			goto out;
 	} else
 		free(name);
 
-- 
1.9.1



More information about the Skiboot mailing list