diff options
Diffstat (limited to 'arch/ppc64/kernel')
-rw-r--r-- | arch/ppc64/kernel/process.c | 34 | ||||
-rw-r--r-- | arch/ppc64/kernel/ptrace.c | 13 | ||||
-rw-r--r-- | arch/ppc64/kernel/ptrace32.c | 13 | ||||
-rw-r--r-- | arch/ppc64/kernel/ras.c | 2 | ||||
-rw-r--r-- | arch/ppc64/kernel/signal.c | 9 | ||||
-rw-r--r-- | arch/ppc64/kernel/signal32.c | 8 |
6 files changed, 77 insertions, 2 deletions
diff --git a/arch/ppc64/kernel/process.c b/arch/ppc64/kernel/process.c index 7a7e027653ad..887005358eb1 100644 --- a/arch/ppc64/kernel/process.c +++ b/arch/ppc64/kernel/process.c | |||
@@ -54,6 +54,7 @@ | |||
54 | #include <asm/sections.h> | 54 | #include <asm/sections.h> |
55 | #include <asm/tlbflush.h> | 55 | #include <asm/tlbflush.h> |
56 | #include <asm/time.h> | 56 | #include <asm/time.h> |
57 | #include <asm/plpar_wrappers.h> | ||
57 | 58 | ||
58 | #ifndef CONFIG_SMP | 59 | #ifndef CONFIG_SMP |
59 | struct task_struct *last_task_used_math = NULL; | 60 | struct task_struct *last_task_used_math = NULL; |
@@ -163,7 +164,30 @@ int dump_task_altivec(struct pt_regs *regs, elf_vrregset_t *vrregs) | |||
163 | 164 | ||
164 | #endif /* CONFIG_ALTIVEC */ | 165 | #endif /* CONFIG_ALTIVEC */ |
165 | 166 | ||
167 | static void set_dabr_spr(unsigned long val) | ||
168 | { | ||
169 | mtspr(SPRN_DABR, val); | ||
170 | } | ||
171 | |||
172 | int set_dabr(unsigned long dabr) | ||
173 | { | ||
174 | int ret = 0; | ||
175 | |||
176 | if (firmware_has_feature(FW_FEATURE_XDABR)) { | ||
177 | /* We want to catch accesses from kernel and userspace */ | ||
178 | unsigned long flags = H_DABRX_KERNEL|H_DABRX_USER; | ||
179 | ret = plpar_set_xdabr(dabr, flags); | ||
180 | } else if (firmware_has_feature(FW_FEATURE_DABR)) { | ||
181 | ret = plpar_set_dabr(dabr); | ||
182 | } else { | ||
183 | set_dabr_spr(dabr); | ||
184 | } | ||
185 | |||
186 | return ret; | ||
187 | } | ||
188 | |||
166 | DEFINE_PER_CPU(struct cpu_usage, cpu_usage_array); | 189 | DEFINE_PER_CPU(struct cpu_usage, cpu_usage_array); |
190 | static DEFINE_PER_CPU(unsigned long, current_dabr); | ||
167 | 191 | ||
168 | struct task_struct *__switch_to(struct task_struct *prev, | 192 | struct task_struct *__switch_to(struct task_struct *prev, |
169 | struct task_struct *new) | 193 | struct task_struct *new) |
@@ -198,6 +222,11 @@ struct task_struct *__switch_to(struct task_struct *prev, | |||
198 | new->thread.regs->msr |= MSR_VEC; | 222 | new->thread.regs->msr |= MSR_VEC; |
199 | #endif /* CONFIG_ALTIVEC */ | 223 | #endif /* CONFIG_ALTIVEC */ |
200 | 224 | ||
225 | if (unlikely(__get_cpu_var(current_dabr) != new->thread.dabr)) { | ||
226 | set_dabr(new->thread.dabr); | ||
227 | __get_cpu_var(current_dabr) = new->thread.dabr; | ||
228 | } | ||
229 | |||
201 | flush_tlb_pending(); | 230 | flush_tlb_pending(); |
202 | 231 | ||
203 | new_thread = &new->thread; | 232 | new_thread = &new->thread; |
@@ -334,6 +363,11 @@ void flush_thread(void) | |||
334 | last_task_used_altivec = NULL; | 363 | last_task_used_altivec = NULL; |
335 | #endif /* CONFIG_ALTIVEC */ | 364 | #endif /* CONFIG_ALTIVEC */ |
336 | #endif /* CONFIG_SMP */ | 365 | #endif /* CONFIG_SMP */ |
366 | |||
367 | if (current->thread.dabr) { | ||
368 | current->thread.dabr = 0; | ||
369 | set_dabr(0); | ||
370 | } | ||
337 | } | 371 | } |
338 | 372 | ||
339 | void | 373 | void |
diff --git a/arch/ppc64/kernel/ptrace.c b/arch/ppc64/kernel/ptrace.c index bf7116d4c4c2..85ed3188a91d 100644 --- a/arch/ppc64/kernel/ptrace.c +++ b/arch/ppc64/kernel/ptrace.c | |||
@@ -207,6 +207,19 @@ int sys_ptrace(long request, long pid, long addr, long data) | |||
207 | break; | 207 | break; |
208 | } | 208 | } |
209 | 209 | ||
210 | case PTRACE_GET_DEBUGREG: { | ||
211 | ret = -EINVAL; | ||
212 | /* We only support one DABR and no IABRS at the moment */ | ||
213 | if (addr > 0) | ||
214 | break; | ||
215 | ret = put_user(child->thread.dabr, | ||
216 | (unsigned long __user *)data); | ||
217 | break; | ||
218 | } | ||
219 | |||
220 | case PTRACE_SET_DEBUGREG: | ||
221 | ret = ptrace_set_debugreg(child, addr, data); | ||
222 | |||
210 | case PTRACE_DETACH: | 223 | case PTRACE_DETACH: |
211 | ret = ptrace_detach(child, data); | 224 | ret = ptrace_detach(child, data); |
212 | break; | 225 | break; |
diff --git a/arch/ppc64/kernel/ptrace32.c b/arch/ppc64/kernel/ptrace32.c index cbb1e0fb8813..fb8c22d6084a 100644 --- a/arch/ppc64/kernel/ptrace32.c +++ b/arch/ppc64/kernel/ptrace32.c | |||
@@ -338,6 +338,19 @@ int sys32_ptrace(long request, long pid, unsigned long addr, unsigned long data) | |||
338 | break; | 338 | break; |
339 | } | 339 | } |
340 | 340 | ||
341 | case PTRACE_GET_DEBUGREG: { | ||
342 | ret = -EINVAL; | ||
343 | /* We only support one DABR and no IABRS at the moment */ | ||
344 | if (addr > 0) | ||
345 | break; | ||
346 | ret = put_user(child->thread.dabr, (u32 __user *)data); | ||
347 | break; | ||
348 | } | ||
349 | |||
350 | case PTRACE_SET_DEBUGREG: | ||
351 | ret = ptrace_set_debugreg(child, addr, data); | ||
352 | break; | ||
353 | |||
341 | case PTRACE_DETACH: | 354 | case PTRACE_DETACH: |
342 | ret = ptrace_detach(child, data); | 355 | ret = ptrace_detach(child, data); |
343 | break; | 356 | break; |
diff --git a/arch/ppc64/kernel/ras.c b/arch/ppc64/kernel/ras.c index 3c00f7bfc1b5..41b97dc9cc0a 100644 --- a/arch/ppc64/kernel/ras.c +++ b/arch/ppc64/kernel/ras.c | |||
@@ -59,8 +59,6 @@ char mce_data_buf[RTAS_ERROR_LOG_MAX] | |||
59 | /* This is true if we are using the firmware NMI handler (typically LPAR) */ | 59 | /* This is true if we are using the firmware NMI handler (typically LPAR) */ |
60 | extern int fwnmi_active; | 60 | extern int fwnmi_active; |
61 | 61 | ||
62 | extern void _exception(int signr, struct pt_regs *regs, int code, unsigned long addr); | ||
63 | |||
64 | static int ras_get_sensor_state_token; | 62 | static int ras_get_sensor_state_token; |
65 | static int ras_check_exception_token; | 63 | static int ras_check_exception_token; |
66 | 64 | ||
diff --git a/arch/ppc64/kernel/signal.c b/arch/ppc64/kernel/signal.c index 49a79a55c32d..347112cca3c0 100644 --- a/arch/ppc64/kernel/signal.c +++ b/arch/ppc64/kernel/signal.c | |||
@@ -550,6 +550,15 @@ int do_signal(sigset_t *oldset, struct pt_regs *regs) | |||
550 | /* Whee! Actually deliver the signal. */ | 550 | /* Whee! Actually deliver the signal. */ |
551 | if (TRAP(regs) == 0x0C00) | 551 | if (TRAP(regs) == 0x0C00) |
552 | syscall_restart(regs, &ka); | 552 | syscall_restart(regs, &ka); |
553 | |||
554 | /* | ||
555 | * Reenable the DABR before delivering the signal to | ||
556 | * user space. The DABR will have been cleared if it | ||
557 | * triggered inside the kernel. | ||
558 | */ | ||
559 | if (current->thread.dabr) | ||
560 | set_dabr(current->thread.dabr); | ||
561 | |||
553 | return handle_signal(signr, &ka, &info, oldset, regs); | 562 | return handle_signal(signr, &ka, &info, oldset, regs); |
554 | } | 563 | } |
555 | 564 | ||
diff --git a/arch/ppc64/kernel/signal32.c b/arch/ppc64/kernel/signal32.c index 46f4d6cc7fc9..a8b7a5a56bb4 100644 --- a/arch/ppc64/kernel/signal32.c +++ b/arch/ppc64/kernel/signal32.c | |||
@@ -970,6 +970,14 @@ int do_signal32(sigset_t *oldset, struct pt_regs *regs) | |||
970 | newsp = regs->gpr[1]; | 970 | newsp = regs->gpr[1]; |
971 | newsp &= ~0xfUL; | 971 | newsp &= ~0xfUL; |
972 | 972 | ||
973 | /* | ||
974 | * Reenable the DABR before delivering the signal to | ||
975 | * user space. The DABR will have been cleared if it | ||
976 | * triggered inside the kernel. | ||
977 | */ | ||
978 | if (current->thread.dabr) | ||
979 | set_dabr(current->thread.dabr); | ||
980 | |||
973 | /* Whee! Actually deliver the signal. */ | 981 | /* Whee! Actually deliver the signal. */ |
974 | if (ka.sa.sa_flags & SA_SIGINFO) | 982 | if (ka.sa.sa_flags & SA_SIGINFO) |
975 | ret = handle_rt_signal32(signr, &ka, &info, oldset, regs, newsp); | 983 | ret = handle_rt_signal32(signr, &ka, &info, oldset, regs, newsp); |