Skip to content

Commit

Permalink
hw/imc: Check for pause_microcode_at_boot() return status
Browse files Browse the repository at this point in the history
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: 9750eee ('hw/imc: pause microcode at boot')
Signed-off-by: Madhavan Srinivasan <maddy@linux.vnet.ibm.com>
Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
  • Loading branch information
Madhavan Srinivasan authored and stewartsmith committed Apr 10, 2018
1 parent dec7fe2 commit afc8918
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions hw/imc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
}

/*
Expand Down Expand Up @@ -606,7 +610,8 @@ void imc_init(void)
* 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
Expand Down

0 comments on commit afc8918

Please sign in to comment.