diff options
Diffstat (limited to 'arch/powerpc/kernel')
-rw-r--r-- | arch/powerpc/kernel/ftrace.c | 52 | ||||
-rw-r--r-- | arch/powerpc/kernel/idle_power7.S | 2 | ||||
-rw-r--r-- | arch/powerpc/kernel/iomap.c | 20 | ||||
-rw-r--r-- | arch/powerpc/kernel/kprobes.c | 9 | ||||
-rw-r--r-- | arch/powerpc/kernel/module_64.c | 11 | ||||
-rw-r--r-- | arch/powerpc/kernel/prom.c | 7 | ||||
-rw-r--r-- | arch/powerpc/kernel/prom_init.c | 211 | ||||
-rw-r--r-- | arch/powerpc/kernel/prom_init_check.sh | 4 | ||||
-rw-r--r-- | arch/powerpc/kernel/setup-common.c | 10 | ||||
-rw-r--r-- | arch/powerpc/kernel/signal_32.c | 9 | ||||
-rw-r--r-- | arch/powerpc/kernel/signal_64.c | 9 | ||||
-rw-r--r-- | arch/powerpc/kernel/smp.c | 2 |
12 files changed, 63 insertions, 283 deletions
diff --git a/arch/powerpc/kernel/ftrace.c b/arch/powerpc/kernel/ftrace.c index f202d0731b06..d178834fe508 100644 --- a/arch/powerpc/kernel/ftrace.c +++ b/arch/powerpc/kernel/ftrace.c | |||
@@ -10,6 +10,8 @@ | |||
10 | * | 10 | * |
11 | */ | 11 | */ |
12 | 12 | ||
13 | #define pr_fmt(fmt) "ftrace-powerpc: " fmt | ||
14 | |||
13 | #include <linux/spinlock.h> | 15 | #include <linux/spinlock.h> |
14 | #include <linux/hardirq.h> | 16 | #include <linux/hardirq.h> |
15 | #include <linux/uaccess.h> | 17 | #include <linux/uaccess.h> |
@@ -105,7 +107,7 @@ __ftrace_make_nop(struct module *mod, | |||
105 | struct dyn_ftrace *rec, unsigned long addr) | 107 | struct dyn_ftrace *rec, unsigned long addr) |
106 | { | 108 | { |
107 | unsigned int op; | 109 | unsigned int op; |
108 | unsigned long ptr; | 110 | unsigned long entry, ptr; |
109 | unsigned long ip = rec->ip; | 111 | unsigned long ip = rec->ip; |
110 | void *tramp; | 112 | void *tramp; |
111 | 113 | ||
@@ -115,7 +117,7 @@ __ftrace_make_nop(struct module *mod, | |||
115 | 117 | ||
116 | /* Make sure that that this is still a 24bit jump */ | 118 | /* Make sure that that this is still a 24bit jump */ |
117 | if (!is_bl_op(op)) { | 119 | if (!is_bl_op(op)) { |
118 | printk(KERN_ERR "Not expected bl: opcode is %x\n", op); | 120 | pr_err("Not expected bl: opcode is %x\n", op); |
119 | return -EINVAL; | 121 | return -EINVAL; |
120 | } | 122 | } |
121 | 123 | ||
@@ -125,21 +127,21 @@ __ftrace_make_nop(struct module *mod, | |||
125 | pr_devel("ip:%lx jumps to %p", ip, tramp); | 127 | pr_devel("ip:%lx jumps to %p", ip, tramp); |
126 | 128 | ||
127 | if (!is_module_trampoline(tramp)) { | 129 | if (!is_module_trampoline(tramp)) { |
128 | printk(KERN_ERR "Not a trampoline\n"); | 130 | pr_err("Not a trampoline\n"); |
129 | return -EINVAL; | 131 | return -EINVAL; |
130 | } | 132 | } |
131 | 133 | ||
132 | if (module_trampoline_target(mod, tramp, &ptr)) { | 134 | if (module_trampoline_target(mod, tramp, &ptr)) { |
133 | printk(KERN_ERR "Failed to get trampoline target\n"); | 135 | pr_err("Failed to get trampoline target\n"); |
134 | return -EFAULT; | 136 | return -EFAULT; |
135 | } | 137 | } |
136 | 138 | ||
137 | pr_devel("trampoline target %lx", ptr); | 139 | pr_devel("trampoline target %lx", ptr); |
138 | 140 | ||
141 | entry = ppc_global_function_entry((void *)addr); | ||
139 | /* This should match what was called */ | 142 | /* This should match what was called */ |
140 | if (ptr != ppc_function_entry((void *)addr)) { | 143 | if (ptr != entry) { |
141 | printk(KERN_ERR "addr %lx does not match expected %lx\n", | 144 | pr_err("addr %lx does not match expected %lx\n", ptr, entry); |
142 | ptr, ppc_function_entry((void *)addr)); | ||
143 | return -EINVAL; | 145 | return -EINVAL; |
144 | } | 146 | } |
145 | 147 | ||
@@ -179,7 +181,7 @@ __ftrace_make_nop(struct module *mod, | |||
179 | 181 | ||
180 | /* Make sure that that this is still a 24bit jump */ | 182 | /* Make sure that that this is still a 24bit jump */ |
181 | if (!is_bl_op(op)) { | 183 | if (!is_bl_op(op)) { |
182 | printk(KERN_ERR "Not expected bl: opcode is %x\n", op); | 184 | pr_err("Not expected bl: opcode is %x\n", op); |
183 | return -EINVAL; | 185 | return -EINVAL; |
184 | } | 186 | } |
185 | 187 | ||
@@ -198,7 +200,7 @@ __ftrace_make_nop(struct module *mod, | |||
198 | 200 | ||
199 | /* Find where the trampoline jumps to */ | 201 | /* Find where the trampoline jumps to */ |
200 | if (probe_kernel_read(jmp, (void *)tramp, sizeof(jmp))) { | 202 | if (probe_kernel_read(jmp, (void *)tramp, sizeof(jmp))) { |
201 | printk(KERN_ERR "Failed to read %lx\n", tramp); | 203 | pr_err("Failed to read %lx\n", tramp); |
202 | return -EFAULT; | 204 | return -EFAULT; |
203 | } | 205 | } |
204 | 206 | ||
@@ -209,7 +211,7 @@ __ftrace_make_nop(struct module *mod, | |||
209 | ((jmp[1] & 0xffff0000) != 0x398c0000) || | 211 | ((jmp[1] & 0xffff0000) != 0x398c0000) || |
210 | (jmp[2] != 0x7d8903a6) || | 212 | (jmp[2] != 0x7d8903a6) || |
211 | (jmp[3] != 0x4e800420)) { | 213 | (jmp[3] != 0x4e800420)) { |
212 | printk(KERN_ERR "Not a trampoline\n"); | 214 | pr_err("Not a trampoline\n"); |
213 | return -EINVAL; | 215 | return -EINVAL; |
214 | } | 216 | } |
215 | 217 | ||
@@ -221,8 +223,7 @@ __ftrace_make_nop(struct module *mod, | |||
221 | pr_devel(" %lx ", tramp); | 223 | pr_devel(" %lx ", tramp); |
222 | 224 | ||
223 | if (tramp != addr) { | 225 | if (tramp != addr) { |
224 | printk(KERN_ERR | 226 | pr_err("Trampoline location %08lx does not match addr\n", |
225 | "Trampoline location %08lx does not match addr\n", | ||
226 | tramp); | 227 | tramp); |
227 | return -EINVAL; | 228 | return -EINVAL; |
228 | } | 229 | } |
@@ -263,15 +264,13 @@ int ftrace_make_nop(struct module *mod, | |||
263 | */ | 264 | */ |
264 | if (!rec->arch.mod) { | 265 | if (!rec->arch.mod) { |
265 | if (!mod) { | 266 | if (!mod) { |
266 | printk(KERN_ERR "No module loaded addr=%lx\n", | 267 | pr_err("No module loaded addr=%lx\n", addr); |
267 | addr); | ||
268 | return -EFAULT; | 268 | return -EFAULT; |
269 | } | 269 | } |
270 | rec->arch.mod = mod; | 270 | rec->arch.mod = mod; |
271 | } else if (mod) { | 271 | } else if (mod) { |
272 | if (mod != rec->arch.mod) { | 272 | if (mod != rec->arch.mod) { |
273 | printk(KERN_ERR | 273 | pr_err("Record mod %p not equal to passed in mod %p\n", |
274 | "Record mod %p not equal to passed in mod %p\n", | ||
275 | rec->arch.mod, mod); | 274 | rec->arch.mod, mod); |
276 | return -EINVAL; | 275 | return -EINVAL; |
277 | } | 276 | } |
@@ -307,26 +306,25 @@ __ftrace_make_call(struct dyn_ftrace *rec, unsigned long addr) | |||
307 | * The load offset is different depending on the ABI. For simplicity | 306 | * The load offset is different depending on the ABI. For simplicity |
308 | * just mask it out when doing the compare. | 307 | * just mask it out when doing the compare. |
309 | */ | 308 | */ |
310 | if ((op[0] != 0x48000008) || ((op[1] & 0xffff00000) != 0xe8410000)) { | 309 | if ((op[0] != 0x48000008) || ((op[1] & 0xffff0000) != 0xe8410000)) { |
311 | printk(KERN_ERR "Unexpected call sequence: %x %x\n", | 310 | pr_err("Unexpected call sequence: %x %x\n", op[0], op[1]); |
312 | op[0], op[1]); | ||
313 | return -EINVAL; | 311 | return -EINVAL; |
314 | } | 312 | } |
315 | 313 | ||
316 | /* If we never set up a trampoline to ftrace_caller, then bail */ | 314 | /* If we never set up a trampoline to ftrace_caller, then bail */ |
317 | if (!rec->arch.mod->arch.tramp) { | 315 | if (!rec->arch.mod->arch.tramp) { |
318 | printk(KERN_ERR "No ftrace trampoline\n"); | 316 | pr_err("No ftrace trampoline\n"); |
319 | return -EINVAL; | 317 | return -EINVAL; |
320 | } | 318 | } |
321 | 319 | ||
322 | /* Ensure branch is within 24 bits */ | 320 | /* Ensure branch is within 24 bits */ |
323 | if (create_branch(ip, rec->arch.mod->arch.tramp, BRANCH_SET_LINK)) { | 321 | if (!create_branch(ip, rec->arch.mod->arch.tramp, BRANCH_SET_LINK)) { |
324 | printk(KERN_ERR "Branch out of range"); | 322 | pr_err("Branch out of range\n"); |
325 | return -EINVAL; | 323 | return -EINVAL; |
326 | } | 324 | } |
327 | 325 | ||
328 | if (patch_branch(ip, rec->arch.mod->arch.tramp, BRANCH_SET_LINK)) { | 326 | if (patch_branch(ip, rec->arch.mod->arch.tramp, BRANCH_SET_LINK)) { |
329 | printk(KERN_ERR "REL24 out of range!\n"); | 327 | pr_err("REL24 out of range!\n"); |
330 | return -EINVAL; | 328 | return -EINVAL; |
331 | } | 329 | } |
332 | 330 | ||
@@ -345,13 +343,13 @@ __ftrace_make_call(struct dyn_ftrace *rec, unsigned long addr) | |||
345 | 343 | ||
346 | /* It should be pointing to a nop */ | 344 | /* It should be pointing to a nop */ |
347 | if (op != PPC_INST_NOP) { | 345 | if (op != PPC_INST_NOP) { |
348 | printk(KERN_ERR "Expected NOP but have %x\n", op); | 346 | pr_err("Expected NOP but have %x\n", op); |
349 | return -EINVAL; | 347 | return -EINVAL; |
350 | } | 348 | } |
351 | 349 | ||
352 | /* If we never set up a trampoline to ftrace_caller, then bail */ | 350 | /* If we never set up a trampoline to ftrace_caller, then bail */ |
353 | if (!rec->arch.mod->arch.tramp) { | 351 | if (!rec->arch.mod->arch.tramp) { |
354 | printk(KERN_ERR "No ftrace trampoline\n"); | 352 | pr_err("No ftrace trampoline\n"); |
355 | return -EINVAL; | 353 | return -EINVAL; |
356 | } | 354 | } |
357 | 355 | ||
@@ -359,7 +357,7 @@ __ftrace_make_call(struct dyn_ftrace *rec, unsigned long addr) | |||
359 | op = create_branch((unsigned int *)ip, | 357 | op = create_branch((unsigned int *)ip, |
360 | rec->arch.mod->arch.tramp, BRANCH_SET_LINK); | 358 | rec->arch.mod->arch.tramp, BRANCH_SET_LINK); |
361 | if (!op) { | 359 | if (!op) { |
362 | printk(KERN_ERR "REL24 out of range!\n"); | 360 | pr_err("REL24 out of range!\n"); |
363 | return -EINVAL; | 361 | return -EINVAL; |
364 | } | 362 | } |
365 | 363 | ||
@@ -397,7 +395,7 @@ int ftrace_make_call(struct dyn_ftrace *rec, unsigned long addr) | |||
397 | * already have a module defined. | 395 | * already have a module defined. |
398 | */ | 396 | */ |
399 | if (!rec->arch.mod) { | 397 | if (!rec->arch.mod) { |
400 | printk(KERN_ERR "No module loaded\n"); | 398 | pr_err("No module loaded\n"); |
401 | return -EINVAL; | 399 | return -EINVAL; |
402 | } | 400 | } |
403 | 401 | ||
diff --git a/arch/powerpc/kernel/idle_power7.S b/arch/powerpc/kernel/idle_power7.S index 2480256272d4..5cf3d367190d 100644 --- a/arch/powerpc/kernel/idle_power7.S +++ b/arch/powerpc/kernel/idle_power7.S | |||
@@ -131,7 +131,7 @@ _GLOBAL(power7_nap) | |||
131 | 131 | ||
132 | _GLOBAL(power7_sleep) | 132 | _GLOBAL(power7_sleep) |
133 | li r3,1 | 133 | li r3,1 |
134 | li r4,0 | 134 | li r4,1 |
135 | b power7_powersave_common | 135 | b power7_powersave_common |
136 | /* No return */ | 136 | /* No return */ |
137 | 137 | ||
diff --git a/arch/powerpc/kernel/iomap.c b/arch/powerpc/kernel/iomap.c index b82227e7e21b..12e48d56f771 100644 --- a/arch/powerpc/kernel/iomap.c +++ b/arch/powerpc/kernel/iomap.c | |||
@@ -23,7 +23,7 @@ unsigned int ioread16(void __iomem *addr) | |||
23 | } | 23 | } |
24 | unsigned int ioread16be(void __iomem *addr) | 24 | unsigned int ioread16be(void __iomem *addr) |
25 | { | 25 | { |
26 | return in_be16(addr); | 26 | return readw_be(addr); |
27 | } | 27 | } |
28 | unsigned int ioread32(void __iomem *addr) | 28 | unsigned int ioread32(void __iomem *addr) |
29 | { | 29 | { |
@@ -31,7 +31,7 @@ unsigned int ioread32(void __iomem *addr) | |||
31 | } | 31 | } |
32 | unsigned int ioread32be(void __iomem *addr) | 32 | unsigned int ioread32be(void __iomem *addr) |
33 | { | 33 | { |
34 | return in_be32(addr); | 34 | return readl_be(addr); |
35 | } | 35 | } |
36 | EXPORT_SYMBOL(ioread8); | 36 | EXPORT_SYMBOL(ioread8); |
37 | EXPORT_SYMBOL(ioread16); | 37 | EXPORT_SYMBOL(ioread16); |
@@ -49,7 +49,7 @@ void iowrite16(u16 val, void __iomem *addr) | |||
49 | } | 49 | } |
50 | void iowrite16be(u16 val, void __iomem *addr) | 50 | void iowrite16be(u16 val, void __iomem *addr) |
51 | { | 51 | { |
52 | out_be16(addr, val); | 52 | writew_be(val, addr); |
53 | } | 53 | } |
54 | void iowrite32(u32 val, void __iomem *addr) | 54 | void iowrite32(u32 val, void __iomem *addr) |
55 | { | 55 | { |
@@ -57,7 +57,7 @@ void iowrite32(u32 val, void __iomem *addr) | |||
57 | } | 57 | } |
58 | void iowrite32be(u32 val, void __iomem *addr) | 58 | void iowrite32be(u32 val, void __iomem *addr) |
59 | { | 59 | { |
60 | out_be32(addr, val); | 60 | writel_be(val, addr); |
61 | } | 61 | } |
62 | EXPORT_SYMBOL(iowrite8); | 62 | EXPORT_SYMBOL(iowrite8); |
63 | EXPORT_SYMBOL(iowrite16); | 63 | EXPORT_SYMBOL(iowrite16); |
@@ -75,15 +75,15 @@ EXPORT_SYMBOL(iowrite32be); | |||
75 | */ | 75 | */ |
76 | void ioread8_rep(void __iomem *addr, void *dst, unsigned long count) | 76 | void ioread8_rep(void __iomem *addr, void *dst, unsigned long count) |
77 | { | 77 | { |
78 | _insb((u8 __iomem *) addr, dst, count); | 78 | readsb(addr, dst, count); |
79 | } | 79 | } |
80 | void ioread16_rep(void __iomem *addr, void *dst, unsigned long count) | 80 | void ioread16_rep(void __iomem *addr, void *dst, unsigned long count) |
81 | { | 81 | { |
82 | _insw_ns((u16 __iomem *) addr, dst, count); | 82 | readsw(addr, dst, count); |
83 | } | 83 | } |
84 | void ioread32_rep(void __iomem *addr, void *dst, unsigned long count) | 84 | void ioread32_rep(void __iomem *addr, void *dst, unsigned long count) |
85 | { | 85 | { |
86 | _insl_ns((u32 __iomem *) addr, dst, count); | 86 | readsl(addr, dst, count); |
87 | } | 87 | } |
88 | EXPORT_SYMBOL(ioread8_rep); | 88 | EXPORT_SYMBOL(ioread8_rep); |
89 | EXPORT_SYMBOL(ioread16_rep); | 89 | EXPORT_SYMBOL(ioread16_rep); |
@@ -91,15 +91,15 @@ EXPORT_SYMBOL(ioread32_rep); | |||
91 | 91 | ||
92 | void iowrite8_rep(void __iomem *addr, const void *src, unsigned long count) | 92 | void iowrite8_rep(void __iomem *addr, const void *src, unsigned long count) |
93 | { | 93 | { |
94 | _outsb((u8 __iomem *) addr, src, count); | 94 | writesb(addr, src, count); |
95 | } | 95 | } |
96 | void iowrite16_rep(void __iomem *addr, const void *src, unsigned long count) | 96 | void iowrite16_rep(void __iomem *addr, const void *src, unsigned long count) |
97 | { | 97 | { |
98 | _outsw_ns((u16 __iomem *) addr, src, count); | 98 | writesw(addr, src, count); |
99 | } | 99 | } |
100 | void iowrite32_rep(void __iomem *addr, const void *src, unsigned long count) | 100 | void iowrite32_rep(void __iomem *addr, const void *src, unsigned long count) |
101 | { | 101 | { |
102 | _outsl_ns((u32 __iomem *) addr, src, count); | 102 | writesl(addr, src, count); |
103 | } | 103 | } |
104 | EXPORT_SYMBOL(iowrite8_rep); | 104 | EXPORT_SYMBOL(iowrite8_rep); |
105 | EXPORT_SYMBOL(iowrite16_rep); | 105 | EXPORT_SYMBOL(iowrite16_rep); |
diff --git a/arch/powerpc/kernel/kprobes.c b/arch/powerpc/kernel/kprobes.c index 90fab64d911d..2f72af82513c 100644 --- a/arch/powerpc/kernel/kprobes.c +++ b/arch/powerpc/kernel/kprobes.c | |||
@@ -32,6 +32,7 @@ | |||
32 | #include <linux/module.h> | 32 | #include <linux/module.h> |
33 | #include <linux/kdebug.h> | 33 | #include <linux/kdebug.h> |
34 | #include <linux/slab.h> | 34 | #include <linux/slab.h> |
35 | #include <asm/code-patching.h> | ||
35 | #include <asm/cacheflush.h> | 36 | #include <asm/cacheflush.h> |
36 | #include <asm/sstep.h> | 37 | #include <asm/sstep.h> |
37 | #include <asm/uaccess.h> | 38 | #include <asm/uaccess.h> |
@@ -491,12 +492,10 @@ int __kprobes kprobe_exceptions_notify(struct notifier_block *self, | |||
491 | return ret; | 492 | return ret; |
492 | } | 493 | } |
493 | 494 | ||
494 | #ifdef CONFIG_PPC64 | ||
495 | unsigned long arch_deref_entry_point(void *entry) | 495 | unsigned long arch_deref_entry_point(void *entry) |
496 | { | 496 | { |
497 | return ((func_descr_t *)entry)->entry; | 497 | return ppc_global_function_entry(entry); |
498 | } | 498 | } |
499 | #endif | ||
500 | 499 | ||
501 | int __kprobes setjmp_pre_handler(struct kprobe *p, struct pt_regs *regs) | 500 | int __kprobes setjmp_pre_handler(struct kprobe *p, struct pt_regs *regs) |
502 | { | 501 | { |
@@ -508,8 +507,12 @@ int __kprobes setjmp_pre_handler(struct kprobe *p, struct pt_regs *regs) | |||
508 | /* setup return addr to the jprobe handler routine */ | 507 | /* setup return addr to the jprobe handler routine */ |
509 | regs->nip = arch_deref_entry_point(jp->entry); | 508 | regs->nip = arch_deref_entry_point(jp->entry); |
510 | #ifdef CONFIG_PPC64 | 509 | #ifdef CONFIG_PPC64 |
510 | #if defined(_CALL_ELF) && _CALL_ELF == 2 | ||
511 | regs->gpr[12] = (unsigned long)jp->entry; | ||
512 | #else | ||
511 | regs->gpr[2] = (unsigned long)(((func_descr_t *)jp->entry)->toc); | 513 | regs->gpr[2] = (unsigned long)(((func_descr_t *)jp->entry)->toc); |
512 | #endif | 514 | #endif |
515 | #endif | ||
513 | 516 | ||
514 | return 1; | 517 | return 1; |
515 | } | 518 | } |
diff --git a/arch/powerpc/kernel/module_64.c b/arch/powerpc/kernel/module_64.c index 077d2ce6c5a7..d807ee626af9 100644 --- a/arch/powerpc/kernel/module_64.c +++ b/arch/powerpc/kernel/module_64.c | |||
@@ -315,8 +315,17 @@ static void dedotify_versions(struct modversion_info *vers, | |||
315 | struct modversion_info *end; | 315 | struct modversion_info *end; |
316 | 316 | ||
317 | for (end = (void *)vers + size; vers < end; vers++) | 317 | for (end = (void *)vers + size; vers < end; vers++) |
318 | if (vers->name[0] == '.') | 318 | if (vers->name[0] == '.') { |
319 | memmove(vers->name, vers->name+1, strlen(vers->name)); | 319 | memmove(vers->name, vers->name+1, strlen(vers->name)); |
320 | #ifdef ARCH_RELOCATES_KCRCTAB | ||
321 | /* The TOC symbol has no CRC computed. To avoid CRC | ||
322 | * check failing, we must force it to the expected | ||
323 | * value (see CRC check in module.c). | ||
324 | */ | ||
325 | if (!strcmp(vers->name, "TOC.")) | ||
326 | vers->crc = -(unsigned long)reloc_start; | ||
327 | #endif | ||
328 | } | ||
320 | } | 329 | } |
321 | 330 | ||
322 | /* Undefined symbols which refer to .funcname, hack to funcname (or .TOC.) */ | 331 | /* Undefined symbols which refer to .funcname, hack to funcname (or .TOC.) */ |
diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c index 613a860a203c..b694b0730971 100644 --- a/arch/powerpc/kernel/prom.c +++ b/arch/powerpc/kernel/prom.c | |||
@@ -662,13 +662,6 @@ void __init early_init_devtree(void *params) | |||
662 | of_scan_flat_dt(early_init_dt_scan_fw_dump, NULL); | 662 | of_scan_flat_dt(early_init_dt_scan_fw_dump, NULL); |
663 | #endif | 663 | #endif |
664 | 664 | ||
665 | /* Pre-initialize the cmd_line with the content of boot_commmand_line, | ||
666 | * which will be empty except when the content of the variable has | ||
667 | * been overriden by a bootloading mechanism. This happens typically | ||
668 | * with HAL takeover | ||
669 | */ | ||
670 | strlcpy(cmd_line, boot_command_line, COMMAND_LINE_SIZE); | ||
671 | |||
672 | /* Retrieve various informations from the /chosen node of the | 665 | /* Retrieve various informations from the /chosen node of the |
673 | * device-tree, including the platform type, initrd location and | 666 | * device-tree, including the platform type, initrd location and |
674 | * size, TCE reserve, and more ... | 667 | * size, TCE reserve, and more ... |
diff --git a/arch/powerpc/kernel/prom_init.c b/arch/powerpc/kernel/prom_init.c index 078145acf7fb..1a85d8f96739 100644 --- a/arch/powerpc/kernel/prom_init.c +++ b/arch/powerpc/kernel/prom_init.c | |||
@@ -1268,201 +1268,6 @@ static u64 __initdata prom_opal_base; | |||
1268 | static u64 __initdata prom_opal_entry; | 1268 | static u64 __initdata prom_opal_entry; |
1269 | #endif | 1269 | #endif |
1270 | 1270 | ||
1271 | #ifdef __BIG_ENDIAN__ | ||
1272 | /* XXX Don't change this structure without updating opal-takeover.S */ | ||
1273 | static struct opal_secondary_data { | ||
1274 | s64 ack; /* 0 */ | ||
1275 | u64 go; /* 8 */ | ||
1276 | struct opal_takeover_args args; /* 16 */ | ||
1277 | } opal_secondary_data; | ||
1278 | |||
1279 | static u64 __initdata prom_opal_align; | ||
1280 | static u64 __initdata prom_opal_size; | ||
1281 | static int __initdata prom_rtas_start_cpu; | ||
1282 | static u64 __initdata prom_rtas_data; | ||
1283 | static u64 __initdata prom_rtas_entry; | ||
1284 | |||
1285 | extern char opal_secondary_entry; | ||
1286 | |||
1287 | static void __init prom_query_opal(void) | ||
1288 | { | ||
1289 | long rc; | ||
1290 | |||
1291 | /* We must not query for OPAL presence on a machine that | ||
1292 | * supports TNK takeover (970 blades), as this uses the same | ||
1293 | * h-call with different arguments and will crash | ||
1294 | */ | ||
1295 | if (PHANDLE_VALID(call_prom("finddevice", 1, 1, | ||
1296 | ADDR("/tnk-memory-map")))) { | ||
1297 | prom_printf("TNK takeover detected, skipping OPAL check\n"); | ||
1298 | return; | ||
1299 | } | ||
1300 | |||
1301 | prom_printf("Querying for OPAL presence... "); | ||
1302 | |||
1303 | rc = opal_query_takeover(&prom_opal_size, | ||
1304 | &prom_opal_align); | ||
1305 | prom_debug("(rc = %ld) ", rc); | ||
1306 | if (rc != 0) { | ||
1307 | prom_printf("not there.\n"); | ||
1308 | return; | ||
1309 | } | ||
1310 | of_platform = PLATFORM_OPAL; | ||
1311 | prom_printf(" there !\n"); | ||
1312 | prom_debug(" opal_size = 0x%lx\n", prom_opal_size); | ||
1313 | prom_debug(" opal_align = 0x%lx\n", prom_opal_align); | ||
1314 | if (prom_opal_align < 0x10000) | ||
1315 | prom_opal_align = 0x10000; | ||
1316 | } | ||
1317 | |||
1318 | static int __init prom_rtas_call(int token, int nargs, int nret, | ||
1319 | int *outputs, ...) | ||
1320 | { | ||
1321 | struct rtas_args rtas_args; | ||
1322 | va_list list; | ||
1323 | int i; | ||
1324 | |||
1325 | rtas_args.token = token; | ||
1326 | rtas_args.nargs = nargs; | ||
1327 | rtas_args.nret = nret; | ||
1328 | rtas_args.rets = (rtas_arg_t *)&(rtas_args.args[nargs]); | ||
1329 | va_start(list, outputs); | ||
1330 | for (i = 0; i < nargs; ++i) | ||
1331 | rtas_args.args[i] = va_arg(list, rtas_arg_t); | ||
1332 | va_end(list); | ||
1333 | |||
1334 | for (i = 0; i < nret; ++i) | ||
1335 | rtas_args.rets[i] = 0; | ||
1336 | |||
1337 | opal_enter_rtas(&rtas_args, prom_rtas_data, | ||
1338 | prom_rtas_entry); | ||
1339 | |||
1340 | if (nret > 1 && outputs != NULL) | ||
1341 | for (i = 0; i < nret-1; ++i) | ||
1342 | outputs[i] = rtas_args.rets[i+1]; | ||
1343 | return (nret > 0)? rtas_args.rets[0]: 0; | ||
1344 | } | ||
1345 | |||
1346 | static void __init prom_opal_hold_cpus(void) | ||
1347 | { | ||
1348 | int i, cnt, cpu, rc; | ||
1349 | long j; | ||
1350 | phandle node; | ||
1351 | char type[64]; | ||
1352 | u32 servers[8]; | ||
1353 | void *entry = (unsigned long *)&opal_secondary_entry; | ||
1354 | struct opal_secondary_data *data = &opal_secondary_data; | ||
1355 | |||
1356 | prom_debug("prom_opal_hold_cpus: start...\n"); | ||
1357 | prom_debug(" - entry = 0x%x\n", entry); | ||
1358 | prom_debug(" - data = 0x%x\n", data); | ||
1359 | |||
1360 | data->ack = -1; | ||
1361 | data->go = 0; | ||
1362 | |||
1363 | /* look for cpus */ | ||
1364 | for (node = 0; prom_next_node(&node); ) { | ||
1365 | type[0] = 0; | ||
1366 | prom_getprop(node, "device_type", type, sizeof(type)); | ||
1367 | if (strcmp(type, "cpu") != 0) | ||
1368 | continue; | ||
1369 | |||
1370 | /* Skip non-configured cpus. */ | ||
1371 | if (prom_getprop(node, "status", type, sizeof(type)) > 0) | ||
1372 | if (strcmp(type, "okay") != 0) | ||
1373 | continue; | ||
1374 | |||
1375 | cnt = prom_getprop(node, "ibm,ppc-interrupt-server#s", servers, | ||
1376 | sizeof(servers)); | ||
1377 | if (cnt == PROM_ERROR) | ||
1378 | break; | ||
1379 | cnt >>= 2; | ||
1380 | for (i = 0; i < cnt; i++) { | ||
1381 | cpu = servers[i]; | ||
1382 | prom_debug("CPU %d ... ", cpu); | ||
1383 | if (cpu == prom.cpu) { | ||
1384 | prom_debug("booted !\n"); | ||
1385 | continue; | ||
1386 | } | ||
1387 | prom_debug("starting ... "); | ||
1388 | |||
1389 | /* Init the acknowledge var which will be reset by | ||
1390 | * the secondary cpu when it awakens from its OF | ||
1391 | * spinloop. | ||
1392 | */ | ||
1393 | data->ack = -1; | ||
1394 | rc = prom_rtas_call(prom_rtas_start_cpu, 3, 1, | ||
1395 | NULL, cpu, entry, data); | ||
1396 | prom_debug("rtas rc=%d ...", rc); | ||
1397 | |||
1398 | for (j = 0; j < 100000000 && data->ack == -1; j++) { | ||
1399 | HMT_low(); | ||
1400 | mb(); | ||
1401 | } | ||
1402 | HMT_medium(); | ||
1403 | if (data->ack != -1) | ||
1404 | prom_debug("done, PIR=0x%x\n", data->ack); | ||
1405 | else | ||
1406 | prom_debug("timeout !\n"); | ||
1407 | } | ||
1408 | } | ||
1409 | prom_debug("prom_opal_hold_cpus: end...\n"); | ||
1410 | } | ||
1411 | |||
1412 | static void __init prom_opal_takeover(void) | ||
1413 | { | ||
1414 | struct opal_secondary_data *data = &opal_secondary_data; | ||
1415 | struct opal_takeover_args *args = &data->args; | ||
1416 | u64 align = prom_opal_align; | ||
1417 | u64 top_addr, opal_addr; | ||
1418 | |||
1419 | args->k_image = (u64)_stext; | ||
1420 | args->k_size = _end - _stext; | ||
1421 | args->k_entry = 0; | ||
1422 | args->k_entry2 = 0x60; | ||
1423 | |||
1424 | top_addr = _ALIGN_UP(args->k_size, align); | ||
1425 | |||
1426 | if (prom_initrd_start != 0) { | ||
1427 | args->rd_image = prom_initrd_start; | ||
1428 | args->rd_size = prom_initrd_end - args->rd_image; | ||
1429 | args->rd_loc = top_addr; | ||
1430 | top_addr = _ALIGN_UP(args->rd_loc + args->rd_size, align); | ||
1431 | } | ||
1432 | |||
1433 | /* Pickup an address for the HAL. We want to go really high | ||
1434 | * up to avoid problem with future kexecs. On the other hand | ||
1435 | * we don't want to be all over the TCEs on P5IOC2 machines | ||
1436 | * which are going to be up there too. We assume the machine | ||
1437 | * has plenty of memory, and we ask for the HAL for now to | ||
1438 | * be just below the 1G point, or above the initrd | ||
1439 | */ | ||
1440 | opal_addr = _ALIGN_DOWN(0x40000000 - prom_opal_size, align); | ||
1441 | if (opal_addr < top_addr) | ||
1442 | opal_addr = top_addr; | ||
1443 | args->hal_addr = opal_addr; | ||
1444 | |||
1445 | /* Copy the command line to the kernel image */ | ||
1446 | strlcpy(boot_command_line, prom_cmd_line, | ||
1447 | COMMAND_LINE_SIZE); | ||
1448 | |||
1449 | prom_debug(" k_image = 0x%lx\n", args->k_image); | ||
1450 | prom_debug(" k_size = 0x%lx\n", args->k_size); | ||
1451 | prom_debug(" k_entry = 0x%lx\n", args->k_entry); | ||
1452 | prom_debug(" k_entry2 = 0x%lx\n", args->k_entry2); | ||
1453 | prom_debug(" hal_addr = 0x%lx\n", args->hal_addr); | ||
1454 | prom_debug(" rd_image = 0x%lx\n", args->rd_image); | ||
1455 | prom_debug(" rd_size = 0x%lx\n", args->rd_size); | ||
1456 | prom_debug(" rd_loc = 0x%lx\n", args->rd_loc); | ||
1457 | prom_printf("Performing OPAL takeover,this can take a few minutes..\n"); | ||
1458 | prom_close_stdin(); | ||
1459 | mb(); | ||
1460 | data->go = 1; | ||
1461 | for (;;) | ||
1462 | opal_do_takeover(args); | ||
1463 | } | ||
1464 | #endif /* __BIG_ENDIAN__ */ | ||
1465 | |||
1466 | /* | 1271 | /* |
1467 | * Allocate room for and instantiate OPAL | 1272 | * Allocate room for and instantiate OPAL |
1468 | */ | 1273 | */ |
@@ -1597,12 +1402,6 @@ static void __init prom_instantiate_rtas(void) | |||
1597 | &val, sizeof(val)) != PROM_ERROR) | 1402 | &val, sizeof(val)) != PROM_ERROR) |
1598 | rtas_has_query_cpu_stopped = true; | 1403 | rtas_has_query_cpu_stopped = true; |
1599 | 1404 | ||
1600 | #if defined(CONFIG_PPC_POWERNV) && defined(__BIG_ENDIAN__) | ||
1601 | /* PowerVN takeover hack */ | ||
1602 | prom_rtas_data = base; | ||
1603 | prom_rtas_entry = entry; | ||
1604 | prom_getprop(rtas_node, "start-cpu", &prom_rtas_start_cpu, 4); | ||
1605 | #endif | ||
1606 | prom_debug("rtas base = 0x%x\n", base); | 1405 | prom_debug("rtas base = 0x%x\n", base); |
1607 | prom_debug("rtas entry = 0x%x\n", entry); | 1406 | prom_debug("rtas entry = 0x%x\n", entry); |
1608 | prom_debug("rtas size = 0x%x\n", (long)size); | 1407 | prom_debug("rtas size = 0x%x\n", (long)size); |
@@ -3027,16 +2826,6 @@ unsigned long __init prom_init(unsigned long r3, unsigned long r4, | |||
3027 | prom_instantiate_rtas(); | 2826 | prom_instantiate_rtas(); |
3028 | 2827 | ||
3029 | #ifdef CONFIG_PPC_POWERNV | 2828 | #ifdef CONFIG_PPC_POWERNV |
3030 | #ifdef __BIG_ENDIAN__ | ||
3031 | /* Detect HAL and try instanciating it & doing takeover */ | ||
3032 | if (of_platform == PLATFORM_PSERIES_LPAR) { | ||
3033 | prom_query_opal(); | ||
3034 | if (of_platform == PLATFORM_OPAL) { | ||
3035 | prom_opal_hold_cpus(); | ||
3036 | prom_opal_takeover(); | ||
3037 | } | ||
3038 | } else | ||
3039 | #endif /* __BIG_ENDIAN__ */ | ||
3040 | if (of_platform == PLATFORM_OPAL) | 2829 | if (of_platform == PLATFORM_OPAL) |
3041 | prom_instantiate_opal(); | 2830 | prom_instantiate_opal(); |
3042 | #endif /* CONFIG_PPC_POWERNV */ | 2831 | #endif /* CONFIG_PPC_POWERNV */ |
diff --git a/arch/powerpc/kernel/prom_init_check.sh b/arch/powerpc/kernel/prom_init_check.sh index 77aa1e95e904..fe8e54b9ef7d 100644 --- a/arch/powerpc/kernel/prom_init_check.sh +++ b/arch/powerpc/kernel/prom_init_check.sh | |||
@@ -21,9 +21,7 @@ _end enter_prom memcpy memset reloc_offset __secondary_hold | |||
21 | __secondary_hold_acknowledge __secondary_hold_spinloop __start | 21 | __secondary_hold_acknowledge __secondary_hold_spinloop __start |
22 | strcmp strcpy strlcpy strlen strncmp strstr logo_linux_clut224 | 22 | strcmp strcpy strlcpy strlen strncmp strstr logo_linux_clut224 |
23 | reloc_got2 kernstart_addr memstart_addr linux_banner _stext | 23 | reloc_got2 kernstart_addr memstart_addr linux_banner _stext |
24 | opal_query_takeover opal_do_takeover opal_enter_rtas opal_secondary_entry | 24 | __prom_init_toc_start __prom_init_toc_end btext_setup_display TOC." |
25 | boot_command_line __prom_init_toc_start __prom_init_toc_end | ||
26 | btext_setup_display TOC." | ||
27 | 25 | ||
28 | NM="$1" | 26 | NM="$1" |
29 | OBJ="$2" | 27 | OBJ="$2" |
diff --git a/arch/powerpc/kernel/setup-common.c b/arch/powerpc/kernel/setup-common.c index e239df3768ac..e5b022c55ccd 100644 --- a/arch/powerpc/kernel/setup-common.c +++ b/arch/powerpc/kernel/setup-common.c | |||
@@ -469,9 +469,17 @@ void __init smp_setup_cpu_maps(void) | |||
469 | } | 469 | } |
470 | 470 | ||
471 | for (j = 0; j < nthreads && cpu < nr_cpu_ids; j++) { | 471 | for (j = 0; j < nthreads && cpu < nr_cpu_ids; j++) { |
472 | bool avail; | ||
473 | |||
472 | DBG(" thread %d -> cpu %d (hard id %d)\n", | 474 | DBG(" thread %d -> cpu %d (hard id %d)\n", |
473 | j, cpu, be32_to_cpu(intserv[j])); | 475 | j, cpu, be32_to_cpu(intserv[j])); |
474 | set_cpu_present(cpu, of_device_is_available(dn)); | 476 | |
477 | avail = of_device_is_available(dn); | ||
478 | if (!avail) | ||
479 | avail = !of_property_match_string(dn, | ||
480 | "enable-method", "spin-table"); | ||
481 | |||
482 | set_cpu_present(cpu, avail); | ||
475 | set_hard_smp_processor_id(cpu, be32_to_cpu(intserv[j])); | 483 | set_hard_smp_processor_id(cpu, be32_to_cpu(intserv[j])); |
476 | set_cpu_possible(cpu, true); | 484 | set_cpu_possible(cpu, true); |
477 | cpu++; | 485 | cpu++; |
diff --git a/arch/powerpc/kernel/signal_32.c b/arch/powerpc/kernel/signal_32.c index 4e47db686b5d..1bc5a1755ed4 100644 --- a/arch/powerpc/kernel/signal_32.c +++ b/arch/powerpc/kernel/signal_32.c | |||
@@ -54,7 +54,6 @@ | |||
54 | 54 | ||
55 | #include "signal.h" | 55 | #include "signal.h" |
56 | 56 | ||
57 | #undef DEBUG_SIG | ||
58 | 57 | ||
59 | #ifdef CONFIG_PPC64 | 58 | #ifdef CONFIG_PPC64 |
60 | #define sys_rt_sigreturn compat_sys_rt_sigreturn | 59 | #define sys_rt_sigreturn compat_sys_rt_sigreturn |
@@ -1063,10 +1062,6 @@ int handle_rt_signal32(unsigned long sig, struct k_sigaction *ka, | |||
1063 | return 1; | 1062 | return 1; |
1064 | 1063 | ||
1065 | badframe: | 1064 | badframe: |
1066 | #ifdef DEBUG_SIG | ||
1067 | printk("badframe in handle_rt_signal, regs=%p frame=%p newsp=%lx\n", | ||
1068 | regs, frame, newsp); | ||
1069 | #endif | ||
1070 | if (show_unhandled_signals) | 1065 | if (show_unhandled_signals) |
1071 | printk_ratelimited(KERN_INFO | 1066 | printk_ratelimited(KERN_INFO |
1072 | "%s[%d]: bad frame in handle_rt_signal32: " | 1067 | "%s[%d]: bad frame in handle_rt_signal32: " |
@@ -1484,10 +1479,6 @@ int handle_signal32(unsigned long sig, struct k_sigaction *ka, | |||
1484 | return 1; | 1479 | return 1; |
1485 | 1480 | ||
1486 | badframe: | 1481 | badframe: |
1487 | #ifdef DEBUG_SIG | ||
1488 | printk("badframe in handle_signal, regs=%p frame=%p newsp=%lx\n", | ||
1489 | regs, frame, newsp); | ||
1490 | #endif | ||
1491 | if (show_unhandled_signals) | 1482 | if (show_unhandled_signals) |
1492 | printk_ratelimited(KERN_INFO | 1483 | printk_ratelimited(KERN_INFO |
1493 | "%s[%d]: bad frame in handle_signal32: " | 1484 | "%s[%d]: bad frame in handle_signal32: " |
diff --git a/arch/powerpc/kernel/signal_64.c b/arch/powerpc/kernel/signal_64.c index d501dc4dc3e6..97c1e4b683fc 100644 --- a/arch/powerpc/kernel/signal_64.c +++ b/arch/powerpc/kernel/signal_64.c | |||
@@ -38,7 +38,6 @@ | |||
38 | 38 | ||
39 | #include "signal.h" | 39 | #include "signal.h" |
40 | 40 | ||
41 | #define DEBUG_SIG 0 | ||
42 | 41 | ||
43 | #define GP_REGS_SIZE min(sizeof(elf_gregset_t), sizeof(struct pt_regs)) | 42 | #define GP_REGS_SIZE min(sizeof(elf_gregset_t), sizeof(struct pt_regs)) |
44 | #define FP_REGS_SIZE sizeof(elf_fpregset_t) | 43 | #define FP_REGS_SIZE sizeof(elf_fpregset_t) |
@@ -700,10 +699,6 @@ int sys_rt_sigreturn(unsigned long r3, unsigned long r4, unsigned long r5, | |||
700 | return 0; | 699 | return 0; |
701 | 700 | ||
702 | badframe: | 701 | badframe: |
703 | #if DEBUG_SIG | ||
704 | printk("badframe in sys_rt_sigreturn, regs=%p uc=%p &uc->uc_mcontext=%p\n", | ||
705 | regs, uc, &uc->uc_mcontext); | ||
706 | #endif | ||
707 | if (show_unhandled_signals) | 702 | if (show_unhandled_signals) |
708 | printk_ratelimited(regs->msr & MSR_64BIT ? fmt64 : fmt32, | 703 | printk_ratelimited(regs->msr & MSR_64BIT ? fmt64 : fmt32, |
709 | current->comm, current->pid, "rt_sigreturn", | 704 | current->comm, current->pid, "rt_sigreturn", |
@@ -809,10 +804,6 @@ int handle_rt_signal64(int signr, struct k_sigaction *ka, siginfo_t *info, | |||
809 | return 1; | 804 | return 1; |
810 | 805 | ||
811 | badframe: | 806 | badframe: |
812 | #if DEBUG_SIG | ||
813 | printk("badframe in setup_rt_frame, regs=%p frame=%p newsp=%lx\n", | ||
814 | regs, frame, newsp); | ||
815 | #endif | ||
816 | if (show_unhandled_signals) | 807 | if (show_unhandled_signals) |
817 | printk_ratelimited(regs->msr & MSR_64BIT ? fmt64 : fmt32, | 808 | printk_ratelimited(regs->msr & MSR_64BIT ? fmt64 : fmt32, |
818 | current->comm, current->pid, "setup_rt_frame", | 809 | current->comm, current->pid, "setup_rt_frame", |
diff --git a/arch/powerpc/kernel/smp.c b/arch/powerpc/kernel/smp.c index 51a3ff78838a..1007fb802e6b 100644 --- a/arch/powerpc/kernel/smp.c +++ b/arch/powerpc/kernel/smp.c | |||
@@ -747,7 +747,7 @@ int setup_profiling_timer(unsigned int multiplier) | |||
747 | 747 | ||
748 | #ifdef CONFIG_SCHED_SMT | 748 | #ifdef CONFIG_SCHED_SMT |
749 | /* cpumask of CPUs with asymetric SMT dependancy */ | 749 | /* cpumask of CPUs with asymetric SMT dependancy */ |
750 | static const int powerpc_smt_flags(void) | 750 | static int powerpc_smt_flags(void) |
751 | { | 751 | { |
752 | int flags = SD_SHARE_CPUCAPACITY | SD_SHARE_PKG_RESOURCES; | 752 | int flags = SD_SHARE_CPUCAPACITY | SD_SHARE_PKG_RESOURCES; |
753 | 753 | ||