perfevents: Add support for Scorpion performance monitors
PATCH v2 2/3 perfevents: Add support for Scorpion performance monitors
This commit adds support for performance monitors provided by Qualcomm Scorpion and ScorpionMP processor to perfevents.
--- arch/arm/include/asm/perf_event.h | 2 + arch/arm/kernel/perf_event.c | 11 + arch/arm/kernel/perf_event_msm.c | 665 +++++++++++++++++++++++++++++++++++++ 3 files changed, 678 insertions(+), 0 deletions(-) create mode 100644 arch/arm/kernel/perf_event_msm.c
arch/arm/include/asm/perf_event.h +2 -0
@@ -24,6 +24,8 @@ enum arm_perf_pmu_ids {ARM_PERF_PMU_ID_V6MP ,ARM_PERF_PMU_ID_CA8 ,ARM_PERF_PMU_ID_CA9 , +ARM_PERF_PMU_ID_SCORPION , +ARM_PERF_PMU_ID_SCORPIONMP , ARM_NUM_PMU_IDS, };
arch/arm/kernel/perf_event.c +11 -0
@@ -608,6 +608,7 @@ static struct pmu pmu = {#include "perf_event_xscale.c" #include "perf_event_v6.c" #include "perf_event_v7.c" +#include "perf_event_msm.c" static int __init init_hw_perf_events (void )
@@ -645,6 +646,16 @@ init_hw_perf_events(void) armpmu =xscale2pmu_init ();break ; } +/* Qualcomm CPUs */ + }else if (0x51 == implementor) { +switch (part_number) { +case 0x00F0 :/* 8x50 & 7x30*/ + armpmu =armv7_scorpion_pmu_init (); +break ; +case 0x02D0 :/* 8x60 */ + armpmu =armv7_scorpionmp_pmu_init (); +break ; + } }if (armpmu) {
arch/arm/kernel/perf_event_msm.c new file +665 -0
665 lines not on this page · raw message
Signature · 5 lines
1.7.4.1 -- Sent by an employee of the Qualcomm Innovation Center, Inc. The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum
Hello Sheetal,
Quoted 13 lines · Sheetal Sahasrabudhe
This commit adds support for performance monitors provided by Qualcomm Scorpion and ScorpionMP processor to perfevents.
Signed-off-by Sheetal Sahasrabudhe <[email protected]>Reviewed-by Jean Pihet <[email protected]>Reviewed-by Will Deacon <[email protected]>--- arch/arm/include/asm/perf_event.h | 2 + arch/arm/kernel/perf_event.c | 11 + arch/arm/kernel/perf_event_msm.c | 665 +++++++++++++++++++++++++++++++++++++ 3 files changed, 678 insertions(+), 0 deletions(-) create mode 100644 arch/arm/kernel/perf_event_msm.c
[...]
Quoted 8 lines
arch/arm/kernel/perf_event_msm.c new file +8
-0+static DEFINE_PER_CPU(u32, venum_orig_val); +static DEFINE_PER_CPU(u32, fp_orig_val); + +static void scorpion_pre_vlpm (void ) +{ +u32 venum_new_val; +u32 fp_new_val; +/* CPACR Enable CP10 access*/
arch/arm/kernel/perf_event_msm.c line 454
Quoted 10 lines
arch/arm/kernel/perf_event_msm.c new file +10
-0+ asmvolatile ("mrc p15, 0, %0, c1, c0, 2" :"=r" (venum_orig_val)); + venum_new_val = venum_orig_val |0x00100000 ; + asmvolatile ("mcr p15, 0, %0, c1, c0, 2" : :"r" (venum_new_val)); +isb (); +/* Enable FPEXC */ + fp_orig_val =fmrx (FPEXC ); + fp_new_val = fp_orig_val |FPEXC_EN ; +fmxr (FPEXC , fp_new_val); +} +
When I looked at this originally, I thought it would be nice to have some functions or macros for poking with the CPACR and planned to submit that as a separate patch...
... well it turns out we already have this! Please can you update this bit of code to use the {get,set}_copro_access functions in asm/system.h? You can use the CPACC_SVC macro to generate the access mask too instead of hardcoding the 0x00100000.
Cheers,
Will
Hi Will,
Quoted 25 lines · Will Deacon
[...]
Quoted 8 lines
arch/arm/kernel/perf_event_msm.c new file +8
-0+static DEFINE_PER_CPU(u32, venum_orig_val); +static DEFINE_PER_CPU(u32, fp_orig_val); + +static void scorpion_pre_vlpm (void ) +{ +u32 venum_new_val; +u32 fp_new_val; +/* CPACR Enable CP10 access*/ arch/arm/kernel/perf_event_msm.c line 454
Quoted 10 lines
arch/arm/kernel/perf_event_msm.c new file +10
-0+ asmvolatile ("mrc p15, 0, %0, c1, c0, 2" :"=r" (venum_orig_val)); + venum_new_val = venum_orig_val |0x00100000 ; + asmvolatile ("mcr p15, 0, %0, c1, c0, 2" : :"r" (venum_new_val)); +isb (); +/* Enable FPEXC */ + fp_orig_val =fmrx (FPEXC ); + fp_new_val = fp_orig_val |FPEXC_EN ; +fmxr (FPEXC , fp_new_val); +} +When I looked at this originally, I thought it would be nice to have some functions or macros for poking with the CPACR and planned to submit that as a separate patch...
Quoted 4 lines
... well it turns out we already have this! Please can you update this bit of code to use the {get,set}_copro_access functions in
asm/system.h? You can use theCPACC_SVCmacro to generate the access mask too instead of hardcoding the0x00100000.
Great! I have made the change and reposted the patch. Please let me know if it looks good.
Thanks,
Sheetal
Signature · 2 lines
Sent by an employee of the Qualcomm Innovation Center, Inc. The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.