Skip to content

Commit 0a7601b

Browse files
hramrachmpe
authored andcommitted
powerpc/64: make buildable without CONFIG_COMPAT
There are numerous references to 32bit functions in generic and 64bit code so ifdef them out. Signed-off-by: Michal Suchanek <[email protected]> Signed-off-by: Michael Ellerman <[email protected]> Link: https://lore.kernel.org/r/e5619617020ef3a1f54f0c076e7d74cb9ec9f3bf.1584699455.git.msuchanek@suse.de
1 parent 2910428 commit 0a7601b

File tree

8 files changed

+20
-13
lines changed

8 files changed

+20
-13
lines changed

arch/powerpc/include/asm/thread_info.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -162,10 +162,10 @@ static inline bool test_thread_local_flags(unsigned int flags)
162162
return (ti->local_flags & flags) != 0;
163163
}
164164

165-
#ifdef CONFIG_PPC64
165+
#ifdef CONFIG_COMPAT
166166
#define is_32bit_task() (test_thread_flag(TIF_32BIT))
167167
#else
168-
#define is_32bit_task() (1)
168+
#define is_32bit_task() (IS_ENABLED(CONFIG_PPC32))
169169
#endif
170170

171171
#if defined(CONFIG_PPC64)

arch/powerpc/kernel/Makefile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,16 +40,17 @@ CFLAGS_btext.o += -DDISABLE_BRANCH_PROFILING
4040
endif
4141

4242
obj-y := cputable.o syscalls.o \
43-
irq.o align.o signal_32.o pmc.o vdso.o \
43+
irq.o align.o signal_$(BITS).o pmc.o vdso.o \
4444
process.o systbl.o idle.o \
4545
signal.o sysfs.o cacheinfo.o time.o \
4646
prom.o traps.o setup-common.o \
4747
udbg.o misc.o io.o misc_$(BITS).o \
4848
of_platform.o prom_parse.o
4949
obj-y += ptrace/
50-
obj-$(CONFIG_PPC64) += setup_64.o sys_ppc32.o signal_64.o \
50+
obj-$(CONFIG_PPC64) += setup_64.o \
5151
paca.o nvram_64.o firmware.o note.o \
5252
syscall_64.o
53+
obj-$(CONFIG_COMPAT) += sys_ppc32.o signal_32.o
5354
obj-$(CONFIG_VDSO32) += vdso32/
5455
obj-$(CONFIG_PPC_WATCHDOG) += watchdog.o
5556
obj-$(CONFIG_HAVE_HW_BREAKPOINT) += hw_breakpoint.o

arch/powerpc/kernel/entry_64.S

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,10 @@
5252
SYS_CALL_TABLE:
5353
.tc sys_call_table[TC],sys_call_table
5454

55+
#ifdef CONFIG_COMPAT
5556
COMPAT_SYS_CALL_TABLE:
5657
.tc compat_sys_call_table[TC],compat_sys_call_table
58+
#endif
5759

5860
/* This value is used to mark exception frames on the stack. */
5961
exception_marker:

arch/powerpc/kernel/ptrace/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
CFLAGS_ptrace-view.o += -DUTS_MACHINE='"$(UTS_MACHINE)"'
77

88
obj-y += ptrace.o ptrace-view.o
9-
obj-$(CONFIG_PPC64) += ptrace32.o
9+
obj-$(CONFIG_COMPAT) += ptrace32.o
1010
obj-$(CONFIG_VSX) += ptrace-vsx.o
1111
ifneq ($(CONFIG_VSX),y)
1212
obj-y += ptrace-novsx.o

arch/powerpc/kernel/signal.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,6 @@ static void do_signal(struct task_struct *tsk)
247247
sigset_t *oldset = sigmask_to_save();
248248
struct ksignal ksig = { .sig = 0 };
249249
int ret;
250-
int is32 = is_32bit_task();
251250

252251
BUG_ON(tsk != current);
253252

@@ -277,7 +276,7 @@ static void do_signal(struct task_struct *tsk)
277276

278277
rseq_signal_deliver(&ksig, tsk->thread.regs);
279278

280-
if (is32) {
279+
if (is_32bit_task()) {
281280
if (ksig.ka.sa.sa_flags & SA_SIGINFO)
282281
ret = handle_rt_signal32(&ksig, oldset, tsk);
283282
else

arch/powerpc/kernel/syscall_64.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ notrace long system_call_exception(long r3, long r4, long r5,
2222
long r6, long r7, long r8,
2323
unsigned long r0, struct pt_regs *regs)
2424
{
25-
unsigned long ti_flags;
2625
syscall_fn f;
2726

2827
if (IS_ENABLED(CONFIG_PPC_IRQ_SOFT_MASK_DEBUG))
@@ -60,8 +59,7 @@ notrace long system_call_exception(long r3, long r4, long r5,
6059

6160
local_irq_enable();
6261

63-
ti_flags = current_thread_info()->flags;
64-
if (unlikely(ti_flags & _TIF_SYSCALL_DOTRACE)) {
62+
if (unlikely(current_thread_info()->flags & _TIF_SYSCALL_DOTRACE)) {
6563
/*
6664
* We use the return value of do_syscall_trace_enter() as the
6765
* syscall number. If the syscall was rejected for any reason
@@ -86,7 +84,7 @@ notrace long system_call_exception(long r3, long r4, long r5,
8684
/* May be faster to do array_index_nospec? */
8785
barrier_nospec();
8886

89-
if (unlikely(ti_flags & _TIF_32BIT)) {
87+
if (unlikely(is_32bit_task())) {
9088
f = (void *)compat_sys_call_table[r0];
9189

9290
r3 &= 0x00000000ffffffffULL;

arch/powerpc/kernel/vdso.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -651,7 +651,8 @@ static void __init vdso_setup_syscall_map(void)
651651
if (sys_call_table[i] != sys_ni_syscall)
652652
vdso_data->syscall_map_64[i >> 5] |=
653653
0x80000000UL >> (i & 0x1f);
654-
if (compat_sys_call_table[i] != sys_ni_syscall)
654+
if (IS_ENABLED(CONFIG_COMPAT) &&
655+
compat_sys_call_table[i] != sys_ni_syscall)
655656
vdso_data->syscall_map_32[i >> 5] |=
656657
0x80000000UL >> (i & 0x1f);
657658
#else /* CONFIG_PPC64 */

arch/powerpc/perf/callchain.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
#include <asm/sigcontext.h>
1616
#include <asm/ucontext.h>
1717
#include <asm/vdso.h>
18-
#ifdef CONFIG_PPC64
18+
#ifdef CONFIG_COMPAT
1919
#include "../kernel/ppc32.h"
2020
#endif
2121
#include <asm/pte-walk.h>
@@ -284,6 +284,7 @@ static inline void perf_callchain_user_64(struct perf_callchain_entry_ctx *entry
284284

285285
#endif /* CONFIG_PPC64 */
286286

287+
#if defined(CONFIG_PPC32) || defined(CONFIG_COMPAT)
287288
/*
288289
* On 32-bit we just access the address and let hash_page create a
289290
* HPTE if necessary, so there is no need to fall back to reading
@@ -447,6 +448,11 @@ static void perf_callchain_user_32(struct perf_callchain_entry_ctx *entry,
447448
sp = next_sp;
448449
}
449450
}
451+
#else /* 32bit */
452+
static void perf_callchain_user_32(struct perf_callchain_entry_ctx *entry,
453+
struct pt_regs *regs)
454+
{}
455+
#endif /* 32bit */
450456

451457
void
452458
perf_callchain_user(struct perf_callchain_entry_ctx *entry, struct pt_regs *regs)

0 commit comments

Comments
 (0)