diff options
-rw-r--r-- | arch/arm64/include/asm/pmu.h | 1 | ||||
-rw-r--r-- | arch/arm64/kernel/perf_event.c | 16 |
2 files changed, 17 insertions, 0 deletions
diff --git a/arch/arm64/include/asm/pmu.h b/arch/arm64/include/asm/pmu.h index b7710a59672c..669d385c500b 100644 --- a/arch/arm64/include/asm/pmu.h +++ b/arch/arm64/include/asm/pmu.h @@ -65,6 +65,7 @@ struct arm_pmu { u64 max_period; struct platform_device *plat_device; struct pmu_hw_events *(*get_hw_events)(void); + int attr_rdpmc; }; #define to_arm_pmu(p) (container_of(p, struct arm_pmu, pmu)) diff --git a/arch/arm64/kernel/perf_event.c b/arch/arm64/kernel/perf_event.c index cce18c85d2e8..7c7dfe48d0f2 100644 --- a/arch/arm64/kernel/perf_event.c +++ b/arch/arm64/kernel/perf_event.c @@ -634,6 +634,16 @@ static void armpmu_disable(struct pmu *pmu) armpmu->stop(); } +static int armpmu_event_idx(struct perf_event *event) +{ + int idx = event->hw.idx; + + if (!cpu_pmu->attr_rdpmc) + return 0; + + return idx + 1; +} + static void __init armpmu_init(struct arm_pmu *armpmu) { atomic_set(&armpmu->active_events, 0); @@ -648,6 +658,7 @@ static void __init armpmu_init(struct arm_pmu *armpmu) .start = armpmu_start, .stop = armpmu_stop, .read = armpmu_read, + .event_idx = armpmu_event_idx, }; } @@ -1378,6 +1389,11 @@ static struct pmu_hw_events *armpmu_get_cpu_events(void) return this_cpu_ptr(&cpu_hw_events); } +void arch_perf_update_userpage(struct perf_event_mmap_page *userpg, u64 now) +{ + userpg->cap_user_rdpmc = cpu_pmu->attr_rdpmc; +} + static void __init cpu_pmu_init(struct arm_pmu *armpmu) { int cpu; |