powerpc/perf: Add generic IMC pmu group and event functions
PATCH v10 4/10 powerpc/perf: Add generic IMC pmu group and event functions
From: Anju T Sudhakar <[email protected]>
Device tree IMC driver code parses the IMC units and their events. It passes the information to IMC pmu code which is placed in powerpc/perf as "imc-pmu.c".
Patch adds a set of generic imc pmu related event functions to be used by each imc pmu unit. Add code to setup format attribute and to register imc pmus. Add a event_init function for nest_imc events.
Since, the IMC counters' data are periodically fed to a memory location, the functions to read/update, start/stop, add/del can be generic and can be used by all IMC PMU units.
Signed-off-by Anju T Sudhakar <[email protected]>
Signed-off-by Hemant Kumar <[email protected]>
Signed-off-by Madhavan Srinivasan <[email protected]>
--- arch/powerpc/include/asm/imc-pmu.h | 2 + arch/powerpc/perf/Makefile | 3 + arch/powerpc/perf/imc-pmu.c | 268 ++++++++++++++++++++++++++++++ arch/powerpc/platforms/powernv/opal-imc.c | 10 +- 4 files changed, 282 insertions(+), 1 deletion(-) create mode 100644 arch/powerpc/perf/imc-pmu.c
arch/powerpc/include/asm/imc-pmu.h +2 -0
@@ -96,4 +96,6 @@ struct imc_pmu {*/ #define IMC_DOMAIN_NEST 1 +extern struct imc_pmu *per_nest_pmu_arr[IMC_MAX_PMUS ]; +extern int __init init_imc_pmu (struct imc_events *events,int idx,struct imc_pmu *pmu_ptr);#endif /* PPC_POWERNV_IMC_PMU_DEF_H */
arch/powerpc/perf/Makefile +3 -0
@@ -6,6 +6,9 @@ obj-$(CONFIG_PPC_PERF_CTRS) += core-book3s.o bhrb.o obj64-$(CONFIG_PPC_PERF_CTRS) += power4-pmu.o ppc970-pmu.o power5-pmu.o \ power5+-pmu.o power6-pmu.o power7-pmu.o \ isa207-common.o power8-pmu.o power9-pmu.o + +obj-$(CONFIG_HV_PERF_IMC_CTRS) += imc-pmu.o + obj32-$(CONFIG_PPC_PERF_CTRS) += mpc7450-pmu.o obj-$(CONFIG_FSL_EMB_PERF_EVENT) += core-fsl-emb.o
arch/powerpc/perf/imc-pmu.c new file +268 -0
268 lines not on this page · raw message
arch/powerpc/platforms/powernv/opal-imc.c +9 -1
@@ -35,7 +35,6 @@#include <asm/imc-pmu.h> u64 nest_max_offset; -struct imc_pmu *per_nest_pmu_arr[IMC_MAX_PMUS ];static int imc_event_prop_update (char *name,struct imc_events *events) {
@@ -471,8 +470,17 @@ static int imc_pmu_create(struct device_node *parent, int pmu_index, int domain)if (prop)imc_events_setup (parent, pmu_index, pmu_ptr, prop, &idx); } +/* Function to register IMC pmu */ + ret =init_imc_pmu (pmu_ptr->events, idx, pmu_ptr); +if (ret) { +pr_err ("IMC PMU %s Register failed\n" , pmu_ptr->pmu.name); + goto free_events; + }return 0 ; +free_events: +if (pmu_ptr->events) +imc_free_events (pmu_ptr->events, idx); free_pmu:if (pmu_ptr)kfree (pmu_ptr);
Signature · 1 line
2.7.4