[Skiboot] [PATCH] hw/imc: Check for pause_microcode_at_boot() return status

Madhavan Srinivasan maddy at linux.vnet.ibm.com
Mon Apr 9 15:00:44 AEST 2018


pause_microcode_at_boot() loops through all the chip's ucode
control block and pause the ucode if it is in the running state.
But it does not fail if any of the chip's ucode is not initialised.

Add code to return a failure if ucode is not initialized in any
of the chip. Since pause_microcode_at_boot() is called just before
attaching the IMC device nodes in imc_init(), add code to check for
the function return.

Fixes: 9750eee802f8d ('hw/imc: pause microcode at boot')
Signed-off-by: Madhavan Srinivasan <maddy at linux.vnet.ibm.com>
---
 hw/imc.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/hw/imc.c b/hw/imc.c
index a56f33677096..c567429ec5f4 100644
--- a/hw/imc.c
+++ b/hw/imc.c
@@ -164,7 +164,7 @@ static struct imc_chip_cb *get_imc_cb(uint32_t chip_id)
 	return cb;
 }
 
-static void pause_microcode_at_boot(void)
+static int pause_microcode_at_boot(void)
 {
 	struct proc_chip *chip;
 	struct imc_chip_cb *cb;
@@ -173,7 +173,11 @@ static void pause_microcode_at_boot(void)
 		cb = get_imc_cb(chip->id);
 		if (cb)
 			cb->imc_chip_command =  cpu_to_be64(NEST_IMC_DISABLE);
+		else
+			return -1; /* ucode is not init-ed */
 	}
+
+	return 0;
 }
 
 /*
@@ -606,7 +610,8 @@ imc_mambo:
 	 * then out to band tools will race with ucode and end up getting
 	 * undesirable values. Hence pause the ucode if it is already running.
 	 */
-	pause_microcode_at_boot();
+	if (pause_microcode_at_boot())
+		goto err;
 
 	/*
 	 * If the dt_attach_root() fails, "imc-counters" node will not be
-- 
2.7.4



More information about the Skiboot mailing list