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

Madhavan Srinivasan maddy at linux.vnet.ibm.com
Tue Mar 1 21:40:33 AEDT 2016


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                           | 22 ++++++++++++++++++++++
 include/opal-api.h                  |  3 ++-
 3 files changed, 61 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..3eba14a718df
--- /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.
+Currently, 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 fc02a11f2aa7..731dac56ec95 100644
--- a/hw/nest.c
+++ b/hw/nest.c
@@ -510,3 +510,25 @@ 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;
+
+	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;
+		if ((chip->type == PROC_CHIP_P8_MURANO) ||
+		    (chip->type == PROC_CHIP_P8_VENICE) ||
+		    (chip->type == PROC_CHIP_P8_NAPLES))
+			return OPAL_SUCCESS;
+		xscom_write(chip->id, IMA_PTS_SCOM, op);
+		return OPAL_SUCCESS;
+	}
+
+	return IMA_PTS_ERROR;
+}
+opal_call(OPAL_NEST_COUNTERS_CONTROL, opal_nest_counters_control, 4);
diff --git a/include/opal-api.h b/include/opal-api.h
index 369aa93276fb..8a8978a6ce47 100644
--- a/include/opal-api.h
+++ b/include/opal-api.h
@@ -163,7 +163,8 @@
 #define OPAL_LEDS_SET_INDICATOR			115
 #define OPAL_CEC_REBOOT2			116
 #define OPAL_CONSOLE_FLUSH			117
-#define OPAL_LAST				117
+#define OPAL_NEST_COUNTERS_CONTROL		118
+#define OPAL_LAST				118
 
 /* Device tree flags */
 
-- 
1.9.1



More information about the Skiboot mailing list