aboutsummaryrefslogtreecommitdiffstats
path: root/arch/ppc64/oprofile
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
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')
-rw-r--r--arch/ppc64/oprofile/common.c7
-rw-r--r--arch/ppc64/oprofile/op_model_power4.c9
2 files changed, 5 insertions, 11 deletions
diff --git a/arch/ppc64/oprofile/common.c b/arch/ppc64/oprofile/common.c
index 4acd1a424933..a376eb2a1f0f 100644
--- a/arch/ppc64/oprofile/common.c
+++ b/arch/ppc64/oprofile/common.c
@@ -16,6 +16,7 @@
16#include <asm/ptrace.h> 16#include <asm/ptrace.h>
17#include <asm/system.h> 17#include <asm/system.h>
18#include <asm/pmc.h> 18#include <asm/pmc.h>
19#include <asm/cputable.h>
19 20
20#include "op_impl.h" 21#include "op_impl.h"
21 22
@@ -131,7 +132,6 @@ int __init oprofile_arch_init(struct oprofile_operations *ops)
131 case PV_630: 132 case PV_630:
132 case PV_630p: 133 case PV_630p:
133 model = &op_model_rs64; 134 model = &op_model_rs64;
134 model->num_counters = 8;
135 ops->cpu_type = "ppc64/power3"; 135 ops->cpu_type = "ppc64/power3";
136 break; 136 break;
137 137
@@ -140,14 +140,12 @@ int __init oprofile_arch_init(struct oprofile_operations *ops)
140 case PV_ICESTAR: 140 case PV_ICESTAR:
141 case PV_SSTAR: 141 case PV_SSTAR:
142 model = &op_model_rs64; 142 model = &op_model_rs64;
143 model->num_counters = 8;
144 ops->cpu_type = "ppc64/rs64"; 143 ops->cpu_type = "ppc64/rs64";
145 break; 144 break;
146 145
147 case PV_POWER4: 146 case PV_POWER4:
148 case PV_POWER4p: 147 case PV_POWER4p:
149 model = &op_model_power4; 148 model = &op_model_power4;
150 model->num_counters = 8;
151 ops->cpu_type = "ppc64/power4"; 149 ops->cpu_type = "ppc64/power4";
152 break; 150 break;
153 151
@@ -155,14 +153,12 @@ int __init oprofile_arch_init(struct oprofile_operations *ops)
155 case PV_970FX: 153 case PV_970FX:
156 case PV_970MP: 154 case PV_970MP:
157 model = &op_model_power4; 155 model = &op_model_power4;
158 model->num_counters = 8;
159 ops->cpu_type = "ppc64/970"; 156 ops->cpu_type = "ppc64/970";
160 break; 157 break;
161 158
162 case PV_POWER5: 159 case PV_POWER5:
163 case PV_POWER5p: 160 case PV_POWER5p:
164 model = &op_model_power4; 161 model = &op_model_power4;
165 model->num_counters = 6;
166 ops->cpu_type = "ppc64/power5"; 162 ops->cpu_type = "ppc64/power5";
167 break; 163 break;
168 164
@@ -170,6 +166,7 @@ int __init oprofile_arch_init(struct oprofile_operations *ops)
170 return -ENODEV; 166 return -ENODEV;
171 } 167 }
172 168
169 model->num_counters = cur_cpu_spec->num_pmcs;
173 ops->create_files = op_ppc64_create_files; 170 ops->create_files = op_ppc64_create_files;
174 ops->setup = op_ppc64_setup; 171 ops->setup = op_ppc64_setup;
175 ops->shutdown = op_ppc64_shutdown; 172 ops->shutdown = op_ppc64_shutdown;
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) {