Re: [PATCH v1 4/4] powerpc: Move C prototypes out of asm-prototypes.h

2022-03-08 Thread Michael Ellerman
Christophe Leroy  writes:
> Le 04/03/2022 à 18:04, Christophe Leroy a écrit :
>> We originally added asm-prototypes.h in commit 42f5b4cacd78 ("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 4efca4ed05cb ("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 
>> ---
>>   arch/powerpc/include/asm/asm-prototypes.h | 51 ---
>>   arch/powerpc/include/asm/ftrace.h |  3 ++
>>   arch/powerpc/include/asm/hvcall.h |  5 ++
>>   arch/powerpc/include/asm/interrupt.h  | 11 
>>   arch/powerpc/include/asm/kexec.h  |  2 +
>>   arch/powerpc/include/asm/processor.h  |  8 +++
>>   arch/powerpc/include/asm/setup.h  |  7 +++
>>   arch/powerpc/include/asm/smp.h|  3 ++
>>   arch/powerpc/include/asm/syscalls.h   |  4 ++
>>   arch/powerpc/kernel/early_32.c|  1 -
>>   arch/powerpc/kernel/interrupt.c   |  1 -
>>   arch/powerpc/kernel/irq.c |  1 -
>>   arch/powerpc/kernel/mce.c |  1 -
>>   arch/powerpc/kernel/prom_init.c   |  1 -
>>   arch/powerpc/kernel/ptrace/ptrace.c   |  1 -
>>   arch/powerpc/kernel/setup_64.c|  1 -
>>   arch/powerpc/kernel/smp.c |  1 -
>>   arch/powerpc/kernel/syscalls.c|  1 -
>>   arch/powerpc/kernel/tau_6xx.c |  1 -
>>   arch/powerpc/kernel/time.c|  1 -
>>   arch/powerpc/kernel/trace/ftrace.c|  1 -
>>   arch/powerpc/kexec/core_64.c  |  1 -
>>   arch/powerpc/kvm/book3s_hv_builtin.c  |  1 -
>>   arch/powerpc/kvm/book3s_hv_rm_xive.c  |  1 -
>>   arch/powerpc/lib/vmx-helper.c |  1 -
>>   arch/powerpc/mm/book3s64/slb.c|  1 -
>>   arch/powerpc/mm/fault.c   |  1 -
>>   arch/powerpc/platforms/powernv/idle.c |  1 -
>>   .../platforms/powernv/opal-tracepoints.c  |  1 -
>>   arch/powerpc/platforms/pseries/lpar.c |  1 -
>>   30 files changed, 43 insertions(+), 72 deletions(-)
>> 
>> diff --git a/arch/powerpc/kernel/prom_init.c 
>> b/arch/powerpc/kernel/prom_init.c
>> index 0ac5faacc909..3b49065daf21 100644
>> --- a/arch/powerpc/kernel/prom_init.c
>> +++ b/arch/powerpc/kernel/prom_init.c
>> @@ -41,7 +41,6 @@
>>   #include 
>>   #include 
>>   #include 
>> -#include 
>
> Need to keep this include as prom_init() couldn't be moved to asm/prom.h 
> due to conflict with drivers/gpu/drm/nouveau/nvkm/subdev/bios/shadowrom.c
>
> Can you fix it ?

Yep, done.

cheers


Re: [PATCH v1 4/4] powerpc: Move C prototypes out of asm-prototypes.h

2022-03-08 Thread Christophe Leroy
Hi again Michael,

Le 04/03/2022 à 18:04, Christophe Leroy a écrit :
> We originally added asm-prototypes.h in commit 42f5b4cacd78 ("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 4efca4ed05cb ("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 
> ---
>   arch/powerpc/include/asm/asm-prototypes.h | 51 ---
>   arch/powerpc/include/asm/ftrace.h |  3 ++
>   arch/powerpc/include/asm/hvcall.h |  5 ++
>   arch/powerpc/include/asm/interrupt.h  | 11 
>   arch/powerpc/include/asm/kexec.h  |  2 +
>   arch/powerpc/include/asm/processor.h  |  8 +++
>   arch/powerpc/include/asm/setup.h  |  7 +++
>   arch/powerpc/include/asm/smp.h|  3 ++
>   arch/powerpc/include/asm/syscalls.h   |  4 ++
>   arch/powerpc/kernel/early_32.c|  1 -
>   arch/powerpc/kernel/interrupt.c   |  1 -
>   arch/powerpc/kernel/irq.c |  1 -
>   arch/powerpc/kernel/mce.c |  1 -
>   arch/powerpc/kernel/prom_init.c   |  1 -
>   arch/powerpc/kernel/ptrace/ptrace.c   |  1 -
>   arch/powerpc/kernel/setup_64.c|  1 -
>   arch/powerpc/kernel/smp.c |  1 -
>   arch/powerpc/kernel/syscalls.c|  1 -
>   arch/powerpc/kernel/tau_6xx.c |  1 -
>   arch/powerpc/kernel/time.c|  1 -
>   arch/powerpc/kernel/trace/ftrace.c|  1 -
>   arch/powerpc/kexec/core_64.c  |  1 -
>   arch/powerpc/kvm/book3s_hv_builtin.c  |  1 -
>   arch/powerpc/kvm/book3s_hv_rm_xive.c  |  1 -
>   arch/powerpc/lib/vmx-helper.c |  1 -
>   arch/powerpc/mm/book3s64/slb.c|  1 -
>   arch/powerpc/mm/fault.c   |  1 -
>   arch/powerpc/platforms/powernv/idle.c |  1 -
>   .../platforms/powernv/opal-tracepoints.c  |  1 -
>   arch/powerpc/platforms/pseries/lpar.c |  1 -
>   30 files changed, 43 insertions(+), 72 deletions(-)
> 
> diff --git a/arch/powerpc/kernel/prom_init.c b/arch/powerpc/kernel/prom_init.c
> index 0ac5faacc909..3b49065daf21 100644
> --- a/arch/powerpc/kernel/prom_init.c
> +++ b/arch/powerpc/kernel/prom_init.c
> @@ -41,7 +41,6 @@
>   #include 
>   #include 
>   #include 
> -#include 

Need to keep this include as prom_init() couldn't be moved to asm/prom.h 
due to conflict with drivers/gpu/drm/nouveau/nvkm/subdev/bios/shadowrom.c

Can you fix it ?

>   #include 
>   
>   #include 

[PATCH v1 4/4] powerpc: Move C prototypes out of asm-prototypes.h

2022-03-04 Thread Christophe Leroy
We originally added asm-prototypes.h in commit 42f5b4cacd78 ("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 4efca4ed05cb ("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 
---
 arch/powerpc/include/asm/asm-prototypes.h | 51 ---
 arch/powerpc/include/asm/ftrace.h |  3 ++
 arch/powerpc/include/asm/hvcall.h |  5 ++
 arch/powerpc/include/asm/interrupt.h  | 11 
 arch/powerpc/include/asm/kexec.h  |  2 +
 arch/powerpc/include/asm/processor.h  |  8 +++
 arch/powerpc/include/asm/setup.h  |  7 +++
 arch/powerpc/include/asm/smp.h|  3 ++
 arch/powerpc/include/asm/syscalls.h   |  4 ++
 arch/powerpc/kernel/early_32.c|  1 -
 arch/powerpc/kernel/interrupt.c   |  1 -
 arch/powerpc/kernel/irq.c |  1 -
 arch/powerpc/kernel/mce.c |  1 -
 arch/powerpc/kernel/prom_init.c   |  1 -
 arch/powerpc/kernel/ptrace/ptrace.c   |  1 -
 arch/powerpc/kernel/setup_64.c|  1 -
 arch/powerpc/kernel/smp.c |  1 -
 arch/powerpc/kernel/syscalls.c|  1 -
 arch/powerpc/kernel/tau_6xx.c |  1 -
 arch/powerpc/kernel/time.c|  1 -
 arch/powerpc/kernel/trace/ftrace.c|  1 -
 arch/powerpc/kexec/core_64.c  |  1 -
 arch/powerpc/kvm/book3s_hv_builtin.c  |  1 -
 arch/powerpc/kvm/book3s_hv_rm_xive.c  |  1 -
 arch/powerpc/lib/vmx-helper.c |  1 -
 arch/powerpc/mm/book3s64/slb.c|  1 -
 arch/powerpc/mm/fault.c   |  1 -
 arch/powerpc/platforms/powernv/idle.c |  1 -
 .../platforms/powernv/opal-tracepoints.c  |  1 -
 arch/powerpc/platforms/pseries/lpar.c |  1 -
 30 files changed, 43 insertions(+), 72 deletions(-)

diff --git a/arch/powerpc/include/asm/asm-prototypes.h 
b/arch/powerpc/include/asm/asm-prototypes.h
index 83ef106923e6..65b7de62f7ec 100644
--- a/arch/powerpc/include/asm/asm-prototypes.h
+++ b/arch/powerpc/include/asm/asm-prototypes.h
@@ -19,19 +19,6 @@
 
 #include 
 
-/* SMP */
-extern struct task_struct *secondary_current;
-void start_secondary(void *unused);
-
-/* kexec */
-struct kimage;
-void kexec_copy_flush(struct kimage *image);
-
-/* pseries hcall tracing */
-extern struct static_key hcall_tracepoint_key;
-void __trace_hcall_entry(unsigned long opcode, unsigned long *args);
-void __trace_hcall_exit(long opcode, long retval, unsigned long *retbuf);
-
 /* Ultravisor */
 #if defined(CONFIG_PPC_POWERNV) || defined(CONFIG_PPC_SVM)
 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,
int64_t a4, int64_t a5, int64_t a6, int64_t a7,
int64_t opcode, uint64_t msr);
 
-/* VMX copying */
-int enter_vmx_usercopy(void);
-int exit_vmx_usercopy(void);
-int enter_vmx_ops(void);
-void *exit_vmx_ops(void *dest);
-
-/* signals, syscalls and interrupts */
-#ifdef CONFIG_PPC32
-int
-ppc_select(int n, fd_set __user *inp, fd_set __user *outp, fd_set __user *exp,
-  struct __kernel_old_timeval __user *tvp);
-unsigned long __init early_init(unsigned long dt_ptr);
-void __init machine_init(u64 dt_ptr);
-#endif
-long system_call_exception(long r3, long r4, long r5, long r6, long r7, long 
r8, unsigned long r0, struct pt_regs *regs);
-notrace unsigned long syscall_exit_prepare(unsigned long r3, struct pt_regs 
*regs, long scv);
-notrace unsigned long interrupt_exit_user_prepare(struct pt_regs *regs);
-notrace unsigned long interrupt_exit_kernel_prepare(struct pt_regs *regs);
-#ifdef CONFIG_PPC64
-unsigned long syscall_exit_restart(unsigned long r3, struct pt_regs *regs);
-unsigned long interrupt_exit_user_restart(struct pt_regs *regs);
-unsigned long interrupt_exit_kernel_restart(struct pt_regs *regs);
-#endif
-
-long ppc_fadvise64_64(int fd, int advice, u32 offset_high, u32 offset_low,
- u32 len_high, u32 len_low);
-
 /* prom_init (OpenFirmware) */
 unsigned long __init prom_init(unsigned long r3, unsigned long