diff options
author | Matt Redfearn <matt.redfearn@mips.com> | 2018-04-20 06:23:04 -0400 |
---|---|---|
committer | James Hogan <jhogan@kernel.org> | 2018-05-15 10:16:16 -0400 |
commit | 800fb71281ca2ed5c8a7299e10ebc0de2f61cdda (patch) | |
tree | f0ac8f30ad775d4cc2000b75a08240a637828f81 | |
parent | 8270ab48e67333f760b3bef507c1524c7a06c699 (diff) |
MIPS: perf: More robustly probe for the presence of per-tc counters
The presence of per TC performance counters is now detected by
cpu-probe.c and indicated by MIPS_CPU_MT_PER_TC_PERF_COUNTERS in
cpu_data. Switch detection of the feature to use this new flag rather
than blindly testing the implementation specific config7 register with a
magic number.
Signed-off-by: Matt Redfearn <matt.redfearn@mips.com>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: Florian Fainelli <f.fainelli@gmail.com>
Cc: Maciej W. Rozycki <macro@mips.com>
Cc: Paul Burton <paul.burton@mips.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Arnaldo Carvalho de Melo <acme@kernel.org>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Robert Richter <rric@kernel.org>
Cc: linux-mips@linux-mips.org
Cc: oprofile-list@lists.sf.net
Patchwork: https://patchwork.linux-mips.org/patch/19142/
Signed-off-by: James Hogan <jhogan@kernel.org>
-rw-r--r-- | arch/mips/include/asm/cpu-features.h | 7 | ||||
-rw-r--r-- | arch/mips/kernel/perf_event_mipsxx.c | 3 | ||||
-rw-r--r-- | arch/mips/oprofile/op_model_mipsxx.c | 2 |
3 files changed, 7 insertions, 5 deletions
diff --git a/arch/mips/include/asm/cpu-features.h b/arch/mips/include/asm/cpu-features.h index 5f74590e0bea..9cdb4e4ce258 100644 --- a/arch/mips/include/asm/cpu-features.h +++ b/arch/mips/include/asm/cpu-features.h | |||
@@ -535,6 +535,13 @@ | |||
535 | # define cpu_has_shared_ftlb_entries 0 | 535 | # define cpu_has_shared_ftlb_entries 0 |
536 | #endif | 536 | #endif |
537 | 537 | ||
538 | #ifdef CONFIG_MIPS_MT_SMP | ||
539 | # define cpu_has_mipsmt_pertccounters \ | ||
540 | (cpu_data[0].options & MIPS_CPU_MT_PER_TC_PERF_COUNTERS) | ||
541 | #else | ||
542 | # define cpu_has_mipsmt_pertccounters 0 | ||
543 | #endif /* CONFIG_MIPS_MT_SMP */ | ||
544 | |||
538 | /* | 545 | /* |
539 | * Guest capabilities | 546 | * Guest capabilities |
540 | */ | 547 | */ |
diff --git a/arch/mips/kernel/perf_event_mipsxx.c b/arch/mips/kernel/perf_event_mipsxx.c index ee73550f0b9a..458015da7149 100644 --- a/arch/mips/kernel/perf_event_mipsxx.c +++ b/arch/mips/kernel/perf_event_mipsxx.c | |||
@@ -129,8 +129,6 @@ static struct mips_pmu mipspmu; | |||
129 | 129 | ||
130 | 130 | ||
131 | #ifdef CONFIG_MIPS_PERF_SHARED_TC_COUNTERS | 131 | #ifdef CONFIG_MIPS_PERF_SHARED_TC_COUNTERS |
132 | static int cpu_has_mipsmt_pertccounters; | ||
133 | |||
134 | static DEFINE_RWLOCK(pmuint_rwlock); | 132 | static DEFINE_RWLOCK(pmuint_rwlock); |
135 | 133 | ||
136 | #if defined(CONFIG_CPU_BMIPS5000) | 134 | #if defined(CONFIG_CPU_BMIPS5000) |
@@ -1723,7 +1721,6 @@ init_hw_perf_events(void) | |||
1723 | } | 1721 | } |
1724 | 1722 | ||
1725 | #ifdef CONFIG_MIPS_PERF_SHARED_TC_COUNTERS | 1723 | #ifdef CONFIG_MIPS_PERF_SHARED_TC_COUNTERS |
1726 | cpu_has_mipsmt_pertccounters = read_c0_config7() & (1<<19); | ||
1727 | if (!cpu_has_mipsmt_pertccounters) | 1724 | if (!cpu_has_mipsmt_pertccounters) |
1728 | counters = counters_total_to_per_cpu(counters); | 1725 | counters = counters_total_to_per_cpu(counters); |
1729 | #endif | 1726 | #endif |
diff --git a/arch/mips/oprofile/op_model_mipsxx.c b/arch/mips/oprofile/op_model_mipsxx.c index c3e4c18ef8d4..7c04b17f4a48 100644 --- a/arch/mips/oprofile/op_model_mipsxx.c +++ b/arch/mips/oprofile/op_model_mipsxx.c | |||
@@ -36,7 +36,6 @@ static int perfcount_irq; | |||
36 | #endif | 36 | #endif |
37 | 37 | ||
38 | #ifdef CONFIG_MIPS_MT_SMP | 38 | #ifdef CONFIG_MIPS_MT_SMP |
39 | static int cpu_has_mipsmt_pertccounters; | ||
40 | #define WHAT (MIPS_PERFCTRL_MT_EN_VPE | \ | 39 | #define WHAT (MIPS_PERFCTRL_MT_EN_VPE | \ |
41 | M_PERFCTL_VPEID(cpu_vpe_id(¤t_cpu_data))) | 40 | M_PERFCTL_VPEID(cpu_vpe_id(¤t_cpu_data))) |
42 | #define vpe_id() (cpu_has_mipsmt_pertccounters ? \ | 41 | #define vpe_id() (cpu_has_mipsmt_pertccounters ? \ |
@@ -326,7 +325,6 @@ static int __init mipsxx_init(void) | |||
326 | } | 325 | } |
327 | 326 | ||
328 | #ifdef CONFIG_MIPS_MT_SMP | 327 | #ifdef CONFIG_MIPS_MT_SMP |
329 | cpu_has_mipsmt_pertccounters = read_c0_config7() & (1<<19); | ||
330 | if (!cpu_has_mipsmt_pertccounters) | 328 | if (!cpu_has_mipsmt_pertccounters) |
331 | counters = counters_total_to_per_cpu(counters); | 329 | counters = counters_total_to_per_cpu(counters); |
332 | #endif | 330 | #endif |