aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/oprofile
diff options
context:
space:
mode:
authorAnton Blanchard <anton@samba.org>2005-11-07 02:43:56 -0500
committerPaul Mackerras <paulus@samba.org>2005-11-07 19:19:55 -0500
commitcb09cff30ad22408eea9b2785555af2d2b0ac1bd (patch)
tree07b41289038c9665c4626174f92abbbeeef9d445 /arch/powerpc/oprofile
parentbcb3557694d4e880051795ad97d609d255bcb658 (diff)
[PATCH] ppc64: fix oprofile sample bit handling
Oprofile was hardwiring the MMCRA sample bit to 1 but on newer cpus (eg POWER5) we want to vary it based on the group being sampled. Add a temporary workaround until people update their oprofile userspace. Signed-off-by: Anton Blanchard <anton@samba.org> Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'arch/powerpc/oprofile')
-rw-r--r--arch/powerpc/oprofile/op_model_power4.c24
1 files changed, 23 insertions, 1 deletions
diff --git a/arch/powerpc/oprofile/op_model_power4.c b/arch/powerpc/oprofile/op_model_power4.c
index 886449315847..c4ee5478427b 100644
--- a/arch/powerpc/oprofile/op_model_power4.c
+++ b/arch/powerpc/oprofile/op_model_power4.c
@@ -17,6 +17,7 @@
17#include <asm/systemcfg.h> 17#include <asm/systemcfg.h>
18#include <asm/rtas.h> 18#include <asm/rtas.h>
19#include <asm/oprofile_impl.h> 19#include <asm/oprofile_impl.h>
20#include <asm/reg.h>
20 21
21#define dbg(args...) 22#define dbg(args...)
22 23
@@ -81,6 +82,26 @@ static void power4_reg_setup(struct op_counter_config *ctr,
81 82
82extern void ppc64_enable_pmcs(void); 83extern void ppc64_enable_pmcs(void);
83 84
85/*
86 * Older CPUs require the MMCRA sample bit to be always set, but newer
87 * CPUs only want it set for some groups. Eventually we will remove all
88 * knowledge of this bit in the kernel, oprofile userspace should be
89 * setting it when required.
90 *
91 * In order to keep current installations working we force the bit for
92 * those older CPUs. Once everyone has updated their oprofile userspace we
93 * can remove this hack.
94 */
95static inline int mmcra_must_set_sample(void)
96{
97 if (__is_processor(PV_POWER4) || __is_processor(PV_POWER4p) ||
98 __is_processor(PV_970) || __is_processor(PV_970FX) ||
99 __is_processor(PV_970MP))
100 return 1;
101
102 return 0;
103}
104
84static void power4_cpu_setup(void *unused) 105static void power4_cpu_setup(void *unused)
85{ 106{
86 unsigned int mmcr0 = mmcr0_val; 107 unsigned int mmcr0 = mmcr0_val;
@@ -98,7 +119,8 @@ static void power4_cpu_setup(void *unused)
98 119
99 mtspr(SPRN_MMCR1, mmcr1_val); 120 mtspr(SPRN_MMCR1, mmcr1_val);
100 121
101 mmcra |= MMCRA_SAMPLE_ENABLE; 122 if (mmcra_must_set_sample())
123 mmcra |= MMCRA_SAMPLE_ENABLE;
102 mtspr(SPRN_MMCRA, mmcra); 124 mtspr(SPRN_MMCRA, mmcra);
103 125
104 dbg("setup on cpu %d, mmcr0 %lx\n", smp_processor_id(), 126 dbg("setup on cpu %d, mmcr0 %lx\n", smp_processor_id(),