[Skiboot] [PATCH v2] skiboot/hw/imc: Add nest_memory region to "exports" node

Madhavan Srinivasan maddy at linux.vnet.ibm.com
Tue Sep 12 21:45:59 AEST 2017


Exports the In-Memory Collection counter nest memory to
the OS. This allows the OS to view the nest counter
region directly. This helps in nest microcode debug
and to check counter raw value.

Signed-off-by: Madhavan Srinivasan <maddy at linux.vnet.ibm.com>
---
Changelog v1:
- Fixed the chip index in file name
- Moved from dt_root to opal_node when searching for "exports"
- Moved the logic to imc_dt_update_nest_node()

 hw/imc.c | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/hw/imc.c b/hw/imc.c
index 60fc39d6b761..99293ee36f9e 100644
--- a/hw/imc.c
+++ b/hw/imc.c
@@ -402,6 +402,9 @@ static void imc_dt_update_nest_node(struct dt_node *dev)
 	int i=0, nr_chip = nr_chips();
 	struct dt_node *node;
 	const struct dt_property *type;
+	uint32_t offset = 0, size = 0;
+	uint64_t baddr;
+	char namebuf[32];
 
 	/* Add the base_addr and chip-id properties for the nest node */
 	base_addr = malloc(sizeof(uint64_t) * nr_chip);
@@ -417,8 +420,27 @@ static void imc_dt_update_nest_node(struct dt_node *dev)
 		if (type && is_nest_node(node)) {
 			dt_add_property(node, "base-addr", base_addr, (i * sizeof(u64)));
 			dt_add_property(node, "chip-id", chipids, (i * sizeof(u32)));
+			offset = dt_prop_get_u32(node, "offset");
+			size = dt_prop_get_u32(node, "size");
 		}
 	}
+
+	/*
+	 * Enable only if we have active nest pmus.
+	 */
+	if (!size)
+		return;
+
+	node = dt_find_by_name(opal_node, "exports");
+	if (!node)
+		return;
+
+	for_each_chip(chip) {
+		snprintf(namebuf, sizeof(namebuf), "imc_nest_chip_%x", chip->id);
+		baddr = chip->homer_base;
+		baddr += offset;
+		dt_add_property_u64s(node, namebuf, baddr, size);
+	}
 }
 
 /*
-- 
2.7.4



More information about the Skiboot mailing list