aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAl Cooper <alcooperx@gmail.com>2012-07-13 16:44:51 -0400
committerRalf Baechle <ralf@linux-mips.org>2012-10-11 05:04:34 -0400
commitda4b62cd6762ce327f660c6e45c8d5a739197159 (patch)
tree7cbb0b1ce047c514f92da5ef382ca0bc6002cf21
parentc5600b2dd9fc7318feddf69f127ca793437c714d (diff)
MIPS: perf: Add cpu feature bit for PCI (performance counter interrupt)
The PCI (Program Counter Interrupt) bit in the "cause" register is mandatory for MIPS32R2 cores, but has also been added to some R1 cores (BMIPS5000). This change adds a cpu feature bit to make it easier to check for and use this feature. Signed-off-by: Al Cooper <alcooperx@gmail.com> Cc: linux-mips@linux-mips.org Cc: linux-kernel@vger.kernel.org Patchwork: https://patchwork.linux-mips.org/patch/4106/ Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
-rw-r--r--arch/mips/include/asm/cpu-features.h4
-rw-r--r--arch/mips/include/asm/cpu.h3
-rw-r--r--arch/mips/include/asm/mipsregs.h2
-rw-r--r--arch/mips/kernel/cpu-probe.c5
-rw-r--r--arch/mips/kernel/perf_event_mipsxx.c2
5 files changed, 13 insertions, 3 deletions
diff --git a/arch/mips/include/asm/cpu-features.h b/arch/mips/include/asm/cpu-features.h
index 63002a240c73..089125a6ae6a 100644
--- a/arch/mips/include/asm/cpu-features.h
+++ b/arch/mips/include/asm/cpu-features.h
@@ -252,4 +252,8 @@
252#define cpu_hwrena_impl_bits 0 252#define cpu_hwrena_impl_bits 0
253#endif 253#endif
254 254
255#ifndef cpu_has_perf_cntr_intr_bit
256#define cpu_has_perf_cntr_intr_bit (cpu_data[0].options & MIPS_CPU_PCI)
257#endif
258
255#endif /* __ASM_CPU_FEATURES_H */ 259#endif /* __ASM_CPU_FEATURES_H */
diff --git a/arch/mips/include/asm/cpu.h b/arch/mips/include/asm/cpu.h
index 554e2d29965d..7dc0db8b9426 100644
--- a/arch/mips/include/asm/cpu.h
+++ b/arch/mips/include/asm/cpu.h
@@ -320,7 +320,8 @@ enum cpu_type_enum {
320#define MIPS_CPU_VINT 0x00080000 /* CPU supports MIPSR2 vectored interrupts */ 320#define MIPS_CPU_VINT 0x00080000 /* CPU supports MIPSR2 vectored interrupts */
321#define MIPS_CPU_VEIC 0x00100000 /* CPU supports MIPSR2 external interrupt controller mode */ 321#define MIPS_CPU_VEIC 0x00100000 /* CPU supports MIPSR2 external interrupt controller mode */
322#define MIPS_CPU_ULRI 0x00200000 /* CPU has ULRI feature */ 322#define MIPS_CPU_ULRI 0x00200000 /* CPU has ULRI feature */
323#define MIPS_CPU_RIXI 0x00400000 /* CPU has TLB Read/eXec Inhibit */ 323#define MIPS_CPU_PCI 0x00400000 /* CPU has Perf Ctr Int indicator */
324#define MIPS_CPU_RIXI 0x00800000 /* CPU has TLB Read/eXec Inhibit */
324 325
325/* 326/*
326 * CPU ASE encodings 327 * CPU ASE encodings
diff --git a/arch/mips/include/asm/mipsregs.h b/arch/mips/include/asm/mipsregs.h
index 528fda1e957c..04d7560dfafb 100644
--- a/arch/mips/include/asm/mipsregs.h
+++ b/arch/mips/include/asm/mipsregs.h
@@ -458,6 +458,8 @@
458#define CAUSEF_IP7 (_ULCAST_(1) << 15) 458#define CAUSEF_IP7 (_ULCAST_(1) << 15)
459#define CAUSEB_IV 23 459#define CAUSEB_IV 23
460#define CAUSEF_IV (_ULCAST_(1) << 23) 460#define CAUSEF_IV (_ULCAST_(1) << 23)
461#define CAUSEB_PCI 26
462#define CAUSEF_PCI (_ULCAST_(1) << 26)
461#define CAUSEB_CE 28 463#define CAUSEB_CE 28
462#define CAUSEF_CE (_ULCAST_(3) << 28) 464#define CAUSEF_CE (_ULCAST_(3) << 28)
463#define CAUSEB_TI 30 465#define CAUSEB_TI 30
diff --git a/arch/mips/kernel/cpu-probe.c b/arch/mips/kernel/cpu-probe.c
index bc58bd10a607..bd2809698e39 100644
--- a/arch/mips/kernel/cpu-probe.c
+++ b/arch/mips/kernel/cpu-probe.c
@@ -1194,8 +1194,11 @@ __cpuinit void cpu_probe(void)
1194 } 1194 }
1195 } 1195 }
1196 1196
1197 if (cpu_has_mips_r2) 1197 if (cpu_has_mips_r2) {
1198 c->srsets = ((read_c0_srsctl() >> 26) & 0x0f) + 1; 1198 c->srsets = ((read_c0_srsctl() >> 26) & 0x0f) + 1;
1199 /* R2 has Performance Counter Interrupt indicator */
1200 c->options |= MIPS_CPU_PCI;
1201 }
1199 else 1202 else
1200 c->srsets = 1; 1203 c->srsets = 1;
1201 1204
diff --git a/arch/mips/kernel/perf_event_mipsxx.c b/arch/mips/kernel/perf_event_mipsxx.c
index 8451f04627d8..4ee111142aad 100644
--- a/arch/mips/kernel/perf_event_mipsxx.c
+++ b/arch/mips/kernel/perf_event_mipsxx.c
@@ -1158,7 +1158,7 @@ static int mipsxx_pmu_handle_shared_irq(void)
1158 int handled = IRQ_NONE; 1158 int handled = IRQ_NONE;
1159 struct pt_regs *regs; 1159 struct pt_regs *regs;
1160 1160
1161 if (cpu_has_mips_r2 && !(read_c0_cause() & (1 << 26))) 1161 if (cpu_has_perf_cntr_intr_bit && !(read_c0_cause() & CAUSEF_PCI))
1162 return handled; 1162 return handled;
1163 /* 1163 /*
1164 * First we pause the local counters, so that when we are locked 1164 * First we pause the local counters, so that when we are locked