Skip to content

Commit 28a5db0

Browse files
Madhavan Srinivasanmpe
Madhavan Srinivasan
authored andcommitted
powerpc/powernv: Add IMC OPAL APIs
In-Memory Collection (IMC) counters are performance monitoring infrastructure. These counters need special sequence of SCOMs to init/start/stop which is handled by OPAL. And OPAL provides three APIs to init and control these IMC engines. OPAL API documentation: https://github.com/open-power/skiboot/blob/master/doc/opal-api/opal-imc-counters.rst Patch updates the kernel side powernv platform code to support the new OPAL APIs Signed-off-by: Hemant Kumar <[email protected]> Signed-off-by: Anju T Sudhakar <[email protected]> Signed-off-by: Madhavan Srinivasan <[email protected]> Signed-off-by: Michael Ellerman <[email protected]>
1 parent 7e7dc66 commit 28a5db0

File tree

3 files changed

+19
-1
lines changed

3 files changed

+19
-1
lines changed

arch/powerpc/include/asm/opal-api.h

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,10 @@
190190
#define OPAL_NPU_INIT_CONTEXT 146
191191
#define OPAL_NPU_DESTROY_CONTEXT 147
192192
#define OPAL_NPU_MAP_LPAR 148
193-
#define OPAL_LAST 148
193+
#define OPAL_IMC_COUNTERS_INIT 149
194+
#define OPAL_IMC_COUNTERS_START 150
195+
#define OPAL_IMC_COUNTERS_STOP 151
196+
#define OPAL_LAST 151
194197

195198
/* Device tree flags */
196199

@@ -1084,6 +1087,13 @@ enum {
10841087
XIVE_DUMP_EMU_STATE = 5,
10851088
};
10861089

1090+
/* "type" argument options for OPAL_IMC_COUNTERS_* calls */
1091+
enum {
1092+
OPAL_IMC_COUNTERS_NEST = 1,
1093+
OPAL_IMC_COUNTERS_CORE = 2,
1094+
};
1095+
1096+
10871097
#endif /* __ASSEMBLY__ */
10881098

10891099
#endif /* __OPAL_API_H */

arch/powerpc/include/asm/opal.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -268,6 +268,11 @@ int64_t opal_xive_free_irq(uint32_t girq);
268268
int64_t opal_xive_sync(uint32_t type, uint32_t id);
269269
int64_t opal_xive_dump(uint32_t type, uint32_t id);
270270

271+
int64_t opal_imc_counters_init(uint32_t type, uint64_t address,
272+
uint64_t cpu_pir);
273+
int64_t opal_imc_counters_start(uint32_t type, uint64_t cpu_pir);
274+
int64_t opal_imc_counters_stop(uint32_t type, uint64_t cpu_pir);
275+
271276
/* Internal functions */
272277
extern int early_init_dt_scan_opal(unsigned long node, const char *uname,
273278
int depth, void *data);

arch/powerpc/platforms/powernv/opal-wrappers.S

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -310,3 +310,6 @@ OPAL_CALL(opal_xive_dump, OPAL_XIVE_DUMP);
310310
OPAL_CALL(opal_npu_init_context, OPAL_NPU_INIT_CONTEXT);
311311
OPAL_CALL(opal_npu_destroy_context, OPAL_NPU_DESTROY_CONTEXT);
312312
OPAL_CALL(opal_npu_map_lpar, OPAL_NPU_MAP_LPAR);
313+
OPAL_CALL(opal_imc_counters_init, OPAL_IMC_COUNTERS_INIT);
314+
OPAL_CALL(opal_imc_counters_start, OPAL_IMC_COUNTERS_START);
315+
OPAL_CALL(opal_imc_counters_stop, OPAL_IMC_COUNTERS_STOP);

0 commit comments

Comments
 (0)