[Skiboot] [PATCH v3 9/9] Add OPAL call to enable/disable Nest pmu

Madhavan Srinivasan maddy at linux.vnet.ibm.com
Mon Aug 3 17:33:48 AEST 2015


Add a new OPAL call to start and stop PORE_SLW_IMA microcode
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..b4b98d7cc234
--- /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 b6b75dcf82e7..9ef6e6927df8 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 e22370f7108e..d43e25026d37 100644
--- a/include/opal-api.h
+++ b/include/opal-api.h
@@ -162,7 +162,8 @@
 #define OPAL_LEDS_GET_INDICATOR			114
 #define OPAL_LEDS_SET_INDICATOR			115
 #define OPAL_CEC_REBOOT2			116
-#define OPAL_LAST				116
+#define OPAL_NEST_IMA_CONTROL			117
+#define OPAL_LAST				117
 
 /* Device tree flags */
 
-- 
1.9.1



More information about the Skiboot mailing list