aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/kernel
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2008-04-21 18:50:49 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-04-21 18:50:49 -0400
commit9a64388d83f6ef08dfff405a9d122e3dbcb6bf38 (patch)
treea77532ce4d6d56be6c6c7f405cd901a0184250fb /arch/powerpc/kernel
parente80ab411e589e00550e2e6e5a6a02d59cc730357 (diff)
parent14b3ca4022f050f8622ed282b734ddf445464583 (diff)
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/paulus/powerpc
* 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/paulus/powerpc: (202 commits) [POWERPC] Fix compile breakage for 64-bit UP configs [POWERPC] Define copy_siginfo_from_user32 [POWERPC] Add compat handler for PTRACE_GETSIGINFO [POWERPC] i2c: Fix build breakage introduced by OF helpers [POWERPC] Optimize fls64() on 64-bit processors [POWERPC] irqtrace support for 64-bit powerpc [POWERPC] Stacktrace support for lockdep [POWERPC] Move stackframe definitions to common header [POWERPC] Fix device-tree locking vs. interrupts [POWERPC] Make pci_bus_to_host()'s struct pci_bus * argument const [POWERPC] Remove unused __max_memory variable [POWERPC] Simplify xics direct/lpar irq_host setup [POWERPC] Use pseries_setup_i8259_cascade() in pseries_mpic_init_IRQ() [POWERPC] Turn xics_setup_8259_cascade() into a generic pseries_setup_i8259_cascade() [POWERPC] Move xics_setup_8259_cascade() into platforms/pseries/setup.c [POWERPC] Use asm-generic/bitops/find.h in bitops.h [POWERPC] 83xx: mpc8315 - fix USB UTMI Host setup [POWERPC] 85xx: Fix the size of qe muram for MPC8568E [POWERPC] 86xx: mpc86xx_hpcn - Temporarily accept old dts node identifier. [POWERPC] 86xx: mark functions static, other minor cleanups ...
Diffstat (limited to 'arch/powerpc/kernel')
-rw-r--r--arch/powerpc/kernel/Makefile1
-rw-r--r--arch/powerpc/kernel/asm-offsets.c10
-rw-r--r--arch/powerpc/kernel/btext.c3
-rw-r--r--arch/powerpc/kernel/cpu_setup_44x.S5
-rw-r--r--arch/powerpc/kernel/cputable.c28
-rw-r--r--arch/powerpc/kernel/crash.c3
-rw-r--r--arch/powerpc/kernel/crash_dump.c3
-rw-r--r--arch/powerpc/kernel/entry_32.S30
-rw-r--r--arch/powerpc/kernel/entry_64.S30
-rw-r--r--arch/powerpc/kernel/head_32.S22
-rw-r--r--arch/powerpc/kernel/head_44x.S4
-rw-r--r--arch/powerpc/kernel/head_64.S69
-rw-r--r--arch/powerpc/kernel/head_booke.h33
-rw-r--r--arch/powerpc/kernel/head_fsl_booke.S44
-rw-r--r--arch/powerpc/kernel/ibmebus.c12
-rw-r--r--arch/powerpc/kernel/iommu.c4
-rw-r--r--arch/powerpc/kernel/irq.c18
-rw-r--r--arch/powerpc/kernel/isa-bridge.c6
-rw-r--r--arch/powerpc/kernel/lparcfg.c12
-rw-r--r--arch/powerpc/kernel/machine_kexec.c3
-rw-r--r--arch/powerpc/kernel/paca.c34
-rw-r--r--arch/powerpc/kernel/ppc32.h2
-rw-r--r--arch/powerpc/kernel/ppc_ksyms.c7
-rw-r--r--arch/powerpc/kernel/process.c33
-rw-r--r--arch/powerpc/kernel/prom.c120
-rw-r--r--arch/powerpc/kernel/prom_init.c8
-rw-r--r--arch/powerpc/kernel/ptrace32.c27
-rw-r--r--arch/powerpc/kernel/rtas.c4
-rw-r--r--arch/powerpc/kernel/rtas_flash.c2
-rw-r--r--arch/powerpc/kernel/rtas_pci.c29
-rw-r--r--arch/powerpc/kernel/setup-common.c11
-rw-r--r--arch/powerpc/kernel/setup_32.c14
-rw-r--r--arch/powerpc/kernel/setup_64.c8
-rw-r--r--arch/powerpc/kernel/signal_32.c19
-rw-r--r--arch/powerpc/kernel/stacktrace.c47
-rw-r--r--arch/powerpc/kernel/sys_ppc32.c5
-rw-r--r--arch/powerpc/kernel/vdso.c3
-rw-r--r--arch/powerpc/kernel/vio.c10
-rw-r--r--arch/powerpc/kernel/vmlinux.lds.S51
39 files changed, 531 insertions, 243 deletions
diff --git a/arch/powerpc/kernel/Makefile b/arch/powerpc/kernel/Makefile
index b9dbfff9afe9..ce1e8d24e747 100644
--- a/arch/powerpc/kernel/Makefile
+++ b/arch/powerpc/kernel/Makefile
@@ -67,6 +67,7 @@ obj-$(CONFIG_BOOTX_TEXT) += btext.o
67obj-$(CONFIG_SMP) += smp.o 67obj-$(CONFIG_SMP) += smp.o
68obj-$(CONFIG_KPROBES) += kprobes.o 68obj-$(CONFIG_KPROBES) += kprobes.o
69obj-$(CONFIG_PPC_UDBG_16550) += legacy_serial.o udbg_16550.o 69obj-$(CONFIG_PPC_UDBG_16550) += legacy_serial.o udbg_16550.o
70obj-$(CONFIG_STACKTRACE) += stacktrace.o
70 71
71pci64-$(CONFIG_PPC64) += pci_dn.o isa-bridge.o 72pci64-$(CONFIG_PPC64) += pci_dn.o isa-bridge.o
72obj-$(CONFIG_PCI) += pci_$(CONFIG_WORD_SIZE).o $(pci64-y) \ 73obj-$(CONFIG_PCI) += pci_$(CONFIG_WORD_SIZE).o $(pci64-y) \
diff --git a/arch/powerpc/kernel/asm-offsets.c b/arch/powerpc/kernel/asm-offsets.c
index 4b749c416464..292c6d8db0e1 100644
--- a/arch/powerpc/kernel/asm-offsets.c
+++ b/arch/powerpc/kernel/asm-offsets.c
@@ -26,8 +26,6 @@
26#ifdef CONFIG_PPC64 26#ifdef CONFIG_PPC64
27#include <linux/time.h> 27#include <linux/time.h>
28#include <linux/hardirq.h> 28#include <linux/hardirq.h>
29#else
30#include <linux/ptrace.h>
31#endif 29#endif
32 30
33#include <asm/io.h> 31#include <asm/io.h>
@@ -46,6 +44,9 @@
46#include <asm/mmu.h> 44#include <asm/mmu.h>
47#include <asm/hvcall.h> 45#include <asm/hvcall.h>
48#endif 46#endif
47#ifdef CONFIG_PPC_ISERIES
48#include <asm/iseries/alpaca.h>
49#endif
49 50
50#define DEFINE(sym, val) \ 51#define DEFINE(sym, val) \
51 asm volatile("\n->" #sym " %0 " #val : : "i" (val)) 52 asm volatile("\n->" #sym " %0 " #val : : "i" (val))
@@ -60,7 +61,6 @@ int main(void)
60 DEFINE(AUDITCONTEXT, offsetof(struct task_struct, audit_context)); 61 DEFINE(AUDITCONTEXT, offsetof(struct task_struct, audit_context));
61#else 62#else
62 DEFINE(THREAD_INFO, offsetof(struct task_struct, stack)); 63 DEFINE(THREAD_INFO, offsetof(struct task_struct, stack));
63 DEFINE(PTRACE, offsetof(struct task_struct, ptrace));
64#endif /* CONFIG_PPC64 */ 64#endif /* CONFIG_PPC64 */
65 65
66 DEFINE(KSP, offsetof(struct thread_struct, ksp)); 66 DEFINE(KSP, offsetof(struct thread_struct, ksp));
@@ -80,7 +80,6 @@ int main(void)
80 DEFINE(PGDIR, offsetof(struct thread_struct, pgdir)); 80 DEFINE(PGDIR, offsetof(struct thread_struct, pgdir));
81#if defined(CONFIG_4xx) || defined(CONFIG_BOOKE) 81#if defined(CONFIG_4xx) || defined(CONFIG_BOOKE)
82 DEFINE(THREAD_DBCR0, offsetof(struct thread_struct, dbcr0)); 82 DEFINE(THREAD_DBCR0, offsetof(struct thread_struct, dbcr0));
83 DEFINE(PT_PTRACED, PT_PTRACED);
84#endif 83#endif
85#ifdef CONFIG_SPE 84#ifdef CONFIG_SPE
86 DEFINE(THREAD_EVR0, offsetof(struct thread_struct, evr[0])); 85 DEFINE(THREAD_EVR0, offsetof(struct thread_struct, evr[0]));
@@ -325,6 +324,9 @@ int main(void)
325 DEFINE(PAGE_OFFSET_VSID, KERNEL_VSID(PAGE_OFFSET)); 324 DEFINE(PAGE_OFFSET_VSID, KERNEL_VSID(PAGE_OFFSET));
326 DEFINE(VMALLOC_START_ESID, GET_ESID(VMALLOC_START)); 325 DEFINE(VMALLOC_START_ESID, GET_ESID(VMALLOC_START));
327 DEFINE(VMALLOC_START_VSID, KERNEL_VSID(VMALLOC_START)); 326 DEFINE(VMALLOC_START_VSID, KERNEL_VSID(VMALLOC_START));
327
328 /* alpaca */
329 DEFINE(ALPACA_SIZE, sizeof(struct alpaca));
328#endif 330#endif
329 331
330 DEFINE(PGD_TABLE_SIZE, PGD_TABLE_SIZE); 332 DEFINE(PGD_TABLE_SIZE, PGD_TABLE_SIZE);
diff --git a/arch/powerpc/kernel/btext.c b/arch/powerpc/kernel/btext.c
index 80e2eef05b2e..9f9377745490 100644
--- a/arch/powerpc/kernel/btext.c
+++ b/arch/powerpc/kernel/btext.c
@@ -7,6 +7,7 @@
7#include <linux/string.h> 7#include <linux/string.h>
8#include <linux/init.h> 8#include <linux/init.h>
9#include <linux/module.h> 9#include <linux/module.h>
10#include <linux/lmb.h>
10 11
11#include <asm/sections.h> 12#include <asm/sections.h>
12#include <asm/prom.h> 13#include <asm/prom.h>
@@ -15,7 +16,7 @@
15#include <asm/mmu.h> 16#include <asm/mmu.h>
16#include <asm/pgtable.h> 17#include <asm/pgtable.h>
17#include <asm/io.h> 18#include <asm/io.h>
18#include <asm/lmb.h> 19#include <asm/prom.h>
19#include <asm/processor.h> 20#include <asm/processor.h>
20#include <asm/udbg.h> 21#include <asm/udbg.h>
21 22
diff --git a/arch/powerpc/kernel/cpu_setup_44x.S b/arch/powerpc/kernel/cpu_setup_44x.S
index 6250443ab9c9..5465e8de0e61 100644
--- a/arch/powerpc/kernel/cpu_setup_44x.S
+++ b/arch/powerpc/kernel/cpu_setup_44x.S
@@ -3,7 +3,7 @@
3 * Valentine Barshak <vbarshak@ru.mvista.com> 3 * Valentine Barshak <vbarshak@ru.mvista.com>
4 * MontaVista Software, Inc (c) 2007 4 * MontaVista Software, Inc (c) 2007
5 * 5 *
6 * Based on cpu_setup_6xx code by 6 * Based on cpu_setup_6xx code by
7 * Benjamin Herrenschmidt <benh@kernel.crashing.org> 7 * Benjamin Herrenschmidt <benh@kernel.crashing.org>
8 * 8 *
9 * This program is free software; you can redistribute it and/or 9 * This program is free software; you can redistribute it and/or
@@ -32,6 +32,9 @@ _GLOBAL(__setup_cpu_440grx)
32 bl __fixup_440A_mcheck 32 bl __fixup_440A_mcheck
33 mtlr r4 33 mtlr r4
34 blr 34 blr
35_GLOBAL(__setup_cpu_460ex)
36_GLOBAL(__setup_cpu_460gt)
37 b __init_fpu_44x
35_GLOBAL(__setup_cpu_440gx) 38_GLOBAL(__setup_cpu_440gx)
36_GLOBAL(__setup_cpu_440spe) 39_GLOBAL(__setup_cpu_440spe)
37 b __fixup_440A_mcheck 40 b __fixup_440A_mcheck
diff --git a/arch/powerpc/kernel/cputable.c b/arch/powerpc/kernel/cputable.c
index 2a8f5cc5184f..26ffb44e2701 100644
--- a/arch/powerpc/kernel/cputable.c
+++ b/arch/powerpc/kernel/cputable.c
@@ -36,6 +36,8 @@ extern void __setup_cpu_440epx(unsigned long offset, struct cpu_spec* spec);
36extern void __setup_cpu_440gx(unsigned long offset, struct cpu_spec* spec); 36extern void __setup_cpu_440gx(unsigned long offset, struct cpu_spec* spec);
37extern void __setup_cpu_440grx(unsigned long offset, struct cpu_spec* spec); 37extern void __setup_cpu_440grx(unsigned long offset, struct cpu_spec* spec);
38extern void __setup_cpu_440spe(unsigned long offset, struct cpu_spec* spec); 38extern void __setup_cpu_440spe(unsigned long offset, struct cpu_spec* spec);
39extern void __setup_cpu_460ex(unsigned long offset, struct cpu_spec* spec);
40extern void __setup_cpu_460gt(unsigned long offset, struct cpu_spec* spec);
39extern void __setup_cpu_603(unsigned long offset, struct cpu_spec* spec); 41extern void __setup_cpu_603(unsigned long offset, struct cpu_spec* spec);
40extern void __setup_cpu_604(unsigned long offset, struct cpu_spec* spec); 42extern void __setup_cpu_604(unsigned long offset, struct cpu_spec* spec);
41extern void __setup_cpu_750(unsigned long offset, struct cpu_spec* spec); 43extern void __setup_cpu_750(unsigned long offset, struct cpu_spec* spec);
@@ -1397,6 +1399,30 @@ static struct cpu_spec __initdata cpu_specs[] = {
1397 .machine_check = machine_check_440A, 1399 .machine_check = machine_check_440A,
1398 .platform = "ppc440", 1400 .platform = "ppc440",
1399 }, 1401 },
1402 { /* 460EX */
1403 .pvr_mask = 0xffff0002,
1404 .pvr_value = 0x13020002,
1405 .cpu_name = "460EX",
1406 .cpu_features = CPU_FTRS_44X,
1407 .cpu_user_features = COMMON_USER_BOOKE | PPC_FEATURE_HAS_FPU,
1408 .icache_bsize = 32,
1409 .dcache_bsize = 32,
1410 .cpu_setup = __setup_cpu_460ex,
1411 .machine_check = machine_check_440A,
1412 .platform = "ppc440",
1413 },
1414 { /* 460GT */
1415 .pvr_mask = 0xffff0002,
1416 .pvr_value = 0x13020000,
1417 .cpu_name = "460GT",
1418 .cpu_features = CPU_FTRS_44X,
1419 .cpu_user_features = COMMON_USER_BOOKE | PPC_FEATURE_HAS_FPU,
1420 .icache_bsize = 32,
1421 .dcache_bsize = 32,
1422 .cpu_setup = __setup_cpu_460gt,
1423 .machine_check = machine_check_440A,
1424 .platform = "ppc440",
1425 },
1400#endif /* CONFIG_44x */ 1426#endif /* CONFIG_44x */
1401#ifdef CONFIG_FSL_BOOKE 1427#ifdef CONFIG_FSL_BOOKE
1402#ifdef CONFIG_E200 1428#ifdef CONFIG_E200
@@ -1512,7 +1538,7 @@ struct cpu_spec * __init identify_cpu(unsigned long offset, unsigned int pvr)
1512 *t = *s; 1538 *t = *s;
1513 *PTRRELOC(&cur_cpu_spec) = &the_cpu_spec; 1539 *PTRRELOC(&cur_cpu_spec) = &the_cpu_spec;
1514#if defined(CONFIG_PPC64) || defined(CONFIG_BOOKE) 1540#if defined(CONFIG_PPC64) || defined(CONFIG_BOOKE)
1515 /* ppc64 and booke expect identify_cpu to also call 1541 /* ppc64 and booke expect identify_cpu to also call
1516 * setup_cpu for that processor. I will consolidate 1542 * setup_cpu for that processor. I will consolidate
1517 * that at a later time, for now, just use #ifdef. 1543 * that at a later time, for now, just use #ifdef.
1518 * we also don't need to PTRRELOC the function pointer 1544 * we also don't need to PTRRELOC the function pointer
diff --git a/arch/powerpc/kernel/crash.c b/arch/powerpc/kernel/crash.c
index 571132ed12c1..eae401de3f76 100644
--- a/arch/powerpc/kernel/crash.c
+++ b/arch/powerpc/kernel/crash.c
@@ -24,12 +24,13 @@
24#include <linux/init.h> 24#include <linux/init.h>
25#include <linux/irq.h> 25#include <linux/irq.h>
26#include <linux/types.h> 26#include <linux/types.h>
27#include <linux/lmb.h>
27 28
28#include <asm/processor.h> 29#include <asm/processor.h>
29#include <asm/machdep.h> 30#include <asm/machdep.h>
30#include <asm/kexec.h> 31#include <asm/kexec.h>
31#include <asm/kdump.h> 32#include <asm/kdump.h>
32#include <asm/lmb.h> 33#include <asm/prom.h>
33#include <asm/firmware.h> 34#include <asm/firmware.h>
34#include <asm/smp.h> 35#include <asm/smp.h>
35#include <asm/system.h> 36#include <asm/system.h>
diff --git a/arch/powerpc/kernel/crash_dump.c b/arch/powerpc/kernel/crash_dump.c
index 29ff77c468ac..9ee3c5278db0 100644
--- a/arch/powerpc/kernel/crash_dump.c
+++ b/arch/powerpc/kernel/crash_dump.c
@@ -13,8 +13,9 @@
13 13
14#include <linux/crash_dump.h> 14#include <linux/crash_dump.h>
15#include <linux/bootmem.h> 15#include <linux/bootmem.h>
16#include <linux/lmb.h>
16#include <asm/kdump.h> 17#include <asm/kdump.h>
17#include <asm/lmb.h> 18#include <asm/prom.h>
18#include <asm/firmware.h> 19#include <asm/firmware.h>
19#include <asm/uaccess.h> 20#include <asm/uaccess.h>
20 21
diff --git a/arch/powerpc/kernel/entry_32.S b/arch/powerpc/kernel/entry_32.S
index 69a91bd46115..84c868633068 100644
--- a/arch/powerpc/kernel/entry_32.S
+++ b/arch/powerpc/kernel/entry_32.S
@@ -110,9 +110,9 @@ transfer_to_handler:
110 stw r11,PT_REGS(r12) 110 stw r11,PT_REGS(r12)
111#if defined(CONFIG_40x) || defined(CONFIG_BOOKE) 111#if defined(CONFIG_40x) || defined(CONFIG_BOOKE)
112 /* Check to see if the dbcr0 register is set up to debug. Use the 112 /* Check to see if the dbcr0 register is set up to debug. Use the
113 single-step bit to do this. */ 113 internal debug mode bit to do this. */
114 lwz r12,THREAD_DBCR0(r12) 114 lwz r12,THREAD_DBCR0(r12)
115 andis. r12,r12,DBCR0_IC@h 115 andis. r12,r12,DBCR0_IDM@h
116 beq+ 3f 116 beq+ 3f
117 /* From user and task is ptraced - load up global dbcr0 */ 117 /* From user and task is ptraced - load up global dbcr0 */
118 li r12,-1 /* clear all pending debug events */ 118 li r12,-1 /* clear all pending debug events */
@@ -120,6 +120,12 @@ transfer_to_handler:
120 lis r11,global_dbcr0@ha 120 lis r11,global_dbcr0@ha
121 tophys(r11,r11) 121 tophys(r11,r11)
122 addi r11,r11,global_dbcr0@l 122 addi r11,r11,global_dbcr0@l
123#ifdef CONFIG_SMP
124 rlwinm r9,r1,0,0,(31-THREAD_SHIFT)
125 lwz r9,TI_CPU(r9)
126 slwi r9,r9,3
127 add r11,r11,r9
128#endif
123 lwz r12,0(r11) 129 lwz r12,0(r11)
124 mtspr SPRN_DBCR0,r12 130 mtspr SPRN_DBCR0,r12
125 lwz r12,4(r11) 131 lwz r12,4(r11)
@@ -238,10 +244,10 @@ ret_from_syscall:
238 stw r11,_CCR(r1) 244 stw r11,_CCR(r1)
239syscall_exit_cont: 245syscall_exit_cont:
240#if defined(CONFIG_4xx) || defined(CONFIG_BOOKE) 246#if defined(CONFIG_4xx) || defined(CONFIG_BOOKE)
241 /* If the process has its own DBCR0 value, load it up. The single 247 /* If the process has its own DBCR0 value, load it up. The internal
242 step bit tells us that dbcr0 should be loaded. */ 248 debug mode bit tells us that dbcr0 should be loaded. */
243 lwz r0,THREAD+THREAD_DBCR0(r2) 249 lwz r0,THREAD+THREAD_DBCR0(r2)
244 andis. r10,r0,DBCR0_IC@h 250 andis. r10,r0,DBCR0_IDM@h
245 bnel- load_dbcr0 251 bnel- load_dbcr0
246#endif 252#endif
247#ifdef CONFIG_44x 253#ifdef CONFIG_44x
@@ -666,10 +672,10 @@ user_exc_return: /* r10 contains MSR_KERNEL here */
666 672
667restore_user: 673restore_user:
668#if defined(CONFIG_4xx) || defined(CONFIG_BOOKE) 674#if defined(CONFIG_4xx) || defined(CONFIG_BOOKE)
669 /* Check whether this process has its own DBCR0 value. The single 675 /* Check whether this process has its own DBCR0 value. The internal
670 step bit tells us that dbcr0 should be loaded. */ 676 debug mode bit tells us that dbcr0 should be loaded. */
671 lwz r0,THREAD+THREAD_DBCR0(r2) 677 lwz r0,THREAD+THREAD_DBCR0(r2)
672 andis. r10,r0,DBCR0_IC@h 678 andis. r10,r0,DBCR0_IDM@h
673 bnel- load_dbcr0 679 bnel- load_dbcr0
674#endif 680#endif
675 681
@@ -879,6 +885,12 @@ load_dbcr0:
879 mfspr r10,SPRN_DBCR0 885 mfspr r10,SPRN_DBCR0
880 lis r11,global_dbcr0@ha 886 lis r11,global_dbcr0@ha
881 addi r11,r11,global_dbcr0@l 887 addi r11,r11,global_dbcr0@l
888#ifdef CONFIG_SMP
889 rlwinm r9,r1,0,0,(31-THREAD_SHIFT)
890 lwz r9,TI_CPU(r9)
891 slwi r9,r9,3
892 add r11,r11,r9
893#endif
882 stw r10,0(r11) 894 stw r10,0(r11)
883 mtspr SPRN_DBCR0,r0 895 mtspr SPRN_DBCR0,r0
884 lwz r10,4(r11) 896 lwz r10,4(r11)
@@ -891,7 +903,7 @@ load_dbcr0:
891 .section .bss 903 .section .bss
892 .align 4 904 .align 4
893global_dbcr0: 905global_dbcr0:
894 .space 8 906 .space 8*NR_CPUS
895 .previous 907 .previous
896#endif /* !(CONFIG_4xx || CONFIG_BOOKE) */ 908#endif /* !(CONFIG_4xx || CONFIG_BOOKE) */
897 909
diff --git a/arch/powerpc/kernel/entry_64.S b/arch/powerpc/kernel/entry_64.S
index 148a3547c9aa..c0db5b769e55 100644
--- a/arch/powerpc/kernel/entry_64.S
+++ b/arch/powerpc/kernel/entry_64.S
@@ -29,6 +29,8 @@
29#include <asm/cputable.h> 29#include <asm/cputable.h>
30#include <asm/firmware.h> 30#include <asm/firmware.h>
31#include <asm/bug.h> 31#include <asm/bug.h>
32#include <asm/ptrace.h>
33#include <asm/irqflags.h>
32 34
33/* 35/*
34 * System calls. 36 * System calls.
@@ -39,7 +41,7 @@
39 41
40/* This value is used to mark exception frames on the stack. */ 42/* This value is used to mark exception frames on the stack. */
41exception_marker: 43exception_marker:
42 .tc ID_72656773_68657265[TC],0x7265677368657265 44 .tc ID_EXC_MARKER[TC],STACK_FRAME_REGS_MARKER
43 45
44 .section ".text" 46 .section ".text"
45 .align 7 47 .align 7
@@ -88,6 +90,14 @@ system_call_common:
88 addi r9,r1,STACK_FRAME_OVERHEAD 90 addi r9,r1,STACK_FRAME_OVERHEAD
89 ld r11,exception_marker@toc(r2) 91 ld r11,exception_marker@toc(r2)
90 std r11,-16(r9) /* "regshere" marker */ 92 std r11,-16(r9) /* "regshere" marker */
93#ifdef CONFIG_TRACE_IRQFLAGS
94 bl .trace_hardirqs_on
95 REST_GPR(0,r1)
96 REST_4GPRS(3,r1)
97 REST_2GPRS(7,r1)
98 addi r9,r1,STACK_FRAME_OVERHEAD
99 ld r12,_MSR(r1)
100#endif /* CONFIG_TRACE_IRQFLAGS */
91 li r10,1 101 li r10,1
92 stb r10,PACASOFTIRQEN(r13) 102 stb r10,PACASOFTIRQEN(r13)
93 stb r10,PACAHARDIRQEN(r13) 103 stb r10,PACAHARDIRQEN(r13)
@@ -102,7 +112,7 @@ BEGIN_FW_FTR_SECTION
102 b hardware_interrupt_entry 112 b hardware_interrupt_entry
1032: 1132:
104END_FW_FTR_SECTION_IFSET(FW_FEATURE_ISERIES) 114END_FW_FTR_SECTION_IFSET(FW_FEATURE_ISERIES)
105#endif 115#endif /* CONFIG_PPC_ISERIES */
106 mfmsr r11 116 mfmsr r11
107 ori r11,r11,MSR_EE 117 ori r11,r11,MSR_EE
108 mtmsrd r11,1 118 mtmsrd r11,1
@@ -504,6 +514,10 @@ BEGIN_FW_FTR_SECTION
504 514
505 li r3,0 515 li r3,0
506 stb r3,PACASOFTIRQEN(r13) /* ensure we are soft-disabled */ 516 stb r3,PACASOFTIRQEN(r13) /* ensure we are soft-disabled */
517#ifdef CONFIG_TRACE_IRQFLAGS
518 bl .trace_hardirqs_off
519 mfmsr r10
520#endif
507 ori r10,r10,MSR_EE 521 ori r10,r10,MSR_EE
508 mtmsrd r10 /* hard-enable again */ 522 mtmsrd r10 /* hard-enable again */
509 addi r3,r1,STACK_FRAME_OVERHEAD 523 addi r3,r1,STACK_FRAME_OVERHEAD
@@ -512,7 +526,7 @@ BEGIN_FW_FTR_SECTION
5124: 5264:
513END_FW_FTR_SECTION_IFSET(FW_FEATURE_ISERIES) 527END_FW_FTR_SECTION_IFSET(FW_FEATURE_ISERIES)
514#endif 528#endif
515 stb r5,PACASOFTIRQEN(r13) 529 TRACE_AND_RESTORE_IRQ(r5);
516 530
517 /* extract EE bit and use it to restore paca->hard_enabled */ 531 /* extract EE bit and use it to restore paca->hard_enabled */
518 ld r3,_MSR(r1) 532 ld r3,_MSR(r1)
@@ -580,6 +594,16 @@ do_work:
580 bne restore 594 bne restore
581 /* here we are preempting the current task */ 595 /* here we are preempting the current task */
5821: 5961:
597#ifdef CONFIG_TRACE_IRQFLAGS
598 bl .trace_hardirqs_on
599 /* Note: we just clobbered r10 which used to contain the previous
600 * MSR before the hard-disabling done by the caller of do_work.
601 * We don't have that value anymore, but it doesn't matter as
602 * we will hard-enable unconditionally, we can just reload the
603 * current MSR into r10
604 */
605 mfmsr r10
606#endif /* CONFIG_TRACE_IRQFLAGS */
583 li r0,1 607 li r0,1
584 stb r0,PACASOFTIRQEN(r13) 608 stb r0,PACASOFTIRQEN(r13)
585 stb r0,PACAHARDIRQEN(r13) 609 stb r0,PACAHARDIRQEN(r13)
diff --git a/arch/powerpc/kernel/head_32.S b/arch/powerpc/kernel/head_32.S
index 0f4fac512020..785af9b56591 100644
--- a/arch/powerpc/kernel/head_32.S
+++ b/arch/powerpc/kernel/head_32.S
@@ -30,6 +30,7 @@
30#include <asm/thread_info.h> 30#include <asm/thread_info.h>
31#include <asm/ppc_asm.h> 31#include <asm/ppc_asm.h>
32#include <asm/asm-offsets.h> 32#include <asm/asm-offsets.h>
33#include <asm/ptrace.h>
33 34
34/* 601 only have IBAT; cr0.eq is set on 601 when using this macro */ 35/* 601 only have IBAT; cr0.eq is set on 601 when using this macro */
35#define LOAD_BAT(n, reg, RA, RB) \ 36#define LOAD_BAT(n, reg, RA, RB) \
@@ -268,8 +269,8 @@ __secondary_hold_acknowledge:
268 li r10,MSR_KERNEL & ~(MSR_IR|MSR_DR); /* can take exceptions */ \ 269 li r10,MSR_KERNEL & ~(MSR_IR|MSR_DR); /* can take exceptions */ \
269 MTMSRD(r10); /* (except for mach check in rtas) */ \ 270 MTMSRD(r10); /* (except for mach check in rtas) */ \
270 stw r0,GPR0(r11); \ 271 stw r0,GPR0(r11); \
271 lis r10,0x7265; /* put exception frame marker */ \ 272 lis r10,STACK_FRAME_REGS_MARKER@ha; /* exception frame marker */ \
272 addi r10,r10,0x6773; \ 273 addi r10,r10,STACK_FRAME_REGS_MARKER@l; \
273 stw r10,8(r11); \ 274 stw r10,8(r11); \
274 SAVE_4GPRS(3, r11); \ 275 SAVE_4GPRS(3, r11); \
275 SAVE_2GPRS(7, r11) 276 SAVE_2GPRS(7, r11)
@@ -763,23 +764,6 @@ load_up_altivec:
763 b fast_exception_return 764 b fast_exception_return
764 765
765/* 766/*
766 * AltiVec unavailable trap from kernel - print a message, but let
767 * the task use AltiVec in the kernel until it returns to user mode.
768 */
769KernelAltiVec:
770 lwz r3,_MSR(r1)
771 oris r3,r3,MSR_VEC@h
772 stw r3,_MSR(r1) /* enable use of AltiVec after return */
773 lis r3,87f@h
774 ori r3,r3,87f@l
775 mr r4,r2 /* current */
776 lwz r5,_NIP(r1)
777 bl printk
778 b ret_from_except
77987: .string "AltiVec used in kernel (task=%p, pc=%x) \n"
780 .align 4,0
781
782/*
783 * giveup_altivec(tsk) 767 * giveup_altivec(tsk)
784 * Disable AltiVec for the task given as the argument, 768 * Disable AltiVec for the task given as the argument,
785 * and save the AltiVec registers in its thread_struct. 769 * and save the AltiVec registers in its thread_struct.
diff --git a/arch/powerpc/kernel/head_44x.S b/arch/powerpc/kernel/head_44x.S
index ad071a146a8d..b84ec6a2fc94 100644
--- a/arch/powerpc/kernel/head_44x.S
+++ b/arch/powerpc/kernel/head_44x.S
@@ -211,7 +211,7 @@ skpinv: addi r4,r4,1 /* Increment */
211 SET_IVOR(12, WatchdogTimer); 211 SET_IVOR(12, WatchdogTimer);
212 SET_IVOR(13, DataTLBError); 212 SET_IVOR(13, DataTLBError);
213 SET_IVOR(14, InstructionTLBError); 213 SET_IVOR(14, InstructionTLBError);
214 SET_IVOR(15, Debug); 214 SET_IVOR(15, DebugCrit);
215 215
216 /* Establish the interrupt vector base */ 216 /* Establish the interrupt vector base */
217 lis r4,interrupt_base@h /* IVPR only uses the high 16-bits */ 217 lis r4,interrupt_base@h /* IVPR only uses the high 16-bits */
@@ -578,7 +578,7 @@ interrupt_base:
578 b InstructionStorage 578 b InstructionStorage
579 579
580 /* Debug Interrupt */ 580 /* Debug Interrupt */
581 DEBUG_EXCEPTION 581 DEBUG_CRIT_EXCEPTION
582 582
583/* 583/*
584 * Local functions 584 * Local functions
diff --git a/arch/powerpc/kernel/head_64.S b/arch/powerpc/kernel/head_64.S
index d3aee08e6814..215973a2c8d5 100644
--- a/arch/powerpc/kernel/head_64.S
+++ b/arch/powerpc/kernel/head_64.S
@@ -36,8 +36,7 @@
36#include <asm/firmware.h> 36#include <asm/firmware.h>
37#include <asm/page_64.h> 37#include <asm/page_64.h>
38#include <asm/exception.h> 38#include <asm/exception.h>
39 39#include <asm/irqflags.h>
40#define DO_SOFT_DISABLE
41 40
42/* 41/*
43 * We layout physical memory as follows: 42 * We layout physical memory as follows:
@@ -450,8 +449,8 @@ bad_stack:
450 */ 449 */
451fast_exc_return_irq: /* restores irq state too */ 450fast_exc_return_irq: /* restores irq state too */
452 ld r3,SOFTE(r1) 451 ld r3,SOFTE(r1)
452 TRACE_AND_RESTORE_IRQ(r3);
453 ld r12,_MSR(r1) 453 ld r12,_MSR(r1)
454 stb r3,PACASOFTIRQEN(r13) /* restore paca->soft_enabled */
455 rldicl r4,r12,49,63 /* get MSR_EE to LSB */ 454 rldicl r4,r12,49,63 /* get MSR_EE to LSB */
456 stb r4,PACAHARDIRQEN(r13) /* restore paca->hard_enabled */ 455 stb r4,PACAHARDIRQEN(r13) /* restore paca->hard_enabled */
457 b 1f 456 b 1f
@@ -621,7 +620,7 @@ END_FW_FTR_SECTION_IFSET(FW_FEATURE_ISERIES)
621 mtlr r10 620 mtlr r10
622 621
623 andi. r10,r12,MSR_RI /* check for unrecoverable exception */ 622 andi. r10,r12,MSR_RI /* check for unrecoverable exception */
624 beq- unrecov_slb 623 beq- 2f
625 624
626.machine push 625.machine push
627.machine "power4" 626.machine "power4"
@@ -643,6 +642,22 @@ END_FW_FTR_SECTION_IFSET(FW_FEATURE_ISERIES)
643 rfid 642 rfid
644 b . /* prevent speculative execution */ 643 b . /* prevent speculative execution */
645 644
6452:
646#ifdef CONFIG_PPC_ISERIES
647BEGIN_FW_FTR_SECTION
648 b unrecov_slb
649END_FW_FTR_SECTION_IFSET(FW_FEATURE_ISERIES)
650#endif /* CONFIG_PPC_ISERIES */
651 mfspr r11,SPRN_SRR0
652 clrrdi r10,r13,32
653 LOAD_HANDLER(r10,unrecov_slb)
654 mtspr SPRN_SRR0,r10
655 mfmsr r10
656 ori r10,r10,MSR_IR|MSR_DR|MSR_RI
657 mtspr SPRN_SRR1,r10
658 rfid
659 b .
660
646unrecov_slb: 661unrecov_slb:
647 EXCEPTION_PROLOG_COMMON(0x4100, PACA_EXSLB) 662 EXCEPTION_PROLOG_COMMON(0x4100, PACA_EXSLB)
648 DISABLE_INTS 663 DISABLE_INTS
@@ -808,7 +823,7 @@ _STATIC(load_up_altivec)
808 * Hash table stuff 823 * Hash table stuff
809 */ 824 */
810 .align 7 825 .align 7
811_GLOBAL(do_hash_page) 826_STATIC(do_hash_page)
812 std r3,_DAR(r1) 827 std r3,_DAR(r1)
813 std r4,_DSISR(r1) 828 std r4,_DSISR(r1)
814 829
@@ -820,6 +835,27 @@ BEGIN_FTR_SECTION
820END_FTR_SECTION_IFCLR(CPU_FTR_SLB) 835END_FTR_SECTION_IFCLR(CPU_FTR_SLB)
821 836
822 /* 837 /*
838 * On iSeries, we soft-disable interrupts here, then
839 * hard-enable interrupts so that the hash_page code can spin on
840 * the hash_table_lock without problems on a shared processor.
841 */
842 DISABLE_INTS
843
844 /*
845 * Currently, trace_hardirqs_off() will be called by DISABLE_INTS
846 * and will clobber volatile registers when irq tracing is enabled
847 * so we need to reload them. It may be possible to be smarter here
848 * and move the irq tracing elsewhere but let's keep it simple for
849 * now
850 */
851#ifdef CONFIG_TRACE_IRQFLAGS
852 ld r3,_DAR(r1)
853 ld r4,_DSISR(r1)
854 ld r5,_TRAP(r1)
855 ld r12,_MSR(r1)
856 clrrdi r5,r5,4
857#endif /* CONFIG_TRACE_IRQFLAGS */
858 /*
823 * We need to set the _PAGE_USER bit if MSR_PR is set or if we are 859 * We need to set the _PAGE_USER bit if MSR_PR is set or if we are
824 * accessing a userspace segment (even from the kernel). We assume 860 * accessing a userspace segment (even from the kernel). We assume
825 * kernel addresses always have the high bit set. 861 * kernel addresses always have the high bit set.
@@ -832,13 +868,6 @@ END_FTR_SECTION_IFCLR(CPU_FTR_SLB)
832 rlwimi r4,r5,22+2,31-2,31-2 /* Set _PAGE_EXEC if trap is 0x400 */ 868 rlwimi r4,r5,22+2,31-2,31-2 /* Set _PAGE_EXEC if trap is 0x400 */
833 869
834 /* 870 /*
835 * On iSeries, we soft-disable interrupts here, then
836 * hard-enable interrupts so that the hash_page code can spin on
837 * the hash_table_lock without problems on a shared processor.
838 */
839 DISABLE_INTS
840
841 /*
842 * r3 contains the faulting address 871 * r3 contains the faulting address
843 * r4 contains the required access permissions 872 * r4 contains the required access permissions
844 * r5 contains the trap number 873 * r5 contains the trap number
@@ -848,7 +877,6 @@ END_FTR_SECTION_IFCLR(CPU_FTR_SLB)
848 bl .hash_page /* build HPTE if possible */ 877 bl .hash_page /* build HPTE if possible */
849 cmpdi r3,0 /* see if hash_page succeeded */ 878 cmpdi r3,0 /* see if hash_page succeeded */
850 879
851#ifdef DO_SOFT_DISABLE
852BEGIN_FW_FTR_SECTION 880BEGIN_FW_FTR_SECTION
853 /* 881 /*
854 * If we had interrupts soft-enabled at the point where the 882 * If we had interrupts soft-enabled at the point where the
@@ -860,7 +888,7 @@ BEGIN_FW_FTR_SECTION
860 */ 888 */
861 beq 13f 889 beq 13f
862END_FW_FTR_SECTION_IFSET(FW_FEATURE_ISERIES) 890END_FW_FTR_SECTION_IFSET(FW_FEATURE_ISERIES)
863#endif 891
864BEGIN_FW_FTR_SECTION 892BEGIN_FW_FTR_SECTION
865 /* 893 /*
866 * Here we have interrupts hard-disabled, so it is sufficient 894 * Here we have interrupts hard-disabled, so it is sufficient
@@ -874,11 +902,12 @@ END_FW_FTR_SECTION_IFCLR(FW_FEATURE_ISERIES)
874 902
875 /* 903 /*
876 * hash_page couldn't handle it, set soft interrupt enable back 904 * hash_page couldn't handle it, set soft interrupt enable back
877 * to what it was before the trap. Note that .local_irq_restore 905 * to what it was before the trap. Note that .raw_local_irq_restore
878 * handles any interrupts pending at this point. 906 * handles any interrupts pending at this point.
879 */ 907 */
880 ld r3,SOFTE(r1) 908 ld r3,SOFTE(r1)
881 bl .local_irq_restore 909 TRACE_AND_RESTORE_IRQ_PARTIAL(r3, 11f)
910 bl .raw_local_irq_restore
882 b 11f 911 b 11f
883 912
884/* Here we have a page fault that hash_page can't handle. */ 913/* Here we have a page fault that hash_page can't handle. */
@@ -1477,6 +1506,10 @@ _INIT_STATIC(start_here_multiplatform)
1477 addi r2,r2,0x4000 1506 addi r2,r2,0x4000
1478 add r2,r2,r26 1507 add r2,r2,r26
1479 1508
1509 /* Set initial ptr to current */
1510 LOAD_REG_IMMEDIATE(r4, init_task)
1511 std r4,PACACURRENT(r13)
1512
1480 /* Do very early kernel initializations, including initial hash table, 1513 /* Do very early kernel initializations, including initial hash table,
1481 * stab and slb setup before we turn on relocation. */ 1514 * stab and slb setup before we turn on relocation. */
1482 1515
@@ -1505,10 +1538,6 @@ _INIT_GLOBAL(start_here_common)
1505 li r0,0 1538 li r0,0
1506 stdu r0,-STACK_FRAME_OVERHEAD(r1) 1539 stdu r0,-STACK_FRAME_OVERHEAD(r1)
1507 1540
1508 /* ptr to current */
1509 LOAD_REG_IMMEDIATE(r4, init_task)
1510 std r4,PACACURRENT(r13)
1511
1512 /* Load the TOC */ 1541 /* Load the TOC */
1513 ld r2,PACATOC(r13) 1542 ld r2,PACATOC(r13)
1514 std r1,PACAKSAVE(r13) 1543 std r1,PACAKSAVE(r13)
diff --git a/arch/powerpc/kernel/head_booke.h b/arch/powerpc/kernel/head_booke.h
index ba9393f8e77a..aefafc6330c9 100644
--- a/arch/powerpc/kernel/head_booke.h
+++ b/arch/powerpc/kernel/head_booke.h
@@ -56,8 +56,17 @@
56 * is necessary since the MMU is always on, for Book-E parts, and the stacks 56 * is necessary since the MMU is always on, for Book-E parts, and the stacks
57 * are offset from KERNELBASE. 57 * are offset from KERNELBASE.
58 * 58 *
59 * There is some space optimization to be had here if desired. However
60 * to allow for a common kernel with support for debug exceptions either
61 * going to critical or their own debug level we aren't currently
62 * providing configurations that micro-optimize space usage.
59 */ 63 */
60#define BOOKE_EXCEPTION_STACK_SIZE (8192) 64#ifdef CONFIG_44x
65#define NUM_EXCEPTION_LVLS 2
66#else
67#define NUM_EXCEPTION_LVLS 3
68#endif
69#define BOOKE_EXCEPTION_STACK_SIZE (4096 * NUM_EXCEPTION_LVLS)
61 70
62/* CRIT_SPRG only used in critical exception handling */ 71/* CRIT_SPRG only used in critical exception handling */
63#define CRIT_SPRG SPRN_SPRG2 72#define CRIT_SPRG SPRN_SPRG2
@@ -68,7 +77,7 @@
68#define CRIT_STACK_TOP (exception_stack_top) 77#define CRIT_STACK_TOP (exception_stack_top)
69 78
70/* only on e200 for now */ 79/* only on e200 for now */
71#define DEBUG_STACK_TOP (exception_stack_top - 4096) 80#define DEBUG_STACK_TOP (exception_stack_top - 8192)
72#define DEBUG_SPRG SPRN_SPRG6W 81#define DEBUG_SPRG SPRN_SPRG6W
73 82
74#ifdef CONFIG_SMP 83#ifdef CONFIG_SMP
@@ -212,9 +221,8 @@ label:
212 * save (and later restore) the MSR via SPRN_CSRR1, which will still have 221 * save (and later restore) the MSR via SPRN_CSRR1, which will still have
213 * the MSR_DE bit set. 222 * the MSR_DE bit set.
214 */ 223 */
215#ifdef CONFIG_E200 224#define DEBUG_DEBUG_EXCEPTION \
216#define DEBUG_EXCEPTION \ 225 START_EXCEPTION(DebugDebug); \
217 START_EXCEPTION(Debug); \
218 DEBUG_EXCEPTION_PROLOG; \ 226 DEBUG_EXCEPTION_PROLOG; \
219 \ 227 \
220 /* \ 228 /* \
@@ -234,8 +242,8 @@ label:
234 cmplw r12,r10; \ 242 cmplw r12,r10; \
235 blt+ 2f; /* addr below exception vectors */ \ 243 blt+ 2f; /* addr below exception vectors */ \
236 \ 244 \
237 lis r10,Debug@h; \ 245 lis r10,DebugDebug@h; \
238 ori r10,r10,Debug@l; \ 246 ori r10,r10,DebugDebug@l; \
239 cmplw r12,r10; \ 247 cmplw r12,r10; \
240 bgt+ 2f; /* addr above exception vectors */ \ 248 bgt+ 2f; /* addr above exception vectors */ \
241 \ 249 \
@@ -265,9 +273,9 @@ label:
2652: mfspr r4,SPRN_DBSR; \ 2732: mfspr r4,SPRN_DBSR; \
266 addi r3,r1,STACK_FRAME_OVERHEAD; \ 274 addi r3,r1,STACK_FRAME_OVERHEAD; \
267 EXC_XFER_TEMPLATE(DebugException, 0x2002, (MSR_KERNEL & ~(MSR_ME|MSR_DE|MSR_CE)), NOCOPY, debug_transfer_to_handler, ret_from_debug_exc) 275 EXC_XFER_TEMPLATE(DebugException, 0x2002, (MSR_KERNEL & ~(MSR_ME|MSR_DE|MSR_CE)), NOCOPY, debug_transfer_to_handler, ret_from_debug_exc)
268#else 276
269#define DEBUG_EXCEPTION \ 277#define DEBUG_CRIT_EXCEPTION \
270 START_EXCEPTION(Debug); \ 278 START_EXCEPTION(DebugCrit); \
271 CRITICAL_EXCEPTION_PROLOG; \ 279 CRITICAL_EXCEPTION_PROLOG; \
272 \ 280 \
273 /* \ 281 /* \
@@ -287,8 +295,8 @@ label:
287 cmplw r12,r10; \ 295 cmplw r12,r10; \
288 blt+ 2f; /* addr below exception vectors */ \ 296 blt+ 2f; /* addr below exception vectors */ \
289 \ 297 \
290 lis r10,Debug@h; \ 298 lis r10,DebugCrit@h; \
291 ori r10,r10,Debug@l; \ 299 ori r10,r10,DebugCrit@l; \
292 cmplw r12,r10; \ 300 cmplw r12,r10; \
293 bgt+ 2f; /* addr above exception vectors */ \ 301 bgt+ 2f; /* addr above exception vectors */ \
294 \ 302 \
@@ -318,7 +326,6 @@ label:
3182: mfspr r4,SPRN_DBSR; \ 3262: mfspr r4,SPRN_DBSR; \
319 addi r3,r1,STACK_FRAME_OVERHEAD; \ 327 addi r3,r1,STACK_FRAME_OVERHEAD; \
320 EXC_XFER_TEMPLATE(DebugException, 0x2002, (MSR_KERNEL & ~(MSR_ME|MSR_DE|MSR_CE)), NOCOPY, crit_transfer_to_handler, ret_from_crit_exc) 328 EXC_XFER_TEMPLATE(DebugException, 0x2002, (MSR_KERNEL & ~(MSR_ME|MSR_DE|MSR_CE)), NOCOPY, crit_transfer_to_handler, ret_from_crit_exc)
321#endif
322 329
323#define INSTRUCTION_STORAGE_EXCEPTION \ 330#define INSTRUCTION_STORAGE_EXCEPTION \
324 START_EXCEPTION(InstructionStorage) \ 331 START_EXCEPTION(InstructionStorage) \
diff --git a/arch/powerpc/kernel/head_fsl_booke.S b/arch/powerpc/kernel/head_fsl_booke.S
index d9cc2c288d9e..4ff744143566 100644
--- a/arch/powerpc/kernel/head_fsl_booke.S
+++ b/arch/powerpc/kernel/head_fsl_booke.S
@@ -68,7 +68,9 @@ _ENTRY(_start);
68 mr r29,r5 68 mr r29,r5
69 mr r28,r6 69 mr r28,r6
70 mr r27,r7 70 mr r27,r7
71 li r25,0 /* phys kernel start (low) */
71 li r24,0 /* CPU number */ 72 li r24,0 /* CPU number */
73 li r23,0 /* phys kernel start (high) */
72 74
73/* We try to not make any assumptions about how the boot loader 75/* We try to not make any assumptions about how the boot loader
74 * setup or used the TLBs. We invalidate all mappings from the 76 * setup or used the TLBs. We invalidate all mappings from the
@@ -167,7 +169,28 @@ skpinv: addi r6,r6,1 /* Increment */
167 mtspr SPRN_MAS0,r7 169 mtspr SPRN_MAS0,r7
168 tlbre 170 tlbre
169 171
170 /* Just modify the entry ID, EPN and RPN for the temp mapping */ 172 /* grab and fixup the RPN */
173 mfspr r6,SPRN_MAS1 /* extract MAS1[SIZE] */
174 rlwinm r6,r6,25,27,30
175 li r8,-1
176 addi r6,r6,10
177 slw r6,r8,r6 /* convert to mask */
178
179 bl 1f /* Find our address */
1801: mflr r7
181
182 mfspr r8,SPRN_MAS3
183#ifdef CONFIG_PHYS_64BIT
184 mfspr r23,SPRN_MAS7
185#endif
186 and r8,r6,r8
187 subfic r9,r6,-4096
188 and r9,r9,r7
189
190 or r25,r8,r9
191 ori r8,r25,(MAS3_SX|MAS3_SW|MAS3_SR)
192
193 /* Just modify the entry ID and EPN for the temp mapping */
171 lis r7,0x1000 /* Set MAS0(TLBSEL) = 1 */ 194 lis r7,0x1000 /* Set MAS0(TLBSEL) = 1 */
172 rlwimi r7,r5,16,4,15 /* Setup MAS0 = TLBSEL | ESEL(r5) */ 195 rlwimi r7,r5,16,4,15 /* Setup MAS0 = TLBSEL | ESEL(r5) */
173 mtspr SPRN_MAS0,r7 196 mtspr SPRN_MAS0,r7
@@ -177,12 +200,10 @@ skpinv: addi r6,r6,1 /* Increment */
177 ori r6,r6,(MAS1_TSIZE(BOOKE_PAGESZ_4K))@l 200 ori r6,r6,(MAS1_TSIZE(BOOKE_PAGESZ_4K))@l
178 mtspr SPRN_MAS1,r6 201 mtspr SPRN_MAS1,r6
179 mfspr r6,SPRN_MAS2 202 mfspr r6,SPRN_MAS2
180 lis r7,PHYSICAL_START@h 203 li r7,0 /* temp EPN = 0 */
181 rlwimi r7,r6,0,20,31 204 rlwimi r7,r6,0,20,31
182 mtspr SPRN_MAS2,r7 205 mtspr SPRN_MAS2,r7
183 mfspr r6,SPRN_MAS3 206 mtspr SPRN_MAS3,r8
184 rlwimi r7,r6,0,20,31
185 mtspr SPRN_MAS3,r7
186 tlbwe 207 tlbwe
187 208
188 xori r6,r4,1 209 xori r6,r4,1
@@ -232,8 +253,7 @@ skpinv: addi r6,r6,1 /* Increment */
232 ori r6,r6,PAGE_OFFSET@l 253 ori r6,r6,PAGE_OFFSET@l
233 rlwimi r6,r7,0,20,31 254 rlwimi r6,r7,0,20,31
234 mtspr SPRN_MAS2,r6 255 mtspr SPRN_MAS2,r6
235 li r7,(MAS3_SX|MAS3_SW|MAS3_SR) 256 mtspr SPRN_MAS3,r8
236 mtspr SPRN_MAS3,r7
237 tlbwe 257 tlbwe
238 258
239/* 7. Jump to KERNELBASE mapping */ 259/* 7. Jump to KERNELBASE mapping */
@@ -283,7 +303,10 @@ skpinv: addi r6,r6,1 /* Increment */
283 SET_IVOR(12, WatchdogTimer); 303 SET_IVOR(12, WatchdogTimer);
284 SET_IVOR(13, DataTLBError); 304 SET_IVOR(13, DataTLBError);
285 SET_IVOR(14, InstructionTLBError); 305 SET_IVOR(14, InstructionTLBError);
286 SET_IVOR(15, Debug); 306 SET_IVOR(15, DebugDebug);
307#if defined(CONFIG_E500)
308 SET_IVOR(15, DebugCrit);
309#endif
287 SET_IVOR(32, SPEUnavailable); 310 SET_IVOR(32, SPEUnavailable);
288 SET_IVOR(33, SPEFloatingPointData); 311 SET_IVOR(33, SPEFloatingPointData);
289 SET_IVOR(34, SPEFloatingPointRound); 312 SET_IVOR(34, SPEFloatingPointRound);
@@ -718,7 +741,10 @@ interrupt_base:
718 741
719 742
720 /* Debug Interrupt */ 743 /* Debug Interrupt */
721 DEBUG_EXCEPTION 744 DEBUG_DEBUG_EXCEPTION
745#if defined(CONFIG_E500)
746 DEBUG_CRIT_EXCEPTION
747#endif
722 748
723/* 749/*
724 * Local functions 750 * Local functions
diff --git a/arch/powerpc/kernel/ibmebus.c b/arch/powerpc/kernel/ibmebus.c
index 2f50bb5d00f9..9971159c8040 100644
--- a/arch/powerpc/kernel/ibmebus.c
+++ b/arch/powerpc/kernel/ibmebus.c
@@ -183,7 +183,7 @@ static int ibmebus_create_devices(const struct of_device_id *matches)
183 ret = ibmebus_create_device(child); 183 ret = ibmebus_create_device(child);
184 if (ret) { 184 if (ret) {
185 printk(KERN_ERR "%s: failed to create device (%i)", 185 printk(KERN_ERR "%s: failed to create device (%i)",
186 __FUNCTION__, ret); 186 __func__, ret);
187 of_node_put(child); 187 of_node_put(child);
188 break; 188 break;
189 } 189 }
@@ -269,7 +269,7 @@ static ssize_t ibmebus_store_probe(struct bus_type *bus,
269 if (bus_find_device(&ibmebus_bus_type, NULL, path, 269 if (bus_find_device(&ibmebus_bus_type, NULL, path,
270 ibmebus_match_path)) { 270 ibmebus_match_path)) {
271 printk(KERN_WARNING "%s: %s has already been probed\n", 271 printk(KERN_WARNING "%s: %s has already been probed\n",
272 __FUNCTION__, path); 272 __func__, path);
273 rc = -EEXIST; 273 rc = -EEXIST;
274 goto out; 274 goto out;
275 } 275 }
@@ -279,7 +279,7 @@ static ssize_t ibmebus_store_probe(struct bus_type *bus,
279 of_node_put(dn); 279 of_node_put(dn);
280 } else { 280 } else {
281 printk(KERN_WARNING "%s: no such device node: %s\n", 281 printk(KERN_WARNING "%s: no such device node: %s\n",
282 __FUNCTION__, path); 282 __func__, path);
283 rc = -ENODEV; 283 rc = -ENODEV;
284 } 284 }
285 285
@@ -308,7 +308,7 @@ static ssize_t ibmebus_store_remove(struct bus_type *bus,
308 return count; 308 return count;
309 } else { 309 } else {
310 printk(KERN_WARNING "%s: %s not on the bus\n", 310 printk(KERN_WARNING "%s: %s not on the bus\n",
311 __FUNCTION__, path); 311 __func__, path);
312 312
313 kfree(path); 313 kfree(path);
314 return -ENODEV; 314 return -ENODEV;
@@ -337,14 +337,14 @@ static int __init ibmebus_bus_init(void)
337 err = of_bus_type_init(&ibmebus_bus_type, "ibmebus"); 337 err = of_bus_type_init(&ibmebus_bus_type, "ibmebus");
338 if (err) { 338 if (err) {
339 printk(KERN_ERR "%s: failed to register IBM eBus.\n", 339 printk(KERN_ERR "%s: failed to register IBM eBus.\n",
340 __FUNCTION__); 340 __func__);
341 return err; 341 return err;
342 } 342 }
343 343
344 err = device_register(&ibmebus_bus_device); 344 err = device_register(&ibmebus_bus_device);
345 if (err) { 345 if (err) {
346 printk(KERN_WARNING "%s: device_register returned %i\n", 346 printk(KERN_WARNING "%s: device_register returned %i\n",
347 __FUNCTION__, err); 347 __func__, err);
348 bus_unregister(&ibmebus_bus_type); 348 bus_unregister(&ibmebus_bus_type);
349 349
350 return err; 350 return err;
diff --git a/arch/powerpc/kernel/iommu.c b/arch/powerpc/kernel/iommu.c
index 8f1f4e539c4b..0c663669bc32 100644
--- a/arch/powerpc/kernel/iommu.c
+++ b/arch/powerpc/kernel/iommu.c
@@ -520,7 +520,7 @@ void iommu_free_table(struct iommu_table *tbl, const char *node_name)
520 unsigned int order; 520 unsigned int order;
521 521
522 if (!tbl || !tbl->it_map) { 522 if (!tbl || !tbl->it_map) {
523 printk(KERN_ERR "%s: expected TCE map for %s\n", __FUNCTION__, 523 printk(KERN_ERR "%s: expected TCE map for %s\n", __func__,
524 node_name); 524 node_name);
525 return; 525 return;
526 } 526 }
@@ -530,7 +530,7 @@ void iommu_free_table(struct iommu_table *tbl, const char *node_name)
530 for (i = 0; i < (tbl->it_size/64); i++) { 530 for (i = 0; i < (tbl->it_size/64); i++) {
531 if (tbl->it_map[i] != 0) { 531 if (tbl->it_map[i] != 0) {
532 printk(KERN_WARNING "%s: Unexpected TCEs for %s\n", 532 printk(KERN_WARNING "%s: Unexpected TCEs for %s\n",
533 __FUNCTION__, node_name); 533 __func__, node_name);
534 break; 534 break;
535 } 535 }
536 } 536 }
diff --git a/arch/powerpc/kernel/irq.c b/arch/powerpc/kernel/irq.c
index 292163f5b39a..425616f92d18 100644
--- a/arch/powerpc/kernel/irq.c
+++ b/arch/powerpc/kernel/irq.c
@@ -114,7 +114,7 @@ static inline void set_soft_enabled(unsigned long enable)
114 : : "r" (enable), "i" (offsetof(struct paca_struct, soft_enabled))); 114 : : "r" (enable), "i" (offsetof(struct paca_struct, soft_enabled)));
115} 115}
116 116
117void local_irq_restore(unsigned long en) 117void raw_local_irq_restore(unsigned long en)
118{ 118{
119 /* 119 /*
120 * get_paca()->soft_enabled = en; 120 * get_paca()->soft_enabled = en;
@@ -174,6 +174,7 @@ void local_irq_restore(unsigned long en)
174 174
175 __hard_irq_enable(); 175 __hard_irq_enable();
176} 176}
177EXPORT_SYMBOL(raw_local_irq_restore);
177#endif /* CONFIG_PPC64 */ 178#endif /* CONFIG_PPC64 */
178 179
179int show_interrupts(struct seq_file *p, void *v) 180int show_interrupts(struct seq_file *p, void *v)
@@ -310,8 +311,21 @@ void do_IRQ(struct pt_regs *regs)
310 handler = &__do_IRQ; 311 handler = &__do_IRQ;
311 irqtp->task = curtp->task; 312 irqtp->task = curtp->task;
312 irqtp->flags = 0; 313 irqtp->flags = 0;
314
315 /* Copy the softirq bits in preempt_count so that the
316 * softirq checks work in the hardirq context.
317 */
318 irqtp->preempt_count =
319 (irqtp->preempt_count & ~SOFTIRQ_MASK) |
320 (curtp->preempt_count & SOFTIRQ_MASK);
321
313 call_handle_irq(irq, desc, irqtp, handler); 322 call_handle_irq(irq, desc, irqtp, handler);
314 irqtp->task = NULL; 323 irqtp->task = NULL;
324
325
326 /* Set any flag that may have been set on the
327 * alternate stack
328 */
315 if (irqtp->flags) 329 if (irqtp->flags)
316 set_bits(irqtp->flags, &curtp->flags); 330 set_bits(irqtp->flags, &curtp->flags);
317 } else 331 } else
@@ -357,7 +371,7 @@ void irq_ctx_init(void)
357 memset((void *)softirq_ctx[i], 0, THREAD_SIZE); 371 memset((void *)softirq_ctx[i], 0, THREAD_SIZE);
358 tp = softirq_ctx[i]; 372 tp = softirq_ctx[i];
359 tp->cpu = i; 373 tp->cpu = i;
360 tp->preempt_count = SOFTIRQ_OFFSET; 374 tp->preempt_count = 0;
361 375
362 memset((void *)hardirq_ctx[i], 0, THREAD_SIZE); 376 memset((void *)hardirq_ctx[i], 0, THREAD_SIZE);
363 tp = hardirq_ctx[i]; 377 tp = hardirq_ctx[i];
diff --git a/arch/powerpc/kernel/isa-bridge.c b/arch/powerpc/kernel/isa-bridge.c
index ee172aa42aa7..289af348978d 100644
--- a/arch/powerpc/kernel/isa-bridge.c
+++ b/arch/powerpc/kernel/isa-bridge.c
@@ -80,13 +80,13 @@ static void __devinit pci_process_ISA_OF_ranges(struct device_node *isa_node,
80 * (size depending on dev->n_addr_cells) 80 * (size depending on dev->n_addr_cells)
81 * cell 5: the size of the range 81 * cell 5: the size of the range
82 */ 82 */
83 if ((range->isa_addr.a_hi && ISA_SPACE_MASK) != ISA_SPACE_IO) { 83 if ((range->isa_addr.a_hi & ISA_SPACE_MASK) != ISA_SPACE_IO) {
84 range++; 84 range++;
85 rlen -= sizeof(struct isa_range); 85 rlen -= sizeof(struct isa_range);
86 if (rlen < sizeof(struct isa_range)) 86 if (rlen < sizeof(struct isa_range))
87 goto inval_range; 87 goto inval_range;
88 } 88 }
89 if ((range->isa_addr.a_hi && ISA_SPACE_MASK) != ISA_SPACE_IO) 89 if ((range->isa_addr.a_hi & ISA_SPACE_MASK) != ISA_SPACE_IO)
90 goto inval_range; 90 goto inval_range;
91 91
92 isa_addr = range->isa_addr.a_lo; 92 isa_addr = range->isa_addr.a_lo;
@@ -99,7 +99,7 @@ static void __devinit pci_process_ISA_OF_ranges(struct device_node *isa_node,
99 */ 99 */
100 if ((pci_addr != 0) || (isa_addr != 0)) { 100 if ((pci_addr != 0) || (isa_addr != 0)) {
101 printk(KERN_ERR "unexpected isa to pci mapping: %s\n", 101 printk(KERN_ERR "unexpected isa to pci mapping: %s\n",
102 __FUNCTION__); 102 __func__);
103 return; 103 return;
104 } 104 }
105 105
diff --git a/arch/powerpc/kernel/lparcfg.c b/arch/powerpc/kernel/lparcfg.c
index dcb89a88df46..1ffacc698ffb 100644
--- a/arch/powerpc/kernel/lparcfg.c
+++ b/arch/powerpc/kernel/lparcfg.c
@@ -226,7 +226,7 @@ static void parse_system_parameter_string(struct seq_file *m)
226 unsigned char *local_buffer = kmalloc(SPLPAR_MAXLENGTH, GFP_KERNEL); 226 unsigned char *local_buffer = kmalloc(SPLPAR_MAXLENGTH, GFP_KERNEL);
227 if (!local_buffer) { 227 if (!local_buffer) {
228 printk(KERN_ERR "%s %s kmalloc failure at line %d \n", 228 printk(KERN_ERR "%s %s kmalloc failure at line %d \n",
229 __FILE__, __FUNCTION__, __LINE__); 229 __FILE__, __func__, __LINE__);
230 return; 230 return;
231 } 231 }
232 232
@@ -243,14 +243,14 @@ static void parse_system_parameter_string(struct seq_file *m)
243 if (call_status != 0) { 243 if (call_status != 0) {
244 printk(KERN_INFO 244 printk(KERN_INFO
245 "%s %s Error calling get-system-parameter (0x%x)\n", 245 "%s %s Error calling get-system-parameter (0x%x)\n",
246 __FILE__, __FUNCTION__, call_status); 246 __FILE__, __func__, call_status);
247 } else { 247 } else {
248 int splpar_strlen; 248 int splpar_strlen;
249 int idx, w_idx; 249 int idx, w_idx;
250 char *workbuffer = kzalloc(SPLPAR_MAXLENGTH, GFP_KERNEL); 250 char *workbuffer = kzalloc(SPLPAR_MAXLENGTH, GFP_KERNEL);
251 if (!workbuffer) { 251 if (!workbuffer) {
252 printk(KERN_ERR "%s %s kmalloc failure at line %d \n", 252 printk(KERN_ERR "%s %s kmalloc failure at line %d \n",
253 __FILE__, __FUNCTION__, __LINE__); 253 __FILE__, __func__, __LINE__);
254 kfree(local_buffer); 254 kfree(local_buffer);
255 return; 255 return;
256 } 256 }
@@ -484,10 +484,10 @@ static ssize_t lparcfg_write(struct file *file, const char __user * buf,
484 current_weight = (resource >> 5 * 8) & 0xFF; 484 current_weight = (resource >> 5 * 8) & 0xFF;
485 485
486 pr_debug("%s: current_entitled = %lu, current_weight = %u\n", 486 pr_debug("%s: current_entitled = %lu, current_weight = %u\n",
487 __FUNCTION__, current_entitled, current_weight); 487 __func__, current_entitled, current_weight);
488 488
489 pr_debug("%s: new_entitled = %lu, new_weight = %u\n", 489 pr_debug("%s: new_entitled = %lu, new_weight = %u\n",
490 __FUNCTION__, *new_entitled_ptr, *new_weight_ptr); 490 __func__, *new_entitled_ptr, *new_weight_ptr);
491 491
492 retval = plpar_hcall_norets(H_SET_PPP, *new_entitled_ptr, 492 retval = plpar_hcall_norets(H_SET_PPP, *new_entitled_ptr,
493 *new_weight_ptr); 493 *new_weight_ptr);
@@ -502,7 +502,7 @@ static ssize_t lparcfg_write(struct file *file, const char __user * buf,
502 retval = -EINVAL; 502 retval = -EINVAL;
503 } else { 503 } else {
504 printk(KERN_WARNING "%s: received unknown hv return code %ld", 504 printk(KERN_WARNING "%s: received unknown hv return code %ld",
505 __FUNCTION__, retval); 505 __func__, retval);
506 retval = -EIO; 506 retval = -EIO;
507 } 507 }
508 508
diff --git a/arch/powerpc/kernel/machine_kexec.c b/arch/powerpc/kernel/machine_kexec.c
index c0c8e8c3ced9..2d202f274e73 100644
--- a/arch/powerpc/kernel/machine_kexec.c
+++ b/arch/powerpc/kernel/machine_kexec.c
@@ -12,8 +12,9 @@
12#include <linux/kexec.h> 12#include <linux/kexec.h>
13#include <linux/reboot.h> 13#include <linux/reboot.h>
14#include <linux/threads.h> 14#include <linux/threads.h>
15#include <linux/lmb.h>
15#include <asm/machdep.h> 16#include <asm/machdep.h>
16#include <asm/lmb.h> 17#include <asm/prom.h>
17 18
18void machine_crash_shutdown(struct pt_regs *regs) 19void machine_crash_shutdown(struct pt_regs *regs)
19{ 20{
diff --git a/arch/powerpc/kernel/paca.c b/arch/powerpc/kernel/paca.c
index 55f1a25085cd..ac163bd46cfd 100644
--- a/arch/powerpc/kernel/paca.c
+++ b/arch/powerpc/kernel/paca.c
@@ -15,7 +15,6 @@
15#include <asm/ptrace.h> 15#include <asm/ptrace.h>
16#include <asm/page.h> 16#include <asm/page.h>
17#include <asm/lppaca.h> 17#include <asm/lppaca.h>
18#include <asm/iseries/it_lp_reg_save.h>
19#include <asm/paca.h> 18#include <asm/paca.h>
20#include <asm/mmu.h> 19#include <asm/mmu.h>
21 20
@@ -25,13 +24,13 @@
25extern unsigned long __toc_start; 24extern unsigned long __toc_start;
26 25
27/* 26/*
28 * iSeries structure which the hypervisor knows about - this structure 27 * The structure which the hypervisor knows about - this structure
29 * should not cross a page boundary. The vpa_init/register_vpa call 28 * should not cross a page boundary. The vpa_init/register_vpa call
30 * is now known to fail if the lppaca structure crosses a page 29 * is now known to fail if the lppaca structure crosses a page
31 * boundary. The lppaca is also used on POWER5 pSeries boxes. The 30 * boundary. The lppaca is also used on legacy iSeries and POWER5
32 * lppaca is 640 bytes long, and cannot readily change since the 31 * pSeries boxes. The lppaca is 640 bytes long, and cannot readily
33 * hypervisor knows its layout, so a 1kB alignment will suffice to 32 * change since the hypervisor knows its layout, so a 1kB alignment
34 * ensure that it doesn't cross a page boundary. 33 * will suffice to ensure that it doesn't cross a page boundary.
35 */ 34 */
36struct lppaca lppaca[] = { 35struct lppaca lppaca[] = {
37 [0 ... (NR_CPUS-1)] = { 36 [0 ... (NR_CPUS-1)] = {
@@ -66,32 +65,17 @@ struct slb_shadow slb_shadow[] __cacheline_aligned = {
66 * processors. The processor VPD array needs one entry per physical 65 * processors. The processor VPD array needs one entry per physical
67 * processor (not thread). 66 * processor (not thread).
68 */ 67 */
69#define PACA_INIT_COMMON(number) \ 68#define PACA_INIT(number) \
69{ \
70 .lppaca_ptr = &lppaca[number], \ 70 .lppaca_ptr = &lppaca[number], \
71 .lock_token = 0x8000, \ 71 .lock_token = 0x8000, \
72 .paca_index = (number), /* Paca Index */ \ 72 .paca_index = (number), /* Paca Index */ \
73 .kernel_toc = (unsigned long)(&__toc_start) + 0x8000UL, \ 73 .kernel_toc = (unsigned long)(&__toc_start) + 0x8000UL, \
74 .hw_cpu_id = 0xffff, \ 74 .hw_cpu_id = 0xffff, \
75 .slb_shadow_ptr = &slb_shadow[number], 75 .slb_shadow_ptr = &slb_shadow[number], \
76 76 .__current = &init_task, \
77#ifdef CONFIG_PPC_ISERIES
78#define PACA_INIT_ISERIES(number) \
79 .reg_save_ptr = &iseries_reg_save[number],
80
81#define PACA_INIT(number) \
82{ \
83 PACA_INIT_COMMON(number) \
84 PACA_INIT_ISERIES(number) \
85} 77}
86 78
87#else
88#define PACA_INIT(number) \
89{ \
90 PACA_INIT_COMMON(number) \
91}
92
93#endif
94
95struct paca_struct paca[] = { 79struct paca_struct paca[] = {
96 PACA_INIT(0), 80 PACA_INIT(0),
97#if NR_CPUS > 1 81#if NR_CPUS > 1
diff --git a/arch/powerpc/kernel/ppc32.h b/arch/powerpc/kernel/ppc32.h
index 90e562771791..fda05e2211d6 100644
--- a/arch/powerpc/kernel/ppc32.h
+++ b/arch/powerpc/kernel/ppc32.h
@@ -135,4 +135,6 @@ struct ucontext32 {
135 struct mcontext32 uc_mcontext; 135 struct mcontext32 uc_mcontext;
136}; 136};
137 137
138extern int copy_siginfo_to_user32(struct compat_siginfo __user *d, siginfo_t *s);
139
138#endif /* _PPC64_PPC32_H */ 140#endif /* _PPC64_PPC32_H */
diff --git a/arch/powerpc/kernel/ppc_ksyms.c b/arch/powerpc/kernel/ppc_ksyms.c
index 65d14e6ddc3c..09fcb50c45ae 100644
--- a/arch/powerpc/kernel/ppc_ksyms.c
+++ b/arch/powerpc/kernel/ppc_ksyms.c
@@ -44,10 +44,6 @@
44#include <asm/signal.h> 44#include <asm/signal.h>
45#include <asm/dcr.h> 45#include <asm/dcr.h>
46 46
47#ifdef CONFIG_PPC64
48EXPORT_SYMBOL(local_irq_restore);
49#endif
50
51#ifdef CONFIG_PPC32 47#ifdef CONFIG_PPC32
52extern void transfer_to_handler(void); 48extern void transfer_to_handler(void);
53extern void do_IRQ(struct pt_regs *regs); 49extern void do_IRQ(struct pt_regs *regs);
@@ -57,7 +53,6 @@ extern void program_check_exception(struct pt_regs *regs);
57extern void single_step_exception(struct pt_regs *regs); 53extern void single_step_exception(struct pt_regs *regs);
58extern int sys_sigreturn(struct pt_regs *regs); 54extern int sys_sigreturn(struct pt_regs *regs);
59 55
60EXPORT_SYMBOL(empty_zero_page);
61EXPORT_SYMBOL(clear_pages); 56EXPORT_SYMBOL(clear_pages);
62EXPORT_SYMBOL(copy_page); 57EXPORT_SYMBOL(copy_page);
63EXPORT_SYMBOL(ISA_DMA_THRESHOLD); 58EXPORT_SYMBOL(ISA_DMA_THRESHOLD);
@@ -78,6 +73,7 @@ EXPORT_SYMBOL(strncpy);
78EXPORT_SYMBOL(strcat); 73EXPORT_SYMBOL(strcat);
79EXPORT_SYMBOL(strlen); 74EXPORT_SYMBOL(strlen);
80EXPORT_SYMBOL(strcmp); 75EXPORT_SYMBOL(strcmp);
76EXPORT_SYMBOL(strncmp);
81 77
82EXPORT_SYMBOL(csum_partial); 78EXPORT_SYMBOL(csum_partial);
83EXPORT_SYMBOL(csum_partial_copy_generic); 79EXPORT_SYMBOL(csum_partial_copy_generic);
@@ -191,3 +187,4 @@ EXPORT_SYMBOL(intercept_table);
191EXPORT_SYMBOL(__mtdcr); 187EXPORT_SYMBOL(__mtdcr);
192EXPORT_SYMBOL(__mfdcr); 188EXPORT_SYMBOL(__mfdcr);
193#endif 189#endif
190EXPORT_SYMBOL(empty_zero_page);
diff --git a/arch/powerpc/kernel/process.c b/arch/powerpc/kernel/process.c
index 4ec605521504..703100d5e458 100644
--- a/arch/powerpc/kernel/process.c
+++ b/arch/powerpc/kernel/process.c
@@ -868,11 +868,6 @@ int sys_execve(unsigned long a0, unsigned long a1, unsigned long a2,
868 flush_spe_to_thread(current); 868 flush_spe_to_thread(current);
869 error = do_execve(filename, (char __user * __user *) a1, 869 error = do_execve(filename, (char __user * __user *) a1,
870 (char __user * __user *) a2, regs); 870 (char __user * __user *) a2, regs);
871 if (error == 0) {
872 task_lock(current);
873 current->ptrace &= ~PT_DTRACE;
874 task_unlock(current);
875 }
876 putname(filename); 871 putname(filename);
877out: 872out:
878 return error; 873 return error;
@@ -919,20 +914,6 @@ int validate_sp(unsigned long sp, struct task_struct *p,
919 return valid_irq_stack(sp, p, nbytes); 914 return valid_irq_stack(sp, p, nbytes);
920} 915}
921 916
922#ifdef CONFIG_PPC64
923#define MIN_STACK_FRAME 112 /* same as STACK_FRAME_OVERHEAD, in fact */
924#define FRAME_LR_SAVE 2
925#define INT_FRAME_SIZE (sizeof(struct pt_regs) + STACK_FRAME_OVERHEAD + 288)
926#define REGS_MARKER 0x7265677368657265ul
927#define FRAME_MARKER 12
928#else
929#define MIN_STACK_FRAME 16
930#define FRAME_LR_SAVE 1
931#define INT_FRAME_SIZE (sizeof(struct pt_regs) + STACK_FRAME_OVERHEAD)
932#define REGS_MARKER 0x72656773ul
933#define FRAME_MARKER 2
934#endif
935
936EXPORT_SYMBOL(validate_sp); 917EXPORT_SYMBOL(validate_sp);
937 918
938unsigned long get_wchan(struct task_struct *p) 919unsigned long get_wchan(struct task_struct *p)
@@ -944,15 +925,15 @@ unsigned long get_wchan(struct task_struct *p)
944 return 0; 925 return 0;
945 926
946 sp = p->thread.ksp; 927 sp = p->thread.ksp;
947 if (!validate_sp(sp, p, MIN_STACK_FRAME)) 928 if (!validate_sp(sp, p, STACK_FRAME_OVERHEAD))
948 return 0; 929 return 0;
949 930
950 do { 931 do {
951 sp = *(unsigned long *)sp; 932 sp = *(unsigned long *)sp;
952 if (!validate_sp(sp, p, MIN_STACK_FRAME)) 933 if (!validate_sp(sp, p, STACK_FRAME_OVERHEAD))
953 return 0; 934 return 0;
954 if (count > 0) { 935 if (count > 0) {
955 ip = ((unsigned long *)sp)[FRAME_LR_SAVE]; 936 ip = ((unsigned long *)sp)[STACK_FRAME_LR_SAVE];
956 if (!in_sched_functions(ip)) 937 if (!in_sched_functions(ip))
957 return ip; 938 return ip;
958 } 939 }
@@ -981,12 +962,12 @@ void show_stack(struct task_struct *tsk, unsigned long *stack)
981 lr = 0; 962 lr = 0;
982 printk("Call Trace:\n"); 963 printk("Call Trace:\n");
983 do { 964 do {
984 if (!validate_sp(sp, tsk, MIN_STACK_FRAME)) 965 if (!validate_sp(sp, tsk, STACK_FRAME_OVERHEAD))
985 return; 966 return;
986 967
987 stack = (unsigned long *) sp; 968 stack = (unsigned long *) sp;
988 newsp = stack[0]; 969 newsp = stack[0];
989 ip = stack[FRAME_LR_SAVE]; 970 ip = stack[STACK_FRAME_LR_SAVE];
990 if (!firstframe || ip != lr) { 971 if (!firstframe || ip != lr) {
991 printk("["REG"] ["REG"] ", sp, ip); 972 printk("["REG"] ["REG"] ", sp, ip);
992 print_symbol("%s", ip); 973 print_symbol("%s", ip);
@@ -1000,8 +981,8 @@ void show_stack(struct task_struct *tsk, unsigned long *stack)
1000 * See if this is an exception frame. 981 * See if this is an exception frame.
1001 * We look for the "regshere" marker in the current frame. 982 * We look for the "regshere" marker in the current frame.
1002 */ 983 */
1003 if (validate_sp(sp, tsk, INT_FRAME_SIZE) 984 if (validate_sp(sp, tsk, STACK_INT_FRAME_SIZE)
1004 && stack[FRAME_MARKER] == REGS_MARKER) { 985 && stack[STACK_FRAME_MARKER] == STACK_FRAME_REGS_MARKER) {
1005 struct pt_regs *regs = (struct pt_regs *) 986 struct pt_regs *regs = (struct pt_regs *)
1006 (sp + STACK_FRAME_OVERHEAD); 987 (sp + STACK_FRAME_OVERHEAD);
1007 printk("--- Exception: %lx", regs->trap); 988 printk("--- Exception: %lx", regs->trap);
diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c
index eac97f48b9b8..3bfe7837e820 100644
--- a/arch/powerpc/kernel/prom.c
+++ b/arch/powerpc/kernel/prom.c
@@ -31,10 +31,10 @@
31#include <linux/kexec.h> 31#include <linux/kexec.h>
32#include <linux/debugfs.h> 32#include <linux/debugfs.h>
33#include <linux/irq.h> 33#include <linux/irq.h>
34#include <linux/lmb.h>
34 35
35#include <asm/prom.h> 36#include <asm/prom.h>
36#include <asm/rtas.h> 37#include <asm/rtas.h>
37#include <asm/lmb.h>
38#include <asm/page.h> 38#include <asm/page.h>
39#include <asm/processor.h> 39#include <asm/processor.h>
40#include <asm/irq.h> 40#include <asm/irq.h>
@@ -51,6 +51,7 @@
51#include <asm/machdep.h> 51#include <asm/machdep.h>
52#include <asm/pSeries_reconfig.h> 52#include <asm/pSeries_reconfig.h>
53#include <asm/pci-bridge.h> 53#include <asm/pci-bridge.h>
54#include <asm/phyp_dump.h>
54#include <asm/kexec.h> 55#include <asm/kexec.h>
55 56
56#ifdef DEBUG 57#ifdef DEBUG
@@ -436,7 +437,7 @@ early_param("mem", early_parse_mem);
436 * The device tree may be allocated beyond our memory limit, or inside the 437 * The device tree may be allocated beyond our memory limit, or inside the
437 * crash kernel region for kdump. If so, move it out of the way. 438 * crash kernel region for kdump. If so, move it out of the way.
438 */ 439 */
439static void move_device_tree(void) 440static void __init move_device_tree(void)
440{ 441{
441 unsigned long start, size; 442 unsigned long start, size;
442 void *p; 443 void *p;
@@ -1040,6 +1041,87 @@ static void __init early_reserve_mem(void)
1040#endif 1041#endif
1041} 1042}
1042 1043
1044#ifdef CONFIG_PHYP_DUMP
1045/**
1046 * phyp_dump_calculate_reserve_size() - reserve variable boot area 5% or arg
1047 *
1048 * Function to find the largest size we need to reserve
1049 * during early boot process.
1050 *
1051 * It either looks for boot param and returns that OR
1052 * returns larger of 256 or 5% rounded down to multiples of 256MB.
1053 *
1054 */
1055static inline unsigned long phyp_dump_calculate_reserve_size(void)
1056{
1057 unsigned long tmp;
1058
1059 if (phyp_dump_info->reserve_bootvar)
1060 return phyp_dump_info->reserve_bootvar;
1061
1062 /* divide by 20 to get 5% of value */
1063 tmp = lmb_end_of_DRAM();
1064 do_div(tmp, 20);
1065
1066 /* round it down in multiples of 256 */
1067 tmp = tmp & ~0x0FFFFFFFUL;
1068
1069 return (tmp > PHYP_DUMP_RMR_END ? tmp : PHYP_DUMP_RMR_END);
1070}
1071
1072/**
1073 * phyp_dump_reserve_mem() - reserve all not-yet-dumped mmemory
1074 *
1075 * This routine may reserve memory regions in the kernel only
1076 * if the system is supported and a dump was taken in last
1077 * boot instance or if the hardware is supported and the
1078 * scratch area needs to be setup. In other instances it returns
1079 * without reserving anything. The memory in case of dump being
1080 * active is freed when the dump is collected (by userland tools).
1081 */
1082static void __init phyp_dump_reserve_mem(void)
1083{
1084 unsigned long base, size;
1085 unsigned long variable_reserve_size;
1086
1087 if (!phyp_dump_info->phyp_dump_configured) {
1088 printk(KERN_ERR "Phyp-dump not supported on this hardware\n");
1089 return;
1090 }
1091
1092 if (!phyp_dump_info->phyp_dump_at_boot) {
1093 printk(KERN_INFO "Phyp-dump disabled at boot time\n");
1094 return;
1095 }
1096
1097 variable_reserve_size = phyp_dump_calculate_reserve_size();
1098
1099 if (phyp_dump_info->phyp_dump_is_active) {
1100 /* Reserve *everything* above RMR.Area freed by userland tools*/
1101 base = variable_reserve_size;
1102 size = lmb_end_of_DRAM() - base;
1103
1104 /* XXX crashed_ram_end is wrong, since it may be beyond
1105 * the memory_limit, it will need to be adjusted. */
1106 lmb_reserve(base, size);
1107
1108 phyp_dump_info->init_reserve_start = base;
1109 phyp_dump_info->init_reserve_size = size;
1110 } else {
1111 size = phyp_dump_info->cpu_state_size +
1112 phyp_dump_info->hpte_region_size +
1113 variable_reserve_size;
1114 base = lmb_end_of_DRAM() - size;
1115 lmb_reserve(base, size);
1116 phyp_dump_info->init_reserve_start = base;
1117 phyp_dump_info->init_reserve_size = size;
1118 }
1119}
1120#else
1121static inline void __init phyp_dump_reserve_mem(void) {}
1122#endif /* CONFIG_PHYP_DUMP && CONFIG_PPC_RTAS */
1123
1124
1043void __init early_init_devtree(void *params) 1125void __init early_init_devtree(void *params)
1044{ 1126{
1045 DBG(" -> early_init_devtree(%p)\n", params); 1127 DBG(" -> early_init_devtree(%p)\n", params);
@@ -1052,6 +1134,11 @@ void __init early_init_devtree(void *params)
1052 of_scan_flat_dt(early_init_dt_scan_rtas, NULL); 1134 of_scan_flat_dt(early_init_dt_scan_rtas, NULL);
1053#endif 1135#endif
1054 1136
1137#ifdef CONFIG_PHYP_DUMP
1138 /* scan tree to see if dump occured during last boot */
1139 of_scan_flat_dt(early_init_dt_scan_phyp_dump, NULL);
1140#endif
1141
1055 /* Retrieve various informations from the /chosen node of the 1142 /* Retrieve various informations from the /chosen node of the
1056 * device-tree, including the platform type, initrd location and 1143 * device-tree, including the platform type, initrd location and
1057 * size, TCE reserve, and more ... 1144 * size, TCE reserve, and more ...
@@ -1072,6 +1159,7 @@ void __init early_init_devtree(void *params)
1072 reserve_kdump_trampoline(); 1159 reserve_kdump_trampoline();
1073 reserve_crashkernel(); 1160 reserve_crashkernel();
1074 early_reserve_mem(); 1161 early_reserve_mem();
1162 phyp_dump_reserve_mem();
1075 1163
1076 lmb_enforce_memory_limit(memory_limit); 1164 lmb_enforce_memory_limit(memory_limit);
1077 lmb_analyze(); 1165 lmb_analyze();
@@ -1244,12 +1332,14 @@ EXPORT_SYMBOL(of_node_put);
1244 */ 1332 */
1245void of_attach_node(struct device_node *np) 1333void of_attach_node(struct device_node *np)
1246{ 1334{
1247 write_lock(&devtree_lock); 1335 unsigned long flags;
1336
1337 write_lock_irqsave(&devtree_lock, flags);
1248 np->sibling = np->parent->child; 1338 np->sibling = np->parent->child;
1249 np->allnext = allnodes; 1339 np->allnext = allnodes;
1250 np->parent->child = np; 1340 np->parent->child = np;
1251 allnodes = np; 1341 allnodes = np;
1252 write_unlock(&devtree_lock); 1342 write_unlock_irqrestore(&devtree_lock, flags);
1253} 1343}
1254 1344
1255/* 1345/*
@@ -1260,8 +1350,9 @@ void of_attach_node(struct device_node *np)
1260void of_detach_node(struct device_node *np) 1350void of_detach_node(struct device_node *np)
1261{ 1351{
1262 struct device_node *parent; 1352 struct device_node *parent;
1353 unsigned long flags;
1263 1354
1264 write_lock(&devtree_lock); 1355 write_lock_irqsave(&devtree_lock, flags);
1265 1356
1266 parent = np->parent; 1357 parent = np->parent;
1267 if (!parent) 1358 if (!parent)
@@ -1292,7 +1383,7 @@ void of_detach_node(struct device_node *np)
1292 of_node_set_flag(np, OF_DETACHED); 1383 of_node_set_flag(np, OF_DETACHED);
1293 1384
1294out_unlock: 1385out_unlock:
1295 write_unlock(&devtree_lock); 1386 write_unlock_irqrestore(&devtree_lock, flags);
1296} 1387}
1297 1388
1298#ifdef CONFIG_PPC_PSERIES 1389#ifdef CONFIG_PPC_PSERIES
@@ -1373,20 +1464,21 @@ __initcall(prom_reconfig_setup);
1373int prom_add_property(struct device_node* np, struct property* prop) 1464int prom_add_property(struct device_node* np, struct property* prop)
1374{ 1465{
1375 struct property **next; 1466 struct property **next;
1467 unsigned long flags;
1376 1468
1377 prop->next = NULL; 1469 prop->next = NULL;
1378 write_lock(&devtree_lock); 1470 write_lock_irqsave(&devtree_lock, flags);
1379 next = &np->properties; 1471 next = &np->properties;
1380 while (*next) { 1472 while (*next) {
1381 if (strcmp(prop->name, (*next)->name) == 0) { 1473 if (strcmp(prop->name, (*next)->name) == 0) {
1382 /* duplicate ! don't insert it */ 1474 /* duplicate ! don't insert it */
1383 write_unlock(&devtree_lock); 1475 write_unlock_irqrestore(&devtree_lock, flags);
1384 return -1; 1476 return -1;
1385 } 1477 }
1386 next = &(*next)->next; 1478 next = &(*next)->next;
1387 } 1479 }
1388 *next = prop; 1480 *next = prop;
1389 write_unlock(&devtree_lock); 1481 write_unlock_irqrestore(&devtree_lock, flags);
1390 1482
1391#ifdef CONFIG_PROC_DEVICETREE 1483#ifdef CONFIG_PROC_DEVICETREE
1392 /* try to add to proc as well if it was initialized */ 1484 /* try to add to proc as well if it was initialized */
@@ -1406,9 +1498,10 @@ int prom_add_property(struct device_node* np, struct property* prop)
1406int prom_remove_property(struct device_node *np, struct property *prop) 1498int prom_remove_property(struct device_node *np, struct property *prop)
1407{ 1499{
1408 struct property **next; 1500 struct property **next;
1501 unsigned long flags;
1409 int found = 0; 1502 int found = 0;
1410 1503
1411 write_lock(&devtree_lock); 1504 write_lock_irqsave(&devtree_lock, flags);
1412 next = &np->properties; 1505 next = &np->properties;
1413 while (*next) { 1506 while (*next) {
1414 if (*next == prop) { 1507 if (*next == prop) {
@@ -1421,7 +1514,7 @@ int prom_remove_property(struct device_node *np, struct property *prop)
1421 } 1514 }
1422 next = &(*next)->next; 1515 next = &(*next)->next;
1423 } 1516 }
1424 write_unlock(&devtree_lock); 1517 write_unlock_irqrestore(&devtree_lock, flags);
1425 1518
1426 if (!found) 1519 if (!found)
1427 return -ENODEV; 1520 return -ENODEV;
@@ -1447,9 +1540,10 @@ int prom_update_property(struct device_node *np,
1447 struct property *oldprop) 1540 struct property *oldprop)
1448{ 1541{
1449 struct property **next; 1542 struct property **next;
1543 unsigned long flags;
1450 int found = 0; 1544 int found = 0;
1451 1545
1452 write_lock(&devtree_lock); 1546 write_lock_irqsave(&devtree_lock, flags);
1453 next = &np->properties; 1547 next = &np->properties;
1454 while (*next) { 1548 while (*next) {
1455 if (*next == oldprop) { 1549 if (*next == oldprop) {
@@ -1463,7 +1557,7 @@ int prom_update_property(struct device_node *np,
1463 } 1557 }
1464 next = &(*next)->next; 1558 next = &(*next)->next;
1465 } 1559 }
1466 write_unlock(&devtree_lock); 1560 write_unlock_irqrestore(&devtree_lock, flags);
1467 1561
1468 if (!found) 1562 if (!found)
1469 return -ENODEV; 1563 return -ENODEV;
diff --git a/arch/powerpc/kernel/prom_init.c b/arch/powerpc/kernel/prom_init.c
index 5ab4c8466cc9..6d6df1e60325 100644
--- a/arch/powerpc/kernel/prom_init.c
+++ b/arch/powerpc/kernel/prom_init.c
@@ -2240,6 +2240,14 @@ static void __init fixup_device_tree_efika(void)
2240 if (rv != PROM_ERROR && (strcmp(prop, "chrp") == 0)) 2240 if (rv != PROM_ERROR && (strcmp(prop, "chrp") == 0))
2241 prom_setprop(node, "/", "device_type", "efika", sizeof("efika")); 2241 prom_setprop(node, "/", "device_type", "efika", sizeof("efika"));
2242 2242
2243 /* CODEGEN,description is exposed in /proc/cpuinfo so
2244 fix that too */
2245 rv = prom_getprop(node, "CODEGEN,description", prop, sizeof(prop));
2246 if (rv != PROM_ERROR && (strstr(prop, "CHRP")))
2247 prom_setprop(node, "/", "CODEGEN,description",
2248 "Efika 5200B PowerPC System",
2249 sizeof("Efika 5200B PowerPC System"));
2250
2243 /* Fixup bestcomm interrupts property */ 2251 /* Fixup bestcomm interrupts property */
2244 node = call_prom("finddevice", 1, 1, ADDR("/builtin/bestcomm")); 2252 node = call_prom("finddevice", 1, 1, ADDR("/builtin/bestcomm"));
2245 if (PHANDLE_VALID(node)) { 2253 if (PHANDLE_VALID(node)) {
diff --git a/arch/powerpc/kernel/ptrace32.c b/arch/powerpc/kernel/ptrace32.c
index 4c1de6af4c09..9d30e10970ac 100644
--- a/arch/powerpc/kernel/ptrace32.c
+++ b/arch/powerpc/kernel/ptrace32.c
@@ -29,12 +29,15 @@
29#include <linux/security.h> 29#include <linux/security.h>
30#include <linux/signal.h> 30#include <linux/signal.h>
31#include <linux/compat.h> 31#include <linux/compat.h>
32#include <linux/elf.h>
32 33
33#include <asm/uaccess.h> 34#include <asm/uaccess.h>
34#include <asm/page.h> 35#include <asm/page.h>
35#include <asm/pgtable.h> 36#include <asm/pgtable.h>
36#include <asm/system.h> 37#include <asm/system.h>
37 38
39#include "ppc32.h"
40
38/* 41/*
39 * does not yet catch signals sent when the child dies. 42 * does not yet catch signals sent when the child dies.
40 * in exit.c or in signal.c. 43 * in exit.c or in signal.c.
@@ -64,6 +67,27 @@ static long compat_ptrace_old(struct task_struct *child, long request,
64 return -EPERM; 67 return -EPERM;
65} 68}
66 69
70static int compat_ptrace_getsiginfo(struct task_struct *child, compat_siginfo_t __user *data)
71{
72 siginfo_t lastinfo;
73 int error = -ESRCH;
74
75 read_lock(&tasklist_lock);
76 if (likely(child->sighand != NULL)) {
77 error = -EINVAL;
78 spin_lock_irq(&child->sighand->siglock);
79 if (likely(child->last_siginfo != NULL)) {
80 lastinfo = *child->last_siginfo;
81 error = 0;
82 }
83 spin_unlock_irq(&child->sighand->siglock);
84 }
85 read_unlock(&tasklist_lock);
86 if (!error)
87 return copy_siginfo_to_user32(data, &lastinfo);
88 return error;
89}
90
67long compat_arch_ptrace(struct task_struct *child, compat_long_t request, 91long compat_arch_ptrace(struct task_struct *child, compat_long_t request,
68 compat_ulong_t caddr, compat_ulong_t cdata) 92 compat_ulong_t caddr, compat_ulong_t cdata)
69{ 93{
@@ -282,6 +306,9 @@ long compat_arch_ptrace(struct task_struct *child, compat_long_t request,
282 0, PT_REGS_COUNT * sizeof(compat_long_t), 306 0, PT_REGS_COUNT * sizeof(compat_long_t),
283 compat_ptr(data)); 307 compat_ptr(data));
284 308
309 case PTRACE_GETSIGINFO:
310 return compat_ptrace_getsiginfo(child, compat_ptr(data));
311
285 case PTRACE_GETFPREGS: 312 case PTRACE_GETFPREGS:
286 case PTRACE_SETFPREGS: 313 case PTRACE_SETFPREGS:
287 case PTRACE_GETVRREGS: 314 case PTRACE_GETVRREGS:
diff --git a/arch/powerpc/kernel/rtas.c b/arch/powerpc/kernel/rtas.c
index fe8d95146893..34843c318419 100644
--- a/arch/powerpc/kernel/rtas.c
+++ b/arch/powerpc/kernel/rtas.c
@@ -22,6 +22,7 @@
22#include <linux/smp.h> 22#include <linux/smp.h>
23#include <linux/completion.h> 23#include <linux/completion.h>
24#include <linux/cpumask.h> 24#include <linux/cpumask.h>
25#include <linux/lmb.h>
25 26
26#include <asm/prom.h> 27#include <asm/prom.h>
27#include <asm/rtas.h> 28#include <asm/rtas.h>
@@ -33,7 +34,6 @@
33#include <asm/system.h> 34#include <asm/system.h>
34#include <asm/delay.h> 35#include <asm/delay.h>
35#include <asm/uaccess.h> 36#include <asm/uaccess.h>
36#include <asm/lmb.h>
37#include <asm/udbg.h> 37#include <asm/udbg.h>
38#include <asm/syscalls.h> 38#include <asm/syscalls.h>
39#include <asm/smp.h> 39#include <asm/smp.h>
@@ -506,7 +506,7 @@ int rtas_error_rc(int rtas_rc)
506 break; 506 break;
507 default: 507 default:
508 printk(KERN_ERR "%s: unexpected RTAS error %d\n", 508 printk(KERN_ERR "%s: unexpected RTAS error %d\n",
509 __FUNCTION__, rtas_rc); 509 __func__, rtas_rc);
510 rc = -ERANGE; 510 rc = -ERANGE;
511 break; 511 break;
512 } 512 }
diff --git a/arch/powerpc/kernel/rtas_flash.c b/arch/powerpc/kernel/rtas_flash.c
index 538baf46f15f..627f126d1848 100644
--- a/arch/powerpc/kernel/rtas_flash.c
+++ b/arch/powerpc/kernel/rtas_flash.c
@@ -807,7 +807,7 @@ int __init rtas_flash_init(void)
807 rtas_block_ctor); 807 rtas_block_ctor);
808 if (!flash_block_cache) { 808 if (!flash_block_cache) {
809 printk(KERN_ERR "%s: failed to create block cache\n", 809 printk(KERN_ERR "%s: failed to create block cache\n",
810 __FUNCTION__); 810 __func__);
811 rc = -ENOMEM; 811 rc = -ENOMEM;
812 goto cleanup; 812 goto cleanup;
813 } 813 }
diff --git a/arch/powerpc/kernel/rtas_pci.c b/arch/powerpc/kernel/rtas_pci.c
index 433a0a0949fb..3ab88a9dc70d 100644
--- a/arch/powerpc/kernel/rtas_pci.c
+++ b/arch/powerpc/kernel/rtas_pci.c
@@ -56,21 +56,6 @@ static inline int config_access_valid(struct pci_dn *dn, int where)
56 return 0; 56 return 0;
57} 57}
58 58
59static int of_device_available(struct device_node * dn)
60{
61 const char *status;
62
63 status = of_get_property(dn, "status", NULL);
64
65 if (!status)
66 return 1;
67
68 if (!strcmp(status, "okay"))
69 return 1;
70
71 return 0;
72}
73
74int rtas_read_config(struct pci_dn *pdn, int where, int size, u32 *val) 59int rtas_read_config(struct pci_dn *pdn, int where, int size, u32 *val)
75{ 60{
76 int returnval = -1; 61 int returnval = -1;
@@ -117,7 +102,7 @@ static int rtas_pci_read_config(struct pci_bus *bus,
117 for (dn = busdn->child; dn; dn = dn->sibling) { 102 for (dn = busdn->child; dn; dn = dn->sibling) {
118 struct pci_dn *pdn = PCI_DN(dn); 103 struct pci_dn *pdn = PCI_DN(dn);
119 if (pdn && pdn->devfn == devfn 104 if (pdn && pdn->devfn == devfn
120 && of_device_available(dn)) 105 && of_device_is_available(dn))
121 return rtas_read_config(pdn, where, size, val); 106 return rtas_read_config(pdn, where, size, val);
122 } 107 }
123 108
@@ -164,7 +149,7 @@ static int rtas_pci_write_config(struct pci_bus *bus,
164 for (dn = busdn->child; dn; dn = dn->sibling) { 149 for (dn = busdn->child; dn; dn = dn->sibling) {
165 struct pci_dn *pdn = PCI_DN(dn); 150 struct pci_dn *pdn = PCI_DN(dn);
166 if (pdn && pdn->devfn == devfn 151 if (pdn && pdn->devfn == devfn
167 && of_device_available(dn)) 152 && of_device_is_available(dn))
168 return rtas_write_config(pdn, where, size, val); 153 return rtas_write_config(pdn, where, size, val);
169 } 154 }
170 return PCIBIOS_DEVICE_NOT_FOUND; 155 return PCIBIOS_DEVICE_NOT_FOUND;
@@ -326,7 +311,7 @@ int pcibios_remove_root_bus(struct pci_controller *phb)
326 311
327 res = b->resource[0]; 312 res = b->resource[0];
328 if (!res->flags) { 313 if (!res->flags) {
329 printk(KERN_ERR "%s: no IO resource for PHB %s\n", __FUNCTION__, 314 printk(KERN_ERR "%s: no IO resource for PHB %s\n", __func__,
330 b->name); 315 b->name);
331 return 1; 316 return 1;
332 } 317 }
@@ -334,13 +319,13 @@ int pcibios_remove_root_bus(struct pci_controller *phb)
334 rc = pcibios_unmap_io_space(b); 319 rc = pcibios_unmap_io_space(b);
335 if (rc) { 320 if (rc) {
336 printk(KERN_ERR "%s: failed to unmap IO on bus %s\n", 321 printk(KERN_ERR "%s: failed to unmap IO on bus %s\n",
337 __FUNCTION__, b->name); 322 __func__, b->name);
338 return 1; 323 return 1;
339 } 324 }
340 325
341 if (release_resource(res)) { 326 if (release_resource(res)) {
342 printk(KERN_ERR "%s: failed to release IO on bus %s\n", 327 printk(KERN_ERR "%s: failed to release IO on bus %s\n",
343 __FUNCTION__, b->name); 328 __func__, b->name);
344 return 1; 329 return 1;
345 } 330 }
346 331
@@ -348,13 +333,13 @@ int pcibios_remove_root_bus(struct pci_controller *phb)
348 res = b->resource[i]; 333 res = b->resource[i];
349 if (!res->flags && i == 0) { 334 if (!res->flags && i == 0) {
350 printk(KERN_ERR "%s: no MEM resource for PHB %s\n", 335 printk(KERN_ERR "%s: no MEM resource for PHB %s\n",
351 __FUNCTION__, b->name); 336 __func__, b->name);
352 return 1; 337 return 1;
353 } 338 }
354 if (res->flags && release_resource(res)) { 339 if (res->flags && release_resource(res)) {
355 printk(KERN_ERR 340 printk(KERN_ERR
356 "%s: failed to release IO %d on bus %s\n", 341 "%s: failed to release IO %d on bus %s\n",
357 __FUNCTION__, i, b->name); 342 __func__, i, b->name);
358 return 1; 343 return 1;
359 } 344 }
360 } 345 }
diff --git a/arch/powerpc/kernel/setup-common.c b/arch/powerpc/kernel/setup-common.c
index 6adb5a1e98bb..db540eab09f4 100644
--- a/arch/powerpc/kernel/setup-common.c
+++ b/arch/powerpc/kernel/setup-common.c
@@ -34,6 +34,7 @@
34#include <linux/serial_8250.h> 34#include <linux/serial_8250.h>
35#include <linux/debugfs.h> 35#include <linux/debugfs.h>
36#include <linux/percpu.h> 36#include <linux/percpu.h>
37#include <linux/lmb.h>
37#include <asm/io.h> 38#include <asm/io.h>
38#include <asm/prom.h> 39#include <asm/prom.h>
39#include <asm/processor.h> 40#include <asm/processor.h>
@@ -56,7 +57,6 @@
56#include <asm/cache.h> 57#include <asm/cache.h>
57#include <asm/page.h> 58#include <asm/page.h>
58#include <asm/mmu.h> 59#include <asm/mmu.h>
59#include <asm/lmb.h>
60#include <asm/xmon.h> 60#include <asm/xmon.h>
61#include <asm/cputhreads.h> 61#include <asm/cputhreads.h>
62 62
@@ -167,6 +167,8 @@ static int show_cpuinfo(struct seq_file *m, void *v)
167 unsigned short min; 167 unsigned short min;
168 168
169 if (cpu_id == NR_CPUS) { 169 if (cpu_id == NR_CPUS) {
170 struct device_node *root;
171 const char *model = NULL;
170#if defined(CONFIG_SMP) && defined(CONFIG_PPC32) 172#if defined(CONFIG_SMP) && defined(CONFIG_PPC32)
171 unsigned long bogosum = 0; 173 unsigned long bogosum = 0;
172 int i; 174 int i;
@@ -178,6 +180,13 @@ static int show_cpuinfo(struct seq_file *m, void *v)
178 seq_printf(m, "timebase\t: %lu\n", ppc_tb_freq); 180 seq_printf(m, "timebase\t: %lu\n", ppc_tb_freq);
179 if (ppc_md.name) 181 if (ppc_md.name)
180 seq_printf(m, "platform\t: %s\n", ppc_md.name); 182 seq_printf(m, "platform\t: %s\n", ppc_md.name);
183 root = of_find_node_by_path("/");
184 if (root)
185 model = of_get_property(root, "model", NULL);
186 if (model)
187 seq_printf(m, "model\t\t: %s\n", model);
188 of_node_put(root);
189
181 if (ppc_md.show_cpuinfo != NULL) 190 if (ppc_md.show_cpuinfo != NULL)
182 ppc_md.show_cpuinfo(m); 191 ppc_md.show_cpuinfo(m);
183 192
diff --git a/arch/powerpc/kernel/setup_32.c b/arch/powerpc/kernel/setup_32.c
index 06d918d94dd1..36f6779c88d4 100644
--- a/arch/powerpc/kernel/setup_32.c
+++ b/arch/powerpc/kernel/setup_32.c
@@ -164,6 +164,18 @@ int __init ppc_setup_l2cr(char *str)
164} 164}
165__setup("l2cr=", ppc_setup_l2cr); 165__setup("l2cr=", ppc_setup_l2cr);
166 166
167/* Checks "l3cr=xxxx" command-line option */
168int __init ppc_setup_l3cr(char *str)
169{
170 if (cpu_has_feature(CPU_FTR_L3CR)) {
171 unsigned long val = simple_strtoul(str, NULL, 0);
172 printk(KERN_INFO "l3cr set to %lx\n", val);
173 _set_L3CR(val); /* and enable it */
174 }
175 return 1;
176}
177__setup("l3cr=", ppc_setup_l3cr);
178
167#ifdef CONFIG_GENERIC_NVRAM 179#ifdef CONFIG_GENERIC_NVRAM
168 180
169/* Generic nvram hooks used by drivers/char/gen_nvram.c */ 181/* Generic nvram hooks used by drivers/char/gen_nvram.c */
@@ -269,7 +281,7 @@ void __init setup_arch(char **cmdline_p)
269 if (ppc_md.panic) 281 if (ppc_md.panic)
270 setup_panic(); 282 setup_panic();
271 283
272 init_mm.start_code = PAGE_OFFSET; 284 init_mm.start_code = (unsigned long)_stext;
273 init_mm.end_code = (unsigned long) _etext; 285 init_mm.end_code = (unsigned long) _etext;
274 init_mm.end_data = (unsigned long) _edata; 286 init_mm.end_data = (unsigned long) _edata;
275 init_mm.brk = klimit; 287 init_mm.brk = klimit;
diff --git a/arch/powerpc/kernel/setup_64.c b/arch/powerpc/kernel/setup_64.c
index 3b1529c103ef..31ada9fdfc5c 100644
--- a/arch/powerpc/kernel/setup_64.c
+++ b/arch/powerpc/kernel/setup_64.c
@@ -33,6 +33,8 @@
33#include <linux/serial_8250.h> 33#include <linux/serial_8250.h>
34#include <linux/bootmem.h> 34#include <linux/bootmem.h>
35#include <linux/pci.h> 35#include <linux/pci.h>
36#include <linux/lockdep.h>
37#include <linux/lmb.h>
36#include <asm/io.h> 38#include <asm/io.h>
37#include <asm/kdump.h> 39#include <asm/kdump.h>
38#include <asm/prom.h> 40#include <asm/prom.h>
@@ -55,7 +57,6 @@
55#include <asm/cache.h> 57#include <asm/cache.h>
56#include <asm/page.h> 58#include <asm/page.h>
57#include <asm/mmu.h> 59#include <asm/mmu.h>
58#include <asm/lmb.h>
59#include <asm/firmware.h> 60#include <asm/firmware.h>
60#include <asm/xmon.h> 61#include <asm/xmon.h>
61#include <asm/udbg.h> 62#include <asm/udbg.h>
@@ -178,6 +179,9 @@ void __init early_setup(unsigned long dt_ptr)
178 /* Enable early debugging if any specified (see udbg.h) */ 179 /* Enable early debugging if any specified (see udbg.h) */
179 udbg_early_init(); 180 udbg_early_init();
180 181
182 /* Initialize lockdep early or else spinlocks will blow */
183 lockdep_init();
184
181 DBG(" -> early_setup(), dt_ptr: 0x%lx\n", dt_ptr); 185 DBG(" -> early_setup(), dt_ptr: 0x%lx\n", dt_ptr);
182 186
183 /* 187 /*
@@ -510,7 +514,7 @@ void __init setup_arch(char **cmdline_p)
510 if (ppc_md.panic) 514 if (ppc_md.panic)
511 setup_panic(); 515 setup_panic();
512 516
513 init_mm.start_code = PAGE_OFFSET; 517 init_mm.start_code = (unsigned long)_stext;
514 init_mm.end_code = (unsigned long) _etext; 518 init_mm.end_code = (unsigned long) _etext;
515 init_mm.end_data = (unsigned long) _edata; 519 init_mm.end_data = (unsigned long) _edata;
516 init_mm.brk = klimit; 520 init_mm.brk = klimit;
diff --git a/arch/powerpc/kernel/signal_32.c b/arch/powerpc/kernel/signal_32.c
index d840bc772fd3..ad6943468ee9 100644
--- a/arch/powerpc/kernel/signal_32.c
+++ b/arch/powerpc/kernel/signal_32.c
@@ -621,6 +621,18 @@ int copy_siginfo_to_user32(struct compat_siginfo __user *d, siginfo_t *s)
621 621
622#define copy_siginfo_to_user copy_siginfo_to_user32 622#define copy_siginfo_to_user copy_siginfo_to_user32
623 623
624int copy_siginfo_from_user32(siginfo_t *to, struct compat_siginfo __user *from)
625{
626 memset(to, 0, sizeof *to);
627
628 if (copy_from_user(to, from, 3*sizeof(int)) ||
629 copy_from_user(to->_sifields._pad,
630 from->_sifields._pad, SI_PAD_SIZE32))
631 return -EFAULT;
632
633 return 0;
634}
635
624/* 636/*
625 * Note: it is necessary to treat pid and sig as unsigned ints, with the 637 * Note: it is necessary to treat pid and sig as unsigned ints, with the
626 * corresponding cast to a signed int to insure that the proper conversion 638 * corresponding cast to a signed int to insure that the proper conversion
@@ -634,9 +646,10 @@ long compat_sys_rt_sigqueueinfo(u32 pid, u32 sig, compat_siginfo_t __user *uinfo
634 int ret; 646 int ret;
635 mm_segment_t old_fs = get_fs(); 647 mm_segment_t old_fs = get_fs();
636 648
637 if (copy_from_user (&info, uinfo, 3*sizeof(int)) || 649 ret = copy_siginfo_from_user32(&info, uinfo);
638 copy_from_user (info._sifields._pad, uinfo->_sifields._pad, SI_PAD_SIZE32)) 650 if (unlikely(ret))
639 return -EFAULT; 651 return ret;
652
640 set_fs (KERNEL_DS); 653 set_fs (KERNEL_DS);
641 /* The __user pointer cast is valid becasuse of the set_fs() */ 654 /* The __user pointer cast is valid becasuse of the set_fs() */
642 ret = sys_rt_sigqueueinfo((int)pid, (int)sig, (siginfo_t __user *) &info); 655 ret = sys_rt_sigqueueinfo((int)pid, (int)sig, (siginfo_t __user *) &info);
diff --git a/arch/powerpc/kernel/stacktrace.c b/arch/powerpc/kernel/stacktrace.c
new file mode 100644
index 000000000000..e3638eeaaae7
--- /dev/null
+++ b/arch/powerpc/kernel/stacktrace.c
@@ -0,0 +1,47 @@
1/*
2 * Stack trace utility
3 *
4 * Copyright 2008 Christoph Hellwig, IBM Corp.
5 *
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version
10 * 2 of the License, or (at your option) any later version.
11 */
12
13#include <linux/sched.h>
14#include <linux/stacktrace.h>
15#include <asm/ptrace.h>
16#include <asm/asm-offsets.h>
17
18/*
19 * Save stack-backtrace addresses into a stack_trace buffer.
20 */
21void save_stack_trace(struct stack_trace *trace)
22{
23 unsigned long sp;
24
25 asm("mr %0,1" : "=r" (sp));
26
27 for (;;) {
28 unsigned long *stack = (unsigned long *) sp;
29 unsigned long newsp, ip;
30
31 if (!validate_sp(sp, current, STACK_FRAME_OVERHEAD))
32 return;
33
34 newsp = stack[0];
35 ip = stack[STACK_FRAME_LR_SAVE];
36
37 if (!trace->skip)
38 trace->entries[trace->nr_entries++] = ip;
39 else
40 trace->skip--;
41
42 if (trace->nr_entries >= trace->max_entries)
43 return;
44
45 sp = newsp;
46 }
47}
diff --git a/arch/powerpc/kernel/sys_ppc32.c b/arch/powerpc/kernel/sys_ppc32.c
index fee9ee2260b1..709f8cb8bfca 100644
--- a/arch/powerpc/kernel/sys_ppc32.c
+++ b/arch/powerpc/kernel/sys_ppc32.c
@@ -367,11 +367,6 @@ long compat_sys_execve(unsigned long a0, unsigned long a1, unsigned long a2,
367 367
368 error = compat_do_execve(filename, compat_ptr(a1), compat_ptr(a2), regs); 368 error = compat_do_execve(filename, compat_ptr(a1), compat_ptr(a2), regs);
369 369
370 if (error == 0) {
371 task_lock(current);
372 current->ptrace &= ~PT_DTRACE;
373 task_unlock(current);
374 }
375 putname(filename); 370 putname(filename);
376 371
377out: 372out:
diff --git a/arch/powerpc/kernel/vdso.c b/arch/powerpc/kernel/vdso.c
index d3437c4c4a6f..c21a626af676 100644
--- a/arch/powerpc/kernel/vdso.c
+++ b/arch/powerpc/kernel/vdso.c
@@ -21,13 +21,14 @@
21#include <linux/elf.h> 21#include <linux/elf.h>
22#include <linux/security.h> 22#include <linux/security.h>
23#include <linux/bootmem.h> 23#include <linux/bootmem.h>
24#include <linux/lmb.h>
24 25
25#include <asm/pgtable.h> 26#include <asm/pgtable.h>
26#include <asm/system.h> 27#include <asm/system.h>
27#include <asm/processor.h> 28#include <asm/processor.h>
28#include <asm/mmu.h> 29#include <asm/mmu.h>
29#include <asm/mmu_context.h> 30#include <asm/mmu_context.h>
30#include <asm/lmb.h> 31#include <asm/prom.h>
31#include <asm/machdep.h> 32#include <asm/machdep.h>
32#include <asm/cputable.h> 33#include <asm/cputable.h>
33#include <asm/sections.h> 34#include <asm/sections.h>
diff --git a/arch/powerpc/kernel/vio.c b/arch/powerpc/kernel/vio.c
index f98867252ee2..b77f8af7ddde 100644
--- a/arch/powerpc/kernel/vio.c
+++ b/arch/powerpc/kernel/vio.c
@@ -139,7 +139,7 @@ static int vio_bus_remove(struct device *dev)
139 */ 139 */
140int vio_register_driver(struct vio_driver *viodrv) 140int vio_register_driver(struct vio_driver *viodrv)
141{ 141{
142 printk(KERN_DEBUG "%s: driver %s registering\n", __FUNCTION__, 142 printk(KERN_DEBUG "%s: driver %s registering\n", __func__,
143 viodrv->driver.name); 143 viodrv->driver.name);
144 144
145 /* fill in 'struct driver' fields */ 145 /* fill in 'struct driver' fields */
@@ -184,7 +184,7 @@ struct vio_dev *vio_register_device_node(struct device_node *of_node)
184 /* we need the 'device_type' property, in order to match with drivers */ 184 /* we need the 'device_type' property, in order to match with drivers */
185 if (of_node->type == NULL) { 185 if (of_node->type == NULL) {
186 printk(KERN_WARNING "%s: node %s missing 'device_type'\n", 186 printk(KERN_WARNING "%s: node %s missing 'device_type'\n",
187 __FUNCTION__, 187 __func__,
188 of_node->name ? of_node->name : "<unknown>"); 188 of_node->name ? of_node->name : "<unknown>");
189 return NULL; 189 return NULL;
190 } 190 }
@@ -192,7 +192,7 @@ struct vio_dev *vio_register_device_node(struct device_node *of_node)
192 unit_address = of_get_property(of_node, "reg", NULL); 192 unit_address = of_get_property(of_node, "reg", NULL);
193 if (unit_address == NULL) { 193 if (unit_address == NULL) {
194 printk(KERN_WARNING "%s: node %s missing 'reg'\n", 194 printk(KERN_WARNING "%s: node %s missing 'reg'\n",
195 __FUNCTION__, 195 __func__,
196 of_node->name ? of_node->name : "<unknown>"); 196 of_node->name ? of_node->name : "<unknown>");
197 return NULL; 197 return NULL;
198 } 198 }
@@ -227,7 +227,7 @@ struct vio_dev *vio_register_device_node(struct device_node *of_node)
227 /* register with generic device framework */ 227 /* register with generic device framework */
228 if (device_register(&viodev->dev)) { 228 if (device_register(&viodev->dev)) {
229 printk(KERN_ERR "%s: failed to register device %s\n", 229 printk(KERN_ERR "%s: failed to register device %s\n",
230 __FUNCTION__, viodev->dev.bus_id); 230 __func__, viodev->dev.bus_id);
231 /* XXX free TCE table */ 231 /* XXX free TCE table */
232 kfree(viodev); 232 kfree(viodev);
233 return NULL; 233 return NULL;
@@ -258,7 +258,7 @@ static int __init vio_bus_init(void)
258 err = device_register(&vio_bus_device.dev); 258 err = device_register(&vio_bus_device.dev);
259 if (err) { 259 if (err) {
260 printk(KERN_WARNING "%s: device_register returned %i\n", 260 printk(KERN_WARNING "%s: device_register returned %i\n",
261 __FUNCTION__, err); 261 __func__, err);
262 return err; 262 return err;
263 } 263 }
264 264
diff --git a/arch/powerpc/kernel/vmlinux.lds.S b/arch/powerpc/kernel/vmlinux.lds.S
index 0afb9e31d2a0..0c3000bf8d75 100644
--- a/arch/powerpc/kernel/vmlinux.lds.S
+++ b/arch/powerpc/kernel/vmlinux.lds.S
@@ -1,11 +1,9 @@
1#ifdef CONFIG_PPC64 1#ifdef CONFIG_PPC64
2#include <asm/page.h>
3#define PROVIDE32(x) PROVIDE(__unused__##x) 2#define PROVIDE32(x) PROVIDE(__unused__##x)
4#else 3#else
5#define PAGE_SIZE 4096
6#define KERNELBASE CONFIG_KERNEL_START
7#define PROVIDE32(x) PROVIDE(x) 4#define PROVIDE32(x) PROVIDE(x)
8#endif 5#endif
6#include <asm/page.h>
9#include <asm-generic/vmlinux.lds.h> 7#include <asm-generic/vmlinux.lds.h>
10#include <asm/cache.h> 8#include <asm/cache.h>
11 9
@@ -33,7 +31,7 @@ SECTIONS
33 */ 31 */
34 32
35 /* Text and gots */ 33 /* Text and gots */
36 .text : { 34 .text : AT(ADDR(.text) - LOAD_OFFSET) {
37 ALIGN_FUNCTION(); 35 ALIGN_FUNCTION();
38 *(.text.head) 36 *(.text.head)
39 _text = .; 37 _text = .;
@@ -58,7 +56,7 @@ SECTIONS
58 RODATA 56 RODATA
59 57
60 /* Exception & bug tables */ 58 /* Exception & bug tables */
61 __ex_table : { 59 __ex_table : AT(ADDR(__ex_table) - LOAD_OFFSET) {
62 __start___ex_table = .; 60 __start___ex_table = .;
63 *(__ex_table) 61 *(__ex_table)
64 __stop___ex_table = .; 62 __stop___ex_table = .;
@@ -74,7 +72,7 @@ SECTIONS
74 . = ALIGN(PAGE_SIZE); 72 . = ALIGN(PAGE_SIZE);
75 __init_begin = .; 73 __init_begin = .;
76 74
77 .init.text : { 75 .init.text : AT(ADDR(.init.text) - LOAD_OFFSET) {
78 _sinittext = .; 76 _sinittext = .;
79 INIT_TEXT 77 INIT_TEXT
80 _einittext = .; 78 _einittext = .;
@@ -83,11 +81,11 @@ SECTIONS
83 /* .exit.text is discarded at runtime, not link time, 81 /* .exit.text is discarded at runtime, not link time,
84 * to deal with references from __bug_table 82 * to deal with references from __bug_table
85 */ 83 */
86 .exit.text : { 84 .exit.text : AT(ADDR(.exit.text) - LOAD_OFFSET) {
87 EXIT_TEXT 85 EXIT_TEXT
88 } 86 }
89 87
90 .init.data : { 88 .init.data : AT(ADDR(.init.data) - LOAD_OFFSET) {
91 INIT_DATA 89 INIT_DATA
92 __vtop_table_begin = .; 90 __vtop_table_begin = .;
93 *(.vtop_fixup); 91 *(.vtop_fixup);
@@ -103,19 +101,19 @@ SECTIONS
103 } 101 }
104 102
105 . = ALIGN(16); 103 . = ALIGN(16);
106 .init.setup : { 104 .init.setup : AT(ADDR(.init.setup) - LOAD_OFFSET) {
107 __setup_start = .; 105 __setup_start = .;
108 *(.init.setup) 106 *(.init.setup)
109 __setup_end = .; 107 __setup_end = .;
110 } 108 }
111 109
112 .initcall.init : { 110 .initcall.init : AT(ADDR(.initcall.init) - LOAD_OFFSET) {
113 __initcall_start = .; 111 __initcall_start = .;
114 INITCALLS 112 INITCALLS
115 __initcall_end = .; 113 __initcall_end = .;
116 } 114 }
117 115
118 .con_initcall.init : { 116 .con_initcall.init : AT(ADDR(.con_initcall.init) - LOAD_OFFSET) {
119 __con_initcall_start = .; 117 __con_initcall_start = .;
120 *(.con_initcall.init) 118 *(.con_initcall.init)
121 __con_initcall_end = .; 119 __con_initcall_end = .;
@@ -124,14 +122,14 @@ SECTIONS
124 SECURITY_INIT 122 SECURITY_INIT
125 123
126 . = ALIGN(8); 124 . = ALIGN(8);
127 __ftr_fixup : { 125 __ftr_fixup : AT(ADDR(__ftr_fixup) - LOAD_OFFSET) {
128 __start___ftr_fixup = .; 126 __start___ftr_fixup = .;
129 *(__ftr_fixup) 127 *(__ftr_fixup)
130 __stop___ftr_fixup = .; 128 __stop___ftr_fixup = .;
131 } 129 }
132#ifdef CONFIG_PPC64 130#ifdef CONFIG_PPC64
133 . = ALIGN(8); 131 . = ALIGN(8);
134 __fw_ftr_fixup : { 132 __fw_ftr_fixup : AT(ADDR(__fw_ftr_fixup) - LOAD_OFFSET) {
135 __start___fw_ftr_fixup = .; 133 __start___fw_ftr_fixup = .;
136 *(__fw_ftr_fixup) 134 *(__fw_ftr_fixup)
137 __stop___fw_ftr_fixup = .; 135 __stop___fw_ftr_fixup = .;
@@ -139,14 +137,14 @@ SECTIONS
139#endif 137#endif
140#ifdef CONFIG_BLK_DEV_INITRD 138#ifdef CONFIG_BLK_DEV_INITRD
141 . = ALIGN(PAGE_SIZE); 139 . = ALIGN(PAGE_SIZE);
142 .init.ramfs : { 140 .init.ramfs : AT(ADDR(.init.ramfs) - LOAD_OFFSET) {
143 __initramfs_start = .; 141 __initramfs_start = .;
144 *(.init.ramfs) 142 *(.init.ramfs)
145 __initramfs_end = .; 143 __initramfs_end = .;
146 } 144 }
147#endif 145#endif
148 . = ALIGN(PAGE_SIZE); 146 . = ALIGN(PAGE_SIZE);
149 .data.percpu : { 147 .data.percpu : AT(ADDR(.data.percpu) - LOAD_OFFSET) {
150 __per_cpu_start = .; 148 __per_cpu_start = .;
151 *(.data.percpu) 149 *(.data.percpu)
152 *(.data.percpu.shared_aligned) 150 *(.data.percpu.shared_aligned)
@@ -154,7 +152,7 @@ SECTIONS
154 } 152 }
155 153
156 . = ALIGN(8); 154 . = ALIGN(8);
157 .machine.desc : { 155 .machine.desc : AT(ADDR(.machine.desc) - LOAD_OFFSET) {
158 __machine_desc_start = . ; 156 __machine_desc_start = . ;
159 *(.machine.desc) 157 *(.machine.desc)
160 __machine_desc_end = . ; 158 __machine_desc_end = . ;
@@ -172,25 +170,24 @@ SECTIONS
172 _sdata = .; 170 _sdata = .;
173 171
174#ifdef CONFIG_PPC32 172#ifdef CONFIG_PPC32
175 .data : 173 .data : AT(ADDR(.data) - LOAD_OFFSET) {
176 {
177 DATA_DATA 174 DATA_DATA
178 *(.sdata) 175 *(.sdata)
179 *(.got.plt) *(.got) 176 *(.got.plt) *(.got)
180 } 177 }
181#else 178#else
182 .data : { 179 .data : AT(ADDR(.data) - LOAD_OFFSET) {
183 DATA_DATA 180 DATA_DATA
184 *(.data.rel*) 181 *(.data.rel*)
185 *(.toc1) 182 *(.toc1)
186 *(.branch_lt) 183 *(.branch_lt)
187 } 184 }
188 185
189 .opd : { 186 .opd : AT(ADDR(.opd) - LOAD_OFFSET) {
190 *(.opd) 187 *(.opd)
191 } 188 }
192 189
193 .got : { 190 .got : AT(ADDR(.got) - LOAD_OFFSET) {
194 __toc_start = .; 191 __toc_start = .;
195 *(.got) 192 *(.got)
196 *(.toc) 193 *(.toc)
@@ -207,26 +204,26 @@ SECTIONS
207#else 204#else
208 . = ALIGN(16384); 205 . = ALIGN(16384);
209#endif 206#endif
210 .data.init_task : { 207 .data.init_task : AT(ADDR(.data.init_task) - LOAD_OFFSET) {
211 *(.data.init_task) 208 *(.data.init_task)
212 } 209 }
213 210
214 . = ALIGN(PAGE_SIZE); 211 . = ALIGN(PAGE_SIZE);
215 .data.page_aligned : { 212 .data.page_aligned : AT(ADDR(.data.page_aligned) - LOAD_OFFSET) {
216 *(.data.page_aligned) 213 *(.data.page_aligned)
217 } 214 }
218 215
219 .data.cacheline_aligned : { 216 .data.cacheline_aligned : AT(ADDR(.data.cacheline_aligned) - LOAD_OFFSET) {
220 *(.data.cacheline_aligned) 217 *(.data.cacheline_aligned)
221 } 218 }
222 219
223 . = ALIGN(L1_CACHE_BYTES); 220 . = ALIGN(L1_CACHE_BYTES);
224 .data.read_mostly : { 221 .data.read_mostly : AT(ADDR(.data.read_mostly) - LOAD_OFFSET) {
225 *(.data.read_mostly) 222 *(.data.read_mostly)
226 } 223 }
227 224
228 . = ALIGN(PAGE_SIZE); 225 . = ALIGN(PAGE_SIZE);
229 __data_nosave : { 226 .data_nosave : AT(ADDR(.data_nosave) - LOAD_OFFSET) {
230 __nosave_begin = .; 227 __nosave_begin = .;
231 *(.data.nosave) 228 *(.data.nosave)
232 . = ALIGN(PAGE_SIZE); 229 . = ALIGN(PAGE_SIZE);
@@ -237,7 +234,7 @@ SECTIONS
237 * And finally the bss 234 * And finally the bss
238 */ 235 */
239 236
240 .bss : { 237 .bss : AT(ADDR(.bss) - LOAD_OFFSET) {
241 __bss_start = .; 238 __bss_start = .;
242 *(.sbss) *(.scommon) 239 *(.sbss) *(.scommon)
243 *(.dynbss) 240 *(.dynbss)