[Skiboot] [PATCH v2 10/11] Add OPAL call to enable/disable Nest pmu
Madhavan Srinivasan
maddy at linux.vnet.ibm.com
Tue Jul 21 16:38:50 AEST 2015
Patch adds a new OPAL call to start and stop PORE Thread Scheduler(PTS)
for Nest PMU Counter collection. Also creates a opal-api doc for this call.
Signed-off-by: Madhavan Srinivasan <maddy at linux.vnet.ibm.com>
---
doc/opal-api/opal-nest-ima.txt | 26 ++++++++++++++++++++++++++
hw/nest.c | 22 ++++++++++++++++++++++
include/opal-api.h | 3 ++-
3 files changed, 50 insertions(+), 1 deletion(-)
create mode 100644 doc/opal-api/opal-nest-ima.txt
diff --git a/doc/opal-api/opal-nest-ima.txt b/doc/opal-api/opal-nest-ima.txt
new file mode 100644
index 000000000000..3b2b95e7aa92
--- /dev/null
+++ b/doc/opal-api/opal-nest-ima.txt
@@ -0,0 +1,26 @@
+OPAL_NEST_IMA_CONTROL
+----------------------
+
+This OPAL call allows the host OS to start or stop the PORE SLW IMA engine for
+Nest instrumentation. List of supported Nest PMU units and their events are
+part of Hardware meta-data file called "Catalogue". Engine programs these
+pre-defined events to the Nest PMU and periodically captures the data from the
+Nest counter and moves the data to a specific memory (which is part of
+HOMER region). HOMER Region has a reserved offset for PORE SLW IMA Engine to
+dump the Nest Counter data. Host OS should map this region to get the counter
+data.
+
+OPAL_NEST_IMA_CONTROL call accepts two parameters:
+
+ Mode (uint64_t):
+ Currently only production mode is supported by the PORE SLW IMA
+ Engine. "SLW_IMA_MODE_PRODUCTION" macro defined in "nest.h"
+ used for this.
+
+ Value (uint64_6):
+ Value to start and stop the engine.
+ 0x0 -- Stop
+ 0x1 -- Start
+
+OPAL_NEST_IMA_CONTROL will return:
+ OPAL_SUCCESS on success and IMA_PTS_ERROR on failure.
diff --git a/hw/nest.c b/hw/nest.c
index 9ff95c7e2baa..eb2632a3ad97 100644
--- a/hw/nest.c
+++ b/hw/nest.c
@@ -426,3 +426,25 @@ void nest_pmu_init(int loaded)
return;
}
+
+static int64_t opal_nest_ima_control(uint64_t mode, uint64_t value)
+{
+ struct proc_chip *chip;
+
+ chip = get_chip(this_cpu()->chip_id);
+ if (mode == SLW_IMA_MODE_PRODUCTION) {
+ if (value)
+ xscom_write(chip->id, IMA_PTS_SCOM, IMA_PTS_ENABLE);
+ else
+ xscom_write(chip->id, IMA_PTS_SCOM, IMA_PTS_DISABLE);
+ } else {
+ /* Unknown/Unsupported SLW IMA mode */
+ goto fail;
+ }
+
+ return OPAL_SUCCESS;
+
+fail:
+ return IMA_PTS_ERROR;
+}
+opal_call (OPAL_NEST_IMA_CONTROL, opal_nest_ima_control, 2);
diff --git a/include/opal-api.h b/include/opal-api.h
index bfad5896df71..02c6792f5d1d 100644
--- a/include/opal-api.h
+++ b/include/opal-api.h
@@ -161,7 +161,8 @@
#define OPAL_PRD_MSG 113
#define OPAL_LEDS_GET_INDICATOR 114
#define OPAL_LEDS_SET_INDICATOR 115
-#define OPAL_LAST 115
+#define OPAL_NEST_IMA_CONTROL 116
+#define OPAL_LAST 116
/* Device tree flags */
--
1.9.1
More information about the Skiboot
mailing list