[Skiboot] [PATCH v4 5/9] nest powerbus unit support

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


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

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

diff --git a/hw/nest.c b/hw/nest.c
index cdf638c7bd8f..148017b84771 100644
--- a/hw/nest.c
+++ b/hw/nest.c
@@ -110,6 +110,37 @@ static int dt_create_nest_mcs_node(struct dt_node *ima,
 	return 0;
 }
 
+static int dt_create_nest_powerbus_node(struct dt_node *ima,
+			struct nest_catalog_group_data *gptr, const char *name)
+{
+	struct dt_node *type;
+	u32 offset;
+	const char *unit = "MiB", *scale = "4.883e-4";
+
+	type = dt_new(ima, name);
+	if (!type) {
+		prlog(PR_ERR, "nest_counters: %s type creation failed\n", name);
+		return -1;
+	}
+
+	dt_add_property_strings(type, "compatible", "ibm,nest-counters-chip");
+
+	/* 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, offset, "pb_cycles", NULL, NULL);
+
+	offset = get_chip_event_offset(gptr->event_index[1], DOMAIN_CHIP);
+	dt_create_nest_unit_events(type, offset, "total_retries_dinc", NULL, NULL);
+
+	offset = get_chip_event_offset(gptr->event_index[2], DOMAIN_CHIP);
+	dt_create_nest_unit_events(type, offset, "internal_bw", scale, unit);
+
+	offset = get_chip_event_offset(gptr->event_index[3], DOMAIN_CHIP);
+	dt_create_nest_unit_events(type, 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
@@ -125,6 +156,7 @@ static int dt_create_nest_unit(struct dt_node *ima,
 	 * not valid device tree node names.
 	 */
 	const char mcs_read[] = "mcs_read", mcs_write[] = "mcs_write";
+	const char pb[] = "powerbus";
 
 	name = malloc(gptr->group_name_len);
 	if (!name)
@@ -137,6 +169,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, mcs_write))
 			goto out;
+	} else if (strstr(name, "PowerBus_BW")) {
+		if (dt_create_nest_powerbus_node(ima, gptr, pb))
+			goto out;
 	} else
 		free(name);
 
-- 
1.9.1



More information about the Skiboot mailing list