aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/kernel
diff options
context:
space:
mode:
authorOlof Johansson <olof@lixom.net>2007-01-28 22:23:54 -0500
committerPaul Mackerras <paulus@samba.org>2007-02-06 22:03:19 -0500
commit1bd2e5ae18a8f93333707d81d3dbd9209a255137 (patch)
tree72feb6bae2a8dea311e2d9f2e412cfbc69a952fb /arch/powerpc/kernel
parentc69b767a2c871bb80cb9e346d6ebce248f711dfb (diff)
[POWERPC] Add PMC type to cputable
Add cputable entries for which type of PMC implementation the processor has. I've only filled in the current 64-bit processors, the unfilled default value will have same behaviour as before so it can be done over time as needed. Also tidy up the dummy_perf implementation a bit, aggregating it into one function with ifdefs instead of several. Signed-off-by: Olof Johansson <olof@lixom.net> Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'arch/powerpc/kernel')
-rw-r--r--arch/powerpc/kernel/cputable.c17
-rw-r--r--arch/powerpc/kernel/pmc.c35
2 files changed, 26 insertions, 26 deletions
diff --git a/arch/powerpc/kernel/cputable.c b/arch/powerpc/kernel/cputable.c
index b742013bb9da..4939b3d56dfb 100644
--- a/arch/powerpc/kernel/cputable.c
+++ b/arch/powerpc/kernel/cputable.c
@@ -86,6 +86,7 @@ static struct cpu_spec cpu_specs[] = {
86 .icache_bsize = 128, 86 .icache_bsize = 128,
87 .dcache_bsize = 128, 87 .dcache_bsize = 128,
88 .num_pmcs = 8, 88 .num_pmcs = 8,
89 .pmc_type = PPC_PMC_IBM,
89 .oprofile_cpu_type = "ppc64/power3", 90 .oprofile_cpu_type = "ppc64/power3",
90 .oprofile_type = PPC_OPROFILE_RS64, 91 .oprofile_type = PPC_OPROFILE_RS64,
91 .platform = "power3", 92 .platform = "power3",
@@ -99,6 +100,7 @@ static struct cpu_spec cpu_specs[] = {
99 .icache_bsize = 128, 100 .icache_bsize = 128,
100 .dcache_bsize = 128, 101 .dcache_bsize = 128,
101 .num_pmcs = 8, 102 .num_pmcs = 8,
103 .pmc_type = PPC_PMC_IBM,
102 .oprofile_cpu_type = "ppc64/power3", 104 .oprofile_cpu_type = "ppc64/power3",
103 .oprofile_type = PPC_OPROFILE_RS64, 105 .oprofile_type = PPC_OPROFILE_RS64,
104 .platform = "power3", 106 .platform = "power3",
@@ -112,6 +114,7 @@ static struct cpu_spec cpu_specs[] = {
112 .icache_bsize = 128, 114 .icache_bsize = 128,
113 .dcache_bsize = 128, 115 .dcache_bsize = 128,
114 .num_pmcs = 8, 116 .num_pmcs = 8,
117 .pmc_type = PPC_PMC_IBM,
115 .oprofile_cpu_type = "ppc64/rs64", 118 .oprofile_cpu_type = "ppc64/rs64",
116 .oprofile_type = PPC_OPROFILE_RS64, 119 .oprofile_type = PPC_OPROFILE_RS64,
117 .platform = "rs64", 120 .platform = "rs64",
@@ -125,6 +128,7 @@ static struct cpu_spec cpu_specs[] = {
125 .icache_bsize = 128, 128 .icache_bsize = 128,
126 .dcache_bsize = 128, 129 .dcache_bsize = 128,
127 .num_pmcs = 8, 130 .num_pmcs = 8,
131 .pmc_type = PPC_PMC_IBM,
128 .oprofile_cpu_type = "ppc64/rs64", 132 .oprofile_cpu_type = "ppc64/rs64",
129 .oprofile_type = PPC_OPROFILE_RS64, 133 .oprofile_type = PPC_OPROFILE_RS64,
130 .platform = "rs64", 134 .platform = "rs64",
@@ -138,6 +142,7 @@ static struct cpu_spec cpu_specs[] = {
138 .icache_bsize = 128, 142 .icache_bsize = 128,
139 .dcache_bsize = 128, 143 .dcache_bsize = 128,
140 .num_pmcs = 8, 144 .num_pmcs = 8,
145 .pmc_type = PPC_PMC_IBM,
141 .oprofile_cpu_type = "ppc64/rs64", 146 .oprofile_cpu_type = "ppc64/rs64",
142 .oprofile_type = PPC_OPROFILE_RS64, 147 .oprofile_type = PPC_OPROFILE_RS64,
143 .platform = "rs64", 148 .platform = "rs64",
@@ -151,6 +156,7 @@ static struct cpu_spec cpu_specs[] = {
151 .icache_bsize = 128, 156 .icache_bsize = 128,
152 .dcache_bsize = 128, 157 .dcache_bsize = 128,
153 .num_pmcs = 8, 158 .num_pmcs = 8,
159 .pmc_type = PPC_PMC_IBM,
154 .oprofile_cpu_type = "ppc64/rs64", 160 .oprofile_cpu_type = "ppc64/rs64",
155 .oprofile_type = PPC_OPROFILE_RS64, 161 .oprofile_type = PPC_OPROFILE_RS64,
156 .platform = "rs64", 162 .platform = "rs64",
@@ -164,6 +170,7 @@ static struct cpu_spec cpu_specs[] = {
164 .icache_bsize = 128, 170 .icache_bsize = 128,
165 .dcache_bsize = 128, 171 .dcache_bsize = 128,
166 .num_pmcs = 8, 172 .num_pmcs = 8,
173 .pmc_type = PPC_PMC_IBM,
167 .oprofile_cpu_type = "ppc64/power4", 174 .oprofile_cpu_type = "ppc64/power4",
168 .oprofile_type = PPC_OPROFILE_POWER4, 175 .oprofile_type = PPC_OPROFILE_POWER4,
169 .platform = "power4", 176 .platform = "power4",
@@ -177,6 +184,7 @@ static struct cpu_spec cpu_specs[] = {
177 .icache_bsize = 128, 184 .icache_bsize = 128,
178 .dcache_bsize = 128, 185 .dcache_bsize = 128,
179 .num_pmcs = 8, 186 .num_pmcs = 8,
187 .pmc_type = PPC_PMC_IBM,
180 .oprofile_cpu_type = "ppc64/power4", 188 .oprofile_cpu_type = "ppc64/power4",
181 .oprofile_type = PPC_OPROFILE_POWER4, 189 .oprofile_type = PPC_OPROFILE_POWER4,
182 .platform = "power4", 190 .platform = "power4",
@@ -191,6 +199,7 @@ static struct cpu_spec cpu_specs[] = {
191 .icache_bsize = 128, 199 .icache_bsize = 128,
192 .dcache_bsize = 128, 200 .dcache_bsize = 128,
193 .num_pmcs = 8, 201 .num_pmcs = 8,
202 .pmc_type = PPC_PMC_IBM,
194 .cpu_setup = __setup_cpu_ppc970, 203 .cpu_setup = __setup_cpu_ppc970,
195 .cpu_restore = __restore_cpu_ppc970, 204 .cpu_restore = __restore_cpu_ppc970,
196 .oprofile_cpu_type = "ppc64/970", 205 .oprofile_cpu_type = "ppc64/970",
@@ -207,6 +216,7 @@ static struct cpu_spec cpu_specs[] = {
207 .icache_bsize = 128, 216 .icache_bsize = 128,
208 .dcache_bsize = 128, 217 .dcache_bsize = 128,
209 .num_pmcs = 8, 218 .num_pmcs = 8,
219 .pmc_type = PPC_PMC_IBM,
210 .cpu_setup = __setup_cpu_ppc970, 220 .cpu_setup = __setup_cpu_ppc970,
211 .cpu_restore = __restore_cpu_ppc970, 221 .cpu_restore = __restore_cpu_ppc970,
212 .oprofile_cpu_type = "ppc64/970", 222 .oprofile_cpu_type = "ppc64/970",
@@ -239,6 +249,7 @@ static struct cpu_spec cpu_specs[] = {
239 .icache_bsize = 128, 249 .icache_bsize = 128,
240 .dcache_bsize = 128, 250 .dcache_bsize = 128,
241 .num_pmcs = 8, 251 .num_pmcs = 8,
252 .pmc_type = PPC_PMC_IBM,
242 .cpu_setup = __setup_cpu_ppc970, 253 .cpu_setup = __setup_cpu_ppc970,
243 .oprofile_cpu_type = "ppc64/970", 254 .oprofile_cpu_type = "ppc64/970",
244 .oprofile_type = PPC_OPROFILE_POWER4, 255 .oprofile_type = PPC_OPROFILE_POWER4,
@@ -253,6 +264,7 @@ static struct cpu_spec cpu_specs[] = {
253 .icache_bsize = 128, 264 .icache_bsize = 128,
254 .dcache_bsize = 128, 265 .dcache_bsize = 128,
255 .num_pmcs = 6, 266 .num_pmcs = 6,
267 .pmc_type = PPC_PMC_IBM,
256 .oprofile_cpu_type = "ppc64/power5", 268 .oprofile_cpu_type = "ppc64/power5",
257 .oprofile_type = PPC_OPROFILE_POWER4, 269 .oprofile_type = PPC_OPROFILE_POWER4,
258 /* SIHV / SIPR bits are implemented on POWER4+ (GQ) 270 /* SIHV / SIPR bits are implemented on POWER4+ (GQ)
@@ -271,6 +283,7 @@ static struct cpu_spec cpu_specs[] = {
271 .icache_bsize = 128, 283 .icache_bsize = 128,
272 .dcache_bsize = 128, 284 .dcache_bsize = 128,
273 .num_pmcs = 6, 285 .num_pmcs = 6,
286 .pmc_type = PPC_PMC_IBM,
274 .oprofile_cpu_type = "ppc64/power5+", 287 .oprofile_cpu_type = "ppc64/power5+",
275 .oprofile_type = PPC_OPROFILE_POWER4, 288 .oprofile_type = PPC_OPROFILE_POWER4,
276 .oprofile_mmcra_sihv = MMCRA_SIHV, 289 .oprofile_mmcra_sihv = MMCRA_SIHV,
@@ -321,6 +334,7 @@ static struct cpu_spec cpu_specs[] = {
321 .icache_bsize = 128, 334 .icache_bsize = 128,
322 .dcache_bsize = 128, 335 .dcache_bsize = 128,
323 .num_pmcs = 6, 336 .num_pmcs = 6,
337 .pmc_type = PPC_PMC_IBM,
324 .oprofile_cpu_type = "ppc64/power6", 338 .oprofile_cpu_type = "ppc64/power6",
325 .oprofile_type = PPC_OPROFILE_POWER4, 339 .oprofile_type = PPC_OPROFILE_POWER4,
326 .oprofile_mmcra_sihv = POWER6_MMCRA_SIHV, 340 .oprofile_mmcra_sihv = POWER6_MMCRA_SIHV,
@@ -340,6 +354,7 @@ static struct cpu_spec cpu_specs[] = {
340 .icache_bsize = 128, 354 .icache_bsize = 128,
341 .dcache_bsize = 128, 355 .dcache_bsize = 128,
342 .num_pmcs = 4, 356 .num_pmcs = 4,
357 .pmc_type = PPC_PMC_IBM,
343 .oprofile_cpu_type = "ppc64/cell-be", 358 .oprofile_cpu_type = "ppc64/cell-be",
344 .oprofile_type = PPC_OPROFILE_CELL, 359 .oprofile_type = PPC_OPROFILE_CELL,
345 .platform = "ppc-cell-be", 360 .platform = "ppc-cell-be",
@@ -353,6 +368,7 @@ static struct cpu_spec cpu_specs[] = {
353 .icache_bsize = 64, 368 .icache_bsize = 64,
354 .dcache_bsize = 64, 369 .dcache_bsize = 64,
355 .num_pmcs = 6, 370 .num_pmcs = 6,
371 .pmc_type = PPC_PMC_PA6T,
356 .platform = "pa6t", 372 .platform = "pa6t",
357 }, 373 },
358 { /* default match */ 374 { /* default match */
@@ -364,6 +380,7 @@ static struct cpu_spec cpu_specs[] = {
364 .icache_bsize = 128, 380 .icache_bsize = 128,
365 .dcache_bsize = 128, 381 .dcache_bsize = 128,
366 .num_pmcs = 6, 382 .num_pmcs = 6,
383 .pmc_type = PPC_PMC_IBM,
367 .platform = "power4", 384 .platform = "power4",
368 } 385 }
369#endif /* CONFIG_PPC64 */ 386#endif /* CONFIG_PPC64 */
diff --git a/arch/powerpc/kernel/pmc.c b/arch/powerpc/kernel/pmc.c
index 3d8f6f44641e..e40f6ddd98a4 100644
--- a/arch/powerpc/kernel/pmc.c
+++ b/arch/powerpc/kernel/pmc.c
@@ -19,38 +19,21 @@
19#include <asm/processor.h> 19#include <asm/processor.h>
20#include <asm/pmc.h> 20#include <asm/pmc.h>
21 21
22#if defined(CONFIG_FSL_BOOKE) && !defined(CONFIG_E200) 22#ifndef MMCR0_PMA0
23static void dummy_perf(struct pt_regs *regs) 23#define MMCR0_PMA0 0
24{
25 unsigned int pmgc0 = mfpmr(PMRN_PMGC0);
26
27 pmgc0 &= ~PMGC0_PMIE;
28 mtpmr(PMRN_PMGC0, pmgc0);
29}
30#elif defined(CONFIG_PPC64) || defined(CONFIG_6xx)
31
32#ifndef MMCR0_PMAO
33#define MMCR0_PMAO 0
34#endif 24#endif
35 25
36/* Ensure exceptions are disabled */
37static void dummy_perf(struct pt_regs *regs) 26static void dummy_perf(struct pt_regs *regs)
38{ 27{
39 unsigned int mmcr0 = mfspr(SPRN_MMCR0); 28#if defined(CONFIG_FSL_BOOKE) && !defined(CONFIG_E200)
40 29 mtpmr(PMRN_PMGC0, mfpmr(PMRN_PMGC0) & ~PMGC0_PMIE);
41 mmcr0 &= ~(MMCR0_PMXE|MMCR0_PMAO); 30#elif defined(CONFIG_PPC64) || defined(CONFIG_6xx)
42 mtspr(SPRN_MMCR0, mmcr0); 31 mtspr(SPRN_MMCR0, mfspr(SPRN_MMCR0) & ~(MMCR0_PMXE|MMCR0_PMA0));
43}
44#else 32#else
45/* Ensure exceptions are disabled */ 33 mtspr(SPRN_MMCR0, mfspr(SPRN_MMCR0) & ~MMCR0_PMXE);
46static void dummy_perf(struct pt_regs *regs)
47{
48 unsigned int mmcr0 = mfspr(SPRN_MMCR0);
49
50 mmcr0 &= ~(MMCR0_PMXE);
51 mtspr(SPRN_MMCR0, mmcr0);
52}
53#endif 34#endif
35}
36
54 37
55static DEFINE_SPINLOCK(pmc_owner_lock); 38static DEFINE_SPINLOCK(pmc_owner_lock);
56static void *pmc_owner_caller; /* mostly for debugging */ 39static void *pmc_owner_caller; /* mostly for debugging */