[Skiboot] [PATCH v5 9/9] Add OPAL call to enable/disable nest pmu

Madhavan Srinivasan maddy at linux.vnet.ibm.com
Thu Sep 3 19:22:36 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-counters.txt | 37 +++++++++++++++++++++++++++++++++++++
 hw/nest.c                           | 21 +++++++++++++++++++++
 include/opal-api.h                  |  3 ++-
 3 files changed, 60 insertions(+), 1 deletion(-)
 create mode 100644 doc/opal-api/opal-nest-counters.txt

diff --git a/doc/opal-api/opal-nest-counters.txt b/doc/opal-api/opal-nest-counters.txt
new file mode 100644
index 000000000000..6bbfc8d4ae32
--- /dev/null
+++ b/doc/opal-api/opal-nest-counters.txt
@@ -0,0 +1,37 @@
+OPAL_NEST_COUNTERS_CONTROL
+----------------------
+
+OPAL call interface for nest instrumentation support.
+Today, the interface supports start and stop of pore slw ima
+(Power On Reset Engine SLeep Wink In Memory Accumulator) engine for
+nest instrumentation from Host OS. But it can be extended.
+
+OPAL_NEST_COUNTERS_CONTROL call accepts four parameters:
+
+	Mode (uint64_t):
+		Currently, only production mode is supported.
+		The "IMA_CHIP_PRODUCTION_MODE" macro defined in "nest.h"
+		is used for this.
+
+	Value_1 (uint64_t):
+		-For "IMA_CHIP_PRODUCTION_MODE" mode, this parameter is used
+		to start and stop the pore_slw_ima engine.
+		0x0 -- Stop
+		0x1 -- Start
+
+		-For other modes, this parameter is undefined for now.
+
+	Value_2 (uint64_t):
+		- For "IMA_CHIP_PRODUCTION_MODE" mode, this parameter should be
+		  zero.
+
+		-For other modes, this parameter is undefined for now.
+
+	Value_3 (uint64_t):
+		- For "IMA_CHIP_PRODUCTION_MODE" mode, this parameter should be
+		  zero.
+
+		-For other modes, this parameter is undefined for now.
+
+OPAL_NEST_COUNTERS_CONTROL will return:
+	OPAL_SUCCESS on success and IMA_PTS_ERROR on failure.
diff --git a/hw/nest.c b/hw/nest.c
index 6bc0abe7ddf4..1bbb77347419 100644
--- a/hw/nest.c
+++ b/hw/nest.c
@@ -473,3 +473,24 @@ fail:
 	dt_free(dev);
 	return;
 }
+
+static int64_t opal_nest_counters_control(uint64_t mode, uint64_t value_1,
+					uint64_t value_2, uint64_t value_3)
+{
+	struct proc_chip *chip;
+	u64 op;
+	int rc;
+
+	chip = get_chip(this_cpu()->chip_id);
+	if (mode == IMA_CHIP_PRODUCTION_MODE &&
+		!value_2 && !value_3) {
+		op = value_1 ? IMA_PTS_ENABLE: IMA_PTS_DISABLE;
+		xscom_write(chip->id, IMA_PTS_SCOM, op);
+	} else {
+		/* Unknown SLW IMA mode */
+		return IMA_PTS_ERROR;
+	}
+
+	return OPAL_SUCCESS;
+}
+opal_call(OPAL_NEST_COUNTERS_CONTROL, opal_nest_counters_control, 4);
diff --git a/include/opal-api.h b/include/opal-api.h
index f70520b34553..0da36bba1418 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_COUNTERS_CONTROL		117
+#define OPAL_LAST				117
 
 /* Device tree flags */
 
-- 
1.9.1



More information about the Skiboot mailing list