aboutsummaryrefslogtreecommitdiffstats
path: root/arch/ppc64/oprofile/op_model_power4.c
diff options
context:
space:
mode:
authorAnton Blanchard <anton@samba.org>2005-09-06 00:52:12 -0400
committerPaul Mackerras <paulus@samba.org>2005-09-06 02:09:21 -0400
commita6908cd00036080fbea14ff67335e5f2a1ab5489 (patch)
tree8ec2f5c877d9f1392184cfd31921cab7a5392c4b /arch/ppc64/oprofile/op_model_power4.c
parent8530935d384bef1467ba76e1f4382f0f8b3c899d (diff)
[PATCH] ppc64: Use num_pmcs in oprofile code
Change oprofile to use num_pmcs from the cpu feature struct. Signed-off-by: Anton Blanchard <anton@samba.org> Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'arch/ppc64/oprofile/op_model_power4.c')
-rw-r--r--arch/ppc64/oprofile/op_model_power4.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/arch/ppc64/oprofile/op_model_power4.c b/arch/ppc64/oprofile/op_model_power4.c
index 3d103d66870d..e469610efde5 100644
--- a/arch/ppc64/oprofile/op_model_power4.c
+++ b/arch/ppc64/oprofile/op_model_power4.c
@@ -23,7 +23,6 @@
23 23
24static unsigned long reset_value[OP_MAX_COUNTER]; 24static unsigned long reset_value[OP_MAX_COUNTER];
25 25
26static int num_counters;
27static int oprofile_running; 26static int oprofile_running;
28static int mmcra_has_sihv; 27static int mmcra_has_sihv;
29 28
@@ -45,8 +44,6 @@ static void power4_reg_setup(struct op_counter_config *ctr,
45{ 44{
46 int i; 45 int i;
47 46
48 num_counters = num_ctrs;
49
50 /* 47 /*
51 * SIHV / SIPR bits are only implemented on POWER4+ (GQ) and above. 48 * SIHV / SIPR bits are only implemented on POWER4+ (GQ) and above.
52 * However we disable it on all POWER4 until we verify it works 49 * However we disable it on all POWER4 until we verify it works
@@ -68,7 +65,7 @@ static void power4_reg_setup(struct op_counter_config *ctr,
68 65
69 backtrace_spinlocks = sys->backtrace_spinlocks; 66 backtrace_spinlocks = sys->backtrace_spinlocks;
70 67
71 for (i = 0; i < num_counters; ++i) 68 for (i = 0; i < cur_cpu_spec->num_pmcs; ++i)
72 reset_value[i] = 0x80000000UL - ctr[i].count; 69 reset_value[i] = 0x80000000UL - ctr[i].count;
73 70
74 /* setup user and kernel profiling */ 71 /* setup user and kernel profiling */
@@ -121,7 +118,7 @@ static void power4_start(struct op_counter_config *ctr)
121 /* set the PMM bit (see comment below) */ 118 /* set the PMM bit (see comment below) */
122 mtmsrd(mfmsr() | MSR_PMM); 119 mtmsrd(mfmsr() | MSR_PMM);
123 120
124 for (i = 0; i < num_counters; ++i) { 121 for (i = 0; i < cur_cpu_spec->num_pmcs; ++i) {
125 if (ctr[i].enabled) { 122 if (ctr[i].enabled) {
126 ctr_write(i, reset_value[i]); 123 ctr_write(i, reset_value[i]);
127 } else { 124 } else {
@@ -272,7 +269,7 @@ static void power4_handle_interrupt(struct pt_regs *regs,
272 /* set the PMM bit (see comment below) */ 269 /* set the PMM bit (see comment below) */
273 mtmsrd(mfmsr() | MSR_PMM); 270 mtmsrd(mfmsr() | MSR_PMM);
274 271
275 for (i = 0; i < num_counters; ++i) { 272 for (i = 0; i < cur_cpu_spec->num_pmcs; ++i) {
276 val = ctr_read(i); 273 val = ctr_read(i);
277 if (val < 0) { 274 if (val < 0) {
278 if (oprofile_running && ctr[i].enabled) { 275 if (oprofile_running && ctr[i].enabled) {