[Skiboot] [PATCH] hw/imc: Check ucode state in all the chip

Madhavan Srinivasan maddy at linux.vnet.ibm.com
Thu Nov 23 18:19:47 AEDT 2017

disable_unavailable_units() checks whether the ucode
is in the running state before enabling the nest units
in the device tree. From a recent debug, it is found
that on some system boot, ucode is not loaded and
running in all the chips in the system. And this
caused a fail in OPAL_IMC_COUNTERS_STOP call where
we check for ucode state on each chip. Bug here is
that disable_unavailable_units() checks the state
of the ucode only in boot cpu chip. Patch adds a
condition in disable_unavailable_units() to check
for the ucode state in all the chip before enabling
the nest units in the device tree node.

Fixes: f98d59958db19 ('skiboot: Find the IMC DTB')
Signed-off-by: Madhavan Srinivasan <maddy at linux.vnet.ibm.com>
 hw/imc.c | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/hw/imc.c b/hw/imc.c
index 88d0302d9da6..1db94ec6ac1b 100644
--- a/hw/imc.c
+++ b/hw/imc.c
@@ -320,10 +320,23 @@ static void disable_unavailable_units(struct dt_node *dev)
 	struct imc_chip_cb *cb;
 	struct dt_node *target;
 	int i;
+	bool flag = true;
+	struct proc_chip *chip;
+	/*
+	 * Check the state of ucode in all the chip.
+	 * Disable the nest unit if ucode is not initialized
+	 * in any of the chip.
+	 */
+	for_each_chip(chip) {
+		cb = get_imc_cb(chip->id);
+		if (!cb)
+			flag = false;
+	}
 	/* Fetch the IMC control block structure */
 	cb = get_imc_cb(this_cpu()->chip_id);
-	if (cb)
+	if (cb && flag)
 		avl_vec = be64_to_cpu(cb->imc_chip_avl_vector);
 	else {
 		avl_vec = 0; /* Remove only nest imc device nodes */

More information about the Skiboot mailing list