Commit 8fef0306f9164d4bfd0befb62e63e4d1167681b5

Authored by Anton Blanchard
Committed by Paul Mackerras
1 parent dca859329c

[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>

Showing 3 changed files with 23 additions and 37 deletions Side-by-side Diff

arch/ppc64/kernel/cputable.c
... ... @@ -19,6 +19,7 @@
19 19 #include <linux/init.h>
20 20 #include <linux/module.h>
21 21  
  22 +#include <asm/oprofile_impl.h>
22 23 #include <asm/cputable.h>
23 24  
24 25 struct cpu_spec* cur_cpu_spec = NULL;
... ... @@ -61,6 +62,7 @@
61 62 .num_pmcs = 8,
62 63 .cpu_setup = __setup_cpu_power3,
63 64 .oprofile_cpu_type = "ppc64/power3",
  65 + .oprofile_model = &op_model_rs64,
64 66 },
65 67 { /* Power3+ */
66 68 .pvr_mask = 0xffff0000,
... ... @@ -74,6 +76,7 @@
74 76 .num_pmcs = 8,
75 77 .cpu_setup = __setup_cpu_power3,
76 78 .oprofile_cpu_type = "ppc64/power3",
  79 + .oprofile_model = &op_model_rs64,
77 80 },
78 81 { /* Northstar */
79 82 .pvr_mask = 0xffff0000,
... ... @@ -88,6 +91,7 @@
88 91 .num_pmcs = 8,
89 92 .cpu_setup = __setup_cpu_power3,
90 93 .oprofile_cpu_type = "ppc64/rs64",
  94 + .oprofile_model = &op_model_rs64,
91 95 },
92 96 { /* Pulsar */
93 97 .pvr_mask = 0xffff0000,
... ... @@ -102,6 +106,7 @@
102 106 .num_pmcs = 8,
103 107 .cpu_setup = __setup_cpu_power3,
104 108 .oprofile_cpu_type = "ppc64/rs64",
  109 + .oprofile_model = &op_model_rs64,
105 110 },
106 111 { /* I-star */
107 112 .pvr_mask = 0xffff0000,
... ... @@ -116,6 +121,7 @@
116 121 .num_pmcs = 8,
117 122 .cpu_setup = __setup_cpu_power3,
118 123 .oprofile_cpu_type = "ppc64/rs64",
  124 + .oprofile_model = &op_model_rs64,
119 125 },
120 126 { /* S-star */
121 127 .pvr_mask = 0xffff0000,
... ... @@ -130,6 +136,7 @@
130 136 .num_pmcs = 8,
131 137 .cpu_setup = __setup_cpu_power3,
132 138 .oprofile_cpu_type = "ppc64/rs64",
  139 + .oprofile_model = &op_model_rs64,
133 140 },
134 141 { /* Power4 */
135 142 .pvr_mask = 0xffff0000,
... ... @@ -144,6 +151,7 @@
144 151 .num_pmcs = 8,
145 152 .cpu_setup = __setup_cpu_power4,
146 153 .oprofile_cpu_type = "ppc64/power4",
  154 + .oprofile_model = &op_model_rs64,
147 155 },
148 156 { /* Power4+ */
149 157 .pvr_mask = 0xffff0000,
... ... @@ -158,6 +166,7 @@
158 166 .num_pmcs = 8,
159 167 .cpu_setup = __setup_cpu_power4,
160 168 .oprofile_cpu_type = "ppc64/power4",
  169 + .oprofile_model = &op_model_power4,
161 170 },
162 171 { /* PPC970 */
163 172 .pvr_mask = 0xffff0000,
... ... @@ -174,6 +183,7 @@
174 183 .num_pmcs = 8,
175 184 .cpu_setup = __setup_cpu_ppc970,
176 185 .oprofile_cpu_type = "ppc64/970",
  186 + .oprofile_model = &op_model_power4,
177 187 },
178 188 { /* PPC970FX */
179 189 .pvr_mask = 0xffff0000,
... ... @@ -190,6 +200,7 @@
190 200 .num_pmcs = 8,
191 201 .cpu_setup = __setup_cpu_ppc970,
192 202 .oprofile_cpu_type = "ppc64/970",
  203 + .oprofile_model = &op_model_power4,
193 204 },
194 205 { /* PPC970MP */
195 206 .pvr_mask = 0xffff0000,
... ... @@ -205,6 +216,7 @@
205 216 .dcache_bsize = 128,
206 217 .cpu_setup = __setup_cpu_ppc970,
207 218 .oprofile_cpu_type = "ppc64/970",
  219 + .oprofile_model = &op_model_power4,
208 220 },
209 221 { /* Power5 */
210 222 .pvr_mask = 0xffff0000,
... ... @@ -221,6 +233,7 @@
221 233 .num_pmcs = 6,
222 234 .cpu_setup = __setup_cpu_power4,
223 235 .oprofile_cpu_type = "ppc64/power5",
  236 + .oprofile_model = &op_model_power4,
224 237 },
225 238 { /* Power5 */
226 239 .pvr_mask = 0xffff0000,
... ... @@ -237,6 +250,7 @@
237 250 .num_pmcs = 6,
238 251 .cpu_setup = __setup_cpu_power4,
239 252 .oprofile_cpu_type = "ppc64/power5",
  253 + .oprofile_model = &op_model_power4,
240 254 },
241 255 { /* BE DD1.x */
242 256 .pvr_mask = 0xffff0000,
arch/ppc64/oprofile/common.c
... ... @@ -121,45 +121,13 @@
121 121  
122 122 int __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 + return -ENODEV;
125 126  
126   - pvr = mfspr(SPRN_PVR);
  127 + model = cur_cpu_spec->oprofile_model;
  128 + model->num_counters = cur_cpu_spec->num_pmcs;
127 129  
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   -
161 130 ops->cpu_type = cur_cpu_spec->oprofile_cpu_type;
162   - model->num_counters = cur_cpu_spec->num_pmcs;
163 131 ops->create_files = op_ppc64_create_files;
164 132 ops->setup = op_ppc64_setup;
165 133 ops->shutdown = op_ppc64_shutdown;
include/asm-ppc64/cputable.h
... ... @@ -36,6 +36,7 @@
36 36 * via the mkdefs mechanism.
37 37 */
38 38 struct cpu_spec;
  39 +struct op_ppc64_model;
39 40  
40 41 typedef void (*cpu_setup_t)(unsigned long offset, struct cpu_spec* spec);
41 42  
... ... @@ -62,6 +63,9 @@
62 63  
63 64 /* Used by oprofile userspace to select the right counters */
64 65 char *oprofile_cpu_type;
  66 +
  67 + /* Processor specific oprofile operations */
  68 + struct op_ppc64_model *oprofile_model;
65 69 };
66 70  
67 71 extern struct cpu_spec cpu_specs[];