[Skiboot] [PATCH v14 10/10] skiboot: Handle combined units node in the imc dt
Madhavan Srinivasan
maddy at linux.vnet.ibm.com
Thu Jun 22 22:15:24 AEST 2017
Add code to detect combined unit nodes
in the imc device tree. Due to HW/OCC restriction
mcs* units are paired and monitored by the nest
microcode. Microcode today does not support monitoring
of individual mcs* unit events, so the patch first
remove these mcs* from the imc device tree if found.
Secondly to enable or disbale combined units nodes like
"mcs01", "mcs23","mcs45" and "mcs67", additional parser
loop is added to disable_unavailable_units().
Signed-off-by: Madhavan Srinivasan <maddy at linux.vnet.ibm.com>
---
hw/imc.c | 59 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
include/imc.h | 7 +++++++
2 files changed, 66 insertions(+)
diff --git a/hw/imc.c b/hw/imc.c
index d36f7ff59487..eaa8668c0a62 100644
--- a/hw/imc.c
+++ b/hw/imc.c
@@ -78,6 +78,37 @@ char const *nest_pmus[] = {
/* reserved bits : 48 - 64 */
};
+/*
+ * Due to Nest HW/OCC restriction, microcode will not support individual unit
+ * events for these nest units mcs0, mcs1 ... mcs7 in the accumulation mode.
+ * And events to monitor each mcs units individually will be supported only
+ * in the debug mode (which will be supported by microcode in the future).
+ * These will be advertised only when OPAL provides interface for the it.
+ */
+char const *debug_mode_units[] = {
+ "mcs0",
+ "mcs1",
+ "mcs2",
+ "mcs3",
+ "mcs4",
+ "mcs5",
+ "mcs6",
+ "mcs7",
+};
+
+/*
+ * Combined unit node events are counted when any of the individual
+ * unit is enabled in the availability vector. That is,
+ * ex, mcs01 unit node should be enabled only when mcs0 or mcs1 enabled.
+ * mcs23 unit node should be enabled only when mcs2 or mcs3 is enabled
+ */
+static struct combined_units_node cu_node[] = {
+ { .name = "mcs01", .unit1 = PPC_BIT(1), .unit2 = PPC_BIT(2) },
+ { .name = "mcs23", .unit1 = PPC_BIT(3), .unit2 = PPC_BIT(4) },
+ { .name = "mcs45", .unit1 = PPC_BIT(5), .unit2 = PPC_BIT(6) },
+ { .name = "mcs67", .unit1 = PPC_BIT(7), .unit2 = PPC_BIT(8) },
+};
+
char *compress_buf;
size_t compress_buf_size;
const char **prop_to_fix(struct dt_node *node);
@@ -293,6 +324,34 @@ static void disable_unavailable_units(struct dt_node *dev)
}
}
+ /*
+ * Loop to detect debug mode units and remove them
+ * since the microcode does not support debug mode function yet.
+ */
+ for (i = 0; i < ARRAY_SIZE(debug_mode_units); i++) {
+ target = dt_find_by_name(dev, debug_mode_units[i]);
+ if (!target)
+ continue;
+ /* Remove the device node */
+ dt_free(target);
+ }
+
+ /*
+ * Based on availability unit vector from control block,
+ * check and enable combined unit nodes in the device tree.
+ */
+ for (i = 0; i < MAX_NEST_COMBINED_UNITS ; i++ ) {
+ if (!(cu_node[i].unit1 & avl_vec) &&
+ !(cu_node[i].unit2 & avl_vec)) {
+ target = dt_find_by_name(dev, cu_node[i].name);
+ if (!target)
+ continue;
+
+ /* Remove the device node */
+ dt_free(target);
+ }
+ }
+
return;
}
diff --git a/include/imc.h b/include/imc.h
index d4381bb2adae..aa7f22dfa60b 100644
--- a/include/imc.h
+++ b/include/imc.h
@@ -132,4 +132,11 @@ struct imc_chip_cb
void imc_init(void);
void imc_catalog_preload(void);
+
+#define MAX_NEST_COMBINED_UNITS 4
+struct combined_units_node {
+ const char *name;
+ u64 unit1;
+ u64 unit2;
+};
#endif /* __IMC_H */
--
2.7.4
More information about the Skiboot
mailing list