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

Madhavan Srinivasan maddy at linux.vnet.ibm.com
Fri Feb 19 03:45:15 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 896fd088b7f6..6499677d8069 100644
--- a/hw/nest.c
+++ b/hw/nest.c
@@ -161,6 +161,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
@@ -182,6 +207,9 @@ static int dt_create_nest_unit(struct dt_node *ima,
 	} else if (strstr(name, "MCS_Write_BW")) {
 		if (dt_create_nest_mcs_node(ima, gptr))
 			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