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

Madhavan Srinivasan maddy at linux.vnet.ibm.com
Mon Dec 4 10:27:28 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>
Changelog v1:
- Fixed the loop to break on any chip fail

 hw/imc.c | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/hw/imc.c b/hw/imc.c
index 765c40fd5c8b..c2540b8ff061 100644
--- a/hw/imc.c
+++ b/hw/imc.c
@@ -356,13 +356,28 @@ 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;
+			break;
+		}
+	}
 	/* Add a property to "exports" node in opal_node */
 	/* 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