aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnton Blanchard <anton@samba.org>2005-09-06 00:57:52 -0400
committerPaul Mackerras <paulus@samba.org>2005-09-06 02:09:21 -0400
commit8fef0306f9164d4bfd0befb62e63e4d1167681b5 (patch)
tree55158562dbbe4a9e16f9f5e600c2b7fcee21d38b
parentdca859329cee9b4cf02c8b7cb805b49973292ed2 (diff)
[PATCH] ppc64: Move oprofile_model into cpu feature struct
Move oprofile_model into cpu feature struct. Signed-off-by: Anton Blanchard <anton@samba.org> Signed-off-by: Paul Mackerras <paulus@samba.org>
-rw-r--r--arch/ppc64/kernel/cputable.c14
-rw-r--r--arch/ppc64/oprofile/common.c42
-rw-r--r--include/asm-ppc64/cputable.h4
3 files changed, 23 insertions, 37 deletions
diff --git a/arch/ppc64/kernel/cputable.c b/arch/ppc64/kernel/cputable.c
index c022ec4d1e91..a18aa383f120 100644
--- a/arch/ppc64/kernel/cputable.c
+++ b/arch/ppc64/kernel/cputable.c
@@ -19,6 +19,7 @@
19#include <linux/init.h> 19#include <linux/init.h>
20#include <linux/module.h> 20#include <linux/module.h>
21 21
22#include <asm/oprofile_impl.h>
22#include <asm/cputable.h> 23#include <asm/cputable.h>
23 24
24struct cpu_spec* cur_cpu_spec = NULL; 25struct cpu_spec* cur_cpu_spec = NULL;
@@ -61,6 +62,7 @@ struct cpu_spec cpu_specs[] = {
61 .num_pmcs = 8, 62 .num_pmcs = 8,
62 .cpu_setup = __setup_cpu_power3, 63 .cpu_setup = __setup_cpu_power3,
63 .oprofile_cpu_type = "ppc64/power3", 64 .oprofile_cpu_type = "ppc64/power3",
65 .oprofile_model = &op_model_rs64,
64 }, 66 },
65 { /* Power3+ */ 67 { /* Power3+ */
66 .pvr_mask = 0xffff0000, 68 .pvr_mask = 0xffff0000,
@@ -74,6 +76,7 @@ struct cpu_spec cpu_specs[] = {
74 .num_pmcs = 8, 76 .num_pmcs = 8,
75 .cpu_setup = __setup_cpu_power3, 77 .cpu_setup = __setup_cpu_power3,
76 .oprofile_cpu_type = "ppc64/power3", 78 .oprofile_cpu_type = "ppc64/power3",
79 .oprofile_model = &op_model_rs64,
77 }, 80 },
78 { /* Northstar */ 81 { /* Northstar */
79 .pvr_mask = 0xffff0000, 82 .pvr_mask = 0xffff0000,
@@ -88,6 +91,7 @@ struct cpu_spec cpu_specs[] = {
88 .num_pmcs = 8, 91 .num_pmcs = 8,
89 .cpu_setup = __setup_cpu_power3, 92 .cpu_setup = __setup_cpu_power3,
90 .oprofile_cpu_type = "ppc64/rs64", 93 .oprofile_cpu_type = "ppc64/rs64",
94 .oprofile_model = &op_model_rs64,
91 }, 95 },
92 { /* Pulsar */ 96 { /* Pulsar */
93 .pvr_mask = 0xffff0000, 97 .pvr_mask = 0xffff0000,
@@ -102,6 +106,7 @@ struct cpu_spec cpu_specs[] = {
102 .num_pmcs = 8, 106 .num_pmcs = 8,
103 .cpu_setup = __setup_cpu_power3, 107 .cpu_setup = __setup_cpu_power3,
104 .oprofile_cpu_type = "ppc64/rs64", 108 .oprofile_cpu_type = "ppc64/rs64",
109 .oprofile_model = &op_model_rs64,
105 }, 110 },
106 { /* I-star */ 111 { /* I-star */
107 .pvr_mask = 0xffff0000, 112 .pvr_mask = 0xffff0000,
@@ -116,6 +121,7 @@ struct cpu_spec cpu_specs[] = {
116 .num_pmcs = 8, 121 .num_pmcs = 8,
117 .cpu_setup = __setup_cpu_power3, 122 .cpu_setup = __setup_cpu_power3,
118 .oprofile_cpu_type = "ppc64/rs64", 123 .oprofile_cpu_type = "ppc64/rs64",
124 .oprofile_model = &op_model_rs64,
119 }, 125 },
120 { /* S-star */ 126 { /* S-star */
121 .pvr_mask = 0xffff0000, 127 .pvr_mask = 0xffff0000,
@@ -130,6 +136,7 @@ struct cpu_spec cpu_specs[] = {
130 .num_pmcs = 8, 136 .num_pmcs = 8,
131 .cpu_setup = __setup_cpu_power3, 137 .cpu_setup = __setup_cpu_power3,
132 .oprofile_cpu_type = "ppc64/rs64", 138 .oprofile_cpu_type = "ppc64/rs64",
139 .oprofile_model = &op_model_rs64,
133 }, 140 },
134 { /* Power4 */ 141 { /* Power4 */
135 .pvr_mask = 0xffff0000, 142 .pvr_mask = 0xffff0000,
@@ -144,6 +151,7 @@ struct cpu_spec cpu_specs[] = {
144 .num_pmcs = 8, 151 .num_pmcs = 8,
145 .cpu_setup = __setup_cpu_power4, 152 .cpu_setup = __setup_cpu_power4,
146 .oprofile_cpu_type = "ppc64/power4", 153 .oprofile_cpu_type = "ppc64/power4",
154 .oprofile_model = &op_model_rs64,
147 }, 155 },
148 { /* Power4+ */ 156 { /* Power4+ */
149 .pvr_mask = 0xffff0000, 157 .pvr_mask = 0xffff0000,
@@ -158,6 +166,7 @@ struct cpu_spec cpu_specs[] = {
158 .num_pmcs = 8, 166 .num_pmcs = 8,
159 .cpu_setup = __setup_cpu_power4, 167 .cpu_setup = __setup_cpu_power4,
160 .oprofile_cpu_type = "ppc64/power4", 168 .oprofile_cpu_type = "ppc64/power4",
169 .oprofile_model = &op_model_power4,
161 }, 170 },
162 { /* PPC970 */ 171 { /* PPC970 */
163 .pvr_mask = 0xffff0000, 172 .pvr_mask = 0xffff0000,
@@ -174,6 +183,7 @@ struct cpu_spec cpu_specs[] = {
174 .num_pmcs = 8, 183 .num_pmcs = 8,
175 .cpu_setup = __setup_cpu_ppc970, 184 .cpu_setup = __setup_cpu_ppc970,
176 .oprofile_cpu_type = "ppc64/970", 185 .oprofile_cpu_type = "ppc64/970",
186 .oprofile_model = &op_model_power4,
177 }, 187 },
178 { /* PPC970FX */ 188 { /* PPC970FX */
179 .pvr_mask = 0xffff0000, 189 .pvr_mask = 0xffff0000,
@@ -190,6 +200,7 @@ struct cpu_spec cpu_specs[] = {
190 .num_pmcs = 8, 200 .num_pmcs = 8,
191 .cpu_setup = __setup_cpu_ppc970, 201 .cpu_setup = __setup_cpu_ppc970,
192 .oprofile_cpu_type = "ppc64/970", 202 .oprofile_cpu_type = "ppc64/970",
203 .oprofile_model = &op_model_power4,
193 }, 204 },
194 { /* PPC970MP */ 205 { /* PPC970MP */
195 .pvr_mask = 0xffff0000, 206 .pvr_mask = 0xffff0000,
@@ -205,6 +216,7 @@ struct cpu_spec cpu_specs[] = {
205 .dcache_bsize = 128, 216 .dcache_bsize = 128,
206 .cpu_setup = __setup_cpu_ppc970, 217 .cpu_setup = __setup_cpu_ppc970,
207 .oprofile_cpu_type = "ppc64/970", 218 .oprofile_cpu_type = "ppc64/970",
219 .oprofile_model = &op_model_power4,
208 }, 220 },
209 { /* Power5 */ 221 { /* Power5 */
210 .pvr_mask = 0xffff0000, 222 .pvr_mask = 0xffff0000,
@@ -221,6 +233,7 @@ struct cpu_spec cpu_specs[] = {
221 .num_pmcs = 6, 233 .num_pmcs = 6,
222 .cpu_setup = __setup_cpu_power4, 234 .cpu_setup = __setup_cpu_power4,
223 .oprofile_cpu_type = "ppc64/power5", 235 .oprofile_cpu_type = "ppc64/power5",
236 .oprofile_model = &op_model_power4,
224 }, 237 },
225 { /* Power5 */ 238 { /* Power5 */
226 .pvr_mask = 0xffff0000, 239 .pvr_mask = 0xffff0000,
@@ -237,6 +250,7 @@ struct cpu_spec cpu_specs[] = {
237 .num_pmcs = 6, 250 .num_pmcs = 6,
238 .cpu_setup = __setup_cpu_power4, 251 .cpu_setup = __setup_cpu_power4,
239 .oprofile_cpu_type = "ppc64/power5", 252 .oprofile_cpu_type = "ppc64/power5",
253 .oprofile_model = &op_model_power4,
240 }, 254 },
241 { /* BE DD1.x */ 255 { /* BE DD1.x */
242 .pvr_mask = 0xffff0000, 256 .pvr_mask = 0xffff0000,
diff --git a/arch/ppc64/oprofile/common.c b/arch/ppc64/oprofile/common.c
index 3e8daabf1021..e5f572710aa0 100644
--- a/arch/ppc64/oprofile/common.c
+++ b/arch/ppc64/oprofile/common.c
@@ -121,45 +121,13 @@ static int op_ppc64_create_files(struct super_block *sb, struct dentry *root)
121 121
122int __init oprofile_arch_init(struct oprofile_operations *ops) 122int __init oprofile_arch_init(struct oprofile_operations *ops)
123{ 123{
124 unsigned int pvr; 124 if (!cur_cpu_spec->oprofile_model || !cur_cpu_spec->oprofile_cpu_type)
125 125 return -ENODEV;
126 pvr = mfspr(SPRN_PVR);
127
128 switch (PVR_VER(pvr)) {
129 case PV_630:
130 case PV_630p:
131 model = &op_model_rs64;
132 break;
133
134 case PV_NORTHSTAR:
135 case PV_PULSAR:
136 case PV_ICESTAR:
137 case PV_SSTAR:
138 model = &op_model_rs64;
139 break;
140
141 case PV_POWER4:
142 case PV_POWER4p:
143 model = &op_model_power4;
144 break;
145
146 case PV_970:
147 case PV_970FX:
148 case PV_970MP:
149 model = &op_model_power4;
150 break;
151
152 case PV_POWER5:
153 case PV_POWER5p:
154 model = &op_model_power4;
155 break;
156
157 default:
158 return -ENODEV;
159 }
160 126
161 ops->cpu_type = cur_cpu_spec->oprofile_cpu_type; 127 model = cur_cpu_spec->oprofile_model;
162 model->num_counters = cur_cpu_spec->num_pmcs; 128 model->num_counters = cur_cpu_spec->num_pmcs;
129
130 ops->cpu_type = cur_cpu_spec->oprofile_cpu_type;
163 ops->create_files = op_ppc64_create_files; 131 ops->create_files = op_ppc64_create_files;
164 ops->setup = op_ppc64_setup; 132 ops->setup = op_ppc64_setup;
165 ops->shutdown = op_ppc64_shutdown; 133 ops->shutdown = op_ppc64_shutdown;
diff --git a/include/asm-ppc64/cputable.h b/include/asm-ppc64/cputable.h
index 445727ae2baa..acc9b4d6c168 100644
--- a/include/asm-ppc64/cputable.h
+++ b/include/asm-ppc64/cputable.h
@@ -36,6 +36,7 @@
36 * via the mkdefs mechanism. 36 * via the mkdefs mechanism.
37 */ 37 */
38struct cpu_spec; 38struct cpu_spec;
39struct op_ppc64_model;
39 40
40typedef void (*cpu_setup_t)(unsigned long offset, struct cpu_spec* spec); 41typedef void (*cpu_setup_t)(unsigned long offset, struct cpu_spec* spec);
41 42
@@ -62,6 +63,9 @@ struct cpu_spec {
62 63
63 /* Used by oprofile userspace to select the right counters */ 64 /* Used by oprofile userspace to select the right counters */
64 char *oprofile_cpu_type; 65 char *oprofile_cpu_type;
66
67 /* Processor specific oprofile operations */
68 struct op_ppc64_model *oprofile_model;
65}; 69};
66 70
67extern struct cpu_spec cpu_specs[]; 71extern struct cpu_spec cpu_specs[];