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

Madhavan Srinivasan maddy at linux.vnet.ibm.com
Mon Aug 17 03:19:27 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                           | 20 ++++++++++++++++++++
 include/opal-api.h                  |  3 ++-
 3 files changed, 59 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 7067b5a84efb..9b6786f09f90 100644
--- a/hw/nest.c
+++ b/hw/nest.c
@@ -433,3 +433,23 @@ 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;
+	u32 op;
+
+	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 e22370f7108e..0fa5be603c53 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