Commit 7a6af5e38054d8e658a4b1b703902331a845de1a

Authored by Stephen Rothwell
Committed by Paul Mackerras
1 parent 6fbb49d56d

[PATCH] ppc64: remove firmware features from cpu_spec

The firmware_features field of struct cpu_spec should really be a separate
variable as the firmware features do not depend on the chip and the
bitmask is constructed independently.  By removing it, we save 112 bytes
from the cpu_specs array and we access the bitmask directly instead of via
the cur_cpu_spec pointer.

Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Paul Mackerras <paulus@samba.org>

Showing 9 changed files with 19 additions and 33 deletions Side-by-side Diff

arch/ppc64/kernel/cputable.c
... ... @@ -23,6 +23,7 @@
23 23  
24 24 struct cpu_spec* cur_cpu_spec = NULL;
25 25 EXPORT_SYMBOL(cur_cpu_spec);
  26 +unsigned long ppc64_firmware_features;
26 27  
27 28 /* NOTE:
28 29 * Unlike ppc32, ppc64 will only call this once for the boot CPU, it's
... ... @@ -60,7 +61,6 @@
60 61 .icache_bsize = 128,
61 62 .dcache_bsize = 128,
62 63 .cpu_setup = __setup_cpu_power3,
63   - .firmware_features = COMMON_PPC64_FW,
64 64 },
65 65 { /* Power3+ */
66 66 .pvr_mask = 0xffff0000,
... ... @@ -73,7 +73,6 @@
73 73 .icache_bsize = 128,
74 74 .dcache_bsize = 128,
75 75 .cpu_setup = __setup_cpu_power3,
76   - .firmware_features = COMMON_PPC64_FW,
77 76 },
78 77 { /* Northstar */
79 78 .pvr_mask = 0xffff0000,
... ... @@ -86,7 +85,6 @@
86 85 .icache_bsize = 128,
87 86 .dcache_bsize = 128,
88 87 .cpu_setup = __setup_cpu_power3,
89   - .firmware_features = COMMON_PPC64_FW,
90 88 },
91 89 { /* Pulsar */
92 90 .pvr_mask = 0xffff0000,
... ... @@ -99,7 +97,6 @@
99 97 .icache_bsize = 128,
100 98 .dcache_bsize = 128,
101 99 .cpu_setup = __setup_cpu_power3,
102   - .firmware_features = COMMON_PPC64_FW,
103 100 },
104 101 { /* I-star */
105 102 .pvr_mask = 0xffff0000,
... ... @@ -112,7 +109,6 @@
112 109 .icache_bsize = 128,
113 110 .dcache_bsize = 128,
114 111 .cpu_setup = __setup_cpu_power3,
115   - .firmware_features = COMMON_PPC64_FW,
116 112 },
117 113 { /* S-star */
118 114 .pvr_mask = 0xffff0000,
... ... @@ -125,7 +121,6 @@
125 121 .icache_bsize = 128,
126 122 .dcache_bsize = 128,
127 123 .cpu_setup = __setup_cpu_power3,
128   - .firmware_features = COMMON_PPC64_FW,
129 124 },
130 125 { /* Power4 */
131 126 .pvr_mask = 0xffff0000,
... ... @@ -138,7 +133,6 @@
138 133 .icache_bsize = 128,
139 134 .dcache_bsize = 128,
140 135 .cpu_setup = __setup_cpu_power4,
141   - .firmware_features = COMMON_PPC64_FW,
142 136 },
143 137 { /* Power4+ */
144 138 .pvr_mask = 0xffff0000,
... ... @@ -151,7 +145,6 @@
151 145 .icache_bsize = 128,
152 146 .dcache_bsize = 128,
153 147 .cpu_setup = __setup_cpu_power4,
154   - .firmware_features = COMMON_PPC64_FW,
155 148 },
156 149 { /* PPC970 */
157 150 .pvr_mask = 0xffff0000,
... ... @@ -166,7 +159,6 @@
166 159 .icache_bsize = 128,
167 160 .dcache_bsize = 128,
168 161 .cpu_setup = __setup_cpu_ppc970,
169   - .firmware_features = COMMON_PPC64_FW,
170 162 },
171 163 { /* PPC970FX */
172 164 .pvr_mask = 0xffff0000,
... ... @@ -181,7 +173,6 @@
181 173 .icache_bsize = 128,
182 174 .dcache_bsize = 128,
183 175 .cpu_setup = __setup_cpu_ppc970,
184   - .firmware_features = COMMON_PPC64_FW,
185 176 },
186 177 { /* PPC970MP */
187 178 .pvr_mask = 0xffff0000,
... ... @@ -196,7 +187,6 @@
196 187 .icache_bsize = 128,
197 188 .dcache_bsize = 128,
198 189 .cpu_setup = __setup_cpu_ppc970,
199   - .firmware_features = COMMON_PPC64_FW,
200 190 },
201 191 { /* Power5 */
202 192 .pvr_mask = 0xffff0000,
... ... @@ -211,7 +201,6 @@
211 201 .icache_bsize = 128,
212 202 .dcache_bsize = 128,
213 203 .cpu_setup = __setup_cpu_power4,
214   - .firmware_features = COMMON_PPC64_FW,
215 204 },
216 205 { /* Power5 */
217 206 .pvr_mask = 0xffff0000,
... ... @@ -226,7 +215,6 @@
226 215 .icache_bsize = 128,
227 216 .dcache_bsize = 128,
228 217 .cpu_setup = __setup_cpu_power4,
229   - .firmware_features = COMMON_PPC64_FW,
230 218 },
231 219 { /* BE DD1.x */
232 220 .pvr_mask = 0xffff0000,
... ... @@ -241,7 +229,6 @@
241 229 .icache_bsize = 128,
242 230 .dcache_bsize = 128,
243 231 .cpu_setup = __setup_cpu_be,
244   - .firmware_features = COMMON_PPC64_FW,
245 232 },
246 233 { /* default match */
247 234 .pvr_mask = 0x00000000,
... ... @@ -254,7 +241,6 @@
254 241 .icache_bsize = 128,
255 242 .dcache_bsize = 128,
256 243 .cpu_setup = __setup_cpu_power4,
257   - .firmware_features = COMMON_PPC64_FW,
258 244 }
259 245 };
260 246  
arch/ppc64/kernel/lparcfg.c
... ... @@ -377,7 +377,7 @@
377 377  
378 378 partition_active_processors = lparcfg_count_active_processors();
379 379  
380   - if (cur_cpu_spec->firmware_features & FW_FEATURE_SPLPAR) {
  380 + if (ppc64_firmware_features & FW_FEATURE_SPLPAR) {
381 381 unsigned long h_entitled, h_unallocated;
382 382 unsigned long h_aggregation, h_resource;
383 383 unsigned long pool_idle_time, pool_procs;
... ... @@ -571,7 +571,7 @@
571 571 mode_t mode = S_IRUSR;
572 572  
573 573 /* Allow writing if we have FW_FEATURE_SPLPAR */
574   - if (cur_cpu_spec->firmware_features & FW_FEATURE_SPLPAR) {
  574 + if (ppc64_firmware_features & FW_FEATURE_SPLPAR) {
575 575 lparcfg_fops.write = lparcfg_write;
576 576 mode |= S_IWUSR;
577 577 }
arch/ppc64/kernel/pSeries_iommu.c
... ... @@ -546,7 +546,7 @@
546 546 }
547 547  
548 548 if (systemcfg->platform & PLATFORM_LPAR) {
549   - if (cur_cpu_spec->firmware_features & FW_FEATURE_MULTITCE) {
  549 + if (ppc64_firmware_features & FW_FEATURE_MULTITCE) {
550 550 ppc_md.tce_build = tce_buildmulti_pSeriesLP;
551 551 ppc_md.tce_free = tce_freemulti_pSeriesLP;
552 552 } else {
arch/ppc64/kernel/pSeries_setup.c
... ... @@ -231,11 +231,11 @@
231 231  
232 232 pSeries_nvram_init();
233 233  
234   - if (cur_cpu_spec->firmware_features & FW_FEATURE_SPLPAR)
  234 + if (ppc64_firmware_features & FW_FEATURE_SPLPAR)
235 235 vpa_init(boot_cpuid);
236 236  
237 237 /* Choose an idle loop */
238   - if (cur_cpu_spec->firmware_features & FW_FEATURE_SPLPAR) {
  238 + if (ppc64_firmware_features & FW_FEATURE_SPLPAR) {
239 239 if (get_paca()->lppaca.shared_proc) {
240 240 printk(KERN_INFO "Using shared processor idle loop\n");
241 241 ppc_md.idle_loop = pseries_shared_idle;
... ... @@ -260,7 +260,7 @@
260 260 arch_initcall(pSeries_init_panel);
261 261  
262 262  
263   -/* Build up the firmware_features bitmask field
  263 +/* Build up the ppc64_firmware_features bitmask field
264 264 * using contents of device-tree/ibm,hypertas-functions.
265 265 * Ultimately this functionality may be moved into prom.c prom_init().
266 266 */
... ... @@ -272,7 +272,7 @@
272 272  
273 273 DBG(" -> fw_feature_init()\n");
274 274  
275   - cur_cpu_spec->firmware_features = 0;
  275 + ppc64_firmware_features = 0;
276 276 dn = of_find_node_by_path("/rtas");
277 277 if (dn == NULL) {
278 278 printk(KERN_ERR "WARNING ! Cannot find RTAS in device-tree !\n");
... ... @@ -288,7 +288,7 @@
288 288 if ((firmware_features_table[i].name) &&
289 289 (strcmp(firmware_features_table[i].name,hypertas))==0) {
290 290 /* we have a match */
291   - cur_cpu_spec->firmware_features |=
  291 + ppc64_firmware_features |=
292 292 (firmware_features_table[i].val);
293 293 break;
294 294 }
... ... @@ -302,7 +302,7 @@
302 302 of_node_put(dn);
303 303 no_rtas:
304 304 printk(KERN_INFO "firmware_features = 0x%lx\n",
305   - cur_cpu_spec->firmware_features);
  305 + ppc64_firmware_features);
306 306  
307 307 DBG(" <- fw_feature_init()\n");
308 308 }
arch/ppc64/kernel/pSeries_smp.c
... ... @@ -326,7 +326,7 @@
326 326 if (cpu != boot_cpuid)
327 327 xics_setup_cpu();
328 328  
329   - if (cur_cpu_spec->firmware_features & FW_FEATURE_SPLPAR)
  329 + if (ppc64_firmware_features & FW_FEATURE_SPLPAR)
330 330 vpa_init(cpu);
331 331  
332 332 cpu_clear(cpu, of_spin_map);
arch/ppc64/kernel/process.c
... ... @@ -206,7 +206,7 @@
206 206 /* purr is nothing but processor time base */
207 207  
208 208 #if defined(CONFIG_PPC_PSERIES)
209   - if (cur_cpu_spec->firmware_features & FW_FEATURE_SPLPAR) {
  209 + if (ppc64_firmware_features & FW_FEATURE_SPLPAR) {
210 210 struct cpu_usage *cu = &__get_cpu_var(cpu_usage_array);
211 211 long unsigned start_tb, current_tb;
212 212 start_tb = old_thread->start_tb;
arch/ppc64/kernel/sysfs.c
... ... @@ -154,7 +154,7 @@
154 154  
155 155 #ifdef CONFIG_PPC_PSERIES
156 156 /* instruct hypervisor to maintain PMCs */
157   - if (cur_cpu_spec->firmware_features & FW_FEATURE_SPLPAR)
  157 + if (ppc64_firmware_features & FW_FEATURE_SPLPAR)
158 158 get_paca()->lppaca.pmcregs_in_use = 1;
159 159 #endif /* CONFIG_PPC_PSERIES */
160 160 }
arch/ppc64/kernel/time.c
... ... @@ -372,7 +372,7 @@
372 372  
373 373 /* collect purr register values often, for accurate calculations */
374 374 #if defined(CONFIG_PPC_PSERIES)
375   - if (cur_cpu_spec->firmware_features & FW_FEATURE_SPLPAR) {
  375 + if (ppc64_firmware_features & FW_FEATURE_SPLPAR) {
376 376 struct cpu_usage *cu = &__get_cpu_var(cpu_usage_array);
377 377 cu->current_tb = mfspr(SPRN_PURR);
378 378 }
include/asm-ppc64/cputable.h
... ... @@ -56,11 +56,6 @@
56 56 * BHT, SPD, etc... from head.S before branching to identify_machine
57 57 */
58 58 cpu_setup_t cpu_setup;
59   -
60   - /* This is used to identify firmware features which are available
61   - * to the kernel.
62   - */
63   - unsigned long firmware_features;
64 59 };
65 60  
66 61 extern struct cpu_spec cpu_specs[];
... ... @@ -71,6 +66,11 @@
71 66 return cur_cpu_spec->cpu_features & feature;
72 67 }
73 68  
  69 +
  70 +/* This is used to identify firmware features which are available
  71 + * to the kernel.
  72 + */
  73 +extern unsigned long ppc64_firmware_features;
74 74  
75 75 /* firmware feature bitmask values */
76 76 #define FIRMWARE_MAX_FEATURES 63