aboutsummaryrefslogtreecommitdiffstats
path: root/arch/ppc64
diff options
context:
space:
mode:
Diffstat (limited to 'arch/ppc64')
-rw-r--r--arch/ppc64/Kconfig4
-rw-r--r--arch/ppc64/Makefile2
-rw-r--r--arch/ppc64/kernel/kprobes.c40
-rw-r--r--arch/ppc64/kernel/misc.S6
-rw-r--r--arch/ppc64/kernel/pSeries_reconfig.c2
-rw-r--r--arch/ppc64/kernel/sys_ppc32.c31
-rw-r--r--arch/ppc64/kernel/time.c7
-rw-r--r--arch/ppc64/kernel/traps.c5
-rw-r--r--arch/ppc64/kernel/vmlinux.lds.S1
-rw-r--r--arch/ppc64/mm/fault.c5
10 files changed, 39 insertions, 64 deletions
diff --git a/arch/ppc64/Kconfig b/arch/ppc64/Kconfig
index 13b262f10216..deca68ad644a 100644
--- a/arch/ppc64/Kconfig
+++ b/arch/ppc64/Kconfig
@@ -44,6 +44,10 @@ config SCHED_NO_NO_OMIT_FRAME_POINTER
44 bool 44 bool
45 default y 45 default y
46 46
47config ARCH_MAY_HAVE_PC_FDC
48 bool
49 default y
50
47# We optimistically allocate largepages from the VM, so make the limit 51# We optimistically allocate largepages from the VM, so make the limit
48# large enough (16MB). This badly named config option is actually 52# large enough (16MB). This badly named config option is actually
49# max order + 1 53# max order + 1
diff --git a/arch/ppc64/Makefile b/arch/ppc64/Makefile
index 6350cce82efb..8189953a372c 100644
--- a/arch/ppc64/Makefile
+++ b/arch/ppc64/Makefile
@@ -49,7 +49,7 @@ NM := $(NM) --synthetic
49 49
50endif 50endif
51 51
52CHECKFLAGS += -m64 -D__powerpc__ 52CHECKFLAGS += -m64 -D__powerpc__ -D__powerpc64__
53 53
54LDFLAGS := -m elf64ppc 54LDFLAGS := -m elf64ppc
55LDFLAGS_vmlinux := -Bstatic -e $(KERNELLOAD) -Ttext $(KERNELLOAD) 55LDFLAGS_vmlinux := -Bstatic -e $(KERNELLOAD) -Ttext $(KERNELLOAD)
diff --git a/arch/ppc64/kernel/kprobes.c b/arch/ppc64/kernel/kprobes.c
index a3d519518fb8..7e80d49c589a 100644
--- a/arch/ppc64/kernel/kprobes.c
+++ b/arch/ppc64/kernel/kprobes.c
@@ -44,7 +44,7 @@ static struct kprobe *kprobe_prev;
44static unsigned long kprobe_status_prev, kprobe_saved_msr_prev; 44static unsigned long kprobe_status_prev, kprobe_saved_msr_prev;
45static struct pt_regs jprobe_saved_regs; 45static struct pt_regs jprobe_saved_regs;
46 46
47int arch_prepare_kprobe(struct kprobe *p) 47int __kprobes arch_prepare_kprobe(struct kprobe *p)
48{ 48{
49 int ret = 0; 49 int ret = 0;
50 kprobe_opcode_t insn = *p->addr; 50 kprobe_opcode_t insn = *p->addr;
@@ -68,27 +68,27 @@ int arch_prepare_kprobe(struct kprobe *p)
68 return ret; 68 return ret;
69} 69}
70 70
71void arch_copy_kprobe(struct kprobe *p) 71void __kprobes arch_copy_kprobe(struct kprobe *p)
72{ 72{
73 memcpy(p->ainsn.insn, p->addr, MAX_INSN_SIZE * sizeof(kprobe_opcode_t)); 73 memcpy(p->ainsn.insn, p->addr, MAX_INSN_SIZE * sizeof(kprobe_opcode_t));
74 p->opcode = *p->addr; 74 p->opcode = *p->addr;
75} 75}
76 76
77void arch_arm_kprobe(struct kprobe *p) 77void __kprobes arch_arm_kprobe(struct kprobe *p)
78{ 78{
79 *p->addr = BREAKPOINT_INSTRUCTION; 79 *p->addr = BREAKPOINT_INSTRUCTION;
80 flush_icache_range((unsigned long) p->addr, 80 flush_icache_range((unsigned long) p->addr,
81 (unsigned long) p->addr + sizeof(kprobe_opcode_t)); 81 (unsigned long) p->addr + sizeof(kprobe_opcode_t));
82} 82}
83 83
84void arch_disarm_kprobe(struct kprobe *p) 84void __kprobes arch_disarm_kprobe(struct kprobe *p)
85{ 85{
86 *p->addr = p->opcode; 86 *p->addr = p->opcode;
87 flush_icache_range((unsigned long) p->addr, 87 flush_icache_range((unsigned long) p->addr,
88 (unsigned long) p->addr + sizeof(kprobe_opcode_t)); 88 (unsigned long) p->addr + sizeof(kprobe_opcode_t));
89} 89}
90 90
91void arch_remove_kprobe(struct kprobe *p) 91void __kprobes arch_remove_kprobe(struct kprobe *p)
92{ 92{
93 up(&kprobe_mutex); 93 up(&kprobe_mutex);
94 free_insn_slot(p->ainsn.insn); 94 free_insn_slot(p->ainsn.insn);
@@ -102,7 +102,7 @@ static inline void prepare_singlestep(struct kprobe *p, struct pt_regs *regs)
102 regs->msr |= MSR_SE; 102 regs->msr |= MSR_SE;
103 103
104 /* single step inline if it is a trap variant */ 104 /* single step inline if it is a trap variant */
105 if (IS_TW(insn) || IS_TD(insn) || IS_TWI(insn) || IS_TDI(insn)) 105 if (is_trap(insn))
106 regs->nip = (unsigned long)p->addr; 106 regs->nip = (unsigned long)p->addr;
107 else 107 else
108 regs->nip = (unsigned long)p->ainsn.insn; 108 regs->nip = (unsigned long)p->ainsn.insn;
@@ -122,7 +122,8 @@ static inline void restore_previous_kprobe(void)
122 kprobe_saved_msr = kprobe_saved_msr_prev; 122 kprobe_saved_msr = kprobe_saved_msr_prev;
123} 123}
124 124
125void arch_prepare_kretprobe(struct kretprobe *rp, struct pt_regs *regs) 125void __kprobes arch_prepare_kretprobe(struct kretprobe *rp,
126 struct pt_regs *regs)
126{ 127{
127 struct kretprobe_instance *ri; 128 struct kretprobe_instance *ri;
128 129
@@ -151,7 +152,9 @@ static inline int kprobe_handler(struct pt_regs *regs)
151 Disarm the probe we just hit, and ignore it. */ 152 Disarm the probe we just hit, and ignore it. */
152 p = get_kprobe(addr); 153 p = get_kprobe(addr);
153 if (p) { 154 if (p) {
154 if (kprobe_status == KPROBE_HIT_SS) { 155 kprobe_opcode_t insn = *p->ainsn.insn;
156 if (kprobe_status == KPROBE_HIT_SS &&
157 is_trap(insn)) {
155 regs->msr &= ~MSR_SE; 158 regs->msr &= ~MSR_SE;
156 regs->msr |= kprobe_saved_msr; 159 regs->msr |= kprobe_saved_msr;
157 unlock_kprobes(); 160 unlock_kprobes();
@@ -191,8 +194,7 @@ static inline int kprobe_handler(struct pt_regs *regs)
191 * trap variant, it could belong to someone else 194 * trap variant, it could belong to someone else
192 */ 195 */
193 kprobe_opcode_t cur_insn = *addr; 196 kprobe_opcode_t cur_insn = *addr;
194 if (IS_TW(cur_insn) || IS_TD(cur_insn) || 197 if (is_trap(cur_insn))
195 IS_TWI(cur_insn) || IS_TDI(cur_insn))
196 goto no_kprobe; 198 goto no_kprobe;
197 /* 199 /*
198 * The breakpoint instruction was removed right 200 * The breakpoint instruction was removed right
@@ -244,7 +246,7 @@ void kretprobe_trampoline_holder(void)
244/* 246/*
245 * Called when the probe at kretprobe trampoline is hit 247 * Called when the probe at kretprobe trampoline is hit
246 */ 248 */
247int trampoline_probe_handler(struct kprobe *p, struct pt_regs *regs) 249int __kprobes trampoline_probe_handler(struct kprobe *p, struct pt_regs *regs)
248{ 250{
249 struct kretprobe_instance *ri = NULL; 251 struct kretprobe_instance *ri = NULL;
250 struct hlist_head *head; 252 struct hlist_head *head;
@@ -308,7 +310,7 @@ int trampoline_probe_handler(struct kprobe *p, struct pt_regs *regs)
308 * single-stepped a copy of the instruction. The address of this 310 * single-stepped a copy of the instruction. The address of this
309 * copy is p->ainsn.insn. 311 * copy is p->ainsn.insn.
310 */ 312 */
311static void resume_execution(struct kprobe *p, struct pt_regs *regs) 313static void __kprobes resume_execution(struct kprobe *p, struct pt_regs *regs)
312{ 314{
313 int ret; 315 int ret;
314 unsigned int insn = *p->ainsn.insn; 316 unsigned int insn = *p->ainsn.insn;
@@ -373,8 +375,8 @@ static inline int kprobe_fault_handler(struct pt_regs *regs, int trapnr)
373/* 375/*
374 * Wrapper routine to for handling exceptions. 376 * Wrapper routine to for handling exceptions.
375 */ 377 */
376int kprobe_exceptions_notify(struct notifier_block *self, unsigned long val, 378int __kprobes kprobe_exceptions_notify(struct notifier_block *self,
377 void *data) 379 unsigned long val, void *data)
378{ 380{
379 struct die_args *args = (struct die_args *)data; 381 struct die_args *args = (struct die_args *)data;
380 int ret = NOTIFY_DONE; 382 int ret = NOTIFY_DONE;
@@ -402,11 +404,11 @@ int kprobe_exceptions_notify(struct notifier_block *self, unsigned long val,
402 default: 404 default:
403 break; 405 break;
404 } 406 }
405 preempt_enable(); 407 preempt_enable_no_resched();
406 return ret; 408 return ret;
407} 409}
408 410
409int setjmp_pre_handler(struct kprobe *p, struct pt_regs *regs) 411int __kprobes setjmp_pre_handler(struct kprobe *p, struct pt_regs *regs)
410{ 412{
411 struct jprobe *jp = container_of(p, struct jprobe, kp); 413 struct jprobe *jp = container_of(p, struct jprobe, kp);
412 414
@@ -419,16 +421,16 @@ int setjmp_pre_handler(struct kprobe *p, struct pt_regs *regs)
419 return 1; 421 return 1;
420} 422}
421 423
422void jprobe_return(void) 424void __kprobes jprobe_return(void)
423{ 425{
424 asm volatile("trap" ::: "memory"); 426 asm volatile("trap" ::: "memory");
425} 427}
426 428
427void jprobe_return_end(void) 429void __kprobes jprobe_return_end(void)
428{ 430{
429}; 431};
430 432
431int longjmp_break_handler(struct kprobe *p, struct pt_regs *regs) 433int __kprobes longjmp_break_handler(struct kprobe *p, struct pt_regs *regs)
432{ 434{
433 /* 435 /*
434 * FIXME - we should ideally be validating that we got here 'cos 436 * FIXME - we should ideally be validating that we got here 'cos
diff --git a/arch/ppc64/kernel/misc.S b/arch/ppc64/kernel/misc.S
index 474df0a862bf..6d860c1d9fa0 100644
--- a/arch/ppc64/kernel/misc.S
+++ b/arch/ppc64/kernel/misc.S
@@ -183,7 +183,7 @@ PPC64_CACHES:
183 * flush all bytes from start through stop-1 inclusive 183 * flush all bytes from start through stop-1 inclusive
184 */ 184 */
185 185
186_GLOBAL(__flush_icache_range) 186_KPROBE(__flush_icache_range)
187 187
188/* 188/*
189 * Flush the data cache to memory 189 * Flush the data cache to memory
@@ -223,7 +223,7 @@ _GLOBAL(__flush_icache_range)
223 bdnz 2b 223 bdnz 2b
224 isync 224 isync
225 blr 225 blr
226 226 .previous .text
227/* 227/*
228 * Like above, but only do the D-cache. 228 * Like above, but only do the D-cache.
229 * 229 *
@@ -957,7 +957,7 @@ _GLOBAL(sys_call_table32)
957 .llong .ppc_fork 957 .llong .ppc_fork
958 .llong .sys_read 958 .llong .sys_read
959 .llong .sys_write 959 .llong .sys_write
960 .llong .sys32_open /* 5 */ 960 .llong .compat_sys_open /* 5 */
961 .llong .sys_close 961 .llong .sys_close
962 .llong .sys32_waitpid 962 .llong .sys32_waitpid
963 .llong .sys32_creat 963 .llong .sys32_creat
diff --git a/arch/ppc64/kernel/pSeries_reconfig.c b/arch/ppc64/kernel/pSeries_reconfig.c
index dc2a69d412a2..58c61219d08e 100644
--- a/arch/ppc64/kernel/pSeries_reconfig.c
+++ b/arch/ppc64/kernel/pSeries_reconfig.c
@@ -111,7 +111,7 @@ static int pSeries_reconfig_add_node(const char *path, struct property *proplist
111 struct device_node *np; 111 struct device_node *np;
112 int err = -ENOMEM; 112 int err = -ENOMEM;
113 113
114 np = kcalloc(1, sizeof(*np), GFP_KERNEL); 114 np = kzalloc(sizeof(*np), GFP_KERNEL);
115 if (!np) 115 if (!np)
116 goto out_err; 116 goto out_err;
117 117
diff --git a/arch/ppc64/kernel/sys_ppc32.c b/arch/ppc64/kernel/sys_ppc32.c
index 206619080e66..214914a95a50 100644
--- a/arch/ppc64/kernel/sys_ppc32.c
+++ b/arch/ppc64/kernel/sys_ppc32.c
@@ -867,37 +867,6 @@ off_t ppc32_lseek(unsigned int fd, u32 offset, unsigned int origin)
867 return sys_lseek(fd, (int)offset, origin); 867 return sys_lseek(fd, (int)offset, origin);
868} 868}
869 869
870/*
871 * This is just a version for 32-bit applications which does
872 * not force O_LARGEFILE on.
873 */
874asmlinkage long sys32_open(const char __user * filename, int flags, int mode)
875{
876 char * tmp;
877 int fd, error;
878
879 tmp = getname(filename);
880 fd = PTR_ERR(tmp);
881 if (!IS_ERR(tmp)) {
882 fd = get_unused_fd();
883 if (fd >= 0) {
884 struct file * f = filp_open(tmp, flags, mode);
885 error = PTR_ERR(f);
886 if (IS_ERR(f))
887 goto out_error;
888 fd_install(fd, f);
889 }
890out:
891 putname(tmp);
892 }
893 return fd;
894
895out_error:
896 put_unused_fd(fd);
897 fd = error;
898 goto out;
899}
900
901/* Note: it is necessary to treat bufsiz as an unsigned int, 870/* Note: it is necessary to treat bufsiz as an unsigned int,
902 * with the corresponding cast to a signed int to insure that the 871 * with the corresponding cast to a signed int to insure that the
903 * proper conversion (sign extension) between the register representation of a signed int (msr in 32-bit mode) 872 * proper conversion (sign extension) between the register representation of a signed int (msr in 32-bit mode)
diff --git a/arch/ppc64/kernel/time.c b/arch/ppc64/kernel/time.c
index 91ef95ccda4f..9939c206afa4 100644
--- a/arch/ppc64/kernel/time.c
+++ b/arch/ppc64/kernel/time.c
@@ -128,7 +128,7 @@ static __inline__ void timer_check_rtc(void)
128 * We should have an rtc call that only sets the minutes and 128 * We should have an rtc call that only sets the minutes and
129 * seconds like on Intel to avoid problems with non UTC clocks. 129 * seconds like on Intel to avoid problems with non UTC clocks.
130 */ 130 */
131 if ( (time_status & STA_UNSYNC) == 0 && 131 if (ntp_synced() &&
132 xtime.tv_sec - last_rtc_update >= 659 && 132 xtime.tv_sec - last_rtc_update >= 659 &&
133 abs((xtime.tv_nsec/1000) - (1000000-1000000/HZ)) < 500000/HZ && 133 abs((xtime.tv_nsec/1000) - (1000000-1000000/HZ)) < 500000/HZ &&
134 jiffies - wall_jiffies == 1) { 134 jiffies - wall_jiffies == 1) {
@@ -435,10 +435,7 @@ int do_settimeofday(struct timespec *tv)
435 */ 435 */
436 last_rtc_update = new_sec - 658; 436 last_rtc_update = new_sec - 658;
437 437
438 time_adjust = 0; /* stop active adjtime() */ 438 ntp_clear();
439 time_status |= STA_UNSYNC;
440 time_maxerror = NTP_PHASE_LIMIT;
441 time_esterror = NTP_PHASE_LIMIT;
442 439
443 delta_xsec = mulhdu( (tb_last_stamp-do_gtod.varp->tb_orig_stamp), 440 delta_xsec = mulhdu( (tb_last_stamp-do_gtod.varp->tb_orig_stamp),
444 do_gtod.varp->tb_to_xs ); 441 do_gtod.varp->tb_to_xs );
diff --git a/arch/ppc64/kernel/traps.c b/arch/ppc64/kernel/traps.c
index a8d5e83ee89f..7467ae508e6e 100644
--- a/arch/ppc64/kernel/traps.c
+++ b/arch/ppc64/kernel/traps.c
@@ -30,6 +30,7 @@
30#include <linux/init.h> 30#include <linux/init.h>
31#include <linux/module.h> 31#include <linux/module.h>
32#include <linux/delay.h> 32#include <linux/delay.h>
33#include <linux/kprobes.h>
33#include <asm/kdebug.h> 34#include <asm/kdebug.h>
34 35
35#include <asm/pgtable.h> 36#include <asm/pgtable.h>
@@ -220,7 +221,7 @@ void instruction_breakpoint_exception(struct pt_regs *regs)
220 _exception(SIGTRAP, regs, TRAP_BRKPT, regs->nip); 221 _exception(SIGTRAP, regs, TRAP_BRKPT, regs->nip);
221} 222}
222 223
223void single_step_exception(struct pt_regs *regs) 224void __kprobes single_step_exception(struct pt_regs *regs)
224{ 225{
225 regs->msr &= ~MSR_SE; /* Turn off 'trace' bit */ 226 regs->msr &= ~MSR_SE; /* Turn off 'trace' bit */
226 227
@@ -398,7 +399,7 @@ check_bug_trap(struct pt_regs *regs)
398 return 0; 399 return 0;
399} 400}
400 401
401void program_check_exception(struct pt_regs *regs) 402void __kprobes program_check_exception(struct pt_regs *regs)
402{ 403{
403 if (debugger_fault_handler(regs)) 404 if (debugger_fault_handler(regs))
404 return; 405 return;
diff --git a/arch/ppc64/kernel/vmlinux.lds.S b/arch/ppc64/kernel/vmlinux.lds.S
index 4103cc13f8d6..0306510bc4ff 100644
--- a/arch/ppc64/kernel/vmlinux.lds.S
+++ b/arch/ppc64/kernel/vmlinux.lds.S
@@ -15,6 +15,7 @@ SECTIONS
15 *(.text .text.*) 15 *(.text .text.*)
16 SCHED_TEXT 16 SCHED_TEXT
17 LOCK_TEXT 17 LOCK_TEXT
18 KPROBES_TEXT
18 *(.fixup) 19 *(.fixup)
19 . = ALIGN(4096); 20 . = ALIGN(4096);
20 _etext = .; 21 _etext = .;
diff --git a/arch/ppc64/mm/fault.c b/arch/ppc64/mm/fault.c
index 20b0f37e8bf8..772f0714a5b7 100644
--- a/arch/ppc64/mm/fault.c
+++ b/arch/ppc64/mm/fault.c
@@ -29,6 +29,7 @@
29#include <linux/interrupt.h> 29#include <linux/interrupt.h>
30#include <linux/smp_lock.h> 30#include <linux/smp_lock.h>
31#include <linux/module.h> 31#include <linux/module.h>
32#include <linux/kprobes.h>
32 33
33#include <asm/page.h> 34#include <asm/page.h>
34#include <asm/pgtable.h> 35#include <asm/pgtable.h>
@@ -84,8 +85,8 @@ static int store_updates_sp(struct pt_regs *regs)
84 * The return value is 0 if the fault was handled, or the signal 85 * The return value is 0 if the fault was handled, or the signal
85 * number if this is a kernel fault that can't be handled here. 86 * number if this is a kernel fault that can't be handled here.
86 */ 87 */
87int do_page_fault(struct pt_regs *regs, unsigned long address, 88int __kprobes do_page_fault(struct pt_regs *regs, unsigned long address,
88 unsigned long error_code) 89 unsigned long error_code)
89{ 90{
90 struct vm_area_struct * vma; 91 struct vm_area_struct * vma;
91 struct mm_struct *mm = current->mm; 92 struct mm_struct *mm = current->mm;