MIPS: perf: Add hardware perf events support for new Loongson-3
Subsystems (3)
PATCH v3 1/2 MIPS: perf: Add hardware perf events support for new Loongson-3
New Loongson-3 means Loongson-3A R2 (Loongson-3A2000) and newer CPUs. Loongson-3 processors have three types of PMU types (so there are three event maps): Loongson-3A1000/Loonngson-3B1000/Loongson-3B1500 is Type-1, Loongson-3A2000/Loongson-3A3000 is Type-2, Loongson-3A4000+ is Type-3.
--- .../asm/mach-loongson64/cpu-feature-overrides.h | 1 + arch/mips/kernel/perf_event_mipsxx.c | 365 +++++++++++++++++++-- 2 files changed, 337 insertions(+), 29 deletions(-)
arch/mips/include/asm/mach-loongson64/cpu-feature-overrides.h +1 -0
@@ -48,5 +48,6 @@#define cpu_hwrena_impl_bits 0xc0000000#define cpu_has_mac2008_only 1#define cpu_has_mips_r2_exec_hazard 0 +#define cpu_has_perf_cntr_intr_bit 0#endif /* __ASM_MACH_LOONGSON64_CPU_FEATURE_OVERRIDES_H */
arch/mips/kernel/perf_event_mipsxx.c +336 -29
510 lines not on this page · raw message
Signature · 1 line
2.7.0
PATCH v3 2/2 MIPS: perf: Use 'fallthrough' pseudo keyword
Commit 294f69e662d1570703e9 ("compiler_attributes.h: Add 'fallthrough' pseudo keyword for switch/case use") introduce a 'fallthrough' pseudo keyword and it is the preferred format. In my previous perf patch the checkpatch.pl script has warned me about this. But to keep consistency I still use /* fall through */ there, and in this patch all of them in perf_event_mipsxx.c has been updated to use the new format.
--- arch/mips/kernel/perf_event_mipsxx.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)
arch/mips/kernel/perf_event_mipsxx.c +8 -8
@@ -852,7 +852,7 @@ static void loongson3_reset_counters(void *arg) mipspmu.write_counter (3 ,0 );mipsxx_pmu_write_control (3 ,575 <<5 ); mipspmu.write_counter (3 ,0 ); -/* fall through */ + fallthrough;case 3 :mipsxx_pmu_write_control (2 ,0 ); mipspmu.write_counter (2 ,0 );
@@ -868,7 +868,7 @@ static void loongson3_reset_counters(void *arg) mipspmu.write_counter (2 ,0 );mipsxx_pmu_write_control (2 ,575 <<5 ); mipspmu.write_counter (2 ,0 ); -/* fall through */ + fallthrough;case 2 :mipsxx_pmu_write_control (1 ,0 ); mipspmu.write_counter (1 ,0 );
@@ -884,7 +884,7 @@ static void loongson3_reset_counters(void *arg) mipspmu.write_counter (1 ,0 );mipsxx_pmu_write_control (1 ,575 <<5 ); mipspmu.write_counter (1 ,0 ); -/* fall through */ + fallthrough;case 1 :mipsxx_pmu_write_control (0 ,0 ); mipspmu.write_counter (0 ,0 );
@@ -900,7 +900,7 @@ static void loongson3_reset_counters(void *arg) mipspmu.write_counter (0 ,0 );mipsxx_pmu_write_control (0 ,575 <<5 ); mipspmu.write_counter (0 ,0 ); -/* fall through */ + fallthrough; } }
@@ -917,19 +917,19 @@ static void reset_counters(void *arg)case 4 :mipsxx_pmu_write_control (3 ,0 ); mipspmu.write_counter (3 ,0 ); -/* fall through */ + fallthrough;case 3 :mipsxx_pmu_write_control (2 ,0 ); mipspmu.write_counter (2 ,0 ); -/* fall through */ + fallthrough;case 2 :mipsxx_pmu_write_control (1 ,0 ); mipspmu.write_counter (1 ,0 ); -/* fall through */ + fallthrough;case 1 :mipsxx_pmu_write_control (0 ,0 ); mipspmu.write_counter (0 ,0 ); -/* fall through */ + fallthrough; } }
Signature · 1 line
2.7.0
Thomas Bogendoerfer
maintainerQuoted 9 lines · Huacai Chen
New Loongson-3 means Loongson-3A R2 (Loongson-3A2000) and newer CPUs. Loongson-3 processors have three types of PMU types (so there are three event maps): Loongson-3A1000/Loonngson-3B1000/Loongson-3B1500 is Type-1, Loongson-3A2000/Loongson-3A3000 is Type-2, Loongson-3A4000+ is Type-3.
Signed-off-by Huacai Chen <[email protected]>--- .../asm/mach-loongson64/cpu-feature-overrides.h | 1 + arch/mips/kernel/perf_event_mipsxx.c | 365 +++++++++++++++++++--
I've folded your second patch into this one and applied it to mips-next.
Thomas.
Signature · 2 lines
Crap can work. Given enough thrust pigs will fly, but it's not necessarily a good idea. [ RFC1925, 2.3 ]