aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/kernel
diff options
context:
space:
mode:
Diffstat (limited to 'arch/powerpc/kernel')
-rw-r--r--arch/powerpc/kernel/Makefile1
-rw-r--r--arch/powerpc/kernel/asm-offsets.c2
-rw-r--r--arch/powerpc/kernel/dma-swiotlb.c2
-rw-r--r--arch/powerpc/kernel/dma.c3
-rw-r--r--arch/powerpc/kernel/exceptions-64e.S194
-rw-r--r--arch/powerpc/kernel/ibmebus.c1
-rw-r--r--arch/powerpc/kernel/process.c2
-rw-r--r--arch/powerpc/kernel/prom_init.c2
-rw-r--r--arch/powerpc/kernel/rtas_flash.c7
-rw-r--r--arch/powerpc/kernel/signal.c6
-rw-r--r--arch/powerpc/kernel/traps.c1
-rw-r--r--arch/powerpc/kernel/uprobes.c184
-rw-r--r--arch/powerpc/kernel/vdso.c4
-rw-r--r--arch/powerpc/kernel/vio.c1
14 files changed, 326 insertions, 84 deletions
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
96obj-$(CONFIG_BOOTX_TEXT) += btext.o 96obj-$(CONFIG_BOOTX_TEXT) += btext.o
97obj-$(CONFIG_SMP) += smp.o 97obj-$(CONFIG_SMP) += smp.o
98obj-$(CONFIG_KPROBES) += kprobes.o 98obj-$(CONFIG_KPROBES) += kprobes.o
99obj-$(CONFIG_UPROBES) += uprobes.o
99obj-$(CONFIG_PPC_UDBG_16550) += legacy_serial.o udbg_16550.o 100obj-$(CONFIG_PPC_UDBG_16550) += legacy_serial.o udbg_16550.o
100obj-$(CONFIG_STACKTRACE) += stacktrace.o 101obj-$(CONFIG_STACKTRACE) += stacktrace.o
101obj-$(CONFIG_SWIOTLB) += dma-swiotlb.o 102obj-$(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
25unsigned int ppc_swiotlb_enable; 25unsigned 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: \
2331: 2581:
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
585masked_interrupt_book3e_0x500: 661masked_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
590masked_interrupt_book3e_0x900: 665masked_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
594masked_interrupt_book3e_0x980: 669masked_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
598masked_interrupt_book3e_0x280: 673masked_interrupt_book3e_0x280:
599masked_interrupt_book3e_0x2c0: 674masked_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
603masked_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
609masked_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
6181: 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
52static struct device ibmebus_bus_device = { /* fake "parent" device */ 51static 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
158void do_notify_resume(struct pt_regs *regs, unsigned long thread_info_flags) 159void 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 */
40int 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 */
60int arch_uprobe_pre_xol(struct arch_uprobe *auprobe, struct pt_regs *regs)
61{
62 struct arch_uprobe_task *autask = &current->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 */
76unsigned 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 */
91bool 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 */
106int 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. */
126int 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 */
159void 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 */
171bool 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