aboutsummaryrefslogtreecommitdiff
path: root/hw/imc.c
diff options
context:
space:
mode:
authorMadhavan Srinivasan <maddy@linux.vnet.ibm.com>2017-10-11 23:20:04 +0530
committerStewart Smith <stewart@linux.vnet.ibm.com>2017-10-15 20:08:14 -0500
commit9750eee802f8d6396147ee4e046e1859949a0e55 (patch)
treeef1a85f126817d091ea35b960e468ed1eb4f1c17 /hw/imc.c
parenta9cf7c586871bdd8187760862c2df8bb2fbb2d6f (diff)
downloadskiboot-9750eee802f8d6396147ee4e046e1859949a0e55.zip
skiboot-9750eee802f8d6396147ee4e046e1859949a0e55.tar.gz
skiboot-9750eee802f8d6396147ee4e046e1859949a0e55.tar.bz2
hw/imc: pause microcode at boot
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> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
Diffstat (limited to 'hw/imc.c')
-rw-r--r--hw/imc.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/hw/imc.c b/hw/imc.c
index 4b2e948..72207e1 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.