diff options
Diffstat (limited to 'arch')
42 files changed, 498 insertions, 218 deletions
diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig index 352f416269ce..98e513b62709 100644 --- a/arch/powerpc/Kconfig +++ b/arch/powerpc/Kconfig | |||
@@ -239,6 +239,9 @@ config PPC_OF_PLATFORM_PCI | |||
239 | config ARCH_SUPPORTS_DEBUG_PAGEALLOC | 239 | config ARCH_SUPPORTS_DEBUG_PAGEALLOC |
240 | def_bool y | 240 | def_bool y |
241 | 241 | ||
242 | config ARCH_SUPPORTS_UPROBES | ||
243 | def_bool y | ||
244 | |||
242 | config PPC_ADV_DEBUG_REGS | 245 | config PPC_ADV_DEBUG_REGS |
243 | bool | 246 | bool |
244 | depends on 40x || BOOKE | 247 | depends on 40x || BOOKE |
diff --git a/arch/powerpc/include/asm/abs_addr.h b/arch/powerpc/include/asm/abs_addr.h deleted file mode 100644 index 9d92ba04b033..000000000000 --- a/arch/powerpc/include/asm/abs_addr.h +++ /dev/null | |||
@@ -1,56 +0,0 @@ | |||
1 | #ifndef _ASM_POWERPC_ABS_ADDR_H | ||
2 | #define _ASM_POWERPC_ABS_ADDR_H | ||
3 | #ifdef __KERNEL__ | ||
4 | |||
5 | |||
6 | /* | ||
7 | * c 2001 PPC 64 Team, IBM Corp | ||
8 | * | ||
9 | * This program is free software; you can redistribute it and/or | ||
10 | * modify it under the terms of the GNU General Public License | ||
11 | * as published by the Free Software Foundation; either version | ||
12 | * 2 of the License, or (at your option) any later version. | ||
13 | */ | ||
14 | |||
15 | #include <linux/memblock.h> | ||
16 | |||
17 | #include <asm/types.h> | ||
18 | #include <asm/page.h> | ||
19 | #include <asm/prom.h> | ||
20 | |||
21 | struct mschunks_map { | ||
22 | unsigned long num_chunks; | ||
23 | unsigned long chunk_size; | ||
24 | unsigned long chunk_shift; | ||
25 | unsigned long chunk_mask; | ||
26 | u32 *mapping; | ||
27 | }; | ||
28 | |||
29 | extern struct mschunks_map mschunks_map; | ||
30 | |||
31 | /* Chunks are 256 KB */ | ||
32 | #define MSCHUNKS_CHUNK_SHIFT (18) | ||
33 | #define MSCHUNKS_CHUNK_SIZE (1UL << MSCHUNKS_CHUNK_SHIFT) | ||
34 | #define MSCHUNKS_OFFSET_MASK (MSCHUNKS_CHUNK_SIZE - 1) | ||
35 | |||
36 | static inline unsigned long chunk_to_addr(unsigned long chunk) | ||
37 | { | ||
38 | return chunk << MSCHUNKS_CHUNK_SHIFT; | ||
39 | } | ||
40 | |||
41 | static inline unsigned long addr_to_chunk(unsigned long addr) | ||
42 | { | ||
43 | return addr >> MSCHUNKS_CHUNK_SHIFT; | ||
44 | } | ||
45 | |||
46 | static inline unsigned long phys_to_abs(unsigned long pa) | ||
47 | { | ||
48 | return pa; | ||
49 | } | ||
50 | |||
51 | /* Convenience macros */ | ||
52 | #define virt_to_abs(va) phys_to_abs(__pa(va)) | ||
53 | #define abs_to_virt(aa) __va(aa) | ||
54 | |||
55 | #endif /* __KERNEL__ */ | ||
56 | #endif /* _ASM_POWERPC_ABS_ADDR_H */ | ||
diff --git a/arch/powerpc/include/asm/exception-64e.h b/arch/powerpc/include/asm/exception-64e.h index ac13addb8495..51fa43e536b9 100644 --- a/arch/powerpc/include/asm/exception-64e.h +++ b/arch/powerpc/include/asm/exception-64e.h | |||
@@ -37,6 +37,7 @@ | |||
37 | * critical data | 37 | * critical data |
38 | */ | 38 | */ |
39 | 39 | ||
40 | #define PACA_EXGDBELL PACA_EXGEN | ||
40 | 41 | ||
41 | /* We are out of SPRGs so we save some things in the PACA. The normal | 42 | /* We are out of SPRGs so we save some things in the PACA. The normal |
42 | * exception frame is smaller than the CRIT or MC one though | 43 | * exception frame is smaller than the CRIT or MC one though |
@@ -45,8 +46,9 @@ | |||
45 | #define EX_CR (1 * 8) | 46 | #define EX_CR (1 * 8) |
46 | #define EX_R10 (2 * 8) | 47 | #define EX_R10 (2 * 8) |
47 | #define EX_R11 (3 * 8) | 48 | #define EX_R11 (3 * 8) |
48 | #define EX_R14 (4 * 8) | 49 | #define EX_R13 (4 * 8) |
49 | #define EX_R15 (5 * 8) | 50 | #define EX_R14 (5 * 8) |
51 | #define EX_R15 (6 * 8) | ||
50 | 52 | ||
51 | /* | 53 | /* |
52 | * The TLB miss exception uses different slots. | 54 | * The TLB miss exception uses different slots. |
diff --git a/arch/powerpc/include/asm/kprobes.h b/arch/powerpc/include/asm/kprobes.h index be0171afdc0f..7b6feab6fd26 100644 --- a/arch/powerpc/include/asm/kprobes.h +++ b/arch/powerpc/include/asm/kprobes.h | |||
@@ -29,21 +29,16 @@ | |||
29 | #include <linux/types.h> | 29 | #include <linux/types.h> |
30 | #include <linux/ptrace.h> | 30 | #include <linux/ptrace.h> |
31 | #include <linux/percpu.h> | 31 | #include <linux/percpu.h> |
32 | #include <asm/probes.h> | ||
32 | 33 | ||
33 | #define __ARCH_WANT_KPROBES_INSN_SLOT | 34 | #define __ARCH_WANT_KPROBES_INSN_SLOT |
34 | 35 | ||
35 | struct pt_regs; | 36 | struct pt_regs; |
36 | struct kprobe; | 37 | struct kprobe; |
37 | 38 | ||
38 | typedef unsigned int kprobe_opcode_t; | 39 | typedef ppc_opcode_t kprobe_opcode_t; |
39 | #define BREAKPOINT_INSTRUCTION 0x7fe00008 /* trap */ | ||
40 | #define MAX_INSN_SIZE 1 | 40 | #define MAX_INSN_SIZE 1 |
41 | 41 | ||
42 | #define IS_TW(instr) (((instr) & 0xfc0007fe) == 0x7c000008) | ||
43 | #define IS_TD(instr) (((instr) & 0xfc0007fe) == 0x7c000088) | ||
44 | #define IS_TDI(instr) (((instr) & 0xfc000000) == 0x08000000) | ||
45 | #define IS_TWI(instr) (((instr) & 0xfc000000) == 0x0c000000) | ||
46 | |||
47 | #ifdef CONFIG_PPC64 | 42 | #ifdef CONFIG_PPC64 |
48 | /* | 43 | /* |
49 | * 64bit powerpc uses function descriptors. | 44 | * 64bit powerpc uses function descriptors. |
@@ -72,12 +67,6 @@ typedef unsigned int kprobe_opcode_t; | |||
72 | addr = (kprobe_opcode_t *)kallsyms_lookup_name(dot_name); \ | 67 | addr = (kprobe_opcode_t *)kallsyms_lookup_name(dot_name); \ |
73 | } \ | 68 | } \ |
74 | } | 69 | } |
75 | |||
76 | #define is_trap(instr) (IS_TW(instr) || IS_TD(instr) || \ | ||
77 | IS_TWI(instr) || IS_TDI(instr)) | ||
78 | #else | ||
79 | /* Use stock kprobe_lookup_name since ppc32 doesn't use function descriptors */ | ||
80 | #define is_trap(instr) (IS_TW(instr) || IS_TWI(instr)) | ||
81 | #endif | 70 | #endif |
82 | 71 | ||
83 | #define flush_insn_slot(p) do { } while (0) | 72 | #define flush_insn_slot(p) do { } while (0) |
diff --git a/arch/powerpc/include/asm/kvm_book3s_asm.h b/arch/powerpc/include/asm/kvm_book3s_asm.h index bfcd00c1485d..88609b23b775 100644 --- a/arch/powerpc/include/asm/kvm_book3s_asm.h +++ b/arch/powerpc/include/asm/kvm_book3s_asm.h | |||
@@ -74,7 +74,6 @@ struct kvmppc_host_state { | |||
74 | ulong vmhandler; | 74 | ulong vmhandler; |
75 | ulong scratch0; | 75 | ulong scratch0; |
76 | ulong scratch1; | 76 | ulong scratch1; |
77 | ulong sprg3; | ||
78 | u8 in_guest; | 77 | u8 in_guest; |
79 | u8 restore_hid5; | 78 | u8 restore_hid5; |
80 | u8 napping; | 79 | u8 napping; |
diff --git a/arch/powerpc/include/asm/paca.h b/arch/powerpc/include/asm/paca.h index daf813fea91f..7796519fd238 100644 --- a/arch/powerpc/include/asm/paca.h +++ b/arch/powerpc/include/asm/paca.h | |||
@@ -136,6 +136,7 @@ struct paca_struct { | |||
136 | u8 io_sync; /* writel() needs spin_unlock sync */ | 136 | u8 io_sync; /* writel() needs spin_unlock sync */ |
137 | u8 irq_work_pending; /* IRQ_WORK interrupt while soft-disable */ | 137 | u8 irq_work_pending; /* IRQ_WORK interrupt while soft-disable */ |
138 | u8 nap_state_lost; /* NV GPR values lost in power7_idle */ | 138 | u8 nap_state_lost; /* NV GPR values lost in power7_idle */ |
139 | u64 sprg3; /* Saved user-visible sprg */ | ||
139 | 140 | ||
140 | #ifdef CONFIG_PPC_POWERNV | 141 | #ifdef CONFIG_PPC_POWERNV |
141 | /* Pointer to OPAL machine check event structure set by the | 142 | /* Pointer to OPAL machine check event structure set by the |
diff --git a/arch/powerpc/include/asm/probes.h b/arch/powerpc/include/asm/probes.h new file mode 100644 index 000000000000..5f1e15b68704 --- /dev/null +++ b/arch/powerpc/include/asm/probes.h | |||
@@ -0,0 +1,42 @@ | |||
1 | #ifndef _ASM_POWERPC_PROBES_H | ||
2 | #define _ASM_POWERPC_PROBES_H | ||
3 | #ifdef __KERNEL__ | ||
4 | /* | ||
5 | * Definitions common to probes files | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License as published by | ||
9 | * the Free Software Foundation; either version 2 of the License, or | ||
10 | * (at your option) any later version. | ||
11 | * | ||
12 | * This program is distributed in the hope that it will be useful, | ||
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
15 | * GNU General Public License for more details. | ||
16 | * | ||
17 | * You should have received a copy of the GNU General Public License | ||
18 | * along with this program; if not, write to the Free Software | ||
19 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | ||
20 | * | ||
21 | * Copyright IBM Corporation, 2012 | ||
22 | */ | ||
23 | #include <linux/types.h> | ||
24 | |||
25 | typedef u32 ppc_opcode_t; | ||
26 | #define BREAKPOINT_INSTRUCTION 0x7fe00008 /* trap */ | ||
27 | |||
28 | /* Trap definitions per ISA */ | ||
29 | #define IS_TW(instr) (((instr) & 0xfc0007fe) == 0x7c000008) | ||
30 | #define IS_TD(instr) (((instr) & 0xfc0007fe) == 0x7c000088) | ||
31 | #define IS_TDI(instr) (((instr) & 0xfc000000) == 0x08000000) | ||
32 | #define IS_TWI(instr) (((instr) & 0xfc000000) == 0x0c000000) | ||
33 | |||
34 | #ifdef CONFIG_PPC64 | ||
35 | #define is_trap(instr) (IS_TW(instr) || IS_TD(instr) || \ | ||
36 | IS_TWI(instr) || IS_TDI(instr)) | ||
37 | #else | ||
38 | #define is_trap(instr) (IS_TW(instr) || IS_TWI(instr)) | ||
39 | #endif /* CONFIG_PPC64 */ | ||
40 | |||
41 | #endif /* __KERNEL__ */ | ||
42 | #endif /* _ASM_POWERPC_PROBES_H */ | ||
diff --git a/arch/powerpc/include/asm/processor.h b/arch/powerpc/include/asm/processor.h index 54b73a28c205..7e7fa13e4667 100644 --- a/arch/powerpc/include/asm/processor.h +++ b/arch/powerpc/include/asm/processor.h | |||
@@ -219,6 +219,7 @@ struct thread_struct { | |||
219 | #endif /* CONFIG_HAVE_HW_BREAKPOINT */ | 219 | #endif /* CONFIG_HAVE_HW_BREAKPOINT */ |
220 | #endif | 220 | #endif |
221 | unsigned long dabr; /* Data address breakpoint register */ | 221 | unsigned long dabr; /* Data address breakpoint register */ |
222 | unsigned long trap_nr; /* last trap # on this thread */ | ||
222 | #ifdef CONFIG_ALTIVEC | 223 | #ifdef CONFIG_ALTIVEC |
223 | /* Complete AltiVec register set */ | 224 | /* Complete AltiVec register set */ |
224 | vector128 vr[32] __attribute__((aligned(16))); | 225 | vector128 vr[32] __attribute__((aligned(16))); |
diff --git a/arch/powerpc/include/asm/reg.h b/arch/powerpc/include/asm/reg.h index 638608677e2a..a391244c18e1 100644 --- a/arch/powerpc/include/asm/reg.h +++ b/arch/powerpc/include/asm/reg.h | |||
@@ -761,7 +761,8 @@ | |||
761 | * 64-bit embedded | 761 | * 64-bit embedded |
762 | * - SPRG0 generic exception scratch | 762 | * - SPRG0 generic exception scratch |
763 | * - SPRG2 TLB exception stack | 763 | * - SPRG2 TLB exception stack |
764 | * - SPRG3 CPU and NUMA node for VDSO getcpu (user visible) | 764 | * - SPRG3 critical exception scratch and |
765 | * CPU and NUMA node for VDSO getcpu (user visible) | ||
765 | * - SPRG4 unused (user visible) | 766 | * - SPRG4 unused (user visible) |
766 | * - SPRG6 TLB miss scratch (user visible, sorry !) | 767 | * - SPRG6 TLB miss scratch (user visible, sorry !) |
767 | * - SPRG7 critical exception scratch | 768 | * - SPRG7 critical exception scratch |
@@ -858,11 +859,12 @@ | |||
858 | 859 | ||
859 | #ifdef CONFIG_PPC_BOOK3E_64 | 860 | #ifdef CONFIG_PPC_BOOK3E_64 |
860 | #define SPRN_SPRG_MC_SCRATCH SPRN_SPRG8 | 861 | #define SPRN_SPRG_MC_SCRATCH SPRN_SPRG8 |
861 | #define SPRN_SPRG_CRIT_SCRATCH SPRN_SPRG7 | 862 | #define SPRN_SPRG_CRIT_SCRATCH SPRN_SPRG3 |
862 | #define SPRN_SPRG_DBG_SCRATCH SPRN_SPRG9 | 863 | #define SPRN_SPRG_DBG_SCRATCH SPRN_SPRG9 |
863 | #define SPRN_SPRG_TLB_EXFRAME SPRN_SPRG2 | 864 | #define SPRN_SPRG_TLB_EXFRAME SPRN_SPRG2 |
864 | #define SPRN_SPRG_TLB_SCRATCH SPRN_SPRG6 | 865 | #define SPRN_SPRG_TLB_SCRATCH SPRN_SPRG6 |
865 | #define SPRN_SPRG_GEN_SCRATCH SPRN_SPRG0 | 866 | #define SPRN_SPRG_GEN_SCRATCH SPRN_SPRG0 |
867 | #define SPRN_SPRG_GDBELL_SCRATCH SPRN_SPRG_GEN_SCRATCH | ||
866 | 868 | ||
867 | #define SET_PACA(rX) mtspr SPRN_SPRG_PACA,rX | 869 | #define SET_PACA(rX) mtspr SPRN_SPRG_PACA,rX |
868 | #define GET_PACA(rX) mfspr rX,SPRN_SPRG_PACA | 870 | #define GET_PACA(rX) mfspr rX,SPRN_SPRG_PACA |
@@ -937,7 +939,7 @@ | |||
937 | #define PVR_VER(pvr) (((pvr) >> 16) & 0xFFFF) /* Version field */ | 939 | #define PVR_VER(pvr) (((pvr) >> 16) & 0xFFFF) /* Version field */ |
938 | #define PVR_REV(pvr) (((pvr) >> 0) & 0xFFFF) /* Revison field */ | 940 | #define PVR_REV(pvr) (((pvr) >> 0) & 0xFFFF) /* Revison field */ |
939 | 941 | ||
940 | #define __is_processor(pv) (PVR_VER(mfspr(SPRN_PVR)) == (pv)) | 942 | #define pvr_version_is(pvr) (PVR_VER(mfspr(SPRN_PVR)) == (pvr)) |
941 | 943 | ||
942 | /* | 944 | /* |
943 | * IBM has further subdivided the standard PowerPC 16-bit version and | 945 | * IBM has further subdivided the standard PowerPC 16-bit version and |
@@ -1002,25 +1004,24 @@ | |||
1002 | #define PVR_476_ISS 0x00052000 | 1004 | #define PVR_476_ISS 0x00052000 |
1003 | 1005 | ||
1004 | /* 64-bit processors */ | 1006 | /* 64-bit processors */ |
1005 | /* XXX the prefix should be PVR_, we'll do a global sweep to fix it one day */ | 1007 | #define PVR_NORTHSTAR 0x0033 |
1006 | #define PV_NORTHSTAR 0x0033 | 1008 | #define PVR_PULSAR 0x0034 |
1007 | #define PV_PULSAR 0x0034 | 1009 | #define PVR_POWER4 0x0035 |
1008 | #define PV_POWER4 0x0035 | 1010 | #define PVR_ICESTAR 0x0036 |
1009 | #define PV_ICESTAR 0x0036 | 1011 | #define PVR_SSTAR 0x0037 |
1010 | #define PV_SSTAR 0x0037 | 1012 | #define PVR_POWER4p 0x0038 |
1011 | #define PV_POWER4p 0x0038 | 1013 | #define PVR_970 0x0039 |
1012 | #define PV_970 0x0039 | 1014 | #define PVR_POWER5 0x003A |
1013 | #define PV_POWER5 0x003A | 1015 | #define PVR_POWER5p 0x003B |
1014 | #define PV_POWER5p 0x003B | 1016 | #define PVR_970FX 0x003C |
1015 | #define PV_970FX 0x003C | 1017 | #define PVR_POWER6 0x003E |
1016 | #define PV_POWER6 0x003E | 1018 | #define PVR_POWER7 0x003F |
1017 | #define PV_POWER7 0x003F | 1019 | #define PVR_630 0x0040 |
1018 | #define PV_630 0x0040 | 1020 | #define PVR_630p 0x0041 |
1019 | #define PV_630p 0x0041 | 1021 | #define PVR_970MP 0x0044 |
1020 | #define PV_970MP 0x0044 | 1022 | #define PVR_970GX 0x0045 |
1021 | #define PV_970GX 0x0045 | 1023 | #define PVR_BE 0x0070 |
1022 | #define PV_BE 0x0070 | 1024 | #define PVR_PA6T 0x0090 |
1023 | #define PV_PA6T 0x0090 | ||
1024 | 1025 | ||
1025 | /* Macros for setting and retrieving special purpose registers */ | 1026 | /* Macros for setting and retrieving special purpose registers */ |
1026 | #ifndef __ASSEMBLY__ | 1027 | #ifndef __ASSEMBLY__ |
diff --git a/arch/powerpc/include/asm/thread_info.h b/arch/powerpc/include/asm/thread_info.h index faf93529cbf0..e942203cd4a8 100644 --- a/arch/powerpc/include/asm/thread_info.h +++ b/arch/powerpc/include/asm/thread_info.h | |||
@@ -102,6 +102,7 @@ static inline struct thread_info *current_thread_info(void) | |||
102 | #define TIF_RESTOREALL 11 /* Restore all regs (implies NOERROR) */ | 102 | #define TIF_RESTOREALL 11 /* Restore all regs (implies NOERROR) */ |
103 | #define TIF_NOERROR 12 /* Force successful syscall return */ | 103 | #define TIF_NOERROR 12 /* Force successful syscall return */ |
104 | #define TIF_NOTIFY_RESUME 13 /* callback before returning to user */ | 104 | #define TIF_NOTIFY_RESUME 13 /* callback before returning to user */ |
105 | #define TIF_UPROBE 14 /* breakpointed or single-stepping */ | ||
105 | #define TIF_SYSCALL_TRACEPOINT 15 /* syscall tracepoint instrumentation */ | 106 | #define TIF_SYSCALL_TRACEPOINT 15 /* syscall tracepoint instrumentation */ |
106 | 107 | ||
107 | /* as above, but as bit values */ | 108 | /* as above, but as bit values */ |
@@ -118,12 +119,13 @@ static inline struct thread_info *current_thread_info(void) | |||
118 | #define _TIF_RESTOREALL (1<<TIF_RESTOREALL) | 119 | #define _TIF_RESTOREALL (1<<TIF_RESTOREALL) |
119 | #define _TIF_NOERROR (1<<TIF_NOERROR) | 120 | #define _TIF_NOERROR (1<<TIF_NOERROR) |
120 | #define _TIF_NOTIFY_RESUME (1<<TIF_NOTIFY_RESUME) | 121 | #define _TIF_NOTIFY_RESUME (1<<TIF_NOTIFY_RESUME) |
122 | #define _TIF_UPROBE (1<<TIF_UPROBE) | ||
121 | #define _TIF_SYSCALL_TRACEPOINT (1<<TIF_SYSCALL_TRACEPOINT) | 123 | #define _TIF_SYSCALL_TRACEPOINT (1<<TIF_SYSCALL_TRACEPOINT) |
122 | #define _TIF_SYSCALL_T_OR_A (_TIF_SYSCALL_TRACE | _TIF_SYSCALL_AUDIT | \ | 124 | #define _TIF_SYSCALL_T_OR_A (_TIF_SYSCALL_TRACE | _TIF_SYSCALL_AUDIT | \ |
123 | _TIF_SECCOMP | _TIF_SYSCALL_TRACEPOINT) | 125 | _TIF_SECCOMP | _TIF_SYSCALL_TRACEPOINT) |
124 | 126 | ||
125 | #define _TIF_USER_WORK_MASK (_TIF_SIGPENDING | _TIF_NEED_RESCHED | \ | 127 | #define _TIF_USER_WORK_MASK (_TIF_SIGPENDING | _TIF_NEED_RESCHED | \ |
126 | _TIF_NOTIFY_RESUME) | 128 | _TIF_NOTIFY_RESUME | _TIF_UPROBE) |
127 | #define _TIF_PERSYSCALL_MASK (_TIF_RESTOREALL|_TIF_NOERROR) | 129 | #define _TIF_PERSYSCALL_MASK (_TIF_RESTOREALL|_TIF_NOERROR) |
128 | 130 | ||
129 | /* Bits in local_flags */ | 131 | /* Bits in local_flags */ |
diff --git a/arch/powerpc/include/asm/uprobes.h b/arch/powerpc/include/asm/uprobes.h new file mode 100644 index 000000000000..b532060d0916 --- /dev/null +++ b/arch/powerpc/include/asm/uprobes.h | |||
@@ -0,0 +1,54 @@ | |||
1 | #ifndef _ASM_UPROBES_H | ||
2 | #define _ASM_UPROBES_H | ||
3 | /* | ||
4 | * User-space Probes (UProbes) for powerpc | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License as published by | ||
8 | * the Free Software Foundation; either version 2 of the License, or | ||
9 | * (at your option) any later version. | ||
10 | * | ||
11 | * This program is distributed in the hope that it will be useful, | ||
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
14 | * GNU General Public License for more details. | ||
15 | * | ||
16 | * You should have received a copy of the GNU General Public License | ||
17 | * along with this program; if not, write to the Free Software | ||
18 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | ||
19 | * | ||
20 | * Copyright IBM Corporation, 2007-2012 | ||
21 | * | ||
22 | * Adapted from the x86 port by Ananth N Mavinakayanahalli <ananth@in.ibm.com> | ||
23 | */ | ||
24 | |||
25 | #include <linux/notifier.h> | ||
26 | #include <asm/probes.h> | ||
27 | |||
28 | typedef ppc_opcode_t uprobe_opcode_t; | ||
29 | |||
30 | #define MAX_UINSN_BYTES 4 | ||
31 | #define UPROBE_XOL_SLOT_BYTES (MAX_UINSN_BYTES) | ||
32 | |||
33 | /* The following alias is needed for reference from arch-agnostic code */ | ||
34 | #define UPROBE_SWBP_INSN BREAKPOINT_INSTRUCTION | ||
35 | #define UPROBE_SWBP_INSN_SIZE 4 /* swbp insn size in bytes */ | ||
36 | |||
37 | struct arch_uprobe { | ||
38 | union { | ||
39 | u8 insn[MAX_UINSN_BYTES]; | ||
40 | u32 ainsn; | ||
41 | }; | ||
42 | }; | ||
43 | |||
44 | struct arch_uprobe_task { | ||
45 | unsigned long saved_trap_nr; | ||
46 | }; | ||
47 | |||
48 | extern int arch_uprobe_analyze_insn(struct arch_uprobe *aup, struct mm_struct *mm, unsigned long addr); | ||
49 | extern int arch_uprobe_pre_xol(struct arch_uprobe *aup, struct pt_regs *regs); | ||
50 | extern int arch_uprobe_post_xol(struct arch_uprobe *aup, struct pt_regs *regs); | ||
51 | extern bool arch_uprobe_xol_was_trapped(struct task_struct *tsk); | ||
52 | extern int arch_uprobe_exception_notify(struct notifier_block *self, unsigned long val, void *data); | ||
53 | extern void arch_uprobe_abort_xol(struct arch_uprobe *aup, struct pt_regs *regs); | ||
54 | #endif /* _ASM_UPROBES_H */ | ||
diff --git a/arch/powerpc/kernel/Makefile b/arch/powerpc/kernel/Makefile index bb282dd81612..cde12f8a4ebc 100644 --- a/arch/powerpc/kernel/Makefile +++ b/arch/powerpc/kernel/Makefile | |||
@@ -96,6 +96,7 @@ obj-$(CONFIG_MODULES) += ppc_ksyms.o | |||
96 | obj-$(CONFIG_BOOTX_TEXT) += btext.o | 96 | obj-$(CONFIG_BOOTX_TEXT) += btext.o |
97 | obj-$(CONFIG_SMP) += smp.o | 97 | obj-$(CONFIG_SMP) += smp.o |
98 | obj-$(CONFIG_KPROBES) += kprobes.o | 98 | obj-$(CONFIG_KPROBES) += kprobes.o |
99 | obj-$(CONFIG_UPROBES) += uprobes.o | ||
99 | obj-$(CONFIG_PPC_UDBG_16550) += legacy_serial.o udbg_16550.o | 100 | obj-$(CONFIG_PPC_UDBG_16550) += legacy_serial.o udbg_16550.o |
100 | obj-$(CONFIG_STACKTRACE) += stacktrace.o | 101 | obj-$(CONFIG_STACKTRACE) += stacktrace.o |
101 | obj-$(CONFIG_SWIOTLB) += dma-swiotlb.o | 102 | obj-$(CONFIG_SWIOTLB) += dma-swiotlb.o |
diff --git a/arch/powerpc/kernel/asm-offsets.c b/arch/powerpc/kernel/asm-offsets.c index e8995727b1c1..7523539cfe9f 100644 --- a/arch/powerpc/kernel/asm-offsets.c +++ b/arch/powerpc/kernel/asm-offsets.c | |||
@@ -206,6 +206,7 @@ int main(void) | |||
206 | DEFINE(PACA_SYSTEM_TIME, offsetof(struct paca_struct, system_time)); | 206 | DEFINE(PACA_SYSTEM_TIME, offsetof(struct paca_struct, system_time)); |
207 | DEFINE(PACA_TRAP_SAVE, offsetof(struct paca_struct, trap_save)); | 207 | DEFINE(PACA_TRAP_SAVE, offsetof(struct paca_struct, trap_save)); |
208 | DEFINE(PACA_NAPSTATELOST, offsetof(struct paca_struct, nap_state_lost)); | 208 | DEFINE(PACA_NAPSTATELOST, offsetof(struct paca_struct, nap_state_lost)); |
209 | DEFINE(PACA_SPRG3, offsetof(struct paca_struct, sprg3)); | ||
209 | #endif /* CONFIG_PPC64 */ | 210 | #endif /* CONFIG_PPC64 */ |
210 | 211 | ||
211 | /* RTAS */ | 212 | /* RTAS */ |
@@ -534,7 +535,6 @@ int main(void) | |||
534 | HSTATE_FIELD(HSTATE_VMHANDLER, vmhandler); | 535 | HSTATE_FIELD(HSTATE_VMHANDLER, vmhandler); |
535 | HSTATE_FIELD(HSTATE_SCRATCH0, scratch0); | 536 | HSTATE_FIELD(HSTATE_SCRATCH0, scratch0); |
536 | HSTATE_FIELD(HSTATE_SCRATCH1, scratch1); | 537 | HSTATE_FIELD(HSTATE_SCRATCH1, scratch1); |
537 | HSTATE_FIELD(HSTATE_SPRG3, sprg3); | ||
538 | HSTATE_FIELD(HSTATE_IN_GUEST, in_guest); | 538 | HSTATE_FIELD(HSTATE_IN_GUEST, in_guest); |
539 | HSTATE_FIELD(HSTATE_RESTORE_HID5, restore_hid5); | 539 | HSTATE_FIELD(HSTATE_RESTORE_HID5, restore_hid5); |
540 | HSTATE_FIELD(HSTATE_NAPPING, napping); | 540 | HSTATE_FIELD(HSTATE_NAPPING, napping); |
diff --git a/arch/powerpc/kernel/dma-swiotlb.c b/arch/powerpc/kernel/dma-swiotlb.c index 46943651da23..a720b54b971c 100644 --- a/arch/powerpc/kernel/dma-swiotlb.c +++ b/arch/powerpc/kernel/dma-swiotlb.c | |||
@@ -12,6 +12,7 @@ | |||
12 | */ | 12 | */ |
13 | 13 | ||
14 | #include <linux/dma-mapping.h> | 14 | #include <linux/dma-mapping.h> |
15 | #include <linux/memblock.h> | ||
15 | #include <linux/pfn.h> | 16 | #include <linux/pfn.h> |
16 | #include <linux/of_platform.h> | 17 | #include <linux/of_platform.h> |
17 | #include <linux/platform_device.h> | 18 | #include <linux/platform_device.h> |
@@ -20,7 +21,6 @@ | |||
20 | #include <asm/machdep.h> | 21 | #include <asm/machdep.h> |
21 | #include <asm/swiotlb.h> | 22 | #include <asm/swiotlb.h> |
22 | #include <asm/dma.h> | 23 | #include <asm/dma.h> |
23 | #include <asm/abs_addr.h> | ||
24 | 24 | ||
25 | unsigned int ppc_swiotlb_enable; | 25 | unsigned int ppc_swiotlb_enable; |
26 | 26 | ||
diff --git a/arch/powerpc/kernel/dma.c b/arch/powerpc/kernel/dma.c index 355b9d84b0f8..8032b97ccdcb 100644 --- a/arch/powerpc/kernel/dma.c +++ b/arch/powerpc/kernel/dma.c | |||
@@ -14,7 +14,6 @@ | |||
14 | #include <linux/pci.h> | 14 | #include <linux/pci.h> |
15 | #include <asm/vio.h> | 15 | #include <asm/vio.h> |
16 | #include <asm/bug.h> | 16 | #include <asm/bug.h> |
17 | #include <asm/abs_addr.h> | ||
18 | #include <asm/machdep.h> | 17 | #include <asm/machdep.h> |
19 | 18 | ||
20 | /* | 19 | /* |
@@ -50,7 +49,7 @@ void *dma_direct_alloc_coherent(struct device *dev, size_t size, | |||
50 | return NULL; | 49 | return NULL; |
51 | ret = page_address(page); | 50 | ret = page_address(page); |
52 | memset(ret, 0, size); | 51 | memset(ret, 0, size); |
53 | *dma_handle = virt_to_abs(ret) + get_dma_offset(dev); | 52 | *dma_handle = __pa(ret) + get_dma_offset(dev); |
54 | 53 | ||
55 | return ret; | 54 | return ret; |
56 | #endif | 55 | #endif |
diff --git a/arch/powerpc/kernel/exceptions-64e.S b/arch/powerpc/kernel/exceptions-64e.S index 98be7f0cd227..87a82fbdf05a 100644 --- a/arch/powerpc/kernel/exceptions-64e.S +++ b/arch/powerpc/kernel/exceptions-64e.S | |||
@@ -25,6 +25,8 @@ | |||
25 | #include <asm/ppc-opcode.h> | 25 | #include <asm/ppc-opcode.h> |
26 | #include <asm/mmu.h> | 26 | #include <asm/mmu.h> |
27 | #include <asm/hw_irq.h> | 27 | #include <asm/hw_irq.h> |
28 | #include <asm/kvm_asm.h> | ||
29 | #include <asm/kvm_booke_hv_asm.h> | ||
28 | 30 | ||
29 | /* XXX This will ultimately add space for a special exception save | 31 | /* XXX This will ultimately add space for a special exception save |
30 | * structure used to save things like SRR0/SRR1, SPRGs, MAS, etc... | 32 | * structure used to save things like SRR0/SRR1, SPRGs, MAS, etc... |
@@ -35,16 +37,18 @@ | |||
35 | #define SPECIAL_EXC_FRAME_SIZE INT_FRAME_SIZE | 37 | #define SPECIAL_EXC_FRAME_SIZE INT_FRAME_SIZE |
36 | 38 | ||
37 | /* Exception prolog code for all exceptions */ | 39 | /* Exception prolog code for all exceptions */ |
38 | #define EXCEPTION_PROLOG(n, type, addition) \ | 40 | #define EXCEPTION_PROLOG(n, intnum, type, addition) \ |
39 | mtspr SPRN_SPRG_##type##_SCRATCH,r13; /* get spare registers */ \ | 41 | mtspr SPRN_SPRG_##type##_SCRATCH,r13; /* get spare registers */ \ |
40 | mfspr r13,SPRN_SPRG_PACA; /* get PACA */ \ | 42 | mfspr r13,SPRN_SPRG_PACA; /* get PACA */ \ |
41 | std r10,PACA_EX##type+EX_R10(r13); \ | 43 | std r10,PACA_EX##type+EX_R10(r13); \ |
42 | std r11,PACA_EX##type+EX_R11(r13); \ | 44 | std r11,PACA_EX##type+EX_R11(r13); \ |
45 | PROLOG_STORE_RESTORE_SCRATCH_##type; \ | ||
43 | mfcr r10; /* save CR */ \ | 46 | mfcr r10; /* save CR */ \ |
47 | mfspr r11,SPRN_##type##_SRR1;/* what are we coming from */ \ | ||
48 | DO_KVM intnum,SPRN_##type##_SRR1; /* KVM hook */ \ | ||
49 | stw r10,PACA_EX##type+EX_CR(r13); /* save old CR in the PACA */ \ | ||
44 | addition; /* additional code for that exc. */ \ | 50 | addition; /* additional code for that exc. */ \ |
45 | std r1,PACA_EX##type+EX_R1(r13); /* save old r1 in the PACA */ \ | 51 | std r1,PACA_EX##type+EX_R1(r13); /* save old r1 in the PACA */ \ |
46 | stw r10,PACA_EX##type+EX_CR(r13); /* save old CR in the PACA */ \ | ||
47 | mfspr r11,SPRN_##type##_SRR1;/* what are we coming from */ \ | ||
48 | type##_SET_KSTACK; /* get special stack if necessary */\ | 52 | type##_SET_KSTACK; /* get special stack if necessary */\ |
49 | andi. r10,r11,MSR_PR; /* save stack pointer */ \ | 53 | andi. r10,r11,MSR_PR; /* save stack pointer */ \ |
50 | beq 1f; /* branch around if supervisor */ \ | 54 | beq 1f; /* branch around if supervisor */ \ |
@@ -59,6 +63,10 @@ | |||
59 | #define SPRN_GEN_SRR0 SPRN_SRR0 | 63 | #define SPRN_GEN_SRR0 SPRN_SRR0 |
60 | #define SPRN_GEN_SRR1 SPRN_SRR1 | 64 | #define SPRN_GEN_SRR1 SPRN_SRR1 |
61 | 65 | ||
66 | #define GDBELL_SET_KSTACK GEN_SET_KSTACK | ||
67 | #define SPRN_GDBELL_SRR0 SPRN_GSRR0 | ||
68 | #define SPRN_GDBELL_SRR1 SPRN_GSRR1 | ||
69 | |||
62 | #define CRIT_SET_KSTACK \ | 70 | #define CRIT_SET_KSTACK \ |
63 | ld r1,PACA_CRIT_STACK(r13); \ | 71 | ld r1,PACA_CRIT_STACK(r13); \ |
64 | subi r1,r1,SPECIAL_EXC_FRAME_SIZE; | 72 | subi r1,r1,SPECIAL_EXC_FRAME_SIZE; |
@@ -77,29 +85,46 @@ | |||
77 | #define SPRN_MC_SRR0 SPRN_MCSRR0 | 85 | #define SPRN_MC_SRR0 SPRN_MCSRR0 |
78 | #define SPRN_MC_SRR1 SPRN_MCSRR1 | 86 | #define SPRN_MC_SRR1 SPRN_MCSRR1 |
79 | 87 | ||
80 | #define NORMAL_EXCEPTION_PROLOG(n, addition) \ | 88 | #define NORMAL_EXCEPTION_PROLOG(n, intnum, addition) \ |
81 | EXCEPTION_PROLOG(n, GEN, addition##_GEN(n)) | 89 | EXCEPTION_PROLOG(n, intnum, GEN, addition##_GEN(n)) |
82 | 90 | ||
83 | #define CRIT_EXCEPTION_PROLOG(n, addition) \ | 91 | #define CRIT_EXCEPTION_PROLOG(n, intnum, addition) \ |
84 | EXCEPTION_PROLOG(n, CRIT, addition##_CRIT(n)) | 92 | EXCEPTION_PROLOG(n, intnum, CRIT, addition##_CRIT(n)) |
85 | 93 | ||
86 | #define DBG_EXCEPTION_PROLOG(n, addition) \ | 94 | #define DBG_EXCEPTION_PROLOG(n, intnum, addition) \ |
87 | EXCEPTION_PROLOG(n, DBG, addition##_DBG(n)) | 95 | EXCEPTION_PROLOG(n, intnum, DBG, addition##_DBG(n)) |
88 | 96 | ||
89 | #define MC_EXCEPTION_PROLOG(n, addition) \ | 97 | #define MC_EXCEPTION_PROLOG(n, intnum, addition) \ |
90 | EXCEPTION_PROLOG(n, MC, addition##_MC(n)) | 98 | EXCEPTION_PROLOG(n, intnum, MC, addition##_MC(n)) |
91 | 99 | ||
100 | #define GDBELL_EXCEPTION_PROLOG(n, intnum, addition) \ | ||
101 | EXCEPTION_PROLOG(n, intnum, GDBELL, addition##_GDBELL(n)) | ||
102 | |||
103 | /* | ||
104 | * Store user-visible scratch in PACA exception slots and restore proper value | ||
105 | */ | ||
106 | #define PROLOG_STORE_RESTORE_SCRATCH_GEN | ||
107 | #define PROLOG_STORE_RESTORE_SCRATCH_GDBELL | ||
108 | #define PROLOG_STORE_RESTORE_SCRATCH_DBG | ||
109 | #define PROLOG_STORE_RESTORE_SCRATCH_MC | ||
110 | |||
111 | #define PROLOG_STORE_RESTORE_SCRATCH_CRIT \ | ||
112 | mfspr r10,SPRN_SPRG_CRIT_SCRATCH; /* get r13 */ \ | ||
113 | std r10,PACA_EXCRIT+EX_R13(r13); \ | ||
114 | ld r11,PACA_SPRG3(r13); \ | ||
115 | mtspr SPRN_SPRG_CRIT_SCRATCH,r11; | ||
92 | 116 | ||
93 | /* Variants of the "addition" argument for the prolog | 117 | /* Variants of the "addition" argument for the prolog |
94 | */ | 118 | */ |
95 | #define PROLOG_ADDITION_NONE_GEN(n) | 119 | #define PROLOG_ADDITION_NONE_GEN(n) |
120 | #define PROLOG_ADDITION_NONE_GDBELL(n) | ||
96 | #define PROLOG_ADDITION_NONE_CRIT(n) | 121 | #define PROLOG_ADDITION_NONE_CRIT(n) |
97 | #define PROLOG_ADDITION_NONE_DBG(n) | 122 | #define PROLOG_ADDITION_NONE_DBG(n) |
98 | #define PROLOG_ADDITION_NONE_MC(n) | 123 | #define PROLOG_ADDITION_NONE_MC(n) |
99 | 124 | ||
100 | #define PROLOG_ADDITION_MASKABLE_GEN(n) \ | 125 | #define PROLOG_ADDITION_MASKABLE_GEN(n) \ |
101 | lbz r11,PACASOFTIRQEN(r13); /* are irqs soft-disabled ? */ \ | 126 | lbz r10,PACASOFTIRQEN(r13); /* are irqs soft-disabled ? */ \ |
102 | cmpwi cr0,r11,0; /* yes -> go out of line */ \ | 127 | cmpwi cr0,r10,0; /* yes -> go out of line */ \ |
103 | beq masked_interrupt_book3e_##n | 128 | beq masked_interrupt_book3e_##n |
104 | 129 | ||
105 | #define PROLOG_ADDITION_2REGS_GEN(n) \ | 130 | #define PROLOG_ADDITION_2REGS_GEN(n) \ |
@@ -233,9 +258,9 @@ exc_##n##_bad_stack: \ | |||
233 | 1: | 258 | 1: |
234 | 259 | ||
235 | 260 | ||
236 | #define MASKABLE_EXCEPTION(trapnum, label, hdlr, ack) \ | 261 | #define MASKABLE_EXCEPTION(trapnum, intnum, label, hdlr, ack) \ |
237 | START_EXCEPTION(label); \ | 262 | START_EXCEPTION(label); \ |
238 | NORMAL_EXCEPTION_PROLOG(trapnum, PROLOG_ADDITION_MASKABLE) \ | 263 | NORMAL_EXCEPTION_PROLOG(trapnum, intnum, PROLOG_ADDITION_MASKABLE)\ |
239 | EXCEPTION_COMMON(trapnum, PACA_EXGEN, INTS_DISABLE) \ | 264 | EXCEPTION_COMMON(trapnum, PACA_EXGEN, INTS_DISABLE) \ |
240 | ack(r8); \ | 265 | ack(r8); \ |
241 | CHECK_NAPPING(); \ | 266 | CHECK_NAPPING(); \ |
@@ -286,7 +311,8 @@ interrupt_end_book3e: | |||
286 | 311 | ||
287 | /* Critical Input Interrupt */ | 312 | /* Critical Input Interrupt */ |
288 | START_EXCEPTION(critical_input); | 313 | START_EXCEPTION(critical_input); |
289 | CRIT_EXCEPTION_PROLOG(0x100, PROLOG_ADDITION_NONE) | 314 | CRIT_EXCEPTION_PROLOG(0x100, BOOKE_INTERRUPT_CRITICAL, |
315 | PROLOG_ADDITION_NONE) | ||
290 | // EXCEPTION_COMMON(0x100, PACA_EXCRIT, INTS_DISABLE) | 316 | // EXCEPTION_COMMON(0x100, PACA_EXCRIT, INTS_DISABLE) |
291 | // bl special_reg_save_crit | 317 | // bl special_reg_save_crit |
292 | // CHECK_NAPPING(); | 318 | // CHECK_NAPPING(); |
@@ -297,7 +323,8 @@ interrupt_end_book3e: | |||
297 | 323 | ||
298 | /* Machine Check Interrupt */ | 324 | /* Machine Check Interrupt */ |
299 | START_EXCEPTION(machine_check); | 325 | START_EXCEPTION(machine_check); |
300 | CRIT_EXCEPTION_PROLOG(0x200, PROLOG_ADDITION_NONE) | 326 | MC_EXCEPTION_PROLOG(0x200, BOOKE_INTERRUPT_MACHINE_CHECK, |
327 | PROLOG_ADDITION_NONE) | ||
301 | // EXCEPTION_COMMON(0x200, PACA_EXMC, INTS_DISABLE) | 328 | // EXCEPTION_COMMON(0x200, PACA_EXMC, INTS_DISABLE) |
302 | // bl special_reg_save_mc | 329 | // bl special_reg_save_mc |
303 | // addi r3,r1,STACK_FRAME_OVERHEAD | 330 | // addi r3,r1,STACK_FRAME_OVERHEAD |
@@ -308,7 +335,8 @@ interrupt_end_book3e: | |||
308 | 335 | ||
309 | /* Data Storage Interrupt */ | 336 | /* Data Storage Interrupt */ |
310 | START_EXCEPTION(data_storage) | 337 | START_EXCEPTION(data_storage) |
311 | NORMAL_EXCEPTION_PROLOG(0x300, PROLOG_ADDITION_2REGS) | 338 | NORMAL_EXCEPTION_PROLOG(0x300, BOOKE_INTERRUPT_DATA_STORAGE, |
339 | PROLOG_ADDITION_2REGS) | ||
312 | mfspr r14,SPRN_DEAR | 340 | mfspr r14,SPRN_DEAR |
313 | mfspr r15,SPRN_ESR | 341 | mfspr r15,SPRN_ESR |
314 | EXCEPTION_COMMON(0x300, PACA_EXGEN, INTS_DISABLE) | 342 | EXCEPTION_COMMON(0x300, PACA_EXGEN, INTS_DISABLE) |
@@ -316,18 +344,21 @@ interrupt_end_book3e: | |||
316 | 344 | ||
317 | /* Instruction Storage Interrupt */ | 345 | /* Instruction Storage Interrupt */ |
318 | START_EXCEPTION(instruction_storage); | 346 | START_EXCEPTION(instruction_storage); |
319 | NORMAL_EXCEPTION_PROLOG(0x400, PROLOG_ADDITION_2REGS) | 347 | NORMAL_EXCEPTION_PROLOG(0x400, BOOKE_INTERRUPT_INST_STORAGE, |
348 | PROLOG_ADDITION_2REGS) | ||
320 | li r15,0 | 349 | li r15,0 |
321 | mr r14,r10 | 350 | mr r14,r10 |
322 | EXCEPTION_COMMON(0x400, PACA_EXGEN, INTS_DISABLE) | 351 | EXCEPTION_COMMON(0x400, PACA_EXGEN, INTS_DISABLE) |
323 | b storage_fault_common | 352 | b storage_fault_common |
324 | 353 | ||
325 | /* External Input Interrupt */ | 354 | /* External Input Interrupt */ |
326 | MASKABLE_EXCEPTION(0x500, external_input, .do_IRQ, ACK_NONE) | 355 | MASKABLE_EXCEPTION(0x500, BOOKE_INTERRUPT_EXTERNAL, |
356 | external_input, .do_IRQ, ACK_NONE) | ||
327 | 357 | ||
328 | /* Alignment */ | 358 | /* Alignment */ |
329 | START_EXCEPTION(alignment); | 359 | START_EXCEPTION(alignment); |
330 | NORMAL_EXCEPTION_PROLOG(0x600, PROLOG_ADDITION_2REGS) | 360 | NORMAL_EXCEPTION_PROLOG(0x600, BOOKE_INTERRUPT_ALIGNMENT, |
361 | PROLOG_ADDITION_2REGS) | ||
331 | mfspr r14,SPRN_DEAR | 362 | mfspr r14,SPRN_DEAR |
332 | mfspr r15,SPRN_ESR | 363 | mfspr r15,SPRN_ESR |
333 | EXCEPTION_COMMON(0x600, PACA_EXGEN, INTS_KEEP) | 364 | EXCEPTION_COMMON(0x600, PACA_EXGEN, INTS_KEEP) |
@@ -335,7 +366,8 @@ interrupt_end_book3e: | |||
335 | 366 | ||
336 | /* Program Interrupt */ | 367 | /* Program Interrupt */ |
337 | START_EXCEPTION(program); | 368 | START_EXCEPTION(program); |
338 | NORMAL_EXCEPTION_PROLOG(0x700, PROLOG_ADDITION_1REG) | 369 | NORMAL_EXCEPTION_PROLOG(0x700, BOOKE_INTERRUPT_PROGRAM, |
370 | PROLOG_ADDITION_1REG) | ||
339 | mfspr r14,SPRN_ESR | 371 | mfspr r14,SPRN_ESR |
340 | EXCEPTION_COMMON(0x700, PACA_EXGEN, INTS_DISABLE) | 372 | EXCEPTION_COMMON(0x700, PACA_EXGEN, INTS_DISABLE) |
341 | std r14,_DSISR(r1) | 373 | std r14,_DSISR(r1) |
@@ -347,7 +379,8 @@ interrupt_end_book3e: | |||
347 | 379 | ||
348 | /* Floating Point Unavailable Interrupt */ | 380 | /* Floating Point Unavailable Interrupt */ |
349 | START_EXCEPTION(fp_unavailable); | 381 | START_EXCEPTION(fp_unavailable); |
350 | NORMAL_EXCEPTION_PROLOG(0x800, PROLOG_ADDITION_NONE) | 382 | NORMAL_EXCEPTION_PROLOG(0x800, BOOKE_INTERRUPT_FP_UNAVAIL, |
383 | PROLOG_ADDITION_NONE) | ||
351 | /* we can probably do a shorter exception entry for that one... */ | 384 | /* we can probably do a shorter exception entry for that one... */ |
352 | EXCEPTION_COMMON(0x800, PACA_EXGEN, INTS_KEEP) | 385 | EXCEPTION_COMMON(0x800, PACA_EXGEN, INTS_KEEP) |
353 | ld r12,_MSR(r1) | 386 | ld r12,_MSR(r1) |
@@ -362,14 +395,17 @@ interrupt_end_book3e: | |||
362 | b .ret_from_except | 395 | b .ret_from_except |
363 | 396 | ||
364 | /* Decrementer Interrupt */ | 397 | /* Decrementer Interrupt */ |
365 | MASKABLE_EXCEPTION(0x900, decrementer, .timer_interrupt, ACK_DEC) | 398 | MASKABLE_EXCEPTION(0x900, BOOKE_INTERRUPT_DECREMENTER, |
399 | decrementer, .timer_interrupt, ACK_DEC) | ||
366 | 400 | ||
367 | /* Fixed Interval Timer Interrupt */ | 401 | /* Fixed Interval Timer Interrupt */ |
368 | MASKABLE_EXCEPTION(0x980, fixed_interval, .unknown_exception, ACK_FIT) | 402 | MASKABLE_EXCEPTION(0x980, BOOKE_INTERRUPT_FIT, |
403 | fixed_interval, .unknown_exception, ACK_FIT) | ||
369 | 404 | ||
370 | /* Watchdog Timer Interrupt */ | 405 | /* Watchdog Timer Interrupt */ |
371 | START_EXCEPTION(watchdog); | 406 | START_EXCEPTION(watchdog); |
372 | CRIT_EXCEPTION_PROLOG(0x9f0, PROLOG_ADDITION_NONE) | 407 | CRIT_EXCEPTION_PROLOG(0x9f0, BOOKE_INTERRUPT_WATCHDOG, |
408 | PROLOG_ADDITION_NONE) | ||
373 | // EXCEPTION_COMMON(0x9f0, PACA_EXCRIT, INTS_DISABLE) | 409 | // EXCEPTION_COMMON(0x9f0, PACA_EXCRIT, INTS_DISABLE) |
374 | // bl special_reg_save_crit | 410 | // bl special_reg_save_crit |
375 | // CHECK_NAPPING(); | 411 | // CHECK_NAPPING(); |
@@ -388,7 +424,8 @@ interrupt_end_book3e: | |||
388 | 424 | ||
389 | /* Auxiliary Processor Unavailable Interrupt */ | 425 | /* Auxiliary Processor Unavailable Interrupt */ |
390 | START_EXCEPTION(ap_unavailable); | 426 | START_EXCEPTION(ap_unavailable); |
391 | NORMAL_EXCEPTION_PROLOG(0xf20, PROLOG_ADDITION_NONE) | 427 | NORMAL_EXCEPTION_PROLOG(0xf20, BOOKE_INTERRUPT_AP_UNAVAIL, |
428 | PROLOG_ADDITION_NONE) | ||
392 | EXCEPTION_COMMON(0xf20, PACA_EXGEN, INTS_DISABLE) | 429 | EXCEPTION_COMMON(0xf20, PACA_EXGEN, INTS_DISABLE) |
393 | bl .save_nvgprs | 430 | bl .save_nvgprs |
394 | addi r3,r1,STACK_FRAME_OVERHEAD | 431 | addi r3,r1,STACK_FRAME_OVERHEAD |
@@ -397,7 +434,8 @@ interrupt_end_book3e: | |||
397 | 434 | ||
398 | /* Debug exception as a critical interrupt*/ | 435 | /* Debug exception as a critical interrupt*/ |
399 | START_EXCEPTION(debug_crit); | 436 | START_EXCEPTION(debug_crit); |
400 | CRIT_EXCEPTION_PROLOG(0xd00, PROLOG_ADDITION_2REGS) | 437 | CRIT_EXCEPTION_PROLOG(0xd00, BOOKE_INTERRUPT_DEBUG, |
438 | PROLOG_ADDITION_2REGS) | ||
401 | 439 | ||
402 | /* | 440 | /* |
403 | * If there is a single step or branch-taken exception in an | 441 | * If there is a single step or branch-taken exception in an |
@@ -431,7 +469,7 @@ interrupt_end_book3e: | |||
431 | mtcr r10 | 469 | mtcr r10 |
432 | ld r10,PACA_EXCRIT+EX_R10(r13) /* restore registers */ | 470 | ld r10,PACA_EXCRIT+EX_R10(r13) /* restore registers */ |
433 | ld r11,PACA_EXCRIT+EX_R11(r13) | 471 | ld r11,PACA_EXCRIT+EX_R11(r13) |
434 | mfspr r13,SPRN_SPRG_CRIT_SCRATCH | 472 | ld r13,PACA_EXCRIT+EX_R13(r13) |
435 | rfci | 473 | rfci |
436 | 474 | ||
437 | /* Normal debug exception */ | 475 | /* Normal debug exception */ |
@@ -444,7 +482,7 @@ interrupt_end_book3e: | |||
444 | /* Now we mash up things to make it look like we are coming on a | 482 | /* Now we mash up things to make it look like we are coming on a |
445 | * normal exception | 483 | * normal exception |
446 | */ | 484 | */ |
447 | mfspr r15,SPRN_SPRG_CRIT_SCRATCH | 485 | ld r15,PACA_EXCRIT+EX_R13(r13) |
448 | mtspr SPRN_SPRG_GEN_SCRATCH,r15 | 486 | mtspr SPRN_SPRG_GEN_SCRATCH,r15 |
449 | mfspr r14,SPRN_DBSR | 487 | mfspr r14,SPRN_DBSR |
450 | EXCEPTION_COMMON(0xd00, PACA_EXCRIT, INTS_DISABLE) | 488 | EXCEPTION_COMMON(0xd00, PACA_EXCRIT, INTS_DISABLE) |
@@ -462,7 +500,8 @@ kernel_dbg_exc: | |||
462 | 500 | ||
463 | /* Debug exception as a debug interrupt*/ | 501 | /* Debug exception as a debug interrupt*/ |
464 | START_EXCEPTION(debug_debug); | 502 | START_EXCEPTION(debug_debug); |
465 | DBG_EXCEPTION_PROLOG(0xd08, PROLOG_ADDITION_2REGS) | 503 | DBG_EXCEPTION_PROLOG(0xd00, BOOKE_INTERRUPT_DEBUG, |
504 | PROLOG_ADDITION_2REGS) | ||
466 | 505 | ||
467 | /* | 506 | /* |
468 | * If there is a single step or branch-taken exception in an | 507 | * If there is a single step or branch-taken exception in an |
@@ -523,18 +562,21 @@ kernel_dbg_exc: | |||
523 | b .ret_from_except | 562 | b .ret_from_except |
524 | 563 | ||
525 | START_EXCEPTION(perfmon); | 564 | START_EXCEPTION(perfmon); |
526 | NORMAL_EXCEPTION_PROLOG(0x260, PROLOG_ADDITION_NONE) | 565 | NORMAL_EXCEPTION_PROLOG(0x260, BOOKE_INTERRUPT_PERFORMANCE_MONITOR, |
566 | PROLOG_ADDITION_NONE) | ||
527 | EXCEPTION_COMMON(0x260, PACA_EXGEN, INTS_DISABLE) | 567 | EXCEPTION_COMMON(0x260, PACA_EXGEN, INTS_DISABLE) |
528 | addi r3,r1,STACK_FRAME_OVERHEAD | 568 | addi r3,r1,STACK_FRAME_OVERHEAD |
529 | bl .performance_monitor_exception | 569 | bl .performance_monitor_exception |
530 | b .ret_from_except_lite | 570 | b .ret_from_except_lite |
531 | 571 | ||
532 | /* Doorbell interrupt */ | 572 | /* Doorbell interrupt */ |
533 | MASKABLE_EXCEPTION(0x280, doorbell, .doorbell_exception, ACK_NONE) | 573 | MASKABLE_EXCEPTION(0x280, BOOKE_INTERRUPT_DOORBELL, |
574 | doorbell, .doorbell_exception, ACK_NONE) | ||
534 | 575 | ||
535 | /* Doorbell critical Interrupt */ | 576 | /* Doorbell critical Interrupt */ |
536 | START_EXCEPTION(doorbell_crit); | 577 | START_EXCEPTION(doorbell_crit); |
537 | CRIT_EXCEPTION_PROLOG(0x2a0, PROLOG_ADDITION_NONE) | 578 | CRIT_EXCEPTION_PROLOG(0x2a0, BOOKE_INTERRUPT_DOORBELL_CRITICAL, |
579 | PROLOG_ADDITION_NONE) | ||
538 | // EXCEPTION_COMMON(0x2a0, PACA_EXCRIT, INTS_DISABLE) | 580 | // EXCEPTION_COMMON(0x2a0, PACA_EXCRIT, INTS_DISABLE) |
539 | // bl special_reg_save_crit | 581 | // bl special_reg_save_crit |
540 | // CHECK_NAPPING(); | 582 | // CHECK_NAPPING(); |
@@ -543,12 +585,24 @@ kernel_dbg_exc: | |||
543 | // b ret_from_crit_except | 585 | // b ret_from_crit_except |
544 | b . | 586 | b . |
545 | 587 | ||
546 | /* Guest Doorbell */ | 588 | /* |
547 | MASKABLE_EXCEPTION(0x2c0, guest_doorbell, .unknown_exception, ACK_NONE) | 589 | * Guest doorbell interrupt |
590 | * This general exception use GSRRx save/restore registers | ||
591 | */ | ||
592 | START_EXCEPTION(guest_doorbell); | ||
593 | GDBELL_EXCEPTION_PROLOG(0x2c0, BOOKE_INTERRUPT_GUEST_DBELL, | ||
594 | PROLOG_ADDITION_NONE) | ||
595 | EXCEPTION_COMMON(0x2c0, PACA_EXGEN, INTS_KEEP) | ||
596 | addi r3,r1,STACK_FRAME_OVERHEAD | ||
597 | bl .save_nvgprs | ||
598 | INTS_RESTORE_HARD | ||
599 | bl .unknown_exception | ||
600 | b .ret_from_except | ||
548 | 601 | ||
549 | /* Guest Doorbell critical Interrupt */ | 602 | /* Guest Doorbell critical Interrupt */ |
550 | START_EXCEPTION(guest_doorbell_crit); | 603 | START_EXCEPTION(guest_doorbell_crit); |
551 | CRIT_EXCEPTION_PROLOG(0x2e0, PROLOG_ADDITION_NONE) | 604 | CRIT_EXCEPTION_PROLOG(0x2e0, BOOKE_INTERRUPT_GUEST_DBELL_CRIT, |
605 | PROLOG_ADDITION_NONE) | ||
552 | // EXCEPTION_COMMON(0x2e0, PACA_EXCRIT, INTS_DISABLE) | 606 | // EXCEPTION_COMMON(0x2e0, PACA_EXCRIT, INTS_DISABLE) |
553 | // bl special_reg_save_crit | 607 | // bl special_reg_save_crit |
554 | // CHECK_NAPPING(); | 608 | // CHECK_NAPPING(); |
@@ -559,7 +613,8 @@ kernel_dbg_exc: | |||
559 | 613 | ||
560 | /* Hypervisor call */ | 614 | /* Hypervisor call */ |
561 | START_EXCEPTION(hypercall); | 615 | START_EXCEPTION(hypercall); |
562 | NORMAL_EXCEPTION_PROLOG(0x310, PROLOG_ADDITION_NONE) | 616 | NORMAL_EXCEPTION_PROLOG(0x310, BOOKE_INTERRUPT_HV_SYSCALL, |
617 | PROLOG_ADDITION_NONE) | ||
563 | EXCEPTION_COMMON(0x310, PACA_EXGEN, INTS_KEEP) | 618 | EXCEPTION_COMMON(0x310, PACA_EXGEN, INTS_KEEP) |
564 | addi r3,r1,STACK_FRAME_OVERHEAD | 619 | addi r3,r1,STACK_FRAME_OVERHEAD |
565 | bl .save_nvgprs | 620 | bl .save_nvgprs |
@@ -569,7 +624,8 @@ kernel_dbg_exc: | |||
569 | 624 | ||
570 | /* Embedded Hypervisor priviledged */ | 625 | /* Embedded Hypervisor priviledged */ |
571 | START_EXCEPTION(ehpriv); | 626 | START_EXCEPTION(ehpriv); |
572 | NORMAL_EXCEPTION_PROLOG(0x320, PROLOG_ADDITION_NONE) | 627 | NORMAL_EXCEPTION_PROLOG(0x320, BOOKE_INTERRUPT_HV_PRIV, |
628 | PROLOG_ADDITION_NONE) | ||
573 | EXCEPTION_COMMON(0x320, PACA_EXGEN, INTS_KEEP) | 629 | EXCEPTION_COMMON(0x320, PACA_EXGEN, INTS_KEEP) |
574 | addi r3,r1,STACK_FRAME_OVERHEAD | 630 | addi r3,r1,STACK_FRAME_OVERHEAD |
575 | bl .save_nvgprs | 631 | bl .save_nvgprs |
@@ -582,44 +638,42 @@ kernel_dbg_exc: | |||
582 | * accordingly and if the interrupt is level sensitive, we hard disable | 638 | * accordingly and if the interrupt is level sensitive, we hard disable |
583 | */ | 639 | */ |
584 | 640 | ||
641 | .macro masked_interrupt_book3e paca_irq full_mask | ||
642 | lbz r10,PACAIRQHAPPENED(r13) | ||
643 | ori r10,r10,\paca_irq | ||
644 | stb r10,PACAIRQHAPPENED(r13) | ||
645 | |||
646 | .if \full_mask == 1 | ||
647 | rldicl r10,r11,48,1 /* clear MSR_EE */ | ||
648 | rotldi r11,r10,16 | ||
649 | mtspr SPRN_SRR1,r11 | ||
650 | .endif | ||
651 | |||
652 | lwz r11,PACA_EXGEN+EX_CR(r13) | ||
653 | mtcr r11 | ||
654 | ld r10,PACA_EXGEN+EX_R10(r13) | ||
655 | ld r11,PACA_EXGEN+EX_R11(r13) | ||
656 | mfspr r13,SPRN_SPRG_GEN_SCRATCH | ||
657 | rfi | ||
658 | b . | ||
659 | .endm | ||
660 | |||
585 | masked_interrupt_book3e_0x500: | 661 | masked_interrupt_book3e_0x500: |
586 | /* XXX When adding support for EPR, use PACA_IRQ_EE_EDGE */ | 662 | // XXX When adding support for EPR, use PACA_IRQ_EE_EDGE |
587 | li r11,PACA_IRQ_EE | 663 | masked_interrupt_book3e PACA_IRQ_EE 1 |
588 | b masked_interrupt_book3e_full_mask | ||
589 | 664 | ||
590 | masked_interrupt_book3e_0x900: | 665 | masked_interrupt_book3e_0x900: |
591 | ACK_DEC(r11); | 666 | ACK_DEC(r10); |
592 | li r11,PACA_IRQ_DEC | 667 | masked_interrupt_book3e PACA_IRQ_DEC 0 |
593 | b masked_interrupt_book3e_no_mask | 668 | |
594 | masked_interrupt_book3e_0x980: | 669 | masked_interrupt_book3e_0x980: |
595 | ACK_FIT(r11); | 670 | ACK_FIT(r10); |
596 | li r11,PACA_IRQ_DEC | 671 | masked_interrupt_book3e PACA_IRQ_DEC 0 |
597 | b masked_interrupt_book3e_no_mask | 672 | |
598 | masked_interrupt_book3e_0x280: | 673 | masked_interrupt_book3e_0x280: |
599 | masked_interrupt_book3e_0x2c0: | 674 | masked_interrupt_book3e_0x2c0: |
600 | li r11,PACA_IRQ_DBELL | 675 | masked_interrupt_book3e PACA_IRQ_DBELL 0 |
601 | b masked_interrupt_book3e_no_mask | ||
602 | 676 | ||
603 | masked_interrupt_book3e_no_mask: | ||
604 | mtcr r10 | ||
605 | lbz r10,PACAIRQHAPPENED(r13) | ||
606 | or r10,r10,r11 | ||
607 | stb r10,PACAIRQHAPPENED(r13) | ||
608 | b 1f | ||
609 | masked_interrupt_book3e_full_mask: | ||
610 | mtcr r10 | ||
611 | lbz r10,PACAIRQHAPPENED(r13) | ||
612 | or r10,r10,r11 | ||
613 | stb r10,PACAIRQHAPPENED(r13) | ||
614 | mfspr r10,SPRN_SRR1 | ||
615 | rldicl r11,r10,48,1 /* clear MSR_EE */ | ||
616 | rotldi r10,r11,16 | ||
617 | mtspr SPRN_SRR1,r10 | ||
618 | 1: ld r10,PACA_EXGEN+EX_R10(r13); | ||
619 | ld r11,PACA_EXGEN+EX_R11(r13); | ||
620 | mfspr r13,SPRN_SPRG_GEN_SCRATCH; | ||
621 | rfi | ||
622 | b . | ||
623 | /* | 677 | /* |
624 | * Called from arch_local_irq_enable when an interrupt needs | 678 | * Called from arch_local_irq_enable when an interrupt needs |
625 | * to be resent. r3 contains either 0x500,0x900,0x260 or 0x280 | 679 | * to be resent. r3 contains either 0x500,0x900,0x260 or 0x280 |
diff --git a/arch/powerpc/kernel/ibmebus.c b/arch/powerpc/kernel/ibmebus.c index b01d14eeca8d..8220baa46faf 100644 --- a/arch/powerpc/kernel/ibmebus.c +++ b/arch/powerpc/kernel/ibmebus.c | |||
@@ -47,7 +47,6 @@ | |||
47 | #include <linux/stat.h> | 47 | #include <linux/stat.h> |
48 | #include <linux/of_platform.h> | 48 | #include <linux/of_platform.h> |
49 | #include <asm/ibmebus.h> | 49 | #include <asm/ibmebus.h> |
50 | #include <asm/abs_addr.h> | ||
51 | 50 | ||
52 | static struct device ibmebus_bus_device = { /* fake "parent" device */ | 51 | static struct device ibmebus_bus_device = { /* fake "parent" device */ |
53 | .init_name = "ibmebus", | 52 | .init_name = "ibmebus", |
diff --git a/arch/powerpc/kernel/process.c b/arch/powerpc/kernel/process.c index 1a1f2ddfb581..2e743de545d0 100644 --- a/arch/powerpc/kernel/process.c +++ b/arch/powerpc/kernel/process.c | |||
@@ -258,6 +258,7 @@ void do_send_trap(struct pt_regs *regs, unsigned long address, | |||
258 | { | 258 | { |
259 | siginfo_t info; | 259 | siginfo_t info; |
260 | 260 | ||
261 | current->thread.trap_nr = signal_code; | ||
261 | if (notify_die(DIE_DABR_MATCH, "dabr_match", regs, error_code, | 262 | if (notify_die(DIE_DABR_MATCH, "dabr_match", regs, error_code, |
262 | 11, SIGSEGV) == NOTIFY_STOP) | 263 | 11, SIGSEGV) == NOTIFY_STOP) |
263 | return; | 264 | return; |
@@ -275,6 +276,7 @@ void do_dabr(struct pt_regs *regs, unsigned long address, | |||
275 | { | 276 | { |
276 | siginfo_t info; | 277 | siginfo_t info; |
277 | 278 | ||
279 | current->thread.trap_nr = TRAP_HWBKPT; | ||
278 | if (notify_die(DIE_DABR_MATCH, "dabr_match", regs, error_code, | 280 | if (notify_die(DIE_DABR_MATCH, "dabr_match", regs, error_code, |
279 | 11, SIGSEGV) == NOTIFY_STOP) | 281 | 11, SIGSEGV) == NOTIFY_STOP) |
280 | return; | 282 | return; |
diff --git a/arch/powerpc/kernel/prom_init.c b/arch/powerpc/kernel/prom_init.c index 0794a3017b1b..ce68278a5d73 100644 --- a/arch/powerpc/kernel/prom_init.c +++ b/arch/powerpc/kernel/prom_init.c | |||
@@ -1691,7 +1691,7 @@ static void __init prom_initialize_tce_table(void) | |||
1691 | * else will impact performance, so we always allocate 8MB. | 1691 | * else will impact performance, so we always allocate 8MB. |
1692 | * Anton | 1692 | * Anton |
1693 | */ | 1693 | */ |
1694 | if (__is_processor(PV_POWER4) || __is_processor(PV_POWER4p)) | 1694 | if (pvr_version_is(PVR_POWER4) || pvr_version_is(PVR_POWER4p)) |
1695 | minsize = 8UL << 20; | 1695 | minsize = 8UL << 20; |
1696 | else | 1696 | else |
1697 | minsize = 4UL << 20; | 1697 | minsize = 4UL << 20; |
diff --git a/arch/powerpc/kernel/rtas_flash.c b/arch/powerpc/kernel/rtas_flash.c index 2c0ee6405633..20b0120db0c3 100644 --- a/arch/powerpc/kernel/rtas_flash.c +++ b/arch/powerpc/kernel/rtas_flash.c | |||
@@ -21,7 +21,6 @@ | |||
21 | #include <asm/delay.h> | 21 | #include <asm/delay.h> |
22 | #include <asm/uaccess.h> | 22 | #include <asm/uaccess.h> |
23 | #include <asm/rtas.h> | 23 | #include <asm/rtas.h> |
24 | #include <asm/abs_addr.h> | ||
25 | 24 | ||
26 | #define MODULE_VERS "1.0" | 25 | #define MODULE_VERS "1.0" |
27 | #define MODULE_NAME "rtas_flash" | 26 | #define MODULE_NAME "rtas_flash" |
@@ -582,7 +581,7 @@ static void rtas_flash_firmware(int reboot_type) | |||
582 | flist = (struct flash_block_list *)&rtas_data_buf[0]; | 581 | flist = (struct flash_block_list *)&rtas_data_buf[0]; |
583 | flist->num_blocks = 0; | 582 | flist->num_blocks = 0; |
584 | flist->next = rtas_firmware_flash_list; | 583 | flist->next = rtas_firmware_flash_list; |
585 | rtas_block_list = virt_to_abs(flist); | 584 | rtas_block_list = __pa(flist); |
586 | if (rtas_block_list >= 4UL*1024*1024*1024) { | 585 | if (rtas_block_list >= 4UL*1024*1024*1024) { |
587 | printk(KERN_ALERT "FLASH: kernel bug...flash list header addr above 4GB\n"); | 586 | printk(KERN_ALERT "FLASH: kernel bug...flash list header addr above 4GB\n"); |
588 | spin_unlock(&rtas_data_buf_lock); | 587 | spin_unlock(&rtas_data_buf_lock); |
@@ -596,13 +595,13 @@ static void rtas_flash_firmware(int reboot_type) | |||
596 | for (f = flist; f; f = next) { | 595 | for (f = flist; f; f = next) { |
597 | /* Translate data addrs to absolute */ | 596 | /* Translate data addrs to absolute */ |
598 | for (i = 0; i < f->num_blocks; i++) { | 597 | for (i = 0; i < f->num_blocks; i++) { |
599 | f->blocks[i].data = (char *)virt_to_abs(f->blocks[i].data); | 598 | f->blocks[i].data = (char *)__pa(f->blocks[i].data); |
600 | image_size += f->blocks[i].length; | 599 | image_size += f->blocks[i].length; |
601 | } | 600 | } |
602 | next = f->next; | 601 | next = f->next; |
603 | /* Don't translate NULL pointer for last entry */ | 602 | /* Don't translate NULL pointer for last entry */ |
604 | if (f->next) | 603 | if (f->next) |
605 | f->next = (struct flash_block_list *)virt_to_abs(f->next); | 604 | f->next = (struct flash_block_list *)__pa(f->next); |
606 | else | 605 | else |
607 | f->next = NULL; | 606 | f->next = NULL; |
608 | /* make num_blocks into the version/length field */ | 607 | /* make num_blocks into the version/length field */ |
diff --git a/arch/powerpc/kernel/signal.c b/arch/powerpc/kernel/signal.c index 5c023c9cf16e..29be2712e560 100644 --- a/arch/powerpc/kernel/signal.c +++ b/arch/powerpc/kernel/signal.c | |||
@@ -11,6 +11,7 @@ | |||
11 | 11 | ||
12 | #include <linux/tracehook.h> | 12 | #include <linux/tracehook.h> |
13 | #include <linux/signal.h> | 13 | #include <linux/signal.h> |
14 | #include <linux/uprobes.h> | ||
14 | #include <linux/key.h> | 15 | #include <linux/key.h> |
15 | #include <asm/hw_breakpoint.h> | 16 | #include <asm/hw_breakpoint.h> |
16 | #include <asm/uaccess.h> | 17 | #include <asm/uaccess.h> |
@@ -157,6 +158,11 @@ static int do_signal(struct pt_regs *regs) | |||
157 | 158 | ||
158 | void do_notify_resume(struct pt_regs *regs, unsigned long thread_info_flags) | 159 | void do_notify_resume(struct pt_regs *regs, unsigned long thread_info_flags) |
159 | { | 160 | { |
161 | if (thread_info_flags & _TIF_UPROBE) { | ||
162 | clear_thread_flag(TIF_UPROBE); | ||
163 | uprobe_notify_resume(regs); | ||
164 | } | ||
165 | |||
160 | if (thread_info_flags & _TIF_SIGPENDING) | 166 | if (thread_info_flags & _TIF_SIGPENDING) |
161 | do_signal(regs); | 167 | do_signal(regs); |
162 | 168 | ||
diff --git a/arch/powerpc/kernel/traps.c b/arch/powerpc/kernel/traps.c index ae0843fa7a61..32518401af68 100644 --- a/arch/powerpc/kernel/traps.c +++ b/arch/powerpc/kernel/traps.c | |||
@@ -251,6 +251,7 @@ void _exception(int signr, struct pt_regs *regs, int code, unsigned long addr) | |||
251 | if (arch_irqs_disabled() && !arch_irq_disabled_regs(regs)) | 251 | if (arch_irqs_disabled() && !arch_irq_disabled_regs(regs)) |
252 | local_irq_enable(); | 252 | local_irq_enable(); |
253 | 253 | ||
254 | current->thread.trap_nr = code; | ||
254 | memset(&info, 0, sizeof(info)); | 255 | memset(&info, 0, sizeof(info)); |
255 | info.si_signo = signr; | 256 | info.si_signo = signr; |
256 | info.si_code = code; | 257 | info.si_code = code; |
diff --git a/arch/powerpc/kernel/uprobes.c b/arch/powerpc/kernel/uprobes.c new file mode 100644 index 000000000000..d2d46d1014f8 --- /dev/null +++ b/arch/powerpc/kernel/uprobes.c | |||
@@ -0,0 +1,184 @@ | |||
1 | /* | ||
2 | * User-space Probes (UProbes) for powerpc | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify | ||
5 | * it under the terms of the GNU General Public License as published by | ||
6 | * the Free Software Foundation; either version 2 of the License, or | ||
7 | * (at your option) any later version. | ||
8 | * | ||
9 | * This program is distributed in the hope that it will be useful, | ||
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
12 | * GNU General Public License for more details. | ||
13 | * | ||
14 | * You should have received a copy of the GNU General Public License | ||
15 | * along with this program; if not, write to the Free Software | ||
16 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | ||
17 | * | ||
18 | * Copyright IBM Corporation, 2007-2012 | ||
19 | * | ||
20 | * Adapted from the x86 port by Ananth N Mavinakayanahalli <ananth@in.ibm.com> | ||
21 | */ | ||
22 | #include <linux/kernel.h> | ||
23 | #include <linux/sched.h> | ||
24 | #include <linux/ptrace.h> | ||
25 | #include <linux/uprobes.h> | ||
26 | #include <linux/uaccess.h> | ||
27 | #include <linux/kdebug.h> | ||
28 | |||
29 | #include <asm/sstep.h> | ||
30 | |||
31 | #define UPROBE_TRAP_NR UINT_MAX | ||
32 | |||
33 | /** | ||
34 | * arch_uprobe_analyze_insn | ||
35 | * @mm: the probed address space. | ||
36 | * @arch_uprobe: the probepoint information. | ||
37 | * @addr: vaddr to probe. | ||
38 | * Return 0 on success or a -ve number on error. | ||
39 | */ | ||
40 | int arch_uprobe_analyze_insn(struct arch_uprobe *auprobe, | ||
41 | struct mm_struct *mm, unsigned long addr) | ||
42 | { | ||
43 | if (addr & 0x03) | ||
44 | return -EINVAL; | ||
45 | |||
46 | /* | ||
47 | * We currently don't support a uprobe on an already | ||
48 | * existing breakpoint instruction underneath | ||
49 | */ | ||
50 | if (is_trap(auprobe->ainsn)) | ||
51 | return -ENOTSUPP; | ||
52 | return 0; | ||
53 | } | ||
54 | |||
55 | /* | ||
56 | * arch_uprobe_pre_xol - prepare to execute out of line. | ||
57 | * @auprobe: the probepoint information. | ||
58 | * @regs: reflects the saved user state of current task. | ||
59 | */ | ||
60 | int arch_uprobe_pre_xol(struct arch_uprobe *auprobe, struct pt_regs *regs) | ||
61 | { | ||
62 | struct arch_uprobe_task *autask = ¤t->utask->autask; | ||
63 | |||
64 | autask->saved_trap_nr = current->thread.trap_nr; | ||
65 | current->thread.trap_nr = UPROBE_TRAP_NR; | ||
66 | regs->nip = current->utask->xol_vaddr; | ||
67 | return 0; | ||
68 | } | ||
69 | |||
70 | /** | ||
71 | * uprobe_get_swbp_addr - compute address of swbp given post-swbp regs | ||
72 | * @regs: Reflects the saved state of the task after it has hit a breakpoint | ||
73 | * instruction. | ||
74 | * Return the address of the breakpoint instruction. | ||
75 | */ | ||
76 | unsigned long uprobe_get_swbp_addr(struct pt_regs *regs) | ||
77 | { | ||
78 | return instruction_pointer(regs); | ||
79 | } | ||
80 | |||
81 | /* | ||
82 | * If xol insn itself traps and generates a signal (SIGILL/SIGSEGV/etc), | ||
83 | * then detect the case where a singlestepped instruction jumps back to its | ||
84 | * own address. It is assumed that anything like do_page_fault/do_trap/etc | ||
85 | * sets thread.trap_nr != UINT_MAX. | ||
86 | * | ||
87 | * arch_uprobe_pre_xol/arch_uprobe_post_xol save/restore thread.trap_nr, | ||
88 | * arch_uprobe_xol_was_trapped() simply checks that ->trap_nr is not equal to | ||
89 | * UPROBE_TRAP_NR == UINT_MAX set by arch_uprobe_pre_xol(). | ||
90 | */ | ||
91 | bool arch_uprobe_xol_was_trapped(struct task_struct *t) | ||
92 | { | ||
93 | if (t->thread.trap_nr != UPROBE_TRAP_NR) | ||
94 | return true; | ||
95 | |||
96 | return false; | ||
97 | } | ||
98 | |||
99 | /* | ||
100 | * Called after single-stepping. To avoid the SMP problems that can | ||
101 | * occur when we temporarily put back the original opcode to | ||
102 | * single-step, we single-stepped a copy of the instruction. | ||
103 | * | ||
104 | * This function prepares to resume execution after the single-step. | ||
105 | */ | ||
106 | int arch_uprobe_post_xol(struct arch_uprobe *auprobe, struct pt_regs *regs) | ||
107 | { | ||
108 | struct uprobe_task *utask = current->utask; | ||
109 | |||
110 | WARN_ON_ONCE(current->thread.trap_nr != UPROBE_TRAP_NR); | ||
111 | |||
112 | current->thread.trap_nr = utask->autask.saved_trap_nr; | ||
113 | |||
114 | /* | ||
115 | * On powerpc, except for loads and stores, most instructions | ||
116 | * including ones that alter code flow (branches, calls, returns) | ||
117 | * are emulated in the kernel. We get here only if the emulation | ||
118 | * support doesn't exist and have to fix-up the next instruction | ||
119 | * to be executed. | ||
120 | */ | ||
121 | regs->nip = utask->vaddr + MAX_UINSN_BYTES; | ||
122 | return 0; | ||
123 | } | ||
124 | |||
125 | /* callback routine for handling exceptions. */ | ||
126 | int arch_uprobe_exception_notify(struct notifier_block *self, | ||
127 | unsigned long val, void *data) | ||
128 | { | ||
129 | struct die_args *args = data; | ||
130 | struct pt_regs *regs = args->regs; | ||
131 | |||
132 | /* regs == NULL is a kernel bug */ | ||
133 | if (WARN_ON(!regs)) | ||
134 | return NOTIFY_DONE; | ||
135 | |||
136 | /* We are only interested in userspace traps */ | ||
137 | if (!user_mode(regs)) | ||
138 | return NOTIFY_DONE; | ||
139 | |||
140 | switch (val) { | ||
141 | case DIE_BPT: | ||
142 | if (uprobe_pre_sstep_notifier(regs)) | ||
143 | return NOTIFY_STOP; | ||
144 | break; | ||
145 | case DIE_SSTEP: | ||
146 | if (uprobe_post_sstep_notifier(regs)) | ||
147 | return NOTIFY_STOP; | ||
148 | default: | ||
149 | break; | ||
150 | } | ||
151 | return NOTIFY_DONE; | ||
152 | } | ||
153 | |||
154 | /* | ||
155 | * This function gets called when XOL instruction either gets trapped or | ||
156 | * the thread has a fatal signal, so reset the instruction pointer to its | ||
157 | * probed address. | ||
158 | */ | ||
159 | void arch_uprobe_abort_xol(struct arch_uprobe *auprobe, struct pt_regs *regs) | ||
160 | { | ||
161 | struct uprobe_task *utask = current->utask; | ||
162 | |||
163 | current->thread.trap_nr = utask->autask.saved_trap_nr; | ||
164 | instruction_pointer_set(regs, utask->vaddr); | ||
165 | } | ||
166 | |||
167 | /* | ||
168 | * See if the instruction can be emulated. | ||
169 | * Returns true if instruction was emulated, false otherwise. | ||
170 | */ | ||
171 | bool arch_uprobe_skip_sstep(struct arch_uprobe *auprobe, struct pt_regs *regs) | ||
172 | { | ||
173 | int ret; | ||
174 | |||
175 | /* | ||
176 | * emulate_step() returns 1 if the insn was successfully emulated. | ||
177 | * For all other cases, we need to single-step in hardware. | ||
178 | */ | ||
179 | ret = emulate_step(regs, auprobe->ainsn); | ||
180 | if (ret > 0) | ||
181 | return true; | ||
182 | |||
183 | return false; | ||
184 | } | ||
diff --git a/arch/powerpc/kernel/vdso.c b/arch/powerpc/kernel/vdso.c index b67db22e102d..1b2076f049ce 100644 --- a/arch/powerpc/kernel/vdso.c +++ b/arch/powerpc/kernel/vdso.c | |||
@@ -723,9 +723,7 @@ int __cpuinit vdso_getcpu_init(void) | |||
723 | 723 | ||
724 | val = (cpu & 0xfff) | ((node & 0xffff) << 16); | 724 | val = (cpu & 0xfff) | ((node & 0xffff) << 16); |
725 | mtspr(SPRN_SPRG3, val); | 725 | mtspr(SPRN_SPRG3, val); |
726 | #ifdef CONFIG_KVM_BOOK3S_HANDLER | 726 | get_paca()->sprg3 = val; |
727 | get_paca()->kvm_hstate.sprg3 = val; | ||
728 | #endif | ||
729 | 727 | ||
730 | put_cpu(); | 728 | put_cpu(); |
731 | 729 | ||
diff --git a/arch/powerpc/kernel/vio.c b/arch/powerpc/kernel/vio.c index 02b32216bbc3..201ba59738be 100644 --- a/arch/powerpc/kernel/vio.c +++ b/arch/powerpc/kernel/vio.c | |||
@@ -33,7 +33,6 @@ | |||
33 | #include <asm/prom.h> | 33 | #include <asm/prom.h> |
34 | #include <asm/firmware.h> | 34 | #include <asm/firmware.h> |
35 | #include <asm/tce.h> | 35 | #include <asm/tce.h> |
36 | #include <asm/abs_addr.h> | ||
37 | #include <asm/page.h> | 36 | #include <asm/page.h> |
38 | #include <asm/hvcall.h> | 37 | #include <asm/hvcall.h> |
39 | 38 | ||
diff --git a/arch/powerpc/kvm/book3s_hv_rmhandlers.S b/arch/powerpc/kvm/book3s_hv_rmhandlers.S index 44b72feaff7d..74a24bbb9637 100644 --- a/arch/powerpc/kvm/book3s_hv_rmhandlers.S +++ b/arch/powerpc/kvm/book3s_hv_rmhandlers.S | |||
@@ -1065,7 +1065,7 @@ END_FTR_SECTION_IFSET(CPU_FTR_ARCH_206) | |||
1065 | mtspr SPRN_DABRX,r6 | 1065 | mtspr SPRN_DABRX,r6 |
1066 | 1066 | ||
1067 | /* Restore SPRG3 */ | 1067 | /* Restore SPRG3 */ |
1068 | ld r3,HSTATE_SPRG3(r13) | 1068 | ld r3,PACA_SPRG3(r13) |
1069 | mtspr SPRN_SPRG3,r3 | 1069 | mtspr SPRN_SPRG3,r3 |
1070 | 1070 | ||
1071 | /* | 1071 | /* |
diff --git a/arch/powerpc/mm/fault.c b/arch/powerpc/mm/fault.c index 08ffcf52a856..995f924e007f 100644 --- a/arch/powerpc/mm/fault.c +++ b/arch/powerpc/mm/fault.c | |||
@@ -133,6 +133,7 @@ static int do_sigbus(struct pt_regs *regs, unsigned long address) | |||
133 | up_read(¤t->mm->mmap_sem); | 133 | up_read(¤t->mm->mmap_sem); |
134 | 134 | ||
135 | if (user_mode(regs)) { | 135 | if (user_mode(regs)) { |
136 | current->thread.trap_nr = BUS_ADRERR; | ||
136 | info.si_signo = SIGBUS; | 137 | info.si_signo = SIGBUS; |
137 | info.si_errno = 0; | 138 | info.si_errno = 0; |
138 | info.si_code = BUS_ADRERR; | 139 | info.si_code = BUS_ADRERR; |
diff --git a/arch/powerpc/mm/hash_native_64.c b/arch/powerpc/mm/hash_native_64.c index 90039bc64119..f21e8ce8db33 100644 --- a/arch/powerpc/mm/hash_native_64.c +++ b/arch/powerpc/mm/hash_native_64.c | |||
@@ -14,10 +14,10 @@ | |||
14 | 14 | ||
15 | #include <linux/spinlock.h> | 15 | #include <linux/spinlock.h> |
16 | #include <linux/bitops.h> | 16 | #include <linux/bitops.h> |
17 | #include <linux/of.h> | ||
17 | #include <linux/threads.h> | 18 | #include <linux/threads.h> |
18 | #include <linux/smp.h> | 19 | #include <linux/smp.h> |
19 | 20 | ||
20 | #include <asm/abs_addr.h> | ||
21 | #include <asm/machdep.h> | 21 | #include <asm/machdep.h> |
22 | #include <asm/mmu.h> | 22 | #include <asm/mmu.h> |
23 | #include <asm/mmu_context.h> | 23 | #include <asm/mmu_context.h> |
diff --git a/arch/powerpc/mm/hash_utils_64.c b/arch/powerpc/mm/hash_utils_64.c index 377e5cbedbbb..ba45739bdfe8 100644 --- a/arch/powerpc/mm/hash_utils_64.c +++ b/arch/powerpc/mm/hash_utils_64.c | |||
@@ -43,7 +43,6 @@ | |||
43 | #include <asm/uaccess.h> | 43 | #include <asm/uaccess.h> |
44 | #include <asm/machdep.h> | 44 | #include <asm/machdep.h> |
45 | #include <asm/prom.h> | 45 | #include <asm/prom.h> |
46 | #include <asm/abs_addr.h> | ||
47 | #include <asm/tlbflush.h> | 46 | #include <asm/tlbflush.h> |
48 | #include <asm/io.h> | 47 | #include <asm/io.h> |
49 | #include <asm/eeh.h> | 48 | #include <asm/eeh.h> |
@@ -651,7 +650,7 @@ static void __init htab_initialize(void) | |||
651 | DBG("Hash table allocated at %lx, size: %lx\n", table, | 650 | DBG("Hash table allocated at %lx, size: %lx\n", table, |
652 | htab_size_bytes); | 651 | htab_size_bytes); |
653 | 652 | ||
654 | htab_address = abs_to_virt(table); | 653 | htab_address = __va(table); |
655 | 654 | ||
656 | /* htab absolute addr + encoded htabsize */ | 655 | /* htab absolute addr + encoded htabsize */ |
657 | _SDR1 = table + __ilog2(pteg_count) - 11; | 656 | _SDR1 = table + __ilog2(pteg_count) - 11; |
diff --git a/arch/powerpc/mm/init_64.c b/arch/powerpc/mm/init_64.c index 620b7acd2fdf..95a45293e5ac 100644 --- a/arch/powerpc/mm/init_64.c +++ b/arch/powerpc/mm/init_64.c | |||
@@ -62,7 +62,6 @@ | |||
62 | #include <asm/cputable.h> | 62 | #include <asm/cputable.h> |
63 | #include <asm/sections.h> | 63 | #include <asm/sections.h> |
64 | #include <asm/iommu.h> | 64 | #include <asm/iommu.h> |
65 | #include <asm/abs_addr.h> | ||
66 | #include <asm/vdso.h> | 65 | #include <asm/vdso.h> |
67 | 66 | ||
68 | #include "mmu_decl.h" | 67 | #include "mmu_decl.h" |
diff --git a/arch/powerpc/mm/pgtable_64.c b/arch/powerpc/mm/pgtable_64.c index 249a0631c4db..297d49547ea8 100644 --- a/arch/powerpc/mm/pgtable_64.c +++ b/arch/powerpc/mm/pgtable_64.c | |||
@@ -51,7 +51,6 @@ | |||
51 | #include <asm/processor.h> | 51 | #include <asm/processor.h> |
52 | #include <asm/cputable.h> | 52 | #include <asm/cputable.h> |
53 | #include <asm/sections.h> | 53 | #include <asm/sections.h> |
54 | #include <asm/abs_addr.h> | ||
55 | #include <asm/firmware.h> | 54 | #include <asm/firmware.h> |
56 | 55 | ||
57 | #include "mmu_decl.h" | 56 | #include "mmu_decl.h" |
diff --git a/arch/powerpc/mm/stab.c b/arch/powerpc/mm/stab.c index 9106ebb118f5..3f8efa6f2997 100644 --- a/arch/powerpc/mm/stab.c +++ b/arch/powerpc/mm/stab.c | |||
@@ -20,7 +20,6 @@ | |||
20 | #include <asm/paca.h> | 20 | #include <asm/paca.h> |
21 | #include <asm/cputable.h> | 21 | #include <asm/cputable.h> |
22 | #include <asm/prom.h> | 22 | #include <asm/prom.h> |
23 | #include <asm/abs_addr.h> | ||
24 | 23 | ||
25 | struct stab_entry { | 24 | struct stab_entry { |
26 | unsigned long esid_data; | 25 | unsigned long esid_data; |
@@ -257,7 +256,7 @@ void __init stabs_alloc(void) | |||
257 | memset((void *)newstab, 0, HW_PAGE_SIZE); | 256 | memset((void *)newstab, 0, HW_PAGE_SIZE); |
258 | 257 | ||
259 | paca[cpu].stab_addr = newstab; | 258 | paca[cpu].stab_addr = newstab; |
260 | paca[cpu].stab_real = virt_to_abs(newstab); | 259 | paca[cpu].stab_real = __pa(newstab); |
261 | printk(KERN_INFO "Segment table for CPU %d at 0x%llx " | 260 | printk(KERN_INFO "Segment table for CPU %d at 0x%llx " |
262 | "virtual, 0x%llx absolute\n", | 261 | "virtual, 0x%llx absolute\n", |
263 | cpu, paca[cpu].stab_addr, paca[cpu].stab_real); | 262 | cpu, paca[cpu].stab_addr, paca[cpu].stab_real); |
diff --git a/arch/powerpc/mm/tlb_low_64e.S b/arch/powerpc/mm/tlb_low_64e.S index f09d48e3268d..b4113bf86353 100644 --- a/arch/powerpc/mm/tlb_low_64e.S +++ b/arch/powerpc/mm/tlb_low_64e.S | |||
@@ -20,6 +20,8 @@ | |||
20 | #include <asm/pgtable.h> | 20 | #include <asm/pgtable.h> |
21 | #include <asm/exception-64e.h> | 21 | #include <asm/exception-64e.h> |
22 | #include <asm/ppc-opcode.h> | 22 | #include <asm/ppc-opcode.h> |
23 | #include <asm/kvm_asm.h> | ||
24 | #include <asm/kvm_booke_hv_asm.h> | ||
23 | 25 | ||
24 | #ifdef CONFIG_PPC_64K_PAGES | 26 | #ifdef CONFIG_PPC_64K_PAGES |
25 | #define VPTE_PMD_SHIFT (PTE_INDEX_SIZE+1) | 27 | #define VPTE_PMD_SHIFT (PTE_INDEX_SIZE+1) |
@@ -37,12 +39,18 @@ | |||
37 | * * | 39 | * * |
38 | **********************************************************************/ | 40 | **********************************************************************/ |
39 | 41 | ||
40 | .macro tlb_prolog_bolted addr | 42 | .macro tlb_prolog_bolted intnum addr |
41 | mtspr SPRN_SPRG_TLB_SCRATCH,r13 | 43 | mtspr SPRN_SPRG_GEN_SCRATCH,r13 |
42 | mfspr r13,SPRN_SPRG_PACA | 44 | mfspr r13,SPRN_SPRG_PACA |
43 | std r10,PACA_EXTLB+EX_TLB_R10(r13) | 45 | std r10,PACA_EXTLB+EX_TLB_R10(r13) |
44 | mfcr r10 | 46 | mfcr r10 |
45 | std r11,PACA_EXTLB+EX_TLB_R11(r13) | 47 | std r11,PACA_EXTLB+EX_TLB_R11(r13) |
48 | #ifdef CONFIG_KVM_BOOKE_HV | ||
49 | BEGIN_FTR_SECTION | ||
50 | mfspr r11, SPRN_SRR1 | ||
51 | END_FTR_SECTION_IFSET(CPU_FTR_EMB_HV) | ||
52 | #endif | ||
53 | DO_KVM \intnum, SPRN_SRR1 | ||
46 | std r16,PACA_EXTLB+EX_TLB_R16(r13) | 54 | std r16,PACA_EXTLB+EX_TLB_R16(r13) |
47 | mfspr r16,\addr /* get faulting address */ | 55 | mfspr r16,\addr /* get faulting address */ |
48 | std r14,PACA_EXTLB+EX_TLB_R14(r13) | 56 | std r14,PACA_EXTLB+EX_TLB_R14(r13) |
@@ -61,12 +69,12 @@ | |||
61 | ld r15,PACA_EXTLB+EX_TLB_R15(r13) | 69 | ld r15,PACA_EXTLB+EX_TLB_R15(r13) |
62 | TLB_MISS_RESTORE_STATS_BOLTED | 70 | TLB_MISS_RESTORE_STATS_BOLTED |
63 | ld r16,PACA_EXTLB+EX_TLB_R16(r13) | 71 | ld r16,PACA_EXTLB+EX_TLB_R16(r13) |
64 | mfspr r13,SPRN_SPRG_TLB_SCRATCH | 72 | mfspr r13,SPRN_SPRG_GEN_SCRATCH |
65 | .endm | 73 | .endm |
66 | 74 | ||
67 | /* Data TLB miss */ | 75 | /* Data TLB miss */ |
68 | START_EXCEPTION(data_tlb_miss_bolted) | 76 | START_EXCEPTION(data_tlb_miss_bolted) |
69 | tlb_prolog_bolted SPRN_DEAR | 77 | tlb_prolog_bolted BOOKE_INTERRUPT_DTLB_MISS SPRN_DEAR |
70 | 78 | ||
71 | /* We need _PAGE_PRESENT and _PAGE_ACCESSED set */ | 79 | /* We need _PAGE_PRESENT and _PAGE_ACCESSED set */ |
72 | 80 | ||
@@ -214,7 +222,7 @@ itlb_miss_fault_bolted: | |||
214 | 222 | ||
215 | /* Instruction TLB miss */ | 223 | /* Instruction TLB miss */ |
216 | START_EXCEPTION(instruction_tlb_miss_bolted) | 224 | START_EXCEPTION(instruction_tlb_miss_bolted) |
217 | tlb_prolog_bolted SPRN_SRR0 | 225 | tlb_prolog_bolted BOOKE_INTERRUPT_ITLB_MISS SPRN_SRR0 |
218 | 226 | ||
219 | rldicl. r10,r16,64-PGTABLE_EADDR_SIZE,PGTABLE_EADDR_SIZE+4 | 227 | rldicl. r10,r16,64-PGTABLE_EADDR_SIZE,PGTABLE_EADDR_SIZE+4 |
220 | srdi r15,r16,60 /* get region */ | 228 | srdi r15,r16,60 /* get region */ |
diff --git a/arch/powerpc/oprofile/op_model_power4.c b/arch/powerpc/oprofile/op_model_power4.c index 95ae77dec3f6..caffffa5b8f2 100644 --- a/arch/powerpc/oprofile/op_model_power4.c +++ b/arch/powerpc/oprofile/op_model_power4.c | |||
@@ -61,10 +61,10 @@ static int power4_reg_setup(struct op_counter_config *ctr, | |||
61 | else | 61 | else |
62 | mmcr0_val |= MMCR0_PROBLEM_DISABLE; | 62 | mmcr0_val |= MMCR0_PROBLEM_DISABLE; |
63 | 63 | ||
64 | if (__is_processor(PV_POWER4) || __is_processor(PV_POWER4p) || | 64 | if (pvr_version_is(PVR_POWER4) || pvr_version_is(PVR_POWER4p) || |
65 | __is_processor(PV_970) || __is_processor(PV_970FX) || | 65 | pvr_version_is(PVR_970) || pvr_version_is(PVR_970FX) || |
66 | __is_processor(PV_970MP) || __is_processor(PV_970GX) || | 66 | pvr_version_is(PVR_970MP) || pvr_version_is(PVR_970GX) || |
67 | __is_processor(PV_POWER5) || __is_processor(PV_POWER5p)) | 67 | pvr_version_is(PVR_POWER5) || pvr_version_is(PVR_POWER5p)) |
68 | use_slot_nums = 1; | 68 | use_slot_nums = 1; |
69 | 69 | ||
70 | return 0; | 70 | return 0; |
@@ -84,9 +84,9 @@ extern void ppc_enable_pmcs(void); | |||
84 | */ | 84 | */ |
85 | static inline int mmcra_must_set_sample(void) | 85 | static inline int mmcra_must_set_sample(void) |
86 | { | 86 | { |
87 | if (__is_processor(PV_POWER4) || __is_processor(PV_POWER4p) || | 87 | if (pvr_version_is(PVR_POWER4) || pvr_version_is(PVR_POWER4p) || |
88 | __is_processor(PV_970) || __is_processor(PV_970FX) || | 88 | pvr_version_is(PVR_970) || pvr_version_is(PVR_970FX) || |
89 | __is_processor(PV_970MP) || __is_processor(PV_970GX)) | 89 | pvr_version_is(PVR_970MP) || pvr_version_is(PVR_970GX)) |
90 | return 1; | 90 | return 1; |
91 | 91 | ||
92 | return 0; | 92 | return 0; |
@@ -276,7 +276,7 @@ static bool pmc_overflow(unsigned long val) | |||
276 | * PMCs because a user might set a period of less than 256 and we | 276 | * PMCs because a user might set a period of less than 256 and we |
277 | * don't want to mistakenly reset them. | 277 | * don't want to mistakenly reset them. |
278 | */ | 278 | */ |
279 | if (__is_processor(PV_POWER7) && ((0x80000000 - val) <= 256)) | 279 | if (pvr_version_is(PVR_POWER7) && ((0x80000000 - val) <= 256)) |
280 | return true; | 280 | return true; |
281 | 281 | ||
282 | return false; | 282 | return false; |
diff --git a/arch/powerpc/perf/core-book3s.c b/arch/powerpc/perf/core-book3s.c index 7cd2dbd6e4c4..fb55da91aa45 100644 --- a/arch/powerpc/perf/core-book3s.c +++ b/arch/powerpc/perf/core-book3s.c | |||
@@ -1396,7 +1396,7 @@ static bool pmc_overflow(unsigned long val) | |||
1396 | * PMCs because a user might set a period of less than 256 and we | 1396 | * PMCs because a user might set a period of less than 256 and we |
1397 | * don't want to mistakenly reset them. | 1397 | * don't want to mistakenly reset them. |
1398 | */ | 1398 | */ |
1399 | if (__is_processor(PV_POWER7) && ((0x80000000 - val) <= 256)) | 1399 | if (pvr_version_is(PVR_POWER7) && ((0x80000000 - val) <= 256)) |
1400 | return true; | 1400 | return true; |
1401 | 1401 | ||
1402 | return false; | 1402 | return false; |
diff --git a/arch/powerpc/platforms/pasemi/iommu.c b/arch/powerpc/platforms/pasemi/iommu.c index 14943ef01918..7d2d036754b5 100644 --- a/arch/powerpc/platforms/pasemi/iommu.c +++ b/arch/powerpc/platforms/pasemi/iommu.c | |||
@@ -19,12 +19,12 @@ | |||
19 | 19 | ||
20 | #undef DEBUG | 20 | #undef DEBUG |
21 | 21 | ||
22 | #include <linux/memblock.h> | ||
22 | #include <linux/types.h> | 23 | #include <linux/types.h> |
23 | #include <linux/spinlock.h> | 24 | #include <linux/spinlock.h> |
24 | #include <linux/pci.h> | 25 | #include <linux/pci.h> |
25 | #include <asm/iommu.h> | 26 | #include <asm/iommu.h> |
26 | #include <asm/machdep.h> | 27 | #include <asm/machdep.h> |
27 | #include <asm/abs_addr.h> | ||
28 | #include <asm/firmware.h> | 28 | #include <asm/firmware.h> |
29 | 29 | ||
30 | #define IOBMAP_PAGE_SHIFT 12 | 30 | #define IOBMAP_PAGE_SHIFT 12 |
@@ -99,7 +99,7 @@ static int iobmap_build(struct iommu_table *tbl, long index, | |||
99 | ip = ((u32 *)tbl->it_base) + index; | 99 | ip = ((u32 *)tbl->it_base) + index; |
100 | 100 | ||
101 | while (npages--) { | 101 | while (npages--) { |
102 | rpn = virt_to_abs(uaddr) >> IOBMAP_PAGE_SHIFT; | 102 | rpn = __pa(uaddr) >> IOBMAP_PAGE_SHIFT; |
103 | 103 | ||
104 | *(ip++) = IOBMAP_L2E_V | rpn; | 104 | *(ip++) = IOBMAP_L2E_V | rpn; |
105 | /* invalidate tlb, can be optimized more */ | 105 | /* invalidate tlb, can be optimized more */ |
@@ -258,7 +258,7 @@ void __init alloc_iobmap_l2(void) | |||
258 | return; | 258 | return; |
259 | #endif | 259 | #endif |
260 | /* For 2G space, 8x64 pages (2^21 bytes) is max total l2 size */ | 260 | /* For 2G space, 8x64 pages (2^21 bytes) is max total l2 size */ |
261 | iob_l2_base = (u32 *)abs_to_virt(memblock_alloc_base(1UL<<21, 1UL<<21, 0x80000000)); | 261 | iob_l2_base = (u32 *)__va(memblock_alloc_base(1UL<<21, 1UL<<21, 0x80000000)); |
262 | 262 | ||
263 | printk(KERN_INFO "IOBMAP L2 allocated at: %p\n", iob_l2_base); | 263 | printk(KERN_INFO "IOBMAP L2 allocated at: %p\n", iob_l2_base); |
264 | } | 264 | } |
diff --git a/arch/powerpc/platforms/powernv/pci-ioda.c b/arch/powerpc/platforms/powernv/pci-ioda.c index 9cda6a1ad0cf..5e75dcfe51b9 100644 --- a/arch/powerpc/platforms/powernv/pci-ioda.c +++ b/arch/powerpc/platforms/powernv/pci-ioda.c | |||
@@ -30,7 +30,6 @@ | |||
30 | #include <asm/opal.h> | 30 | #include <asm/opal.h> |
31 | #include <asm/iommu.h> | 31 | #include <asm/iommu.h> |
32 | #include <asm/tce.h> | 32 | #include <asm/tce.h> |
33 | #include <asm/abs_addr.h> | ||
34 | 33 | ||
35 | #include "powernv.h" | 34 | #include "powernv.h" |
36 | #include "pci.h" | 35 | #include "pci.h" |
diff --git a/arch/powerpc/platforms/powernv/pci-p5ioc2.c b/arch/powerpc/platforms/powernv/pci-p5ioc2.c index 264967770c3a..6b4bef4e9d82 100644 --- a/arch/powerpc/platforms/powernv/pci-p5ioc2.c +++ b/arch/powerpc/platforms/powernv/pci-p5ioc2.c | |||
@@ -30,7 +30,6 @@ | |||
30 | #include <asm/opal.h> | 30 | #include <asm/opal.h> |
31 | #include <asm/iommu.h> | 31 | #include <asm/iommu.h> |
32 | #include <asm/tce.h> | 32 | #include <asm/tce.h> |
33 | #include <asm/abs_addr.h> | ||
34 | 33 | ||
35 | #include "powernv.h" | 34 | #include "powernv.h" |
36 | #include "pci.h" | 35 | #include "pci.h" |
diff --git a/arch/powerpc/platforms/powernv/pci.c b/arch/powerpc/platforms/powernv/pci.c index be3cfc5ceabb..1e908aef4201 100644 --- a/arch/powerpc/platforms/powernv/pci.c +++ b/arch/powerpc/platforms/powernv/pci.c | |||
@@ -30,7 +30,6 @@ | |||
30 | #include <asm/opal.h> | 30 | #include <asm/opal.h> |
31 | #include <asm/iommu.h> | 31 | #include <asm/iommu.h> |
32 | #include <asm/tce.h> | 32 | #include <asm/tce.h> |
33 | #include <asm/abs_addr.h> | ||
34 | #include <asm/firmware.h> | 33 | #include <asm/firmware.h> |
35 | 34 | ||
36 | #include "powernv.h" | 35 | #include "powernv.h" |
diff --git a/arch/powerpc/platforms/pseries/iommu.c b/arch/powerpc/platforms/pseries/iommu.c index bca220f2873c..6153eea27ce7 100644 --- a/arch/powerpc/platforms/pseries/iommu.c +++ b/arch/powerpc/platforms/pseries/iommu.c | |||
@@ -28,6 +28,7 @@ | |||
28 | #include <linux/types.h> | 28 | #include <linux/types.h> |
29 | #include <linux/slab.h> | 29 | #include <linux/slab.h> |
30 | #include <linux/mm.h> | 30 | #include <linux/mm.h> |
31 | #include <linux/memblock.h> | ||
31 | #include <linux/spinlock.h> | 32 | #include <linux/spinlock.h> |
32 | #include <linux/sched.h> /* for show_stack */ | 33 | #include <linux/sched.h> /* for show_stack */ |
33 | #include <linux/string.h> | 34 | #include <linux/string.h> |
@@ -41,7 +42,6 @@ | |||
41 | #include <asm/iommu.h> | 42 | #include <asm/iommu.h> |
42 | #include <asm/pci-bridge.h> | 43 | #include <asm/pci-bridge.h> |
43 | #include <asm/machdep.h> | 44 | #include <asm/machdep.h> |
44 | #include <asm/abs_addr.h> | ||
45 | #include <asm/pSeries_reconfig.h> | 45 | #include <asm/pSeries_reconfig.h> |
46 | #include <asm/firmware.h> | 46 | #include <asm/firmware.h> |
47 | #include <asm/tce.h> | 47 | #include <asm/tce.h> |
@@ -99,7 +99,7 @@ static int tce_build_pSeries(struct iommu_table *tbl, long index, | |||
99 | 99 | ||
100 | while (npages--) { | 100 | while (npages--) { |
101 | /* can't move this out since we might cross MEMBLOCK boundary */ | 101 | /* can't move this out since we might cross MEMBLOCK boundary */ |
102 | rpn = (virt_to_abs(uaddr)) >> TCE_SHIFT; | 102 | rpn = __pa(uaddr) >> TCE_SHIFT; |
103 | *tcep = proto_tce | (rpn & TCE_RPN_MASK) << TCE_RPN_SHIFT; | 103 | *tcep = proto_tce | (rpn & TCE_RPN_MASK) << TCE_RPN_SHIFT; |
104 | 104 | ||
105 | uaddr += TCE_PAGE_SIZE; | 105 | uaddr += TCE_PAGE_SIZE; |
@@ -148,7 +148,7 @@ static int tce_build_pSeriesLP(struct iommu_table *tbl, long tcenum, | |||
148 | int ret = 0; | 148 | int ret = 0; |
149 | long tcenum_start = tcenum, npages_start = npages; | 149 | long tcenum_start = tcenum, npages_start = npages; |
150 | 150 | ||
151 | rpn = (virt_to_abs(uaddr)) >> TCE_SHIFT; | 151 | rpn = __pa(uaddr) >> TCE_SHIFT; |
152 | proto_tce = TCE_PCI_READ; | 152 | proto_tce = TCE_PCI_READ; |
153 | if (direction != DMA_TO_DEVICE) | 153 | if (direction != DMA_TO_DEVICE) |
154 | proto_tce |= TCE_PCI_WRITE; | 154 | proto_tce |= TCE_PCI_WRITE; |
@@ -217,7 +217,7 @@ static int tce_buildmulti_pSeriesLP(struct iommu_table *tbl, long tcenum, | |||
217 | __get_cpu_var(tce_page) = tcep; | 217 | __get_cpu_var(tce_page) = tcep; |
218 | } | 218 | } |
219 | 219 | ||
220 | rpn = (virt_to_abs(uaddr)) >> TCE_SHIFT; | 220 | rpn = __pa(uaddr) >> TCE_SHIFT; |
221 | proto_tce = TCE_PCI_READ; | 221 | proto_tce = TCE_PCI_READ; |
222 | if (direction != DMA_TO_DEVICE) | 222 | if (direction != DMA_TO_DEVICE) |
223 | proto_tce |= TCE_PCI_WRITE; | 223 | proto_tce |= TCE_PCI_WRITE; |
@@ -237,7 +237,7 @@ static int tce_buildmulti_pSeriesLP(struct iommu_table *tbl, long tcenum, | |||
237 | 237 | ||
238 | rc = plpar_tce_put_indirect((u64)tbl->it_index, | 238 | rc = plpar_tce_put_indirect((u64)tbl->it_index, |
239 | (u64)tcenum << 12, | 239 | (u64)tcenum << 12, |
240 | (u64)virt_to_abs(tcep), | 240 | (u64)__pa(tcep), |
241 | limit); | 241 | limit); |
242 | 242 | ||
243 | npages -= limit; | 243 | npages -= limit; |
@@ -441,7 +441,7 @@ static int tce_setrange_multi_pSeriesLP(unsigned long start_pfn, | |||
441 | 441 | ||
442 | rc = plpar_tce_put_indirect(liobn, | 442 | rc = plpar_tce_put_indirect(liobn, |
443 | dma_offset, | 443 | dma_offset, |
444 | (u64)virt_to_abs(tcep), | 444 | (u64)__pa(tcep), |
445 | limit); | 445 | limit); |
446 | 446 | ||
447 | num_tce -= limit; | 447 | num_tce -= limit; |
diff --git a/arch/powerpc/platforms/pseries/lpar.c b/arch/powerpc/platforms/pseries/lpar.c index 5f3ef876ded2..177055d0186b 100644 --- a/arch/powerpc/platforms/pseries/lpar.c +++ b/arch/powerpc/platforms/pseries/lpar.c | |||
@@ -31,7 +31,6 @@ | |||
31 | #include <asm/page.h> | 31 | #include <asm/page.h> |
32 | #include <asm/pgtable.h> | 32 | #include <asm/pgtable.h> |
33 | #include <asm/machdep.h> | 33 | #include <asm/machdep.h> |
34 | #include <asm/abs_addr.h> | ||
35 | #include <asm/mmu_context.h> | 34 | #include <asm/mmu_context.h> |
36 | #include <asm/iommu.h> | 35 | #include <asm/iommu.h> |
37 | #include <asm/tlbflush.h> | 36 | #include <asm/tlbflush.h> |
diff --git a/arch/powerpc/sysdev/dart_iommu.c b/arch/powerpc/sysdev/dart_iommu.c index 4f2680f431b5..8ef63a01e345 100644 --- a/arch/powerpc/sysdev/dart_iommu.c +++ b/arch/powerpc/sysdev/dart_iommu.c | |||
@@ -43,7 +43,6 @@ | |||
43 | #include <asm/iommu.h> | 43 | #include <asm/iommu.h> |
44 | #include <asm/pci-bridge.h> | 44 | #include <asm/pci-bridge.h> |
45 | #include <asm/machdep.h> | 45 | #include <asm/machdep.h> |
46 | #include <asm/abs_addr.h> | ||
47 | #include <asm/cacheflush.h> | 46 | #include <asm/cacheflush.h> |
48 | #include <asm/ppc-pci.h> | 47 | #include <asm/ppc-pci.h> |
49 | 48 | ||
@@ -167,7 +166,7 @@ static int dart_build(struct iommu_table *tbl, long index, | |||
167 | */ | 166 | */ |
168 | l = npages; | 167 | l = npages; |
169 | while (l--) { | 168 | while (l--) { |
170 | rpn = virt_to_abs(uaddr) >> DART_PAGE_SHIFT; | 169 | rpn = __pa(uaddr) >> DART_PAGE_SHIFT; |
171 | 170 | ||
172 | *(dp++) = DARTMAP_VALID | (rpn & DARTMAP_RPNMASK); | 171 | *(dp++) = DARTMAP_VALID | (rpn & DARTMAP_RPNMASK); |
173 | 172 | ||
@@ -244,7 +243,7 @@ static int __init dart_init(struct device_node *dart_node) | |||
244 | panic("DART: Cannot map registers!"); | 243 | panic("DART: Cannot map registers!"); |
245 | 244 | ||
246 | /* Map in DART table */ | 245 | /* Map in DART table */ |
247 | dart_vbase = ioremap(virt_to_abs(dart_tablebase), dart_tablesize); | 246 | dart_vbase = ioremap(__pa(dart_tablebase), dart_tablesize); |
248 | 247 | ||
249 | /* Fill initial table */ | 248 | /* Fill initial table */ |
250 | for (i = 0; i < dart_tablesize/4; i++) | 249 | for (i = 0; i < dart_tablesize/4; i++) |
@@ -463,7 +462,7 @@ void __init alloc_dart_table(void) | |||
463 | * will blow up an entire large page anyway in the kernel mapping | 462 | * will blow up an entire large page anyway in the kernel mapping |
464 | */ | 463 | */ |
465 | dart_tablebase = (unsigned long) | 464 | dart_tablebase = (unsigned long) |
466 | abs_to_virt(memblock_alloc_base(1UL<<24, 1UL<<24, 0x80000000L)); | 465 | __va(memblock_alloc_base(1UL<<24, 1UL<<24, 0x80000000L)); |
467 | 466 | ||
468 | printk(KERN_INFO "DART table allocated at: %lx\n", dart_tablebase); | 467 | printk(KERN_INFO "DART table allocated at: %lx\n", dart_tablebase); |
469 | } | 468 | } |