Message ID | 1507744204-23316-1-git-send-email-maddy@linux.vnet.ibm.com |
---|---|
State | Accepted |
Headers | show |
Series | [v2] hw/imc: pause microcode at boot | expand |
Madhavan Srinivasan <maddy@linux.vnet.ibm.com> writes: > IMC nest counters has both in-band (ucode access) and out of > band access to it. Since not all nest counter configurations > are supported by ucode, out of band tools are used to characterize > other configuration. > > So it is prefer to pause the nest microcode at boot to aid the > nest out of band tools. If the ucode not paused and OS does not > have IMC driver support, then out to band tools will race with > ucode and end up getting undesirable values. Patch to check and > pause the ucode at boot. > > OPAL provides APIs to control IMC counters. OPAL_IMC_COUNTERS_INIT > is used to initialize these counters at boot. OPAL_IMC_COUNTERS_START > and OPAL_IMC_COUNTERS_STOP API calls should be used to start and pause > these IMC engines. `doc/opal-api/opal-imc-counters.rst` details the > OPAL APIs and their usage. > > Signed-off-by: Madhavan Srinivasan <maddy@linux.vnet.ibm.com> > --- > hw/imc.c | 24 ++++++++++++++++++++++++ > 1 file changed, 24 insertions(+) Merged to master as of 9750eee802f8d6396147ee4e046e1859949a0e55
diff --git a/hw/imc.c b/hw/imc.c index 4b2e94884198..72207e141c73 100644 --- a/hw/imc.c +++ b/hw/imc.c @@ -160,6 +160,18 @@ static struct imc_chip_cb *get_imc_cb(uint32_t chip_id) return cb; } +static void pause_microcode_at_boot(void) +{ + struct proc_chip *chip; + struct imc_chip_cb *cb; + + for_each_chip(chip) { + cb = get_imc_cb(chip->id); + if (cb) + cb->imc_chip_command = cpu_to_be64(NEST_IMC_DISABLE); + } +} + /* * Decompresses the blob obtained from the IMC pnor sub-partition * in "src" of size "src_size", assigns the uncompressed device tree @@ -543,6 +555,18 @@ imc_mambo: return; /* + * IMC nest counters has both in-band (ucode access) and out of band + * access to it. Since not all nest counter configurations are supported + * by ucode, out of band tools are used to characterize other + * configuration. + * + * If the ucode not paused and OS does not have IMC driver support, + * 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 the dt_attach_root() fails, "imc-counters" node will not be * seen in the device-tree and hence OS should not make any * OPAL_IMC_* calls.
IMC nest counters has both in-band (ucode access) and out of band access to it. Since not all nest counter configurations are supported by ucode, out of band tools are used to characterize other configuration. So it is prefer to pause the nest microcode at boot to aid the nest out of band tools. If the ucode not paused and OS does not have IMC driver support, then out to band tools will race with ucode and end up getting undesirable values. Patch to check and pause the ucode at boot. OPAL provides APIs to control IMC counters. OPAL_IMC_COUNTERS_INIT is used to initialize these counters at boot. OPAL_IMC_COUNTERS_START and OPAL_IMC_COUNTERS_STOP API calls should be used to start and pause these IMC engines. `doc/opal-api/opal-imc-counters.rst` details the OPAL APIs and their usage. Signed-off-by: Madhavan Srinivasan <maddy@linux.vnet.ibm.com> --- hw/imc.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+)