--- v7
+++ v8
@@ -25,9 +25,9 @@
Signed-off-by: Madhavan Srinivasan <maddy@linux.vnet.ibm.com>
---
arch/powerpc/include/asm/imc-pmu.h | 5 +
- arch/powerpc/perf/imc-pmu.c | 201 ++++++++++++++++++++++++++++++
+ arch/powerpc/perf/imc-pmu.c | 209 +++++++++++++++++++++++++++++-
arch/powerpc/platforms/powernv/opal-imc.c | 3 +
- 3 files changed, 209 insertions(+)
+ 3 files changed, 216 insertions(+), 1 deletion(-)
diff --git a/arch/powerpc/include/asm/imc-pmu.h b/arch/powerpc/include/asm/imc-pmu.h
index 6260e61..cc04712 100644
@@ -58,7 +58,7 @@
+void thread_imc_disable(void);
#endif /* PPC_POWERNV_IMC_PMU_DEF_H */
diff --git a/arch/powerpc/perf/imc-pmu.c b/arch/powerpc/perf/imc-pmu.c
-index ac69d81..b055748 100644
+index 9767714..cfd112e 100644
--- a/arch/powerpc/perf/imc-pmu.c
+++ b/arch/powerpc/perf/imc-pmu.c
@@ -38,6 +38,9 @@ static u64 per_core_pdbar_add[IMC_MAX_CHIPS][IMC_MAX_CORES];
@@ -71,7 +71,7 @@
/* Needed for sanity check */
extern u64 nest_max_offset;
extern u64 core_max_offset;
-@@ -482,6 +485,56 @@ static int core_imc_event_init(struct perf_event *event)
+@@ -480,6 +483,56 @@ static int core_imc_event_init(struct perf_event *event)
return 0;
}
@@ -128,7 +128,7 @@
static void imc_read_counter(struct perf_event *event)
{
u64 *addr, data;
-@@ -723,6 +776,84 @@ static int core_imc_event_add(struct perf_event *event, int flags)
+@@ -720,6 +773,84 @@ static int core_imc_event_add(struct perf_event *event, int flags)
}
@@ -213,10 +213,11 @@
/* update_pmu_ops : Populate the appropriate operations for "pmu" */
static int update_pmu_ops(struct imc_pmu *pmu)
{
-@@ -749,6 +880,19 @@ static int update_pmu_ops(struct imc_pmu *pmu)
+@@ -745,7 +876,26 @@ static int update_pmu_ops(struct imc_pmu *pmu)
+ pmu->pmu.read = imc_perf_event_update;
pmu->attr_groups[IMC_FORMAT_ATTR] = &imc_format_group;
pmu->pmu.attr_groups = pmu->attr_groups;
-
+-
+ if (pmu->domain == IMC_DOMAIN_THREAD) {
+ pmu->pmu.event_init = thread_imc_event_init;
+ pmu->pmu.start = thread_imc_event_start;
@@ -228,12 +229,19 @@
+ pmu->pmu.cancel_txn = thread_imc_pmu_cancel_txn;
+ pmu->pmu.commit_txn = thread_imc_pmu_commit_txn;
+ pmu->pmu.sched_task = thread_imc_pmu_sched_task;
++
++ /*
++ * Since thread_imc does not have any CPUMASK attr,
++ * this may drop the "events" attr all together.
++ * So swap the IMC_EVENT_ATTR slot with IMC_CPUMASK_ATTR.
++ */
++ pmu->attr_groups[IMC_CPUMASK_ATTR] = pmu->attr_groups[IMC_EVENT_ATTR];
++ pmu->attr_groups[IMC_EVENT_ATTR] = NULL;
+ }
-+
return 0;
}
-@@ -809,6 +953,56 @@ static int update_events_in_group(struct imc_events *events,
+@@ -806,6 +956,56 @@ static int update_events_in_group(struct imc_events *events,
return 0;
}
@@ -290,7 +298,7 @@
/*
* init_imc_pmu : Setup and register the IMC pmu device.
*
-@@ -836,6 +1030,9 @@ int __init init_imc_pmu(struct imc_events *events, int idx,
+@@ -833,6 +1033,9 @@ int __init init_imc_pmu(struct imc_events *events, int idx,
if (ret)
return ret;
break;
@@ -300,7 +308,7 @@
default:
return -1; /* Unknown domain */
}
-@@ -868,5 +1065,9 @@ int __init init_imc_pmu(struct imc_events *events, int idx,
+@@ -865,5 +1068,9 @@ int __init init_imc_pmu(struct imc_events *events, int idx,
if (pmu_ptr->domain == IMC_DOMAIN_CORE)
cleanup_all_core_imc_memory();