Skip to content

Commit 7622280

Browse files
chleroympe
authored andcommitted
powerpc: Move C prototypes out of asm-prototypes.h
We originally added asm-prototypes.h in commit 42f5b4c ("powerpc: Introduce asm-prototypes.h"). It's purpose was for prototypes of C functions that are only called from asm, in order to fix sparse warnings about missing prototypes. A few months later Nick added a different use case in commit 4efca4e ("kbuild: modversions for EXPORT_SYMBOL() for asm") for C prototypes for exported asm functions. This is basically the inverse of our original usage. Since then we've added various prototypes to asm-prototypes.h for both reasons, meaning we now need to unstitch it all. Dispatch prototypes of C functions into relevant headers and keep only the prototypes for functions defined in assembly. For the time being, leave prom_init() there because moving it into asm/prom.h or asm/setup.h conflicts with drivers/gpu/drm/nouveau/nvkm/subdev/bios/shadowrom.o This will be fixed later by untaggling asm/pci.h and asm/prom.h or by renaming the function in shadowrom.c Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au> Link: https://lore.kernel.org/r/62d46904eca74042097acf4cb12c175e3067f3d1.1646413435.git.christophe.leroy@csgroup.eu
1 parent a4abd55 commit 7622280

29 files changed

Lines changed: 43 additions & 69 deletions

arch/powerpc/include/asm/asm-prototypes.h

Lines changed: 0 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -19,19 +19,6 @@
1919

2020
#include <uapi/asm/ucontext.h>
2121

22-
/* SMP */
23-
extern struct task_struct *secondary_current;
24-
void start_secondary(void *unused);
25-
26-
/* kexec */
27-
struct kimage;
28-
void kexec_copy_flush(struct kimage *image);
29-
30-
/* pseries hcall tracing */
31-
extern struct static_key hcall_tracepoint_key;
32-
void __trace_hcall_entry(unsigned long opcode, unsigned long *args);
33-
void __trace_hcall_exit(long opcode, long retval, unsigned long *retbuf);
34-
3522
/* Ultravisor */
3623
#if defined(CONFIG_PPC_POWERNV) || defined(CONFIG_PPC_SVM)
3724
long ucall_norets(unsigned long opcode, ...);
@@ -47,43 +34,12 @@ int64_t __opal_call(int64_t a0, int64_t a1, int64_t a2, int64_t a3,
4734
int64_t a4, int64_t a5, int64_t a6, int64_t a7,
4835
int64_t opcode, uint64_t msr);
4936

50-
/* VMX copying */
51-
int enter_vmx_usercopy(void);
52-
int exit_vmx_usercopy(void);
53-
int enter_vmx_ops(void);
54-
void *exit_vmx_ops(void *dest);
55-
56-
/* signals, syscalls and interrupts */
57-
#ifdef CONFIG_PPC32
58-
int
59-
ppc_select(int n, fd_set __user *inp, fd_set __user *outp, fd_set __user *exp,
60-
struct __kernel_old_timeval __user *tvp);
61-
unsigned long __init early_init(unsigned long dt_ptr);
62-
void __init machine_init(u64 dt_ptr);
63-
#endif
64-
long system_call_exception(long r3, long r4, long r5, long r6, long r7, long r8, unsigned long r0, struct pt_regs *regs);
65-
notrace unsigned long syscall_exit_prepare(unsigned long r3, struct pt_regs *regs, long scv);
66-
notrace unsigned long interrupt_exit_user_prepare(struct pt_regs *regs);
67-
notrace unsigned long interrupt_exit_kernel_prepare(struct pt_regs *regs);
68-
#ifdef CONFIG_PPC64
69-
unsigned long syscall_exit_restart(unsigned long r3, struct pt_regs *regs);
70-
unsigned long interrupt_exit_user_restart(struct pt_regs *regs);
71-
unsigned long interrupt_exit_kernel_restart(struct pt_regs *regs);
72-
#endif
73-
74-
long ppc_fadvise64_64(int fd, int advice, u32 offset_high, u32 offset_low,
75-
u32 len_high, u32 len_low);
76-
7737
/* prom_init (OpenFirmware) */
7838
unsigned long __init prom_init(unsigned long r3, unsigned long r4,
7939
unsigned long pp,
8040
unsigned long r6, unsigned long r7,
8141
unsigned long kbase);
8242

83-
/* setup */
84-
void __init early_setup(unsigned long dt_ptr);
85-
void early_setup_secondary(void);
86-
8743
/* misc runtime */
8844
extern u64 __bswapdi2(u64);
8945
extern s64 __lshrdi3(s64, int);
@@ -94,11 +50,6 @@ extern int __ucmpdi2(u64, u64);
9450

9551
/* tracing */
9652
void _mcount(void);
97-
unsigned long prepare_ftrace_return(unsigned long parent, unsigned long ip,
98-
unsigned long sp);
99-
100-
void pnv_power9_force_smt4_catch(void);
101-
void pnv_power9_force_smt4_release(void);
10253

10354
/* Transaction memory related */
10455
void tm_enable(void);

arch/powerpc/include/asm/ftrace.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ static inline unsigned long ftrace_call_adjust(unsigned long addr)
1919
return addr;
2020
}
2121

22+
unsigned long prepare_ftrace_return(unsigned long parent, unsigned long ip,
23+
unsigned long sp);
24+
2225
struct dyn_arch_ftrace {
2326
struct module *mod;
2427
};

arch/powerpc/include/asm/hvcall.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -501,6 +501,11 @@ long plpar_hcall_raw(unsigned long opcode, unsigned long *retbuf, ...);
501501
long plpar_hcall9(unsigned long opcode, unsigned long *retbuf, ...);
502502
long plpar_hcall9_raw(unsigned long opcode, unsigned long *retbuf, ...);
503503

504+
/* pseries hcall tracing */
505+
extern struct static_key hcall_tracepoint_key;
506+
void __trace_hcall_entry(unsigned long opcode, unsigned long *args);
507+
void __trace_hcall_exit(long opcode, long retval, unsigned long *retbuf);
508+
504509
struct hvcall_mpp_data {
505510
unsigned long entitled_mem;
506511
unsigned long mapped_mem;

arch/powerpc/include/asm/interrupt.h

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -636,6 +636,17 @@ static inline void interrupt_cond_local_irq_enable(struct pt_regs *regs)
636636
local_irq_enable();
637637
}
638638

639+
long system_call_exception(long r3, long r4, long r5, long r6, long r7, long r8,
640+
unsigned long r0, struct pt_regs *regs);
641+
notrace unsigned long syscall_exit_prepare(unsigned long r3, struct pt_regs *regs, long scv);
642+
notrace unsigned long interrupt_exit_user_prepare(struct pt_regs *regs);
643+
notrace unsigned long interrupt_exit_kernel_prepare(struct pt_regs *regs);
644+
#ifdef CONFIG_PPC64
645+
unsigned long syscall_exit_restart(unsigned long r3, struct pt_regs *regs);
646+
unsigned long interrupt_exit_user_restart(struct pt_regs *regs);
647+
unsigned long interrupt_exit_kernel_restart(struct pt_regs *regs);
648+
#endif
649+
639650
#endif /* __ASSEMBLY__ */
640651

641652
#endif /* _ASM_POWERPC_INTERRUPT_H */

arch/powerpc/include/asm/kexec.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,8 @@ static inline bool kdump_in_progress(void)
9696
void relocate_new_kernel(unsigned long indirection_page, unsigned long reboot_code_buffer,
9797
unsigned long start_address) __noreturn;
9898

99+
void kexec_copy_flush(struct kimage *image);
100+
99101
#ifdef CONFIG_KEXEC_FILE
100102
extern const struct kexec_file_ops kexec_elf64_ops;
101103

arch/powerpc/include/asm/processor.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -411,6 +411,8 @@ extern int powersave_nap; /* set if nap mode can be used in idle loop */
411411
extern void power7_idle_type(unsigned long type);
412412
extern void arch300_idle_type(unsigned long stop_psscr_val,
413413
unsigned long stop_psscr_mask);
414+
void pnv_power9_force_smt4_catch(void);
415+
void pnv_power9_force_smt4_release(void);
414416

415417
extern int fix_alignment(struct pt_regs *);
416418

@@ -427,6 +429,12 @@ extern int fix_alignment(struct pt_regs *);
427429

428430
int do_mathemu(struct pt_regs *regs);
429431

432+
/* VMX copying */
433+
int enter_vmx_usercopy(void);
434+
int exit_vmx_usercopy(void);
435+
int enter_vmx_ops(void);
436+
void *exit_vmx_ops(void *dest);
437+
430438
#endif /* __KERNEL__ */
431439
#endif /* __ASSEMBLY__ */
432440
#endif /* _ASM_POWERPC_PROCESSOR_H */

arch/powerpc/include/asm/setup.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,13 @@ static inline void setup_spectre_v2(void) {}
7676
#endif
7777
void __init do_btb_flush_fixups(void);
7878

79+
#ifdef CONFIG_PPC32
80+
unsigned long __init early_init(unsigned long dt_ptr);
81+
void __init machine_init(u64 dt_ptr);
82+
#endif
83+
void __init early_setup(unsigned long dt_ptr);
84+
void early_setup_secondary(void);
85+
7986
#endif /* !__ASSEMBLY__ */
8087

8188
#endif /* _ASM_POWERPC_SETUP_H */

arch/powerpc/include/asm/smp.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,9 @@ struct smp_ops_t {
6060
#endif
6161
};
6262

63+
extern struct task_struct *secondary_current;
64+
65+
void start_secondary(void *unused);
6366
extern int smp_send_nmi_ipi(int cpu, void (*fn)(struct pt_regs *), u64 delay_us);
6467
extern int smp_send_safe_nmi_ipi(int cpu, void (*fn)(struct pt_regs *), u64 delay_us);
6568
extern void smp_send_debugger_break(void);

arch/powerpc/include/asm/syscalls.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@ asmlinkage long sys_mmap2(unsigned long addr, size_t len,
1818
unsigned long fd, unsigned long pgoff);
1919
asmlinkage long ppc64_personality(unsigned long personality);
2020
asmlinkage long sys_rtas(struct rtas_args __user *uargs);
21+
int ppc_select(int n, fd_set __user *inp, fd_set __user *outp,
22+
fd_set __user *exp, struct __kernel_old_timeval __user *tvp);
23+
long ppc_fadvise64_64(int fd, int advice, u32 offset_high, u32 offset_low,
24+
u32 len_high, u32 len_low);
2125

2226
#ifdef CONFIG_COMPAT
2327
unsigned long compat_sys_mmap2(unsigned long addr, size_t len,

arch/powerpc/kernel/early_32.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
#include <linux/kernel.h>
99
#include <asm/setup.h>
1010
#include <asm/sections.h>
11-
#include <asm/asm-prototypes.h>
1211

1312
/*
1413
* We're called here very early in the boot.

0 commit comments

Comments
 (0)