powerpc/ptrace: drop unnecessary #ifdefs CONFIG_PPC64

Drop a bunch of #ifdefs CONFIG_PPC64 that are not vital.

Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/af38b87a7e1e3efe4f9b664eaeb029e6e7d69fdb.1582848567.git.christophe.leroy@c-s.fr
This commit is contained in:
Christophe Leroy 2020-02-28 00:14:39 +00:00 committed by Michael Ellerman
parent b3138536c8
commit f1763e623c
2 changed files with 5 additions and 15 deletions

View File

@ -279,6 +279,8 @@ static inline unsigned long regs_get_kernel_stack_nth(struct pt_regs *regs,
#endif /* __ASSEMBLY__ */ #endif /* __ASSEMBLY__ */
#ifndef __powerpc64__ #ifndef __powerpc64__
/* We need PT_SOFTE defined at all time to avoid #ifdefs */
#define PT_SOFTE PT_MQ
#else /* __powerpc64__ */ #else /* __powerpc64__ */
#define PT_FPSCR32 (PT_FPR0 + 2*32 + 1) /* each FP reg occupies 2 32-bit userspace slots */ #define PT_FPSCR32 (PT_FPR0 + 2*32 + 1) /* each FP reg occupies 2 32-bit userspace slots */
#define PT_VR0_32 164 /* each Vector reg occupies 4 slots in 32-bit */ #define PT_VR0_32 164 /* each Vector reg occupies 4 slots in 32-bit */

View File

@ -274,17 +274,15 @@ int ptrace_get_reg(struct task_struct *task, int regno, unsigned long *data)
if (regno == PT_DSCR) if (regno == PT_DSCR)
return get_user_dscr(task, data); return get_user_dscr(task, data);
#ifdef CONFIG_PPC64
/* /*
* softe copies paca->irq_soft_mask variable state. Since irq_soft_mask is * softe copies paca->irq_soft_mask variable state. Since irq_soft_mask is
* no more used as a flag, lets force usr to alway see the softe value as 1 * no more used as a flag, lets force usr to alway see the softe value as 1
* which means interrupts are not soft disabled. * which means interrupts are not soft disabled.
*/ */
if (regno == PT_SOFTE) { if (IS_ENABLED(CONFIG_PPC64) && regno == PT_SOFTE) {
*data = 1; *data = 1;
return 0; return 0;
} }
#endif
regs_max = sizeof(struct user_pt_regs) / sizeof(unsigned long); regs_max = sizeof(struct user_pt_regs) / sizeof(unsigned long);
if (regno < regs_max) { if (regno < regs_max) {
@ -1998,7 +1996,6 @@ static const struct user_regset_view user_ppc_native_view = {
.regsets = native_regsets, .n = ARRAY_SIZE(native_regsets) .regsets = native_regsets, .n = ARRAY_SIZE(native_regsets)
}; };
#ifdef CONFIG_PPC64
#include <linux/compat.h> #include <linux/compat.h>
static int gpr32_get_common(struct task_struct *target, static int gpr32_get_common(struct task_struct *target,
@ -2272,14 +2269,11 @@ static const struct user_regset_view user_ppc_compat_view = {
.name = "ppc", .e_machine = EM_PPC, .ei_osabi = ELF_OSABI, .name = "ppc", .e_machine = EM_PPC, .ei_osabi = ELF_OSABI,
.regsets = compat_regsets, .n = ARRAY_SIZE(compat_regsets) .regsets = compat_regsets, .n = ARRAY_SIZE(compat_regsets)
}; };
#endif /* CONFIG_PPC64 */
const struct user_regset_view *task_user_regset_view(struct task_struct *task) const struct user_regset_view *task_user_regset_view(struct task_struct *task)
{ {
#ifdef CONFIG_PPC64 if (IS_ENABLED(CONFIG_PPC64) && test_tsk_thread_flag(task, TIF_32BIT))
if (test_tsk_thread_flag(task, TIF_32BIT))
return &user_ppc_compat_view; return &user_ppc_compat_view;
#endif
return &user_ppc_native_view; return &user_ppc_native_view;
} }
@ -3063,11 +3057,7 @@ long arch_ptrace(struct task_struct *child, long request,
else else
dbginfo.num_data_bps = 0; dbginfo.num_data_bps = 0;
dbginfo.num_condition_regs = 0; dbginfo.num_condition_regs = 0;
#ifdef CONFIG_PPC64 dbginfo.data_bp_alignment = sizeof(long);
dbginfo.data_bp_alignment = 8;
#else
dbginfo.data_bp_alignment = 4;
#endif
dbginfo.sizeof_condition = 0; dbginfo.sizeof_condition = 0;
#ifdef CONFIG_HAVE_HW_BREAKPOINT #ifdef CONFIG_HAVE_HW_BREAKPOINT
dbginfo.features = PPC_DEBUG_FEATURE_DATA_BP_RANGE; dbginfo.features = PPC_DEBUG_FEATURE_DATA_BP_RANGE;
@ -3304,12 +3294,10 @@ long do_syscall_trace_enter(struct pt_regs *regs)
if (unlikely(test_thread_flag(TIF_SYSCALL_TRACEPOINT))) if (unlikely(test_thread_flag(TIF_SYSCALL_TRACEPOINT)))
trace_sys_enter(regs, regs->gpr[0]); trace_sys_enter(regs, regs->gpr[0]);
#ifdef CONFIG_PPC64
if (!is_32bit_task()) if (!is_32bit_task())
audit_syscall_entry(regs->gpr[0], regs->gpr[3], regs->gpr[4], audit_syscall_entry(regs->gpr[0], regs->gpr[3], regs->gpr[4],
regs->gpr[5], regs->gpr[6]); regs->gpr[5], regs->gpr[6]);
else else
#endif
audit_syscall_entry(regs->gpr[0], audit_syscall_entry(regs->gpr[0],
regs->gpr[3] & 0xffffffff, regs->gpr[3] & 0xffffffff,
regs->gpr[4] & 0xffffffff, regs->gpr[4] & 0xffffffff,