[Skiboot] [PATCH v4 6/9] nest alink and xlink units support

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


Add support for nest alink and xlink units. In general xlinks connects
the chips within the dual chip modules(dcm) and alinks connects sockets.

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

diff --git a/hw/nest.c b/hw/nest.c
index 148017b84771..fa45902c17ef 100644
--- a/hw/nest.c
+++ b/hw/nest.c
@@ -42,6 +42,23 @@ struct nest_catalog_desc *catalog_desc;
  */
 struct nest_catalog_page_0 *page0_desc;
 
+static bool is_P8_proc(void)
+{
+	struct proc_chip *chip;
+
+	chip = get_chip(this_cpu()->chip_id);
+	switch(chip->type) {
+	case PROC_CHIP_P8_MURANO:
+	case PROC_CHIP_P8_VENICE:
+	case PROC_CHIP_P8_NAPLES:
+		return true;
+	default:
+		break;
+	}
+
+	return false;
+}
+
 static u32 get_chip_event_offset(int idx, int domain)
 {
 	char *marker;
@@ -141,6 +158,46 @@ static int dt_create_nest_powerbus_node(struct dt_node *ima,
 	return 0;
 }
 
+static int dt_create_nest_alink_xlink_node(struct dt_node *ima,
+		struct nest_catalog_group_data *gptr, const char *name)
+{
+	struct dt_node *type;
+	int idx;
+	u32 offset;
+	const char ev_name[MAX_NAME_SIZE];
+	const char *unit = "MiB", *scale = "7.629e-6";
+
+	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");
+	for(idx = 0; idx < 3; idx++) {
+		offset = get_chip_event_offset(gptr->event_index[idx], DOMAIN_CHIP);
+		if (strstr(name, "alink")) {
+			snprintf((char *)ev_name, MAX_NAME_SIZE,
+							"alink%d_bw", idx);
+			dt_create_nest_unit_events(type, offset,
+						ev_name, scale, unit);
+		} else if (strstr(name, "xlink")) {
+			/*
+			 * Power8 does not use xlink2, it only uses xlink[0,1,3]
+			 * So skipping it.
+			 */
+			if ((idx == 2) && is_P8_proc())
+				idx = 3;
+			snprintf((char *)ev_name, MAX_NAME_SIZE,
+							"xlink%d_bw", idx);
+			dt_create_nest_unit_events(type, offset,
+						ev_name, 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
@@ -156,7 +213,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";
+	const char pb[] = "powerbus", al[]="alink", xl[] = "xlink";
 
 	name = malloc(gptr->group_name_len);
 	if (!name)
@@ -172,6 +229,12 @@ static int dt_create_nest_unit(struct dt_node *ima,
 	} else if (strstr(name, "PowerBus_BW")) {
 		if (dt_create_nest_powerbus_node(ima, gptr, pb))
 			goto out;
+	} else if (strstr(name, "A-link_data")) {
+		if (dt_create_nest_alink_xlink_node(ima, gptr, al))
+			goto out;
+	} else if (strstr(name, "X-link_data")) {
+		if (dt_create_nest_alink_xlink_node(ima, gptr, xl))
+			goto out;
 	} else
 		free(name);
 
-- 
1.9.1



More information about the Skiboot mailing list