All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/4] powerpc/sparse: make some things static
@ 2016-05-18  1:16 Daniel Axtens
  2016-05-18  1:16 ` [PATCH 2/4] powerpc: Introduce asm-prototypes.h Daniel Axtens
                   ` (3 more replies)
  0 siblings, 4 replies; 12+ messages in thread
From: Daniel Axtens @ 2016-05-18  1:16 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: mpe, Daniel Axtens

This is just a smattering of things picked up by sparse that should
be made static.

Signed-off-by: Daniel Axtens <dja@axtens.net>
---
 arch/powerpc/kernel/crash.c                     | 2 +-
 arch/powerpc/kernel/sysfs.c                     | 2 +-
 arch/powerpc/platforms/powernv/idle.c           | 2 +-
 arch/powerpc/platforms/pseries/pseries_energy.c | 8 ++++----
 4 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/arch/powerpc/kernel/crash.c b/arch/powerpc/kernel/crash.c
index 2bb252c01f07..c47a1bf36403 100644
--- a/arch/powerpc/kernel/crash.c
+++ b/arch/powerpc/kernel/crash.c
@@ -65,7 +65,7 @@ static int handle_fault(struct pt_regs *regs)
 #ifdef CONFIG_SMP
 
 static atomic_t cpus_in_crash;
-void crash_ipi_callback(struct pt_regs *regs)
+static void crash_ipi_callback(struct pt_regs *regs)
 {
 	static cpumask_t cpus_state_saved = CPU_MASK_NONE;
 
diff --git a/arch/powerpc/kernel/sysfs.c b/arch/powerpc/kernel/sysfs.c
index 692873bff334..c4f1d1f7bae0 100644
--- a/arch/powerpc/kernel/sysfs.c
+++ b/arch/powerpc/kernel/sysfs.c
@@ -35,7 +35,7 @@ static DEFINE_PER_CPU(struct cpu, cpu_devices);
 #ifdef CONFIG_PPC64
 
 /* Time in microseconds we delay before sleeping in the idle loop */
-DEFINE_PER_CPU(long, smt_snooze_delay) = { 100 };
+static DEFINE_PER_CPU(long, smt_snooze_delay) = { 100 };
 
 static ssize_t store_smt_snooze_delay(struct device *dev,
 				      struct device_attribute *attr,
diff --git a/arch/powerpc/platforms/powernv/idle.c b/arch/powerpc/platforms/powernv/idle.c
index fcc8b6861b63..92a8020f3502 100644
--- a/arch/powerpc/platforms/powernv/idle.c
+++ b/arch/powerpc/platforms/powernv/idle.c
@@ -29,7 +29,7 @@
 
 static u32 supported_cpuidle_states;
 
-int pnv_save_sprs_for_winkle(void)
+static int pnv_save_sprs_for_winkle(void)
 {
 	int cpu;
 	int rc;
diff --git a/arch/powerpc/platforms/pseries/pseries_energy.c b/arch/powerpc/platforms/pseries/pseries_energy.c
index 92767791f93b..164a13d3998a 100644
--- a/arch/powerpc/platforms/pseries/pseries_energy.c
+++ b/arch/powerpc/platforms/pseries/pseries_energy.c
@@ -208,19 +208,19 @@ static ssize_t percpu_deactivate_hint_show(struct device *dev,
  *	Per-cpu value of the hint
  */
 
-struct device_attribute attr_cpu_activate_hint_list =
+static struct device_attribute attr_cpu_activate_hint_list =
 		__ATTR(pseries_activate_hint_list, 0444,
 		cpu_activate_hint_list_show, NULL);
 
-struct device_attribute attr_cpu_deactivate_hint_list =
+static struct device_attribute attr_cpu_deactivate_hint_list =
 		__ATTR(pseries_deactivate_hint_list, 0444,
 		cpu_deactivate_hint_list_show, NULL);
 
-struct device_attribute attr_percpu_activate_hint =
+static struct device_attribute attr_percpu_activate_hint =
 		__ATTR(pseries_activate_hint, 0444,
 		percpu_activate_hint_show, NULL);
 
-struct device_attribute attr_percpu_deactivate_hint =
+static struct device_attribute attr_percpu_deactivate_hint =
 		__ATTR(pseries_deactivate_hint, 0444,
 		percpu_deactivate_hint_show, NULL);
 
-- 
2.5.0

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH 2/4] powerpc: Introduce asm-prototypes.h
  2016-05-18  1:16 [PATCH 1/4] powerpc/sparse: make some things static Daniel Axtens
@ 2016-05-18  1:16 ` Daniel Axtens
  2016-06-21  0:40   ` [2/4] " Michael Ellerman
  2020-08-14  9:34   ` [PATCH 2/4] " Christophe Leroy
  2016-05-18  1:16 ` [PATCH 3/4] powerpc/sparse: Include headers containing prototypes Daniel Axtens
                   ` (2 subsequent siblings)
  3 siblings, 2 replies; 12+ messages in thread
From: Daniel Axtens @ 2016-05-18  1:16 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: mpe, Daniel Axtens

Sparse picked up a number of functions that are implemented in C and
then only referred to in asm code.

This introduces asm-prototypes.h, which provides a place for
prototypes of these functions.

This silences some sparse warnings.

Signed-off-by: Daniel Axtens <dja@axtens.net>
---
 arch/powerpc/include/asm/asm-prototypes.h         | 79 +++++++++++++++++++++++
 arch/powerpc/kernel/machine_kexec_64.c            |  1 +
 arch/powerpc/kernel/smp.c                         |  1 +
 arch/powerpc/kernel/traps.c                       |  1 +
 arch/powerpc/lib/vmx-helper.c                     |  1 +
 arch/powerpc/platforms/powernv/opal-tracepoints.c |  1 +
 arch/powerpc/platforms/pseries/lpar.c             |  1 +
 7 files changed, 85 insertions(+)
 create mode 100644 arch/powerpc/include/asm/asm-prototypes.h

diff --git a/arch/powerpc/include/asm/asm-prototypes.h b/arch/powerpc/include/asm/asm-prototypes.h
new file mode 100644
index 000000000000..6ee0a9d80bbc
--- /dev/null
+++ b/arch/powerpc/include/asm/asm-prototypes.h
@@ -0,0 +1,79 @@
+/*
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License, version 2, as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * Copyright IBM Corp. 2016
+ *
+ * Authors: Daniel Axtens <dja@axtens.net>
+ */
+
+/*
+ * This file is for prototypes of C functions that are only called
+ * from asm, and any associated variables.
+ */
+
+#include <linux/threads.h>
+#include <linux/kprobes.h>
+
+/* SMP */
+extern struct thread_info *current_set[NR_CPUS];
+extern struct thread_info *secondary_ti;
+void start_secondary(void *unused);
+
+/* kexec */
+struct paca_struct;
+struct kimage;
+extern struct paca_struct kexec_paca;
+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, unsigned long retval,
+			unsigned long *retbuf);
+/* OPAL tracing */
+#ifdef HAVE_JUMP_LABEL
+extern struct static_key opal_tracepoint_key;
+#endif
+
+void __trace_opal_entry(unsigned long opcode, unsigned long *args);
+void __trace_opal_exit(long opcode, unsigned long retval);
+
+/* VMX copying */
+int enter_vmx_usercopy(void);
+int exit_vmx_usercopy(void);
+int enter_vmx_copy(void);
+void * exit_vmx_copy(void *dest);
+
+/* Traps */
+long machine_check_early(struct pt_regs *regs);
+long hmi_exception_realmode(struct pt_regs *regs);
+void SMIException(struct pt_regs *regs);
+void handle_hmi_exception(struct pt_regs *regs);
+void instruction_breakpoint_exception(struct pt_regs *regs);
+void RunModeException(struct pt_regs *regs);
+void __kprobes single_step_exception(struct pt_regs *regs);
+void __kprobes program_check_exception(struct pt_regs *regs);
+void alignment_exception(struct pt_regs *regs);
+void StackOverflow(struct pt_regs *regs);
+void nonrecoverable_exception(struct pt_regs *regs);
+void kernel_fp_unavailable_exception(struct pt_regs *regs);
+void altivec_unavailable_exception(struct pt_regs *regs);
+void vsx_unavailable_exception(struct pt_regs *regs);
+void fp_unavailable_tm(struct pt_regs *regs);
+void altivec_unavailable_tm(struct pt_regs *regs);
+void vsx_unavailable_tm(struct pt_regs *regs);
+void facility_unavailable_exception(struct pt_regs *regs);
+void TAUException(struct pt_regs *regs);
+void altivec_assist_exception(struct pt_regs *regs);
+void unrecoverable_exception(struct pt_regs *regs);
+void kernel_bad_stack(struct pt_regs *regs);
+void system_reset_exception(struct pt_regs *regs);
+void machine_check_exception(struct pt_regs *regs);
+void __kprobes emulation_assist_interrupt(struct pt_regs *regs);
diff --git a/arch/powerpc/kernel/machine_kexec_64.c b/arch/powerpc/kernel/machine_kexec_64.c
index b8c202d63ecb..50bf55135ef8 100644
--- a/arch/powerpc/kernel/machine_kexec_64.c
+++ b/arch/powerpc/kernel/machine_kexec_64.c
@@ -29,6 +29,7 @@
 #include <asm/prom.h>
 #include <asm/smp.h>
 #include <asm/hw_breakpoint.h>
+#include <asm/asm-prototypes.h>
 
 #ifdef CONFIG_PPC_BOOK3E
 int default_machine_kexec_prepare(struct kimage *image)
diff --git a/arch/powerpc/kernel/smp.c b/arch/powerpc/kernel/smp.c
index 55c924b65f71..f1adc3c4f4ca 100644
--- a/arch/powerpc/kernel/smp.c
+++ b/arch/powerpc/kernel/smp.c
@@ -53,6 +53,7 @@
 #include <asm/vdso.h>
 #include <asm/debug.h>
 #include <asm/kexec.h>
+#include <asm/asm-prototypes.h>
 
 #ifdef DEBUG
 #include <asm/udbg.h>
diff --git a/arch/powerpc/kernel/traps.c b/arch/powerpc/kernel/traps.c
index 9229ba63c370..11d15e7270e0 100644
--- a/arch/powerpc/kernel/traps.c
+++ b/arch/powerpc/kernel/traps.c
@@ -60,6 +60,7 @@
 #include <asm/switch_to.h>
 #include <asm/tm.h>
 #include <asm/debug.h>
+#include <asm/asm-prototypes.h>
 #include <sysdev/fsl_pci.h>
 
 #if defined(CONFIG_DEBUGGER) || defined(CONFIG_KEXEC)
diff --git a/arch/powerpc/lib/vmx-helper.c b/arch/powerpc/lib/vmx-helper.c
index b27e030fc9f8..bf925cdcaca9 100644
--- a/arch/powerpc/lib/vmx-helper.c
+++ b/arch/powerpc/lib/vmx-helper.c
@@ -21,6 +21,7 @@
 #include <linux/uaccess.h>
 #include <linux/hardirq.h>
 #include <asm/switch_to.h>
+#include <asm/asm-prototypes.h>
 
 int enter_vmx_usercopy(void)
 {
diff --git a/arch/powerpc/platforms/powernv/opal-tracepoints.c b/arch/powerpc/platforms/powernv/opal-tracepoints.c
index e11273b2386d..1e496b780efd 100644
--- a/arch/powerpc/platforms/powernv/opal-tracepoints.c
+++ b/arch/powerpc/platforms/powernv/opal-tracepoints.c
@@ -1,6 +1,7 @@
 #include <linux/percpu.h>
 #include <linux/jump_label.h>
 #include <asm/trace.h>
+#include <asm/asm-prototypes.h>
 
 #ifdef HAVE_JUMP_LABEL
 struct static_key opal_tracepoint_key = STATIC_KEY_INIT;
diff --git a/arch/powerpc/platforms/pseries/lpar.c b/arch/powerpc/platforms/pseries/lpar.c
index 7f6100d91b4b..03ff9867a610 100644
--- a/arch/powerpc/platforms/pseries/lpar.c
+++ b/arch/powerpc/platforms/pseries/lpar.c
@@ -45,6 +45,7 @@
 #include <asm/plpar_wrappers.h>
 #include <asm/kexec.h>
 #include <asm/fadump.h>
+#include <asm/asm-prototypes.h>
 
 #include "pseries.h"
 
-- 
2.5.0

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH 3/4] powerpc/sparse: Include headers containing prototypes
  2016-05-18  1:16 [PATCH 1/4] powerpc/sparse: make some things static Daniel Axtens
  2016-05-18  1:16 ` [PATCH 2/4] powerpc: Introduce asm-prototypes.h Daniel Axtens
@ 2016-05-18  1:16 ` Daniel Axtens
  2016-06-21  0:40   ` [3/4] " Michael Ellerman
  2016-05-18  1:16 ` [PATCH 4/4] powerpc/sparse: Use LE definition of REG_BYTE Daniel Axtens
  2016-06-21  0:40 ` [1/4] powerpc/sparse: make some things static Michael Ellerman
  3 siblings, 1 reply; 12+ messages in thread
From: Daniel Axtens @ 2016-05-18  1:16 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: mpe, Daniel Axtens

Sometimes headers that provide prototypes for functions are
accidentally omitted from the files that define the functions.

Fix a couple of times that occurs.

Signed-off-by: Daniel Axtens <dja@axtens.net>
---
 arch/powerpc/kernel/smp.c              | 1 +
 arch/powerpc/platforms/pseries/power.c | 2 ++
 2 files changed, 3 insertions(+)

diff --git a/arch/powerpc/kernel/smp.c b/arch/powerpc/kernel/smp.c
index f1adc3c4f4ca..1b55c7864291 100644
--- a/arch/powerpc/kernel/smp.c
+++ b/arch/powerpc/kernel/smp.c
@@ -31,6 +31,7 @@
 #include <linux/cpu.h>
 #include <linux/notifier.h>
 #include <linux/topology.h>
+#include <linux/profile.h>
 
 #include <asm/ptrace.h>
 #include <linux/atomic.h>
diff --git a/arch/powerpc/platforms/pseries/power.c b/arch/powerpc/platforms/pseries/power.c
index c26eadde434c..a4a0b57d1d81 100644
--- a/arch/powerpc/platforms/pseries/power.c
+++ b/arch/powerpc/platforms/pseries/power.c
@@ -27,6 +27,8 @@
 #include <linux/init.h>
 #include <asm/machdep.h>
 
+#include "pseries.h"
+
 unsigned long rtas_poweron_auto; /* default and normal state is 0 */
 
 static ssize_t auto_poweron_show(struct kobject *kobj,
-- 
2.5.0

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH 4/4] powerpc/sparse: Use LE definition of REG_BYTE
  2016-05-18  1:16 [PATCH 1/4] powerpc/sparse: make some things static Daniel Axtens
  2016-05-18  1:16 ` [PATCH 2/4] powerpc: Introduce asm-prototypes.h Daniel Axtens
  2016-05-18  1:16 ` [PATCH 3/4] powerpc/sparse: Include headers containing prototypes Daniel Axtens
@ 2016-05-18  1:16 ` Daniel Axtens
  2016-06-21  0:40 ` [1/4] powerpc/sparse: make some things static Michael Ellerman
  3 siblings, 0 replies; 12+ messages in thread
From: Daniel Axtens @ 2016-05-18  1:16 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: mpe, Daniel Axtens

Sparse complains that it doesn't know what REG_BYTE is:

arch/powerpc/kernel/align.c:313:29: error: undefined identifier 'REG_BYTE'
arch/powerpc/kernel/align.c:320:37: error: undefined identifier 'REG_BYTE'
arch/powerpc/kernel/align.c:328:29: error: cast from unknown type
arch/powerpc/kernel/align.c:328:29: error: cast from unknown type

REG_BYTE is defined differently based on whether we're compiling for
LE, BE32 or BE64. Sparse apparently doesn't provide __BIG_ENDIAN__
or __LITTLE_ENDIAN__, so add an explicit __CHECKER__ to the LE
definition.

The choice of LE is arbitrary.

Signed-off-by: Daniel Axtens <dja@axtens.net>
---
 arch/powerpc/kernel/align.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/powerpc/kernel/align.c b/arch/powerpc/kernel/align.c
index 8e7cb8e2b21a..43f745f2cea9 100644
--- a/arch/powerpc/kernel/align.c
+++ b/arch/powerpc/kernel/align.c
@@ -230,7 +230,7 @@ static int emulate_dcbz(struct pt_regs *regs, unsigned char __user *addr)
 #endif
 #endif
 
-#ifdef __LITTLE_ENDIAN__
+#if defined(__LITTLE_ENDIAN__) || defined(__CHECKER__)
 #define REG_BYTE(rp, i)		(*(((u8 *)((rp) + ((i)>>2)) + ((i)&3))))
 #endif
 
-- 
2.5.0

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* Re: [1/4] powerpc/sparse: make some things static
  2016-05-18  1:16 [PATCH 1/4] powerpc/sparse: make some things static Daniel Axtens
                   ` (2 preceding siblings ...)
  2016-05-18  1:16 ` [PATCH 4/4] powerpc/sparse: Use LE definition of REG_BYTE Daniel Axtens
@ 2016-06-21  0:40 ` Michael Ellerman
  3 siblings, 0 replies; 12+ messages in thread
From: Michael Ellerman @ 2016-06-21  0:40 UTC (permalink / raw)
  To: Daniel Axtens, linuxppc-dev; +Cc: Daniel Axtens

On Wed, 2016-18-05 at 01:16:49 UTC, Daniel Axtens wrote:
> This is just a smattering of things picked up by sparse that should
> be made static.
> 
> Signed-off-by: Daniel Axtens <dja@axtens.net>

Applied to powerpc next, thanks.

https://git.kernel.org/powerpc/c/34852ed5511ec5d07897f22d56

cheers

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [2/4] powerpc: Introduce asm-prototypes.h
  2016-05-18  1:16 ` [PATCH 2/4] powerpc: Introduce asm-prototypes.h Daniel Axtens
@ 2016-06-21  0:40   ` Michael Ellerman
  2020-08-14  9:34   ` [PATCH 2/4] " Christophe Leroy
  1 sibling, 0 replies; 12+ messages in thread
From: Michael Ellerman @ 2016-06-21  0:40 UTC (permalink / raw)
  To: Daniel Axtens, linuxppc-dev; +Cc: Daniel Axtens

On Wed, 2016-18-05 at 01:16:50 UTC, Daniel Axtens wrote:
> Sparse picked up a number of functions that are implemented in C and
> then only referred to in asm code.
> 
> This introduces asm-prototypes.h, which provides a place for
> prototypes of these functions.
> 
> This silences some sparse warnings.
> 
> Signed-off-by: Daniel Axtens <dja@axtens.net>

Applied to powerpc next, thanks.

https://git.kernel.org/powerpc/c/42f5b4cacd783faf05e3ff8bf8

cheers

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [3/4] powerpc/sparse: Include headers containing prototypes
  2016-05-18  1:16 ` [PATCH 3/4] powerpc/sparse: Include headers containing prototypes Daniel Axtens
@ 2016-06-21  0:40   ` Michael Ellerman
  0 siblings, 0 replies; 12+ messages in thread
From: Michael Ellerman @ 2016-06-21  0:40 UTC (permalink / raw)
  To: Daniel Axtens, linuxppc-dev; +Cc: Daniel Axtens

On Wed, 2016-18-05 at 01:16:51 UTC, Daniel Axtens wrote:
> Sometimes headers that provide prototypes for functions are
> accidentally omitted from the files that define the functions.
> 
> Fix a couple of times that occurs.
> 
> Signed-off-by: Daniel Axtens <dja@axtens.net>

Applied to powerpc next, thanks.

https://git.kernel.org/powerpc/c/665e87ffe1c400c525c3a4cd6f

cheers

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 2/4] powerpc: Introduce asm-prototypes.h
  2016-05-18  1:16 ` [PATCH 2/4] powerpc: Introduce asm-prototypes.h Daniel Axtens
  2016-06-21  0:40   ` [2/4] " Michael Ellerman
@ 2020-08-14  9:34   ` Christophe Leroy
  2020-08-14  9:53     ` Daniel Axtens
  2020-08-14 13:04     ` Michael Ellerman
  1 sibling, 2 replies; 12+ messages in thread
From: Christophe Leroy @ 2020-08-14  9:34 UTC (permalink / raw)
  To: Daniel Axtens, linuxppc-dev



Le 18/05/2016 à 03:16, Daniel Axtens a écrit :
> Sparse picked up a number of functions that are implemented in C and
> then only referred to in asm code.
> 
> This introduces asm-prototypes.h, which provides a place for
> prototypes of these functions.

It looks like this is a mis-use of asm-prototypes.h

On other architectures, asm-prototypes.h is there to allow MODVERSION to 
sent versions for exported assembly functions (I checked history of that 
file in x86 and arm64).

It looks like you have used it on the other way round, you have declared 
in it C functions used by ASM functions, whereas it is supposed to be 
dedicated to declaring exported ASM functions used by C functions.

Any plan to fix that ?

Christophe

> 
> This silences some sparse warnings.
> 
> Signed-off-by: Daniel Axtens <dja@axtens.net>
> ---
>   arch/powerpc/include/asm/asm-prototypes.h         | 79 +++++++++++++++++++++++
>   arch/powerpc/kernel/machine_kexec_64.c            |  1 +
>   arch/powerpc/kernel/smp.c                         |  1 +
>   arch/powerpc/kernel/traps.c                       |  1 +
>   arch/powerpc/lib/vmx-helper.c                     |  1 +
>   arch/powerpc/platforms/powernv/opal-tracepoints.c |  1 +
>   arch/powerpc/platforms/pseries/lpar.c             |  1 +
>   7 files changed, 85 insertions(+)
>   create mode 100644 arch/powerpc/include/asm/asm-prototypes.h
> 
> diff --git a/arch/powerpc/include/asm/asm-prototypes.h b/arch/powerpc/include/asm/asm-prototypes.h
> new file mode 100644
> index 000000000000..6ee0a9d80bbc
> --- /dev/null
> +++ b/arch/powerpc/include/asm/asm-prototypes.h
> @@ -0,0 +1,79 @@
> +/*
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License, version 2, as
> + * published by the Free Software Foundation.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> + * GNU General Public License for more details.
> + *
> + * Copyright IBM Corp. 2016
> + *
> + * Authors: Daniel Axtens <dja@axtens.net>
> + */
> +
> +/*
> + * This file is for prototypes of C functions that are only called
> + * from asm, and any associated variables.
> + */
> +
> +#include <linux/threads.h>
> +#include <linux/kprobes.h>
> +
> +/* SMP */
> +extern struct thread_info *current_set[NR_CPUS];
> +extern struct thread_info *secondary_ti;
> +void start_secondary(void *unused);
> +
> +/* kexec */
> +struct paca_struct;
> +struct kimage;
> +extern struct paca_struct kexec_paca;
> +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, unsigned long retval,
> +			unsigned long *retbuf);
> +/* OPAL tracing */
> +#ifdef HAVE_JUMP_LABEL
> +extern struct static_key opal_tracepoint_key;
> +#endif
> +
> +void __trace_opal_entry(unsigned long opcode, unsigned long *args);
> +void __trace_opal_exit(long opcode, unsigned long retval);
> +
> +/* VMX copying */
> +int enter_vmx_usercopy(void);
> +int exit_vmx_usercopy(void);
> +int enter_vmx_copy(void);
> +void * exit_vmx_copy(void *dest);
> +
> +/* Traps */
> +long machine_check_early(struct pt_regs *regs);
> +long hmi_exception_realmode(struct pt_regs *regs);
> +void SMIException(struct pt_regs *regs);
> +void handle_hmi_exception(struct pt_regs *regs);
> +void instruction_breakpoint_exception(struct pt_regs *regs);
> +void RunModeException(struct pt_regs *regs);
> +void __kprobes single_step_exception(struct pt_regs *regs);
> +void __kprobes program_check_exception(struct pt_regs *regs);
> +void alignment_exception(struct pt_regs *regs);
> +void StackOverflow(struct pt_regs *regs);
> +void nonrecoverable_exception(struct pt_regs *regs);
> +void kernel_fp_unavailable_exception(struct pt_regs *regs);
> +void altivec_unavailable_exception(struct pt_regs *regs);
> +void vsx_unavailable_exception(struct pt_regs *regs);
> +void fp_unavailable_tm(struct pt_regs *regs);
> +void altivec_unavailable_tm(struct pt_regs *regs);
> +void vsx_unavailable_tm(struct pt_regs *regs);
> +void facility_unavailable_exception(struct pt_regs *regs);
> +void TAUException(struct pt_regs *regs);
> +void altivec_assist_exception(struct pt_regs *regs);
> +void unrecoverable_exception(struct pt_regs *regs);
> +void kernel_bad_stack(struct pt_regs *regs);
> +void system_reset_exception(struct pt_regs *regs);
> +void machine_check_exception(struct pt_regs *regs);
> +void __kprobes emulation_assist_interrupt(struct pt_regs *regs);
> diff --git a/arch/powerpc/kernel/machine_kexec_64.c b/arch/powerpc/kernel/machine_kexec_64.c
> index b8c202d63ecb..50bf55135ef8 100644
> --- a/arch/powerpc/kernel/machine_kexec_64.c
> +++ b/arch/powerpc/kernel/machine_kexec_64.c
> @@ -29,6 +29,7 @@
>   #include <asm/prom.h>
>   #include <asm/smp.h>
>   #include <asm/hw_breakpoint.h>
> +#include <asm/asm-prototypes.h>
>   
>   #ifdef CONFIG_PPC_BOOK3E
>   int default_machine_kexec_prepare(struct kimage *image)
> diff --git a/arch/powerpc/kernel/smp.c b/arch/powerpc/kernel/smp.c
> index 55c924b65f71..f1adc3c4f4ca 100644
> --- a/arch/powerpc/kernel/smp.c
> +++ b/arch/powerpc/kernel/smp.c
> @@ -53,6 +53,7 @@
>   #include <asm/vdso.h>
>   #include <asm/debug.h>
>   #include <asm/kexec.h>
> +#include <asm/asm-prototypes.h>
>   
>   #ifdef DEBUG
>   #include <asm/udbg.h>
> diff --git a/arch/powerpc/kernel/traps.c b/arch/powerpc/kernel/traps.c
> index 9229ba63c370..11d15e7270e0 100644
> --- a/arch/powerpc/kernel/traps.c
> +++ b/arch/powerpc/kernel/traps.c
> @@ -60,6 +60,7 @@
>   #include <asm/switch_to.h>
>   #include <asm/tm.h>
>   #include <asm/debug.h>
> +#include <asm/asm-prototypes.h>
>   #include <sysdev/fsl_pci.h>
>   
>   #if defined(CONFIG_DEBUGGER) || defined(CONFIG_KEXEC)
> diff --git a/arch/powerpc/lib/vmx-helper.c b/arch/powerpc/lib/vmx-helper.c
> index b27e030fc9f8..bf925cdcaca9 100644
> --- a/arch/powerpc/lib/vmx-helper.c
> +++ b/arch/powerpc/lib/vmx-helper.c
> @@ -21,6 +21,7 @@
>   #include <linux/uaccess.h>
>   #include <linux/hardirq.h>
>   #include <asm/switch_to.h>
> +#include <asm/asm-prototypes.h>
>   
>   int enter_vmx_usercopy(void)
>   {
> diff --git a/arch/powerpc/platforms/powernv/opal-tracepoints.c b/arch/powerpc/platforms/powernv/opal-tracepoints.c
> index e11273b2386d..1e496b780efd 100644
> --- a/arch/powerpc/platforms/powernv/opal-tracepoints.c
> +++ b/arch/powerpc/platforms/powernv/opal-tracepoints.c
> @@ -1,6 +1,7 @@
>   #include <linux/percpu.h>
>   #include <linux/jump_label.h>
>   #include <asm/trace.h>
> +#include <asm/asm-prototypes.h>
>   
>   #ifdef HAVE_JUMP_LABEL
>   struct static_key opal_tracepoint_key = STATIC_KEY_INIT;
> diff --git a/arch/powerpc/platforms/pseries/lpar.c b/arch/powerpc/platforms/pseries/lpar.c
> index 7f6100d91b4b..03ff9867a610 100644
> --- a/arch/powerpc/platforms/pseries/lpar.c
> +++ b/arch/powerpc/platforms/pseries/lpar.c
> @@ -45,6 +45,7 @@
>   #include <asm/plpar_wrappers.h>
>   #include <asm/kexec.h>
>   #include <asm/fadump.h>
> +#include <asm/asm-prototypes.h>
>   
>   #include "pseries.h"
>   
> 

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 2/4] powerpc: Introduce asm-prototypes.h
  2020-08-14  9:34   ` [PATCH 2/4] " Christophe Leroy
@ 2020-08-14  9:53     ` Daniel Axtens
  2020-08-14 10:41       ` Christophe Leroy
  2020-08-14 13:04     ` Michael Ellerman
  1 sibling, 1 reply; 12+ messages in thread
From: Daniel Axtens @ 2020-08-14  9:53 UTC (permalink / raw)
  To: Christophe Leroy, linuxppc-dev

Christophe Leroy <christophe.leroy@csgroup.eu> writes:

> Le 18/05/2016 à 03:16, Daniel Axtens a écrit :
>> Sparse picked up a number of functions that are implemented in C and
>> then only referred to in asm code.
>> 
>> This introduces asm-prototypes.h, which provides a place for
>> prototypes of these functions.
>
> It looks like this is a mis-use of asm-prototypes.h
>
> On other architectures, asm-prototypes.h is there to allow MODVERSION to 
> sent versions for exported assembly functions (I checked history of that 
> file in x86 and arm64).

Hmm, I was young(er) and (more) inexperienced 4 years ago and wouldn't
have thought to check x86 and arm64.

> It looks like you have used it on the other way round, you have declared 
> in it C functions used by ASM functions, whereas it is supposed to be 
> dedicated to declaring exported ASM functions used by C functions.
>
> Any plan to fix that ?

What should we call it?

Kind regards,
Daniel
>
> Christophe
>
>> 
>> This silences some sparse warnings.
>> 
>> Signed-off-by: Daniel Axtens <dja@axtens.net>
>> ---
>>   arch/powerpc/include/asm/asm-prototypes.h         | 79 +++++++++++++++++++++++
>>   arch/powerpc/kernel/machine_kexec_64.c            |  1 +
>>   arch/powerpc/kernel/smp.c                         |  1 +
>>   arch/powerpc/kernel/traps.c                       |  1 +
>>   arch/powerpc/lib/vmx-helper.c                     |  1 +
>>   arch/powerpc/platforms/powernv/opal-tracepoints.c |  1 +
>>   arch/powerpc/platforms/pseries/lpar.c             |  1 +
>>   7 files changed, 85 insertions(+)
>>   create mode 100644 arch/powerpc/include/asm/asm-prototypes.h
>> 
>> diff --git a/arch/powerpc/include/asm/asm-prototypes.h b/arch/powerpc/include/asm/asm-prototypes.h
>> new file mode 100644
>> index 000000000000..6ee0a9d80bbc
>> --- /dev/null
>> +++ b/arch/powerpc/include/asm/asm-prototypes.h
>> @@ -0,0 +1,79 @@
>> +/*
>> + * This program is free software; you can redistribute it and/or modify
>> + * it under the terms of the GNU General Public License, version 2, as
>> + * published by the Free Software Foundation.
>> + *
>> + * This program is distributed in the hope that it will be useful,
>> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
>> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
>> + * GNU General Public License for more details.
>> + *
>> + * Copyright IBM Corp. 2016
>> + *
>> + * Authors: Daniel Axtens <dja@axtens.net>
>> + */
>> +
>> +/*
>> + * This file is for prototypes of C functions that are only called
>> + * from asm, and any associated variables.
>> + */
>> +
>> +#include <linux/threads.h>
>> +#include <linux/kprobes.h>
>> +
>> +/* SMP */
>> +extern struct thread_info *current_set[NR_CPUS];
>> +extern struct thread_info *secondary_ti;
>> +void start_secondary(void *unused);
>> +
>> +/* kexec */
>> +struct paca_struct;
>> +struct kimage;
>> +extern struct paca_struct kexec_paca;
>> +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, unsigned long retval,
>> +			unsigned long *retbuf);
>> +/* OPAL tracing */
>> +#ifdef HAVE_JUMP_LABEL
>> +extern struct static_key opal_tracepoint_key;
>> +#endif
>> +
>> +void __trace_opal_entry(unsigned long opcode, unsigned long *args);
>> +void __trace_opal_exit(long opcode, unsigned long retval);
>> +
>> +/* VMX copying */
>> +int enter_vmx_usercopy(void);
>> +int exit_vmx_usercopy(void);
>> +int enter_vmx_copy(void);
>> +void * exit_vmx_copy(void *dest);
>> +
>> +/* Traps */
>> +long machine_check_early(struct pt_regs *regs);
>> +long hmi_exception_realmode(struct pt_regs *regs);
>> +void SMIException(struct pt_regs *regs);
>> +void handle_hmi_exception(struct pt_regs *regs);
>> +void instruction_breakpoint_exception(struct pt_regs *regs);
>> +void RunModeException(struct pt_regs *regs);
>> +void __kprobes single_step_exception(struct pt_regs *regs);
>> +void __kprobes program_check_exception(struct pt_regs *regs);
>> +void alignment_exception(struct pt_regs *regs);
>> +void StackOverflow(struct pt_regs *regs);
>> +void nonrecoverable_exception(struct pt_regs *regs);
>> +void kernel_fp_unavailable_exception(struct pt_regs *regs);
>> +void altivec_unavailable_exception(struct pt_regs *regs);
>> +void vsx_unavailable_exception(struct pt_regs *regs);
>> +void fp_unavailable_tm(struct pt_regs *regs);
>> +void altivec_unavailable_tm(struct pt_regs *regs);
>> +void vsx_unavailable_tm(struct pt_regs *regs);
>> +void facility_unavailable_exception(struct pt_regs *regs);
>> +void TAUException(struct pt_regs *regs);
>> +void altivec_assist_exception(struct pt_regs *regs);
>> +void unrecoverable_exception(struct pt_regs *regs);
>> +void kernel_bad_stack(struct pt_regs *regs);
>> +void system_reset_exception(struct pt_regs *regs);
>> +void machine_check_exception(struct pt_regs *regs);
>> +void __kprobes emulation_assist_interrupt(struct pt_regs *regs);
>> diff --git a/arch/powerpc/kernel/machine_kexec_64.c b/arch/powerpc/kernel/machine_kexec_64.c
>> index b8c202d63ecb..50bf55135ef8 100644
>> --- a/arch/powerpc/kernel/machine_kexec_64.c
>> +++ b/arch/powerpc/kernel/machine_kexec_64.c
>> @@ -29,6 +29,7 @@
>>   #include <asm/prom.h>
>>   #include <asm/smp.h>
>>   #include <asm/hw_breakpoint.h>
>> +#include <asm/asm-prototypes.h>
>>   
>>   #ifdef CONFIG_PPC_BOOK3E
>>   int default_machine_kexec_prepare(struct kimage *image)
>> diff --git a/arch/powerpc/kernel/smp.c b/arch/powerpc/kernel/smp.c
>> index 55c924b65f71..f1adc3c4f4ca 100644
>> --- a/arch/powerpc/kernel/smp.c
>> +++ b/arch/powerpc/kernel/smp.c
>> @@ -53,6 +53,7 @@
>>   #include <asm/vdso.h>
>>   #include <asm/debug.h>
>>   #include <asm/kexec.h>
>> +#include <asm/asm-prototypes.h>
>>   
>>   #ifdef DEBUG
>>   #include <asm/udbg.h>
>> diff --git a/arch/powerpc/kernel/traps.c b/arch/powerpc/kernel/traps.c
>> index 9229ba63c370..11d15e7270e0 100644
>> --- a/arch/powerpc/kernel/traps.c
>> +++ b/arch/powerpc/kernel/traps.c
>> @@ -60,6 +60,7 @@
>>   #include <asm/switch_to.h>
>>   #include <asm/tm.h>
>>   #include <asm/debug.h>
>> +#include <asm/asm-prototypes.h>
>>   #include <sysdev/fsl_pci.h>
>>   
>>   #if defined(CONFIG_DEBUGGER) || defined(CONFIG_KEXEC)
>> diff --git a/arch/powerpc/lib/vmx-helper.c b/arch/powerpc/lib/vmx-helper.c
>> index b27e030fc9f8..bf925cdcaca9 100644
>> --- a/arch/powerpc/lib/vmx-helper.c
>> +++ b/arch/powerpc/lib/vmx-helper.c
>> @@ -21,6 +21,7 @@
>>   #include <linux/uaccess.h>
>>   #include <linux/hardirq.h>
>>   #include <asm/switch_to.h>
>> +#include <asm/asm-prototypes.h>
>>   
>>   int enter_vmx_usercopy(void)
>>   {
>> diff --git a/arch/powerpc/platforms/powernv/opal-tracepoints.c b/arch/powerpc/platforms/powernv/opal-tracepoints.c
>> index e11273b2386d..1e496b780efd 100644
>> --- a/arch/powerpc/platforms/powernv/opal-tracepoints.c
>> +++ b/arch/powerpc/platforms/powernv/opal-tracepoints.c
>> @@ -1,6 +1,7 @@
>>   #include <linux/percpu.h>
>>   #include <linux/jump_label.h>
>>   #include <asm/trace.h>
>> +#include <asm/asm-prototypes.h>
>>   
>>   #ifdef HAVE_JUMP_LABEL
>>   struct static_key opal_tracepoint_key = STATIC_KEY_INIT;
>> diff --git a/arch/powerpc/platforms/pseries/lpar.c b/arch/powerpc/platforms/pseries/lpar.c
>> index 7f6100d91b4b..03ff9867a610 100644
>> --- a/arch/powerpc/platforms/pseries/lpar.c
>> +++ b/arch/powerpc/platforms/pseries/lpar.c
>> @@ -45,6 +45,7 @@
>>   #include <asm/plpar_wrappers.h>
>>   #include <asm/kexec.h>
>>   #include <asm/fadump.h>
>> +#include <asm/asm-prototypes.h>
>>   
>>   #include "pseries.h"
>>   
>> 

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 2/4] powerpc: Introduce asm-prototypes.h
  2020-08-14  9:53     ` Daniel Axtens
@ 2020-08-14 10:41       ` Christophe Leroy
  0 siblings, 0 replies; 12+ messages in thread
From: Christophe Leroy @ 2020-08-14 10:41 UTC (permalink / raw)
  To: Daniel Axtens, linuxppc-dev



On 08/14/2020 09:53 AM, Daniel Axtens wrote:
> Christophe Leroy <christophe.leroy@csgroup.eu> writes:
> 
>> Le 18/05/2016 à 03:16, Daniel Axtens a écrit :
>>> Sparse picked up a number of functions that are implemented in C and
>>> then only referred to in asm code.
>>>
>>> This introduces asm-prototypes.h, which provides a place for
>>> prototypes of these functions.
>>
>> It looks like this is a mis-use of asm-prototypes.h
>>
>> On other architectures, asm-prototypes.h is there to allow MODVERSION to
>> sent versions for exported assembly functions (I checked history of that
>> file in x86 and arm64).
> 
> Hmm, I was young(er) and (more) inexperienced 4 years ago and wouldn't
> have thought to check x86 and arm64.
> 
>> It looks like you have used it on the other way round, you have declared
>> in it C functions used by ASM functions, whereas it is supposed to be
>> dedicated to declaring exported ASM functions used by C functions.
>>
>> Any plan to fix that ?
> 
> What should we call it?

I don't know but that's for sure more complex than just a rename.

Because after you created the file, people have started using it for 
what it is, see for instance following commits:
- 9e5f68842276 ("powerpc: Fix missing CRCs, add more asm-prototypes.h 
declarations") or commit
- 99ad503287da ("powerpc: Add a prototype for mcount() so it can be 
versioned")
- 43a8888f0a70 ("powerpc: Fix missing CRCs, add more asm-prototypes.h 
declarations")

But for instance, for function kexec_copy_flush(), I'd have included it 
is asm/kexec.c
For function __trace_opal_entry() and __trace_opal_exit(), I would have 
added them in asm/opal.h
Etc ...

Christophe


> 
> Kind regards,
> Daniel
>>
>> Christophe
>>
>>>
>>> This silences some sparse warnings.
>>>
>>> Signed-off-by: Daniel Axtens <dja@axtens.net>
>>> ---
>>>    arch/powerpc/include/asm/asm-prototypes.h         | 79 +++++++++++++++++++++++
>>>    arch/powerpc/kernel/machine_kexec_64.c            |  1 +
>>>    arch/powerpc/kernel/smp.c                         |  1 +
>>>    arch/powerpc/kernel/traps.c                       |  1 +
>>>    arch/powerpc/lib/vmx-helper.c                     |  1 +
>>>    arch/powerpc/platforms/powernv/opal-tracepoints.c |  1 +
>>>    arch/powerpc/platforms/pseries/lpar.c             |  1 +
>>>    7 files changed, 85 insertions(+)
>>>    create mode 100644 arch/powerpc/include/asm/asm-prototypes.h
>>>
>>> diff --git a/arch/powerpc/include/asm/asm-prototypes.h b/arch/powerpc/include/asm/asm-prototypes.h
>>> new file mode 100644
>>> index 000000000000..6ee0a9d80bbc
>>> --- /dev/null
>>> +++ b/arch/powerpc/include/asm/asm-prototypes.h
>>> @@ -0,0 +1,79 @@
>>> +/*
>>> + * This program is free software; you can redistribute it and/or modify
>>> + * it under the terms of the GNU General Public License, version 2, as
>>> + * published by the Free Software Foundation.
>>> + *
>>> + * This program is distributed in the hope that it will be useful,
>>> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
>>> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
>>> + * GNU General Public License for more details.
>>> + *
>>> + * Copyright IBM Corp. 2016
>>> + *
>>> + * Authors: Daniel Axtens <dja@axtens.net>
>>> + */
>>> +
>>> +/*
>>> + * This file is for prototypes of C functions that are only called
>>> + * from asm, and any associated variables.
>>> + */
>>> +
>>> +#include <linux/threads.h>
>>> +#include <linux/kprobes.h>
>>> +
>>> +/* SMP */
>>> +extern struct thread_info *current_set[NR_CPUS];
>>> +extern struct thread_info *secondary_ti;
>>> +void start_secondary(void *unused);
>>> +
>>> +/* kexec */
>>> +struct paca_struct;
>>> +struct kimage;
>>> +extern struct paca_struct kexec_paca;
>>> +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, unsigned long retval,
>>> +			unsigned long *retbuf);
>>> +/* OPAL tracing */
>>> +#ifdef HAVE_JUMP_LABEL
>>> +extern struct static_key opal_tracepoint_key;
>>> +#endif
>>> +
>>> +void __trace_opal_entry(unsigned long opcode, unsigned long *args);
>>> +void __trace_opal_exit(long opcode, unsigned long retval);
>>> +
>>> +/* VMX copying */
>>> +int enter_vmx_usercopy(void);
>>> +int exit_vmx_usercopy(void);
>>> +int enter_vmx_copy(void);
>>> +void * exit_vmx_copy(void *dest);
>>> +
>>> +/* Traps */
>>> +long machine_check_early(struct pt_regs *regs);
>>> +long hmi_exception_realmode(struct pt_regs *regs);
>>> +void SMIException(struct pt_regs *regs);
>>> +void handle_hmi_exception(struct pt_regs *regs);
>>> +void instruction_breakpoint_exception(struct pt_regs *regs);
>>> +void RunModeException(struct pt_regs *regs);
>>> +void __kprobes single_step_exception(struct pt_regs *regs);
>>> +void __kprobes program_check_exception(struct pt_regs *regs);
>>> +void alignment_exception(struct pt_regs *regs);
>>> +void StackOverflow(struct pt_regs *regs);
>>> +void nonrecoverable_exception(struct pt_regs *regs);
>>> +void kernel_fp_unavailable_exception(struct pt_regs *regs);
>>> +void altivec_unavailable_exception(struct pt_regs *regs);
>>> +void vsx_unavailable_exception(struct pt_regs *regs);
>>> +void fp_unavailable_tm(struct pt_regs *regs);
>>> +void altivec_unavailable_tm(struct pt_regs *regs);
>>> +void vsx_unavailable_tm(struct pt_regs *regs);
>>> +void facility_unavailable_exception(struct pt_regs *regs);
>>> +void TAUException(struct pt_regs *regs);
>>> +void altivec_assist_exception(struct pt_regs *regs);
>>> +void unrecoverable_exception(struct pt_regs *regs);
>>> +void kernel_bad_stack(struct pt_regs *regs);
>>> +void system_reset_exception(struct pt_regs *regs);
>>> +void machine_check_exception(struct pt_regs *regs);
>>> +void __kprobes emulation_assist_interrupt(struct pt_regs *regs);
>>> diff --git a/arch/powerpc/kernel/machine_kexec_64.c b/arch/powerpc/kernel/machine_kexec_64.c
>>> index b8c202d63ecb..50bf55135ef8 100644
>>> --- a/arch/powerpc/kernel/machine_kexec_64.c
>>> +++ b/arch/powerpc/kernel/machine_kexec_64.c
>>> @@ -29,6 +29,7 @@
>>>    #include <asm/prom.h>
>>>    #include <asm/smp.h>
>>>    #include <asm/hw_breakpoint.h>
>>> +#include <asm/asm-prototypes.h>
>>>    
>>>    #ifdef CONFIG_PPC_BOOK3E
>>>    int default_machine_kexec_prepare(struct kimage *image)
>>> diff --git a/arch/powerpc/kernel/smp.c b/arch/powerpc/kernel/smp.c
>>> index 55c924b65f71..f1adc3c4f4ca 100644
>>> --- a/arch/powerpc/kernel/smp.c
>>> +++ b/arch/powerpc/kernel/smp.c
>>> @@ -53,6 +53,7 @@
>>>    #include <asm/vdso.h>
>>>    #include <asm/debug.h>
>>>    #include <asm/kexec.h>
>>> +#include <asm/asm-prototypes.h>
>>>    
>>>    #ifdef DEBUG
>>>    #include <asm/udbg.h>
>>> diff --git a/arch/powerpc/kernel/traps.c b/arch/powerpc/kernel/traps.c
>>> index 9229ba63c370..11d15e7270e0 100644
>>> --- a/arch/powerpc/kernel/traps.c
>>> +++ b/arch/powerpc/kernel/traps.c
>>> @@ -60,6 +60,7 @@
>>>    #include <asm/switch_to.h>
>>>    #include <asm/tm.h>
>>>    #include <asm/debug.h>
>>> +#include <asm/asm-prototypes.h>
>>>    #include <sysdev/fsl_pci.h>
>>>    
>>>    #if defined(CONFIG_DEBUGGER) || defined(CONFIG_KEXEC)
>>> diff --git a/arch/powerpc/lib/vmx-helper.c b/arch/powerpc/lib/vmx-helper.c
>>> index b27e030fc9f8..bf925cdcaca9 100644
>>> --- a/arch/powerpc/lib/vmx-helper.c
>>> +++ b/arch/powerpc/lib/vmx-helper.c
>>> @@ -21,6 +21,7 @@
>>>    #include <linux/uaccess.h>
>>>    #include <linux/hardirq.h>
>>>    #include <asm/switch_to.h>
>>> +#include <asm/asm-prototypes.h>
>>>    
>>>    int enter_vmx_usercopy(void)
>>>    {
>>> diff --git a/arch/powerpc/platforms/powernv/opal-tracepoints.c b/arch/powerpc/platforms/powernv/opal-tracepoints.c
>>> index e11273b2386d..1e496b780efd 100644
>>> --- a/arch/powerpc/platforms/powernv/opal-tracepoints.c
>>> +++ b/arch/powerpc/platforms/powernv/opal-tracepoints.c
>>> @@ -1,6 +1,7 @@
>>>    #include <linux/percpu.h>
>>>    #include <linux/jump_label.h>
>>>    #include <asm/trace.h>
>>> +#include <asm/asm-prototypes.h>
>>>    
>>>    #ifdef HAVE_JUMP_LABEL
>>>    struct static_key opal_tracepoint_key = STATIC_KEY_INIT;
>>> diff --git a/arch/powerpc/platforms/pseries/lpar.c b/arch/powerpc/platforms/pseries/lpar.c
>>> index 7f6100d91b4b..03ff9867a610 100644
>>> --- a/arch/powerpc/platforms/pseries/lpar.c
>>> +++ b/arch/powerpc/platforms/pseries/lpar.c
>>> @@ -45,6 +45,7 @@
>>>    #include <asm/plpar_wrappers.h>
>>>    #include <asm/kexec.h>
>>>    #include <asm/fadump.h>
>>> +#include <asm/asm-prototypes.h>
>>>    
>>>    #include "pseries.h"
>>>    
>>>

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 2/4] powerpc: Introduce asm-prototypes.h
  2020-08-14  9:34   ` [PATCH 2/4] " Christophe Leroy
  2020-08-14  9:53     ` Daniel Axtens
@ 2020-08-14 13:04     ` Michael Ellerman
  2020-08-14 13:26       ` Christophe Leroy
  1 sibling, 1 reply; 12+ messages in thread
From: Michael Ellerman @ 2020-08-14 13:04 UTC (permalink / raw)
  To: Christophe Leroy, Daniel Axtens, linuxppc-dev

Christophe Leroy <christophe.leroy@csgroup.eu> writes:
> Le 18/05/2016 à 03:16, Daniel Axtens a écrit :
>> Sparse picked up a number of functions that are implemented in C and
>> then only referred to in asm code.
>> 
>> This introduces asm-prototypes.h, which provides a place for
>> prototypes of these functions.
>
> It looks like this is a mis-use of asm-prototypes.h
>
> On other architectures, asm-prototypes.h is there to allow MODVERSION to 
> sent versions for exported assembly functions (I checked history of that 
> file in x86 and arm64).

Look closer :)

42f5b4cacd78 ("powerpc: Introduce asm-prototypes.h") (Jun 2016)
334bb7738764 ("x86/kbuild: enable modversions for symbols exported from asm") (Dec 2016)
c3296a1391cb ("arm64: add <asm/asm-prototypes.h>") (Dec 2018)

> It looks like you have used it on the other way round, you have declared 
> in it C functions used by ASM functions, whereas it is supposed to be 
> dedicated to declaring exported ASM functions used by C functions.

But yes, it's since been co-opted for the modversions stuff.

I guess the contents should be split out into appropriate headers
depending on what the prototypes are for.

chers

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 2/4] powerpc: Introduce asm-prototypes.h
  2020-08-14 13:04     ` Michael Ellerman
@ 2020-08-14 13:26       ` Christophe Leroy
  0 siblings, 0 replies; 12+ messages in thread
From: Christophe Leroy @ 2020-08-14 13:26 UTC (permalink / raw)
  To: Michael Ellerman, Daniel Axtens, linuxppc-dev; +Cc: Nicholas Piggin



On 08/14/2020 01:04 PM, Michael Ellerman wrote:
> Christophe Leroy <christophe.leroy@csgroup.eu> writes:
>> Le 18/05/2016 à 03:16, Daniel Axtens a écrit :
>>> Sparse picked up a number of functions that are implemented in C and
>>> then only referred to in asm code.
>>>
>>> This introduces asm-prototypes.h, which provides a place for
>>> prototypes of these functions.
>>
>> It looks like this is a mis-use of asm-prototypes.h
>>
>> On other architectures, asm-prototypes.h is there to allow MODVERSION to
>> sent versions for exported assembly functions (I checked history of that
>> file in x86 and arm64).
> 
> Look closer :)
> 
> 42f5b4cacd78 ("powerpc: Introduce asm-prototypes.h") (Jun 2016)
> 334bb7738764 ("x86/kbuild: enable modversions for symbols exported from asm") (Dec 2016)
> c3296a1391cb ("arm64: add <asm/asm-prototypes.h>") (Dec 2018)

Aren't you all sitting at the same place in the middle of Pacific Ocean, 
far far away from Paris ? :)

Looking closer I see: mdr: (Ok, that's Nov 2016 but ...)

commit 4efca4ed05cbdfd13ec3e8cb623fb77d6e4ab187
Author: Nicholas Piggin <npiggin@gmail.com>
Date:   Tue Nov 1 12:46:19 2016 +1100

     kbuild: modversions for EXPORT_SYMBOL() for asm

     Allow architectures to create asm/asm-prototypes.h file that
     provides C prototypes for exported asm functions, which enables
     proper CRC versions to be generated for them.

     Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
     Signed-off-by: Michal Marek <mmarek@suse.com>




> 
>> It looks like you have used it on the other way round, you have declared
>> in it C functions used by ASM functions, whereas it is supposed to be
>> dedicated to declaring exported ASM functions used by C functions.
> 
> But yes, it's since been co-opted for the modversions stuff.
> 
> I guess the contents should be split out into appropriate headers
> depending on what the prototypes are for.
> 


Christophe

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2020-08-14 13:29 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-05-18  1:16 [PATCH 1/4] powerpc/sparse: make some things static Daniel Axtens
2016-05-18  1:16 ` [PATCH 2/4] powerpc: Introduce asm-prototypes.h Daniel Axtens
2016-06-21  0:40   ` [2/4] " Michael Ellerman
2020-08-14  9:34   ` [PATCH 2/4] " Christophe Leroy
2020-08-14  9:53     ` Daniel Axtens
2020-08-14 10:41       ` Christophe Leroy
2020-08-14 13:04     ` Michael Ellerman
2020-08-14 13:26       ` Christophe Leroy
2016-05-18  1:16 ` [PATCH 3/4] powerpc/sparse: Include headers containing prototypes Daniel Axtens
2016-06-21  0:40   ` [3/4] " Michael Ellerman
2016-05-18  1:16 ` [PATCH 4/4] powerpc/sparse: Use LE definition of REG_BYTE Daniel Axtens
2016-06-21  0:40 ` [1/4] powerpc/sparse: make some things static Michael Ellerman

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.