linux-trace-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 00/20] x86: address -Wmissing-prototype warnings
@ 2023-05-16 19:35 Arnd Bergmann
  2023-05-16 19:35 ` [PATCH 01/20] x86: move prepare_ftrace_return prototype to header Arnd Bergmann
                   ` (21 more replies)
  0 siblings, 22 replies; 29+ messages in thread
From: Arnd Bergmann @ 2023-05-16 19:35 UTC (permalink / raw)
  To: x86
  Cc: Arnd Bergmann, Thomas Gleixner, Ingo Molnar, Borislav Petkov,
	Dave Hansen, H. Peter Anvin, Andy Lutomirski, Steven Rostedt,
	Masami Hiramatsu, Mark Rutland, Juergen Gross,
	Srivatsa S. Bhat (VMware), Alexey Makhalov,
	VMware PV-Drivers Reviewers, Peter Zijlstra, Darren Hart,
	Andy Shevchenko, Boris Ostrovsky, Rafael J. Wysocki, linux-kernel,
	linux-trace-kernel, virtualization, linux-pci,
	platform-driver-x86, xen-devel, linux-pm, linux-mm

From: Arnd Bergmann <arnd@arndb.de>

This addresses all x86 specific prototype warnings. The majority of the
patches should be straightforward, either adding an #include statement
to get the right header, or ensuring that an unused global function is
left out of the build when the prototype is hidden.

The ones that are a bit awkward are those that just add a prototype to
shut up the warning, but the prototypes are never used for calling the
function because the only caller is in assembler code. I tried to come up
with other ways to shut up the compiler using the asmlinkage annotation,
but with no success.

All of the warnings have to be addressed in some form before the warning
can be enabled by default.

    Arnd

Link: https://people.kernel.org/arnd/missing-prototype-warnings-in-the-kernel


Arnd Bergmann (20):
  x86: move prepare_ftrace_return prototype to header
  x86: ce4100: Mark local functions as 'static'
  x86: apic: hide unused safe_smp_processor_id on UP
  x86: avoid unneeded __div64_32 function definition
  x86: head: add dummy prototype for mk_early_pgtbl_32
  x86: math-emu: include asm/fpu/regset.h
  x86: doublefault: avoid missing-prototype warnings
  x86: highmem: include asm/numa.h for set_highmem_pages_init
  x86: platform_quirks: include linux/pnp.h for arch_pnpbios_disabled
  x86: xen: add missing prototypes
  x86: entry: add  do_SYSENTER_32() prototype
  x86: qspinlock-paravirt: fix mising-prototype warnings
  x86: hibernate: declare global functions in suspend.h
  x86: fbdev: include asm/fb.h as needed
  x86: mce: add copy_mc_fragile_handle_tail prototype
  x86: vdso: include vdso/processor.h
  x86: usercopy: include arch_wb_cache_pmem declaration
  x86: ioremap: add early_memremap_pgprot_adjust prototype
  x86: purgatory: include header for warn() declaration
  x86: olpc: avoid missing-prototype warnings

 arch/x86/boot/compressed/error.c          |  2 +-
 arch/x86/boot/compressed/error.h          |  2 +-
 arch/x86/entry/vdso/vgetcpu.c             |  1 +
 arch/x86/include/asm/div64.h              |  2 ++
 arch/x86/include/asm/doublefault.h        |  4 ++++
 arch/x86/include/asm/ftrace.h             |  3 +++
 arch/x86/include/asm/mce.h                |  3 +++
 arch/x86/include/asm/qspinlock_paravirt.h |  2 ++
 arch/x86/include/asm/syscall.h            |  6 ++++--
 arch/x86/kernel/apic/ipi.c                |  2 ++
 arch/x86/kernel/doublefault_32.c          |  1 +
 arch/x86/kernel/ftrace.c                  |  3 ---
 arch/x86/kernel/head32.c                  |  1 +
 arch/x86/kernel/paravirt.c                |  2 ++
 arch/x86/kernel/platform-quirks.c         |  1 +
 arch/x86/lib/usercopy_64.c                |  1 +
 arch/x86/math-emu/fpu_entry.c             |  1 +
 arch/x86/mm/highmem_32.c                  |  1 +
 arch/x86/pci/ce4100.c                     |  4 ++--
 arch/x86/platform/olpc/olpc_dt.c          |  2 +-
 arch/x86/purgatory/purgatory.c            |  1 +
 arch/x86/video/fbdev.c                    |  1 +
 arch/x86/xen/efi.c                        |  2 ++
 arch/x86/xen/smp.h                        |  3 +++
 arch/x86/xen/xen-ops.h                    | 14 ++++++++++++++
 include/linux/io.h                        |  5 +++++
 include/linux/olpc-ec.h                   |  2 ++
 include/linux/suspend.h                   |  4 ++++
 include/xen/xen.h                         |  3 +++
 kernel/locking/qspinlock_paravirt.h       | 20 ++++++++++----------
 kernel/power/power.h                      |  5 -----
 mm/internal.h                             |  6 ------
 32 files changed, 79 insertions(+), 31 deletions(-)

-- 
2.39.2

Cc: Thomas Gleixner <tglx@linutronix.de> (maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT),commit_signer:1/5=20%,authored:1/5=20%)
Cc: Ingo Molnar <mingo@redhat.com> (maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT))
Cc: Borislav Petkov <bp@alien8.de> (maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT),commit_signer:1/3=33%,commit_signer:1/5=20%,authored:1/5=20%,removed_lines:40/51=78%)
Cc: Dave Hansen <dave.hansen@linux.intel.com> (maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT),commit_signer:1/5=20%)
Cc: x86@kernel.org (maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT))
Cc: "H. Peter Anvin" <hpa@zytor.com> (reviewer:X86 ARCHITECTURE (32-BIT AND 64-BIT))
Cc: Andy Lutomirski <luto@kernel.org> (maintainer:X86 VDSO)
Cc: Steven Rostedt <rostedt@goodmis.org> (maintainer:FUNCTION HOOKS (FTRACE))
Cc: Masami Hiramatsu <mhiramat@kernel.org> (maintainer:FUNCTION HOOKS (FTRACE))
Cc: Mark Rutland <mark.rutland@arm.com> (reviewer:FUNCTION HOOKS (FTRACE))
Cc: Juergen Gross <jgross@suse.com> (supporter:PARAVIRT_OPS INTERFACE,commit_signer:2/5=40%,authored:1/5=20%,added_lines:20/31=65%,removed_lines:27/35=77%)
Cc: "Srivatsa S. Bhat (VMware)" <srivatsa@csail.mit.edu> (supporter:PARAVIRT_OPS INTERFACE)
Cc: Alexey Makhalov <amakhalov@vmware.com> (reviewer:PARAVIRT_OPS INTERFACE)
Cc: VMware PV-Drivers Reviewers <pv-drivers@vmware.com> (reviewer:PARAVIRT_OPS INTERFACE)
Cc: Peter Zijlstra <peterz@infradead.org> (maintainer:X86 MM,commit_signer:4/5=80%,commit_signer:1/2=50%)
Cc: Darren Hart <dvhart@infradead.org> (reviewer:X86 PLATFORM DRIVERS - ARCH)
Cc: Andy Shevchenko <andy@infradead.org> (reviewer:X86 PLATFORM DRIVERS - ARCH)
Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com> (reviewer:XEN HYPERVISOR X86)
Cc: "Rafael J. Wysocki" <rafael@kernel.org> (supporter:HIBERNATION (aka Software Suspend, aka swsusp))
Cc: linux-kernel@vger.kernel.org (open list:X86 ARCHITECTURE (32-BIT AND 64-BIT))
Cc: linux-trace-kernel@vger.kernel.org (open list:FUNCTION HOOKS (FTRACE))
Cc: virtualization@lists.linux-foundation.org (open list:PARAVIRT_OPS INTERFACE)
Cc: linux-pci@vger.kernel.org (open list:PCI SUBSYSTEM)
Cc: platform-driver-x86@vger.kernel.org (open list:X86 PLATFORM DRIVERS - ARCH)
Cc: xen-devel@lists.xenproject.org (moderated list:XEN HYPERVISOR X86)
Cc: linux-pm@vger.kernel.org (open list:HIBERNATION (aka Software Suspend, aka swsusp))
Cc: linux-mm@kvack.org (open list:MEMORY MANAGEMENT)


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

* [PATCH 01/20] x86: move prepare_ftrace_return prototype to header
  2023-05-16 19:35 [PATCH 00/20] x86: address -Wmissing-prototype warnings Arnd Bergmann
@ 2023-05-16 19:35 ` Arnd Bergmann
  2023-05-16 21:44   ` Steven Rostedt
  2023-05-16 19:35 ` [PATCH 02/20] x86: ce4100: Mark local functions as 'static' Arnd Bergmann
                   ` (20 subsequent siblings)
  21 siblings, 1 reply; 29+ messages in thread
From: Arnd Bergmann @ 2023-05-16 19:35 UTC (permalink / raw)
  To: x86
  Cc: Arnd Bergmann, Thomas Gleixner, Ingo Molnar, Borislav Petkov,
	Dave Hansen, H. Peter Anvin, Andy Lutomirski, Steven Rostedt,
	Masami Hiramatsu, Mark Rutland, Juergen Gross,
	Srivatsa S. Bhat (VMware), Alexey Makhalov,
	VMware PV-Drivers Reviewers, Peter Zijlstra, Darren Hart,
	Andy Shevchenko, Boris Ostrovsky, Rafael J. Wysocki, linux-kernel,
	linux-trace-kernel, virtualization, linux-pci,
	platform-driver-x86, xen-devel, linux-pm, linux-mm

From: Arnd Bergmann <arnd@arndb.de>

On 32-bit builds, the prepare_ftrace_return() function only has a global
definition, but no prototype before it, which causes a warning:

arch/x86/kernel/ftrace.c:625:6: warning: no previous prototype for ‘prepare_ftrace_return’ [-Wmissing-prototypes]
  625 | void prepare_ftrace_return(unsigned long ip, unsigned long *parent,

Move the prototype that is already needed for some configurations into
a header file where it can be seen unconditionally.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 arch/x86/include/asm/ftrace.h | 3 +++
 arch/x86/kernel/ftrace.c      | 3 ---
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/arch/x86/include/asm/ftrace.h b/arch/x86/include/asm/ftrace.h
index 5061ac98ffa1..b8d4a07f9595 100644
--- a/arch/x86/include/asm/ftrace.h
+++ b/arch/x86/include/asm/ftrace.h
@@ -106,6 +106,9 @@ struct dyn_arch_ftrace {
 
 #ifndef __ASSEMBLY__
 
+void prepare_ftrace_return(unsigned long ip, unsigned long *parent,
+			   unsigned long frame_pointer);
+
 #if defined(CONFIG_FUNCTION_TRACER) && defined(CONFIG_DYNAMIC_FTRACE)
 extern void set_ftrace_ops_ro(void);
 #else
diff --git a/arch/x86/kernel/ftrace.c b/arch/x86/kernel/ftrace.c
index 5e7ead52cfdb..01e8f34daf22 100644
--- a/arch/x86/kernel/ftrace.c
+++ b/arch/x86/kernel/ftrace.c
@@ -525,9 +525,6 @@ static void *addr_from_call(void *ptr)
 	return ptr + CALL_INSN_SIZE + call.disp;
 }
 
-void prepare_ftrace_return(unsigned long ip, unsigned long *parent,
-			   unsigned long frame_pointer);
-
 /*
  * If the ops->trampoline was not allocated, then it probably
  * has a static trampoline func, or is the ftrace caller itself.
-- 
2.39.2


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

* [PATCH 02/20] x86: ce4100: Mark local functions as 'static'
  2023-05-16 19:35 [PATCH 00/20] x86: address -Wmissing-prototype warnings Arnd Bergmann
  2023-05-16 19:35 ` [PATCH 01/20] x86: move prepare_ftrace_return prototype to header Arnd Bergmann
@ 2023-05-16 19:35 ` Arnd Bergmann
  2023-05-16 19:35 ` [PATCH 03/20] x86: apic: hide unused safe_smp_processor_id on UP Arnd Bergmann
                   ` (19 subsequent siblings)
  21 siblings, 0 replies; 29+ messages in thread
From: Arnd Bergmann @ 2023-05-16 19:35 UTC (permalink / raw)
  To: x86
  Cc: Arnd Bergmann, Thomas Gleixner, Ingo Molnar, Borislav Petkov,
	Dave Hansen, H. Peter Anvin, Andy Lutomirski, Steven Rostedt,
	Masami Hiramatsu, Mark Rutland, Juergen Gross,
	Srivatsa S. Bhat (VMware), Alexey Makhalov,
	VMware PV-Drivers Reviewers, Peter Zijlstra, Darren Hart,
	Andy Shevchenko, Boris Ostrovsky, Rafael J. Wysocki, linux-kernel,
	linux-trace-kernel, virtualization, linux-pci,
	platform-driver-x86, xen-devel, linux-pm, linux-mm

From: Arnd Bergmann <arnd@arndb.de>

Two functions in this file are global but have no prototype in
a header and are not called from elsewhere, so they should
be static:

arch/x86/pci/ce4100.c:86:6: error: no previous prototype for 'sata_revid_init' [-Werror=missing-prototypes]
arch/x86/pci/ce4100.c:175:5: error: no previous prototype for 'bridge_read' [-Werror=missing-prototypes]

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 arch/x86/pci/ce4100.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/x86/pci/ce4100.c b/arch/x86/pci/ce4100.c
index 584c25b588b4..87313701f069 100644
--- a/arch/x86/pci/ce4100.c
+++ b/arch/x86/pci/ce4100.c
@@ -83,7 +83,7 @@ static void ehci_reg_read(struct sim_dev_reg *reg, u32 *value)
 		*value |= 0x100;
 }
 
-void sata_revid_init(struct sim_dev_reg *reg)
+static void sata_revid_init(struct sim_dev_reg *reg)
 {
 	reg->sim_reg.value = 0x01060100;
 	reg->sim_reg.mask = 0;
@@ -172,7 +172,7 @@ static inline void extract_bytes(u32 *value, int reg, int len)
 	*value &= mask;
 }
 
-int bridge_read(unsigned int devfn, int reg, int len, u32 *value)
+static int bridge_read(unsigned int devfn, int reg, int len, u32 *value)
 {
 	u32 av_bridge_base, av_bridge_limit;
 	int retval = 0;
-- 
2.39.2


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

* [PATCH 03/20] x86: apic: hide unused safe_smp_processor_id on UP
  2023-05-16 19:35 [PATCH 00/20] x86: address -Wmissing-prototype warnings Arnd Bergmann
  2023-05-16 19:35 ` [PATCH 01/20] x86: move prepare_ftrace_return prototype to header Arnd Bergmann
  2023-05-16 19:35 ` [PATCH 02/20] x86: ce4100: Mark local functions as 'static' Arnd Bergmann
@ 2023-05-16 19:35 ` Arnd Bergmann
  2023-05-16 19:35 ` [PATCH 04/20] x86: avoid unneeded __div64_32 function definition Arnd Bergmann
                   ` (18 subsequent siblings)
  21 siblings, 0 replies; 29+ messages in thread
From: Arnd Bergmann @ 2023-05-16 19:35 UTC (permalink / raw)
  To: x86
  Cc: Arnd Bergmann, Thomas Gleixner, Ingo Molnar, Borislav Petkov,
	Dave Hansen, H. Peter Anvin, Andy Lutomirski, Steven Rostedt,
	Masami Hiramatsu, Mark Rutland, Juergen Gross,
	Srivatsa S. Bhat (VMware), Alexey Makhalov,
	VMware PV-Drivers Reviewers, Peter Zijlstra, Darren Hart,
	Andy Shevchenko, Boris Ostrovsky, Rafael J. Wysocki, linux-kernel,
	linux-trace-kernel, virtualization, linux-pci,
	platform-driver-x86, xen-devel, linux-pm, linux-mm

From: Arnd Bergmann <arnd@arndb.de>

When CONFIG_SMP is disabled, the prototype for safe_smp_processor_id()
is hidden, which causes a W=1 warning:

/home/arnd/arm-soc/arch/x86/kernel/apic/ipi.c:316:5: error: no previous prototype for 'safe_smp_processor_id' [-Werror=missing-prototypes]

Since there are no callers in this configuration, just hide the definition
as well.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 arch/x86/kernel/apic/ipi.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/x86/kernel/apic/ipi.c b/arch/x86/kernel/apic/ipi.c
index 2a6509e8c840..9bfd6e397384 100644
--- a/arch/x86/kernel/apic/ipi.c
+++ b/arch/x86/kernel/apic/ipi.c
@@ -301,6 +301,7 @@ void default_send_IPI_mask_logical(const struct cpumask *cpumask, int vector)
 	local_irq_restore(flags);
 }
 
+#ifdef CONFIG_SMP
 /* must come after the send_IPI functions above for inlining */
 static int convert_apicid_to_cpu(int apic_id)
 {
@@ -329,3 +330,4 @@ int safe_smp_processor_id(void)
 	return cpuid >= 0 ? cpuid : 0;
 }
 #endif
+#endif
-- 
2.39.2


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

* [PATCH 04/20] x86: avoid unneeded __div64_32 function definition
  2023-05-16 19:35 [PATCH 00/20] x86: address -Wmissing-prototype warnings Arnd Bergmann
                   ` (2 preceding siblings ...)
  2023-05-16 19:35 ` [PATCH 03/20] x86: apic: hide unused safe_smp_processor_id on UP Arnd Bergmann
@ 2023-05-16 19:35 ` Arnd Bergmann
  2023-05-16 19:35 ` [PATCH 05/20] x86: head: add dummy prototype for mk_early_pgtbl_32 Arnd Bergmann
                   ` (17 subsequent siblings)
  21 siblings, 0 replies; 29+ messages in thread
From: Arnd Bergmann @ 2023-05-16 19:35 UTC (permalink / raw)
  To: x86
  Cc: Arnd Bergmann, Thomas Gleixner, Ingo Molnar, Borislav Petkov,
	Dave Hansen, H. Peter Anvin, Andy Lutomirski, Steven Rostedt,
	Masami Hiramatsu, Mark Rutland, Juergen Gross,
	Srivatsa S. Bhat (VMware), Alexey Makhalov,
	VMware PV-Drivers Reviewers, Peter Zijlstra, Darren Hart,
	Andy Shevchenko, Boris Ostrovsky, Rafael J. Wysocki, linux-kernel,
	linux-trace-kernel, virtualization, linux-pci,
	platform-driver-x86, xen-devel, linux-pm, linux-mm

From: Arnd Bergmann <arnd@arndb.de>

The __div64_32() function is provided for 32-bit architectures that
don't have a custom do_div() implementation. x86_32 has one, and
does not use the header file that declares the function prototype,
so the definition causes a W=1 warning:

lib/math/div64.c:31:32: error: no previous prototype for '__div64_32' [-Werror=missing-prototypes]

Define an empty macro to prevent the function definition from getting
built, which avoids the warning and saves a little .text space.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 arch/x86/include/asm/div64.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/x86/include/asm/div64.h b/arch/x86/include/asm/div64.h
index b8f1dc0761e4..9826d5fc12e3 100644
--- a/arch/x86/include/asm/div64.h
+++ b/arch/x86/include/asm/div64.h
@@ -71,6 +71,8 @@ static inline u64 mul_u32_u32(u32 a, u32 b)
 }
 #define mul_u32_u32 mul_u32_u32
 
+#define __div64_32 /* not needed */
+
 #else
 # include <asm-generic/div64.h>
 
-- 
2.39.2


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

* [PATCH 05/20] x86: head: add dummy prototype for mk_early_pgtbl_32
  2023-05-16 19:35 [PATCH 00/20] x86: address -Wmissing-prototype warnings Arnd Bergmann
                   ` (3 preceding siblings ...)
  2023-05-16 19:35 ` [PATCH 04/20] x86: avoid unneeded __div64_32 function definition Arnd Bergmann
@ 2023-05-16 19:35 ` Arnd Bergmann
  2023-05-18 16:52   ` Alexander Lobakin
  2023-05-16 19:35 ` [PATCH 06/20] x86: math-emu: include asm/fpu/regset.h Arnd Bergmann
                   ` (16 subsequent siblings)
  21 siblings, 1 reply; 29+ messages in thread
From: Arnd Bergmann @ 2023-05-16 19:35 UTC (permalink / raw)
  To: x86
  Cc: Arnd Bergmann, Thomas Gleixner, Ingo Molnar, Borislav Petkov,
	Dave Hansen, H. Peter Anvin, Andy Lutomirski, Steven Rostedt,
	Masami Hiramatsu, Mark Rutland, Juergen Gross,
	Srivatsa S. Bhat (VMware), Alexey Makhalov,
	VMware PV-Drivers Reviewers, Peter Zijlstra, Darren Hart,
	Andy Shevchenko, Boris Ostrovsky, Rafael J. Wysocki, linux-kernel,
	linux-trace-kernel, virtualization, linux-pci,
	platform-driver-x86, xen-devel, linux-pm, linux-mm

From: Arnd Bergmann <arnd@arndb.de>

'make W=1' warns about a function without a prototype in the x86-32 head code:

arch/x86/kernel/head32.c:72:13: error: no previous prototype for 'mk_early_pgtbl_32' [-Werror=missing-prototypes]

This is called from assembler code, so it does not actually need a prototype.
I could not find an appropriate header for it, so just declare it in front
of the definition to shut up th warning.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 arch/x86/kernel/head32.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/x86/kernel/head32.c b/arch/x86/kernel/head32.c
index 10c27b4261eb..246a609f889b 100644
--- a/arch/x86/kernel/head32.c
+++ b/arch/x86/kernel/head32.c
@@ -69,6 +69,7 @@ asmlinkage __visible void __init __noreturn i386_start_kernel(void)
  * to the first kernel PMD. Note the upper half of each PMD or PTE are
  * always zero at this stage.
  */
+void __init mk_early_pgtbl_32(void);
 void __init mk_early_pgtbl_32(void)
 {
 #ifdef __pa
-- 
2.39.2


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

* [PATCH 06/20] x86: math-emu: include asm/fpu/regset.h
  2023-05-16 19:35 [PATCH 00/20] x86: address -Wmissing-prototype warnings Arnd Bergmann
                   ` (4 preceding siblings ...)
  2023-05-16 19:35 ` [PATCH 05/20] x86: head: add dummy prototype for mk_early_pgtbl_32 Arnd Bergmann
@ 2023-05-16 19:35 ` Arnd Bergmann
  2023-05-16 19:35 ` [PATCH 07/20] x86: doublefault: avoid missing-prototype warnings Arnd Bergmann
                   ` (15 subsequent siblings)
  21 siblings, 0 replies; 29+ messages in thread
From: Arnd Bergmann @ 2023-05-16 19:35 UTC (permalink / raw)
  To: x86
  Cc: Arnd Bergmann, Thomas Gleixner, Ingo Molnar, Borislav Petkov,
	Dave Hansen, H. Peter Anvin, Andy Lutomirski, Steven Rostedt,
	Masami Hiramatsu, Mark Rutland, Juergen Gross,
	Srivatsa S. Bhat (VMware), Alexey Makhalov,
	VMware PV-Drivers Reviewers, Peter Zijlstra, Darren Hart,
	Andy Shevchenko, Boris Ostrovsky, Rafael J. Wysocki, linux-kernel,
	linux-trace-kernel, virtualization, linux-pci,
	platform-driver-x86, xen-devel, linux-pm, linux-mm

From: Arnd Bergmann <arnd@arndb.de>

The fpregs_soft_set/fpregs_soft_get functions are declared in a
header that is not included in the file that defines them, causing
a W=1 warning:

/home/arnd/arm-soc/arch/x86/math-emu/fpu_entry.c:638:5: error: no previous prototype for 'fpregs_soft_set' [-Werror=missing-prototypes]
  638 | int fpregs_soft_set(struct task_struct *target,
      |     ^~~~~~~~~~~~~~~
/home/arnd/arm-soc/arch/x86/math-emu/fpu_entry.c:690:5: error: no previous prototype for 'fpregs_soft_get' [-Werror=missing-prototypes]
  690 | int fpregs_soft_get(struct task_struct *target,

Include the file here to avoid the warning.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 arch/x86/math-emu/fpu_entry.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/x86/math-emu/fpu_entry.c b/arch/x86/math-emu/fpu_entry.c
index 7fe56c594aa6..91c52ead1226 100644
--- a/arch/x86/math-emu/fpu_entry.c
+++ b/arch/x86/math-emu/fpu_entry.c
@@ -32,6 +32,7 @@
 #include <asm/traps.h>
 #include <asm/user.h>
 #include <asm/fpu/api.h>
+#include <asm/fpu/regset.h>
 
 #include "fpu_system.h"
 #include "fpu_emu.h"
-- 
2.39.2


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

* [PATCH 07/20] x86: doublefault: avoid missing-prototype warnings
  2023-05-16 19:35 [PATCH 00/20] x86: address -Wmissing-prototype warnings Arnd Bergmann
                   ` (5 preceding siblings ...)
  2023-05-16 19:35 ` [PATCH 06/20] x86: math-emu: include asm/fpu/regset.h Arnd Bergmann
@ 2023-05-16 19:35 ` Arnd Bergmann
  2023-05-16 19:35 ` [PATCH 08/20] x86: highmem: include asm/numa.h for set_highmem_pages_init Arnd Bergmann
                   ` (14 subsequent siblings)
  21 siblings, 0 replies; 29+ messages in thread
From: Arnd Bergmann @ 2023-05-16 19:35 UTC (permalink / raw)
  To: x86
  Cc: Arnd Bergmann, Thomas Gleixner, Ingo Molnar, Borislav Petkov,
	Dave Hansen, H. Peter Anvin, Andy Lutomirski, Steven Rostedt,
	Masami Hiramatsu, Mark Rutland, Juergen Gross,
	Srivatsa S. Bhat (VMware), Alexey Makhalov,
	VMware PV-Drivers Reviewers, Peter Zijlstra, Darren Hart,
	Andy Shevchenko, Boris Ostrovsky, Rafael J. Wysocki, linux-kernel,
	linux-trace-kernel, virtualization, linux-pci,
	platform-driver-x86, xen-devel, linux-pm, linux-mm

From: Arnd Bergmann <arnd@arndb.de>

Two functions in the 32-bit doublefault code are lacking a prototype:

arch/x86/kernel/doublefault_32.c:23:36: error: no previous prototype for 'doublefault_shim' [-Werror=missing-prototypes]
   23 | asmlinkage noinstr void __noreturn doublefault_shim(void)
      |                                    ^~~~~~~~~~~~~~~~
arch/x86/kernel/doublefault_32.c:114:6: error: no previous prototype for 'doublefault_init_cpu_tss' [-Werror=missing-prototypes]
  114 | void doublefault_init_cpu_tss(void)

The first one is only called from assembler, while the second one is
declared in doublefault.h, but this file is not included.

Include the header file and add the other declaration there as well.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 arch/x86/include/asm/doublefault.h | 4 ++++
 arch/x86/kernel/doublefault_32.c   | 1 +
 2 files changed, 5 insertions(+)

diff --git a/arch/x86/include/asm/doublefault.h b/arch/x86/include/asm/doublefault.h
index 54a6e4a2e132..de0e88b32207 100644
--- a/arch/x86/include/asm/doublefault.h
+++ b/arch/x86/include/asm/doublefault.h
@@ -2,6 +2,8 @@
 #ifndef _ASM_X86_DOUBLEFAULT_H
 #define _ASM_X86_DOUBLEFAULT_H
 
+#include <linux/linkage.h>
+
 #ifdef CONFIG_X86_32
 extern void doublefault_init_cpu_tss(void);
 #else
@@ -10,4 +12,6 @@ static inline void doublefault_init_cpu_tss(void)
 }
 #endif
 
+asmlinkage void __noreturn doublefault_shim(void);
+
 #endif /* _ASM_X86_DOUBLEFAULT_H */
diff --git a/arch/x86/kernel/doublefault_32.c b/arch/x86/kernel/doublefault_32.c
index 3b58d8703094..6eaf9a6bc02f 100644
--- a/arch/x86/kernel/doublefault_32.c
+++ b/arch/x86/kernel/doublefault_32.c
@@ -9,6 +9,7 @@
 #include <asm/processor.h>
 #include <asm/desc.h>
 #include <asm/traps.h>
+#include <asm/doublefault.h>
 
 #define ptr_ok(x) ((x) > PAGE_OFFSET && (x) < PAGE_OFFSET + MAXMEM)
 
-- 
2.39.2


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

* [PATCH 08/20] x86: highmem: include asm/numa.h for set_highmem_pages_init
  2023-05-16 19:35 [PATCH 00/20] x86: address -Wmissing-prototype warnings Arnd Bergmann
                   ` (6 preceding siblings ...)
  2023-05-16 19:35 ` [PATCH 07/20] x86: doublefault: avoid missing-prototype warnings Arnd Bergmann
@ 2023-05-16 19:35 ` Arnd Bergmann
  2023-05-16 19:35 ` [PATCH 09/20] x86: platform_quirks: include linux/pnp.h for arch_pnpbios_disabled Arnd Bergmann
                   ` (13 subsequent siblings)
  21 siblings, 0 replies; 29+ messages in thread
From: Arnd Bergmann @ 2023-05-16 19:35 UTC (permalink / raw)
  To: x86
  Cc: Arnd Bergmann, Thomas Gleixner, Ingo Molnar, Borislav Petkov,
	Dave Hansen, H. Peter Anvin, Andy Lutomirski, Steven Rostedt,
	Masami Hiramatsu, Mark Rutland, Juergen Gross,
	Srivatsa S. Bhat (VMware), Alexey Makhalov,
	VMware PV-Drivers Reviewers, Peter Zijlstra, Darren Hart,
	Andy Shevchenko, Boris Ostrovsky, Rafael J. Wysocki, linux-kernel,
	linux-trace-kernel, virtualization, linux-pci,
	platform-driver-x86, xen-devel, linux-pm, linux-mm

From: Arnd Bergmann <arnd@arndb.de>

The set_highmem_pages_init() function is declared in asm/numa.h, which
must be included in the file that defines it to avoid a W=1 warning:

arch/x86/mm/highmem_32.c:7:13: error: no previous prototype for 'set_highmem_pages_init' [-Werror=missing-prototypes]

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 arch/x86/mm/highmem_32.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/x86/mm/highmem_32.c b/arch/x86/mm/highmem_32.c
index 2c54b76d8f84..d9efa35711ee 100644
--- a/arch/x86/mm/highmem_32.c
+++ b/arch/x86/mm/highmem_32.c
@@ -3,6 +3,7 @@
 #include <linux/export.h>
 #include <linux/swap.h> /* for totalram_pages */
 #include <linux/memblock.h>
+#include <asm/numa.h>
 
 void __init set_highmem_pages_init(void)
 {
-- 
2.39.2


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

* [PATCH 09/20] x86: platform_quirks: include linux/pnp.h for arch_pnpbios_disabled
  2023-05-16 19:35 [PATCH 00/20] x86: address -Wmissing-prototype warnings Arnd Bergmann
                   ` (7 preceding siblings ...)
  2023-05-16 19:35 ` [PATCH 08/20] x86: highmem: include asm/numa.h for set_highmem_pages_init Arnd Bergmann
@ 2023-05-16 19:35 ` Arnd Bergmann
  2023-05-16 19:35 ` [PATCH 10/20] x86: xen: add missing prototypes Arnd Bergmann
                   ` (12 subsequent siblings)
  21 siblings, 0 replies; 29+ messages in thread
From: Arnd Bergmann @ 2023-05-16 19:35 UTC (permalink / raw)
  To: x86
  Cc: Arnd Bergmann, Thomas Gleixner, Ingo Molnar, Borislav Petkov,
	Dave Hansen, H. Peter Anvin, Andy Lutomirski, Steven Rostedt,
	Masami Hiramatsu, Mark Rutland, Juergen Gross,
	Srivatsa S. Bhat (VMware), Alexey Makhalov,
	VMware PV-Drivers Reviewers, Peter Zijlstra, Darren Hart,
	Andy Shevchenko, Boris Ostrovsky, Rafael J. Wysocki, linux-kernel,
	linux-trace-kernel, virtualization, linux-pci,
	platform-driver-x86, xen-devel, linux-pm, linux-mm

From: Arnd Bergmann <arnd@arndb.de>

arch_pnpbios_disabled() is defined in architecture code on x86, but this
does not include the appropriate header, causing a warning:

arch/x86/kernel/platform-quirks.c:42:13: error: no previous prototype for 'arch_pnpbios_disabled' [-Werror=missing-prototypes]

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 arch/x86/kernel/platform-quirks.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/x86/kernel/platform-quirks.c b/arch/x86/kernel/platform-quirks.c
index b348a672f71d..b525fe6d6657 100644
--- a/arch/x86/kernel/platform-quirks.c
+++ b/arch/x86/kernel/platform-quirks.c
@@ -1,6 +1,7 @@
 // SPDX-License-Identifier: GPL-2.0
 #include <linux/kernel.h>
 #include <linux/init.h>
+#include <linux/pnp.h>
 
 #include <asm/setup.h>
 #include <asm/bios_ebda.h>
-- 
2.39.2


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

* [PATCH 10/20] x86: xen: add missing prototypes
  2023-05-16 19:35 [PATCH 00/20] x86: address -Wmissing-prototype warnings Arnd Bergmann
                   ` (8 preceding siblings ...)
  2023-05-16 19:35 ` [PATCH 09/20] x86: platform_quirks: include linux/pnp.h for arch_pnpbios_disabled Arnd Bergmann
@ 2023-05-16 19:35 ` Arnd Bergmann
  2023-05-18 17:28   ` Dave Hansen
  2023-05-16 19:35 ` [PATCH 11/20] x86: entry: add do_SYSENTER_32() prototype Arnd Bergmann
                   ` (11 subsequent siblings)
  21 siblings, 1 reply; 29+ messages in thread
From: Arnd Bergmann @ 2023-05-16 19:35 UTC (permalink / raw)
  To: x86
  Cc: Arnd Bergmann, Thomas Gleixner, Ingo Molnar, Borislav Petkov,
	Dave Hansen, H. Peter Anvin, Andy Lutomirski, Steven Rostedt,
	Masami Hiramatsu, Mark Rutland, Juergen Gross,
	Srivatsa S. Bhat (VMware), Alexey Makhalov,
	VMware PV-Drivers Reviewers, Peter Zijlstra, Darren Hart,
	Andy Shevchenko, Boris Ostrovsky, Rafael J. Wysocki, linux-kernel,
	linux-trace-kernel, virtualization, linux-pci,
	platform-driver-x86, xen-devel, linux-pm, linux-mm

From: Arnd Bergmann <arnd@arndb.de>

arch/x86/xen/enlighten_pv.c:1233:34: error: no previous prototype for 'xen_start_kernel' [-Werror=missing-prototypes]
arch/x86/xen/irq.c:22:14: error: no previous prototype for 'xen_force_evtchn_callback' [-Werror=missing-prototypes]
arch/x86/xen/mmu_pv.c:358:20: error: no previous prototype for 'xen_pte_val' [-Werror=missing-prototypes]
arch/x86/xen/mmu_pv.c:366:20: error: no previous prototype for 'xen_pgd_val' [-Werror=missing-prototypes]

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 arch/x86/xen/efi.c     |  2 ++
 arch/x86/xen/smp.h     |  3 +++
 arch/x86/xen/xen-ops.h | 14 ++++++++++++++
 include/xen/xen.h      |  3 +++
 4 files changed, 22 insertions(+)

diff --git a/arch/x86/xen/efi.c b/arch/x86/xen/efi.c
index 7d7ffb9c826a..863d0d6b3edc 100644
--- a/arch/x86/xen/efi.c
+++ b/arch/x86/xen/efi.c
@@ -16,6 +16,8 @@
 #include <asm/setup.h>
 #include <asm/xen/hypercall.h>
 
+#include "xen-ops.h"
+
 static efi_char16_t vendor[100] __initdata;
 
 static efi_system_table_t efi_systab_xen __initdata = {
diff --git a/arch/x86/xen/smp.h b/arch/x86/xen/smp.h
index 22fb982ff971..cbc45e2462f5 100644
--- a/arch/x86/xen/smp.h
+++ b/arch/x86/xen/smp.h
@@ -2,6 +2,9 @@
 #ifndef _XEN_SMP_H
 
 #ifdef CONFIG_SMP
+
+asmlinkage void cpu_bringup_and_idle(void);
+
 extern void xen_send_IPI_mask(const struct cpumask *mask,
 			      int vector);
 extern void xen_send_IPI_mask_allbutself(const struct cpumask *mask,
diff --git a/arch/x86/xen/xen-ops.h b/arch/x86/xen/xen-ops.h
index 6d7f6318fc07..0f71ee3fe86b 100644
--- a/arch/x86/xen/xen-ops.h
+++ b/arch/x86/xen/xen-ops.h
@@ -160,4 +160,18 @@ void xen_hvm_post_suspend(int suspend_cancelled);
 static inline void xen_hvm_post_suspend(int suspend_cancelled) {}
 #endif
 
+void xen_force_evtchn_callback(void);
+pteval_t xen_pte_val(pte_t pte);
+pgdval_t xen_pgd_val(pgd_t pgd);
+pte_t xen_make_pte(pteval_t pte);
+pgd_t xen_make_pgd(pgdval_t pgd);
+pmdval_t xen_pmd_val(pmd_t pmd);
+pmd_t xen_make_pmd(pmdval_t pmd);
+pudval_t xen_pud_val(pud_t pud);
+pud_t xen_make_pud(pudval_t pud);
+p4dval_t xen_p4d_val(p4d_t p4d);
+p4d_t xen_make_p4d(p4dval_t p4d);
+pte_t xen_make_pte_init(pteval_t pte);
+void xen_start_kernel(struct start_info *si);
+
 #endif /* XEN_OPS_H */
diff --git a/include/xen/xen.h b/include/xen/xen.h
index 0efeb652f9b8..f989162983c3 100644
--- a/include/xen/xen.h
+++ b/include/xen/xen.h
@@ -31,6 +31,9 @@ extern uint32_t xen_start_flags;
 
 #include <xen/interface/hvm/start_info.h>
 extern struct hvm_start_info pvh_start_info;
+void xen_prepare_pvh(void);
+struct pt_regs;
+void xen_pv_evtchn_do_upcall(struct pt_regs *regs);
 
 #ifdef CONFIG_XEN_DOM0
 #include <xen/interface/xen.h>
-- 
2.39.2


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

* [PATCH 11/20] x86: entry: add  do_SYSENTER_32() prototype
  2023-05-16 19:35 [PATCH 00/20] x86: address -Wmissing-prototype warnings Arnd Bergmann
                   ` (9 preceding siblings ...)
  2023-05-16 19:35 ` [PATCH 10/20] x86: xen: add missing prototypes Arnd Bergmann
@ 2023-05-16 19:35 ` Arnd Bergmann
  2023-05-16 19:35 ` [PATCH 12/20] x86: qspinlock-paravirt: fix mising-prototype warnings Arnd Bergmann
                   ` (10 subsequent siblings)
  21 siblings, 0 replies; 29+ messages in thread
From: Arnd Bergmann @ 2023-05-16 19:35 UTC (permalink / raw)
  To: x86
  Cc: Arnd Bergmann, Thomas Gleixner, Ingo Molnar, Borislav Petkov,
	Dave Hansen, H. Peter Anvin, Andy Lutomirski, Steven Rostedt,
	Masami Hiramatsu, Mark Rutland, Juergen Gross,
	Srivatsa S. Bhat (VMware), Alexey Makhalov,
	VMware PV-Drivers Reviewers, Peter Zijlstra, Darren Hart,
	Andy Shevchenko, Boris Ostrovsky, Rafael J. Wysocki, linux-kernel,
	linux-trace-kernel, virtualization, linux-pci,
	platform-driver-x86, xen-devel, linux-pm, linux-mm

From: Arnd Bergmann <arnd@arndb.de>

The 32-bit system call entry points can be called on both 32-bit
and 64-bit kernels, but on the former the declarations are hidden:

arch/x86/entry/common.c:238:24: error: no previous prototype for 'do_SYSENTER_32' [-Werror=missing-prototypes]

Move them all out of the #ifdef block to avoid the warnings.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 arch/x86/include/asm/syscall.h | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/arch/x86/include/asm/syscall.h b/arch/x86/include/asm/syscall.h
index 5b85987a5e97..4fb36fba4b5a 100644
--- a/arch/x86/include/asm/syscall.h
+++ b/arch/x86/include/asm/syscall.h
@@ -127,9 +127,11 @@ static inline int syscall_get_arch(struct task_struct *task)
 }
 
 void do_syscall_64(struct pt_regs *regs, int nr);
-void do_int80_syscall_32(struct pt_regs *regs);
-long do_fast_syscall_32(struct pt_regs *regs);
 
 #endif	/* CONFIG_X86_32 */
 
+void do_int80_syscall_32(struct pt_regs *regs);
+long do_fast_syscall_32(struct pt_regs *regs);
+long do_SYSENTER_32(struct pt_regs *regs);
+
 #endif	/* _ASM_X86_SYSCALL_H */
-- 
2.39.2


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

* [PATCH 12/20] x86: qspinlock-paravirt: fix mising-prototype warnings
  2023-05-16 19:35 [PATCH 00/20] x86: address -Wmissing-prototype warnings Arnd Bergmann
                   ` (10 preceding siblings ...)
  2023-05-16 19:35 ` [PATCH 11/20] x86: entry: add do_SYSENTER_32() prototype Arnd Bergmann
@ 2023-05-16 19:35 ` Arnd Bergmann
  2023-05-16 19:35 ` [PATCH 13/20] x86: hibernate: declare global functions in suspend.h Arnd Bergmann
                   ` (9 subsequent siblings)
  21 siblings, 0 replies; 29+ messages in thread
From: Arnd Bergmann @ 2023-05-16 19:35 UTC (permalink / raw)
  To: x86
  Cc: Arnd Bergmann, Thomas Gleixner, Ingo Molnar, Borislav Petkov,
	Dave Hansen, H. Peter Anvin, Andy Lutomirski, Steven Rostedt,
	Masami Hiramatsu, Mark Rutland, Juergen Gross,
	Srivatsa S. Bhat (VMware), Alexey Makhalov,
	VMware PV-Drivers Reviewers, Peter Zijlstra, Darren Hart,
	Andy Shevchenko, Boris Ostrovsky, Rafael J. Wysocki, linux-kernel,
	linux-trace-kernel, virtualization, linux-pci,
	platform-driver-x86, xen-devel, linux-pm, linux-mm

From: Arnd Bergmann <arnd@arndb.de>

__pv_queued_spin_unlock_slowpath is defined in a header file as a global
function, and designed to be called from an inline asm, but there is
no prototype visible in the definition:

kernel/locking/qspinlock_paravirt.h:493:1: error: no previous prototype for '__pv_queued_spin_unlock_slowpath' [-Werror=missing-prototypes]

Add this to the x86 header that contains the inline asm calling it,
and ensure this gets included before the definition, rather than
after it.

The native_pv_lock_init function in turn is only declared in SMP
builds but can be left out in UP to avoid another warning:

arch/x86/kernel/paravirt.c:76:13: error: no previous prototype for 'native_pv_lock_init' [-Werror=missing-prototypes]

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 arch/x86/include/asm/qspinlock_paravirt.h |  2 ++
 arch/x86/kernel/paravirt.c                |  2 ++
 kernel/locking/qspinlock_paravirt.h       | 20 ++++++++++----------
 3 files changed, 14 insertions(+), 10 deletions(-)

diff --git a/arch/x86/include/asm/qspinlock_paravirt.h b/arch/x86/include/asm/qspinlock_paravirt.h
index 42b17cf10b10..85b6e3609cb9 100644
--- a/arch/x86/include/asm/qspinlock_paravirt.h
+++ b/arch/x86/include/asm/qspinlock_paravirt.h
@@ -4,6 +4,8 @@
 
 #include <asm/ibt.h>
 
+void __lockfunc __pv_queued_spin_unlock_slowpath(struct qspinlock *lock, u8 locked);
+
 /*
  * For x86-64, PV_CALLEE_SAVE_REGS_THUNK() saves and restores 8 64-bit
  * registers. For i386, however, only 1 32-bit register needs to be saved
diff --git a/arch/x86/kernel/paravirt.c b/arch/x86/kernel/paravirt.c
index ac10b46c5832..eb67aa4cc5ef 100644
--- a/arch/x86/kernel/paravirt.c
+++ b/arch/x86/kernel/paravirt.c
@@ -73,11 +73,13 @@ DEFINE_PARAVIRT_ASM(pv_native_read_cr2, "mov %cr2, %rax", .noinstr.text);
 
 DEFINE_STATIC_KEY_TRUE(virt_spin_lock_key);
 
+#ifdef CONFIG_SMP
 void __init native_pv_lock_init(void)
 {
 	if (!boot_cpu_has(X86_FEATURE_HYPERVISOR))
 		static_branch_disable(&virt_spin_lock_key);
 }
+#endif
 
 unsigned int paravirt_patch(u8 type, void *insn_buff, unsigned long addr,
 			    unsigned int len)
diff --git a/kernel/locking/qspinlock_paravirt.h b/kernel/locking/qspinlock_paravirt.h
index 6afc249ce697..6a0184e9c234 100644
--- a/kernel/locking/qspinlock_paravirt.h
+++ b/kernel/locking/qspinlock_paravirt.h
@@ -485,6 +485,16 @@ pv_wait_head_or_lock(struct qspinlock *lock, struct mcs_spinlock *node)
 	return (u32)(atomic_read(&lock->val) | _Q_LOCKED_VAL);
 }
 
+/*
+ * Include the architecture specific callee-save thunk of the
+ * __pv_queued_spin_unlock(). This thunk is put together with
+ * __pv_queued_spin_unlock() to make the callee-save thunk and the real unlock
+ * function close to each other sharing consecutive instruction cachelines.
+ * Alternatively, architecture specific version of __pv_queued_spin_unlock()
+ * can be defined.
+ */
+#include <asm/qspinlock_paravirt.h>
+
 /*
  * PV versions of the unlock fastpath and slowpath functions to be used
  * instead of queued_spin_unlock().
@@ -533,16 +543,6 @@ __pv_queued_spin_unlock_slowpath(struct qspinlock *lock, u8 locked)
 	pv_kick(node->cpu);
 }
 
-/*
- * Include the architecture specific callee-save thunk of the
- * __pv_queued_spin_unlock(). This thunk is put together with
- * __pv_queued_spin_unlock() to make the callee-save thunk and the real unlock
- * function close to each other sharing consecutive instruction cachelines.
- * Alternatively, architecture specific version of __pv_queued_spin_unlock()
- * can be defined.
- */
-#include <asm/qspinlock_paravirt.h>
-
 #ifndef __pv_queued_spin_unlock
 __visible __lockfunc void __pv_queued_spin_unlock(struct qspinlock *lock)
 {
-- 
2.39.2


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

* [PATCH 13/20] x86: hibernate: declare global functions in suspend.h
  2023-05-16 19:35 [PATCH 00/20] x86: address -Wmissing-prototype warnings Arnd Bergmann
                   ` (11 preceding siblings ...)
  2023-05-16 19:35 ` [PATCH 12/20] x86: qspinlock-paravirt: fix mising-prototype warnings Arnd Bergmann
@ 2023-05-16 19:35 ` Arnd Bergmann
  2023-05-16 19:35 ` [PATCH 14/20] x86: fbdev: include asm/fb.h as needed Arnd Bergmann
                   ` (8 subsequent siblings)
  21 siblings, 0 replies; 29+ messages in thread
From: Arnd Bergmann @ 2023-05-16 19:35 UTC (permalink / raw)
  To: x86
  Cc: Arnd Bergmann, Thomas Gleixner, Ingo Molnar, Borislav Petkov,
	Dave Hansen, H. Peter Anvin, Andy Lutomirski, Steven Rostedt,
	Masami Hiramatsu, Mark Rutland, Juergen Gross,
	Srivatsa S. Bhat (VMware), Alexey Makhalov,
	VMware PV-Drivers Reviewers, Peter Zijlstra, Darren Hart,
	Andy Shevchenko, Boris Ostrovsky, Rafael J. Wysocki, linux-kernel,
	linux-trace-kernel, virtualization, linux-pci,
	platform-driver-x86, xen-devel, linux-pm, linux-mm

From: Arnd Bergmann <arnd@arndb.de>

Three functions that are defined in x86 specific code to override
generic __weak implementations cause a warning because of a missing
prototype:

arch/x86/power/cpu.c:298:5: error: no previous prototype for 'hibernate_resume_nonboot_cpu_disable' [-Werror=missing-prototypes]
arch/x86/power/hibernate.c:129:5: error: no previous prototype for 'arch_hibernation_header_restore' [-Werror=missing-prototypes]
arch/x86/power/hibernate.c:91:5: error: no previous prototype for 'arch_hibernation_header_save' [-Werror=missing-prototypes]

Move the declarations into a global header so it can be included
by any file defining one of these.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 include/linux/suspend.h | 4 ++++
 kernel/power/power.h    | 5 -----
 2 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/include/linux/suspend.h b/include/linux/suspend.h
index 7ec73e77e652..bc911fecb8e8 100644
--- a/include/linux/suspend.h
+++ b/include/linux/suspend.h
@@ -452,6 +452,10 @@ extern struct pbe *restore_pblist;
 int pfn_is_nosave(unsigned long pfn);
 
 int hibernate_quiet_exec(int (*func)(void *data), void *data);
+int hibernate_resume_nonboot_cpu_disable(void);
+int arch_hibernation_header_save(void *addr, unsigned int max_size);
+int arch_hibernation_header_restore(void *addr);
+
 #else /* CONFIG_HIBERNATION */
 static inline void register_nosave_region(unsigned long b, unsigned long e) {}
 static inline int swsusp_page_is_forbidden(struct page *p) { return 0; }
diff --git a/kernel/power/power.h b/kernel/power/power.h
index b83c8d5e188d..a6a16faf0ead 100644
--- a/kernel/power/power.h
+++ b/kernel/power/power.h
@@ -26,9 +26,6 @@ extern void __init hibernate_image_size_init(void);
 /* Maximum size of architecture specific data in a hibernation header */
 #define MAX_ARCH_HEADER_SIZE	(sizeof(struct new_utsname) + 4)
 
-extern int arch_hibernation_header_save(void *addr, unsigned int max_size);
-extern int arch_hibernation_header_restore(void *addr);
-
 static inline int init_header_complete(struct swsusp_info *info)
 {
 	return arch_hibernation_header_save(info, MAX_ARCH_HEADER_SIZE);
@@ -41,8 +38,6 @@ static inline const char *check_image_kernel(struct swsusp_info *info)
 }
 #endif /* CONFIG_ARCH_HIBERNATION_HEADER */
 
-extern int hibernate_resume_nonboot_cpu_disable(void);
-
 /*
  * Keep some memory free so that I/O operations can succeed without paging
  * [Might this be more than 4 MB?]
-- 
2.39.2


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

* [PATCH 14/20] x86: fbdev: include asm/fb.h as needed
  2023-05-16 19:35 [PATCH 00/20] x86: address -Wmissing-prototype warnings Arnd Bergmann
                   ` (12 preceding siblings ...)
  2023-05-16 19:35 ` [PATCH 13/20] x86: hibernate: declare global functions in suspend.h Arnd Bergmann
@ 2023-05-16 19:35 ` Arnd Bergmann
  2023-05-16 19:35 ` [PATCH 15/20] x86: mce: add copy_mc_fragile_handle_tail prototype Arnd Bergmann
                   ` (7 subsequent siblings)
  21 siblings, 0 replies; 29+ messages in thread
From: Arnd Bergmann @ 2023-05-16 19:35 UTC (permalink / raw)
  To: x86
  Cc: Arnd Bergmann, Thomas Gleixner, Ingo Molnar, Borislav Petkov,
	Dave Hansen, H. Peter Anvin, Andy Lutomirski, Steven Rostedt,
	Masami Hiramatsu, Mark Rutland, Juergen Gross,
	Srivatsa S. Bhat (VMware), Alexey Makhalov,
	VMware PV-Drivers Reviewers, Peter Zijlstra, Darren Hart,
	Andy Shevchenko, Boris Ostrovsky, Rafael J. Wysocki, linux-kernel,
	linux-trace-kernel, virtualization, linux-pci,
	platform-driver-x86, xen-devel, linux-pm, linux-mm

From: Arnd Bergmann <arnd@arndb.de>

fb_is_primary_device() is defined as a global function on x86, unlike
the others that have an inline version. The file that defines is
however needs to include the declaration to avoid a warning:

arch/x86/video/fbdev.c:14:5: error: no previous prototype for 'fb_is_primary_device' [-Werror=missing-prototypes]

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 arch/x86/video/fbdev.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/x86/video/fbdev.c b/arch/x86/video/fbdev.c
index 9fd24846d094..9e9143085d19 100644
--- a/arch/x86/video/fbdev.c
+++ b/arch/x86/video/fbdev.c
@@ -10,6 +10,7 @@
 #include <linux/pci.h>
 #include <linux/module.h>
 #include <linux/vgaarb.h>
+#include <asm/fb.h>
 
 int fb_is_primary_device(struct fb_info *info)
 {
-- 
2.39.2


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

* [PATCH 15/20] x86: mce: add copy_mc_fragile_handle_tail prototype
  2023-05-16 19:35 [PATCH 00/20] x86: address -Wmissing-prototype warnings Arnd Bergmann
                   ` (13 preceding siblings ...)
  2023-05-16 19:35 ` [PATCH 14/20] x86: fbdev: include asm/fb.h as needed Arnd Bergmann
@ 2023-05-16 19:35 ` Arnd Bergmann
  2023-05-16 19:35 ` [PATCH 16/20] x86: vdso: include vdso/processor.h Arnd Bergmann
                   ` (6 subsequent siblings)
  21 siblings, 0 replies; 29+ messages in thread
From: Arnd Bergmann @ 2023-05-16 19:35 UTC (permalink / raw)
  To: x86
  Cc: Arnd Bergmann, Thomas Gleixner, Ingo Molnar, Borislav Petkov,
	Dave Hansen, H. Peter Anvin, Andy Lutomirski, Steven Rostedt,
	Masami Hiramatsu, Mark Rutland, Juergen Gross,
	Srivatsa S. Bhat (VMware), Alexey Makhalov,
	VMware PV-Drivers Reviewers, Peter Zijlstra, Darren Hart,
	Andy Shevchenko, Boris Ostrovsky, Rafael J. Wysocki, linux-kernel,
	linux-trace-kernel, virtualization, linux-pci,
	platform-driver-x86, xen-devel, linux-pm, linux-mm

From: Arnd Bergmann <arnd@arndb.de>

copy_mc_fragile_handle_tail() is only called from assembler,
but 'make W=1' complains about a missing prototype:

arch/x86/lib/copy_mc.c:26:1: warning: no previous prototype for ‘copy_mc_fragile_handle_tail’ [-Wmissing-prototypes]
   26 | copy_mc_fragile_handle_tail(char *to, char *from, unsigned len)

Add the prototype to avoid the warning.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 arch/x86/include/asm/mce.h | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/arch/x86/include/asm/mce.h b/arch/x86/include/asm/mce.h
index 9646ed6e8c0b..180b1cbfcc4e 100644
--- a/arch/x86/include/asm/mce.h
+++ b/arch/x86/include/asm/mce.h
@@ -350,4 +350,7 @@ static inline void mce_amd_feature_init(struct cpuinfo_x86 *c)		{ }
 #endif
 
 static inline void mce_hygon_feature_init(struct cpuinfo_x86 *c)	{ return mce_amd_feature_init(c); }
+
+unsigned long copy_mc_fragile_handle_tail(char *to, char *from, unsigned len);
+
 #endif /* _ASM_X86_MCE_H */
-- 
2.39.2


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

* [PATCH 16/20] x86: vdso: include vdso/processor.h
  2023-05-16 19:35 [PATCH 00/20] x86: address -Wmissing-prototype warnings Arnd Bergmann
                   ` (14 preceding siblings ...)
  2023-05-16 19:35 ` [PATCH 15/20] x86: mce: add copy_mc_fragile_handle_tail prototype Arnd Bergmann
@ 2023-05-16 19:35 ` Arnd Bergmann
  2023-05-16 19:35 ` [PATCH 17/20] x86: usercopy: include arch_wb_cache_pmem declaration Arnd Bergmann
                   ` (5 subsequent siblings)
  21 siblings, 0 replies; 29+ messages in thread
From: Arnd Bergmann @ 2023-05-16 19:35 UTC (permalink / raw)
  To: x86
  Cc: Arnd Bergmann, Thomas Gleixner, Ingo Molnar, Borislav Petkov,
	Dave Hansen, H. Peter Anvin, Andy Lutomirski, Steven Rostedt,
	Masami Hiramatsu, Mark Rutland, Juergen Gross,
	Srivatsa S. Bhat (VMware), Alexey Makhalov,
	VMware PV-Drivers Reviewers, Peter Zijlstra, Darren Hart,
	Andy Shevchenko, Boris Ostrovsky, Rafael J. Wysocki, linux-kernel,
	linux-trace-kernel, virtualization, linux-pci,
	platform-driver-x86, xen-devel, linux-pm, linux-mm

From: Arnd Bergmann <arnd@arndb.de>

__vdso_getcpu is declared in a header but this is not included
before the definition, causing a W=1 warning:

arch/x86/entry/vdso/vgetcpu.c:13:1: error: no previous prototype for '__vdso_getcpu' [-Werror=missing-prototypes]
arch/x86/entry/vdso/vdso32/../vgetcpu.c:13:1: error: no previous prototype for '__vdso_getcpu' [-Werror=missing-prototypes]

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 arch/x86/entry/vdso/vgetcpu.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/x86/entry/vdso/vgetcpu.c b/arch/x86/entry/vdso/vgetcpu.c
index 0a9007c24056..e4640306b2e3 100644
--- a/arch/x86/entry/vdso/vgetcpu.c
+++ b/arch/x86/entry/vdso/vgetcpu.c
@@ -8,6 +8,7 @@
 #include <linux/kernel.h>
 #include <linux/getcpu.h>
 #include <asm/segment.h>
+#include <vdso/processor.h>
 
 notrace long
 __vdso_getcpu(unsigned *cpu, unsigned *node, struct getcpu_cache *unused)
-- 
2.39.2


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

* [PATCH 17/20] x86: usercopy: include arch_wb_cache_pmem declaration
  2023-05-16 19:35 [PATCH 00/20] x86: address -Wmissing-prototype warnings Arnd Bergmann
                   ` (15 preceding siblings ...)
  2023-05-16 19:35 ` [PATCH 16/20] x86: vdso: include vdso/processor.h Arnd Bergmann
@ 2023-05-16 19:35 ` Arnd Bergmann
  2023-05-16 19:35 ` [PATCH 18/20] x86: ioremap: add early_memremap_pgprot_adjust prototype Arnd Bergmann
                   ` (4 subsequent siblings)
  21 siblings, 0 replies; 29+ messages in thread
From: Arnd Bergmann @ 2023-05-16 19:35 UTC (permalink / raw)
  To: x86
  Cc: Arnd Bergmann, Thomas Gleixner, Ingo Molnar, Borislav Petkov,
	Dave Hansen, H. Peter Anvin, Andy Lutomirski, Steven Rostedt,
	Masami Hiramatsu, Mark Rutland, Juergen Gross,
	Srivatsa S. Bhat (VMware), Alexey Makhalov,
	VMware PV-Drivers Reviewers, Peter Zijlstra, Darren Hart,
	Andy Shevchenko, Boris Ostrovsky, Rafael J. Wysocki, linux-kernel,
	linux-trace-kernel, virtualization, linux-pci,
	platform-driver-x86, xen-devel, linux-pm, linux-mm

From: Arnd Bergmann <arnd@arndb.de>

arch_wb_cache_pmem() is declared in a global header but defined by
the architecture. On x86, the implementation needs to include the header
to avoid this warning:

arch/x86/lib/usercopy_64.c:39:6: error: no previous prototype for 'arch_wb_cache_pmem' [-Werror=missing-prototypes]

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 arch/x86/lib/usercopy_64.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/x86/lib/usercopy_64.c b/arch/x86/lib/usercopy_64.c
index 003d90138e20..e9251b89a9e9 100644
--- a/arch/x86/lib/usercopy_64.c
+++ b/arch/x86/lib/usercopy_64.c
@@ -9,6 +9,7 @@
 #include <linux/export.h>
 #include <linux/uaccess.h>
 #include <linux/highmem.h>
+#include <linux/libnvdimm.h>
 
 /*
  * Zero Userspace
-- 
2.39.2


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

* [PATCH 18/20] x86: ioremap: add early_memremap_pgprot_adjust prototype
  2023-05-16 19:35 [PATCH 00/20] x86: address -Wmissing-prototype warnings Arnd Bergmann
                   ` (16 preceding siblings ...)
  2023-05-16 19:35 ` [PATCH 17/20] x86: usercopy: include arch_wb_cache_pmem declaration Arnd Bergmann
@ 2023-05-16 19:35 ` Arnd Bergmann
  2023-05-16 19:35 ` [PATCH 19/20] x86: purgatory: include header for warn() declaration Arnd Bergmann
                   ` (3 subsequent siblings)
  21 siblings, 0 replies; 29+ messages in thread
From: Arnd Bergmann @ 2023-05-16 19:35 UTC (permalink / raw)
  To: x86
  Cc: Arnd Bergmann, Thomas Gleixner, Ingo Molnar, Borislav Petkov,
	Dave Hansen, H. Peter Anvin, Andy Lutomirski, Steven Rostedt,
	Masami Hiramatsu, Mark Rutland, Juergen Gross,
	Srivatsa S. Bhat (VMware), Alexey Makhalov,
	VMware PV-Drivers Reviewers, Peter Zijlstra, Darren Hart,
	Andy Shevchenko, Boris Ostrovsky, Rafael J. Wysocki, linux-kernel,
	linux-trace-kernel, virtualization, linux-pci,
	platform-driver-x86, xen-devel, linux-pm, linux-mm

From: Arnd Bergmann <arnd@arndb.de>

early_memremap_pgprot_adjust() is a __weak function with a local
prototype, but x86 has a custom implementation that does not
see the prototype, causing a W=1 warning:

arch/x86/mm/ioremap.c:785:17: error: no previous prototype for 'early_memremap_pgprot_adjust' [-Werror=missing-prototypes]

Move the declaration into the global linux/io.h header to avoid this.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 include/linux/io.h | 5 +++++
 mm/internal.h      | 6 ------
 2 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/include/linux/io.h b/include/linux/io.h
index 308f4f0cfb93..7304f2a69960 100644
--- a/include/linux/io.h
+++ b/include/linux/io.h
@@ -68,6 +68,11 @@ void *devm_memremap(struct device *dev, resource_size_t offset,
 		size_t size, unsigned long flags);
 void devm_memunmap(struct device *dev, void *addr);
 
+/* architectures can override this */
+pgprot_t __init early_memremap_pgprot_adjust(resource_size_t phys_addr,
+					unsigned long size, pgprot_t prot);
+
+
 #ifdef CONFIG_PCI
 /*
  * The PCI specifications (Rev 3.0, 3.2.5 "Transaction Ordering and
diff --git a/mm/internal.h b/mm/internal.h
index 68410c6d97ac..e6029d94bdb2 100644
--- a/mm/internal.h
+++ b/mm/internal.h
@@ -178,12 +178,6 @@ extern unsigned long highest_memmap_pfn;
  */
 #define MAX_RECLAIM_RETRIES 16
 
-/*
- * in mm/early_ioremap.c
- */
-pgprot_t __init early_memremap_pgprot_adjust(resource_size_t phys_addr,
-					unsigned long size, pgprot_t prot);
-
 /*
  * in mm/vmscan.c:
  */
-- 
2.39.2


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

* [PATCH 19/20] x86: purgatory: include header for warn() declaration
  2023-05-16 19:35 [PATCH 00/20] x86: address -Wmissing-prototype warnings Arnd Bergmann
                   ` (17 preceding siblings ...)
  2023-05-16 19:35 ` [PATCH 18/20] x86: ioremap: add early_memremap_pgprot_adjust prototype Arnd Bergmann
@ 2023-05-16 19:35 ` Arnd Bergmann
  2023-05-16 19:35 ` [PATCH 20/20] x86: olpc: avoid missing-prototype warnings Arnd Bergmann
                   ` (2 subsequent siblings)
  21 siblings, 0 replies; 29+ messages in thread
From: Arnd Bergmann @ 2023-05-16 19:35 UTC (permalink / raw)
  To: x86
  Cc: Arnd Bergmann, Thomas Gleixner, Ingo Molnar, Borislav Petkov,
	Dave Hansen, H. Peter Anvin, Andy Lutomirski, Steven Rostedt,
	Masami Hiramatsu, Mark Rutland, Juergen Gross,
	Srivatsa S. Bhat (VMware), Alexey Makhalov,
	VMware PV-Drivers Reviewers, Peter Zijlstra, Darren Hart,
	Andy Shevchenko, Boris Ostrovsky, Rafael J. Wysocki, linux-kernel,
	linux-trace-kernel, virtualization, linux-pci,
	platform-driver-x86, xen-devel, linux-pm, linux-mm

From: Arnd Bergmann <arnd@arndb.de>

The purgatory code has uses parts of the decompressor and provides
its own warn() function, but has to include the corresponding
header file to avoid a -Wmissing-prototypes warning.

It turns out that this the function prototype actually differs
from the declaration, so change it to get a constant pointer
in the declaration and the other definition as well.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 arch/x86/boot/compressed/error.c | 2 +-
 arch/x86/boot/compressed/error.h | 2 +-
 arch/x86/purgatory/purgatory.c   | 1 +
 3 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/arch/x86/boot/compressed/error.c b/arch/x86/boot/compressed/error.c
index c881878e56d3..ce5ed7d8265e 100644
--- a/arch/x86/boot/compressed/error.c
+++ b/arch/x86/boot/compressed/error.c
@@ -7,7 +7,7 @@
 #include "misc.h"
 #include "error.h"
 
-void warn(char *m)
+void warn(const char *m)
 {
 	error_putstr("\n\n");
 	error_putstr(m);
diff --git a/arch/x86/boot/compressed/error.h b/arch/x86/boot/compressed/error.h
index 1de5821184f1..87062dea9a20 100644
--- a/arch/x86/boot/compressed/error.h
+++ b/arch/x86/boot/compressed/error.h
@@ -4,7 +4,7 @@
 
 #include <linux/compiler.h>
 
-void warn(char *m);
+void warn(const char *m);
 void error(char *m) __noreturn;
 
 #endif /* BOOT_COMPRESSED_ERROR_H */
diff --git a/arch/x86/purgatory/purgatory.c b/arch/x86/purgatory/purgatory.c
index 7558139920f8..aea47e793963 100644
--- a/arch/x86/purgatory/purgatory.c
+++ b/arch/x86/purgatory/purgatory.c
@@ -14,6 +14,7 @@
 #include <crypto/sha2.h>
 #include <asm/purgatory.h>
 
+#include "../boot/compressed/error.h"
 #include "../boot/string.h"
 
 u8 purgatory_sha256_digest[SHA256_DIGEST_SIZE] __section(".kexec-purgatory");
-- 
2.39.2


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

* [PATCH 20/20] x86: olpc: avoid missing-prototype warnings
  2023-05-16 19:35 [PATCH 00/20] x86: address -Wmissing-prototype warnings Arnd Bergmann
                   ` (18 preceding siblings ...)
  2023-05-16 19:35 ` [PATCH 19/20] x86: purgatory: include header for warn() declaration Arnd Bergmann
@ 2023-05-16 19:35 ` Arnd Bergmann
  2023-05-18 17:31 ` [PATCH 00/20] x86: address -Wmissing-prototype warnings Dave Hansen
  2023-05-18 21:56 ` Dave Hansen
  21 siblings, 0 replies; 29+ messages in thread
From: Arnd Bergmann @ 2023-05-16 19:35 UTC (permalink / raw)
  To: x86
  Cc: Arnd Bergmann, Thomas Gleixner, Ingo Molnar, Borislav Petkov,
	Dave Hansen, H. Peter Anvin, Andy Lutomirski, Steven Rostedt,
	Masami Hiramatsu, Mark Rutland, Juergen Gross,
	Srivatsa S. Bhat (VMware), Alexey Makhalov,
	VMware PV-Drivers Reviewers, Peter Zijlstra, Darren Hart,
	Andy Shevchenko, Boris Ostrovsky, Rafael J. Wysocki, linux-kernel,
	linux-trace-kernel, virtualization, linux-pci,
	platform-driver-x86, xen-devel, linux-pm, linux-mm

From: Arnd Bergmann <arnd@arndb.de>

There are two functions in the olpc platform that have no prototype:

arch/x86/platform/olpc/olpc_dt.c:237:13: error: no previous prototype for 'olpc_dt_fixup' [-Werror=missing-prototypes]
arch/x86/platform/olpc/olpc-xo1-pm.c:73:26: error: no previous prototype for 'xo1_do_sleep' [-Werror=missing-prototypes]

The first one should just be marked 'static' as there are no other
callers, while the second one is called from assembler and is
just a false-positive warning that can be silenced by adding a
prototype.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 arch/x86/platform/olpc/olpc_dt.c | 2 +-
 include/linux/olpc-ec.h          | 2 ++
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/arch/x86/platform/olpc/olpc_dt.c b/arch/x86/platform/olpc/olpc_dt.c
index 75e3319e8bee..74ebd6882690 100644
--- a/arch/x86/platform/olpc/olpc_dt.c
+++ b/arch/x86/platform/olpc/olpc_dt.c
@@ -234,7 +234,7 @@ static int __init olpc_dt_compatible_match(phandle node, const char *compat)
 	return 0;
 }
 
-void __init olpc_dt_fixup(void)
+static void __init olpc_dt_fixup(void)
 {
 	phandle node;
 	u32 board_rev;
diff --git a/include/linux/olpc-ec.h b/include/linux/olpc-ec.h
index c4602364e909..3c2891d85c41 100644
--- a/include/linux/olpc-ec.h
+++ b/include/linux/olpc-ec.h
@@ -56,6 +56,8 @@ extern int olpc_ec_sci_query(u16 *sci_value);
 
 extern bool olpc_ec_wakeup_available(void);
 
+asmlinkage int xo1_do_sleep(u8 sleep_state);
+
 #else
 
 static inline int olpc_ec_cmd(u8 cmd, u8 *inbuf, size_t inlen, u8 *outbuf,
-- 
2.39.2


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

* Re: [PATCH 01/20] x86: move prepare_ftrace_return prototype to header
  2023-05-16 19:35 ` [PATCH 01/20] x86: move prepare_ftrace_return prototype to header Arnd Bergmann
@ 2023-05-16 21:44   ` Steven Rostedt
  0 siblings, 0 replies; 29+ messages in thread
From: Steven Rostedt @ 2023-05-16 21:44 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: x86, Arnd Bergmann, Thomas Gleixner, Ingo Molnar, Borislav Petkov,
	Dave Hansen, H. Peter Anvin, Andy Lutomirski, Masami Hiramatsu,
	Mark Rutland, Juergen Gross, Srivatsa S. Bhat (VMware),
	Alexey Makhalov, VMware PV-Drivers Reviewers, Peter Zijlstra,
	Darren Hart, Andy Shevchenko, Boris Ostrovsky, Rafael J. Wysocki,
	linux-kernel, linux-trace-kernel, virtualization, linux-pci,
	platform-driver-x86, xen-devel, linux-pm, linux-mm

On Tue, 16 May 2023 21:35:30 +0200
Arnd Bergmann <arnd@kernel.org> wrote:

> From: Arnd Bergmann <arnd@arndb.de>
> 
> On 32-bit builds, the prepare_ftrace_return() function only has a global
> definition, but no prototype before it, which causes a warning:
> 
> arch/x86/kernel/ftrace.c:625:6: warning: no previous prototype for ‘prepare_ftrace_return’ [-Wmissing-prototypes]
>   625 | void prepare_ftrace_return(unsigned long ip, unsigned long *parent,
> 
> Move the prototype that is already needed for some configurations into
> a header file where it can be seen unconditionally.
> 
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
>  arch/x86/include/asm/ftrace.h | 3 +++
>  arch/x86/kernel/ftrace.c      | 3 ---
>  2 files changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/arch/x86/include/asm/ftrace.h b/arch/x86/include/asm/ftrace.h
> index 5061ac98ffa1..b8d4a07f9595 100644
> --- a/arch/x86/include/asm/ftrace.h
> +++ b/arch/x86/include/asm/ftrace.h

Acked-by: Steven Rostedt (Google) <rostedt@goodmis.org>

-- Steve

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

* Re: [PATCH 05/20] x86: head: add dummy prototype for mk_early_pgtbl_32
  2023-05-16 19:35 ` [PATCH 05/20] x86: head: add dummy prototype for mk_early_pgtbl_32 Arnd Bergmann
@ 2023-05-18 16:52   ` Alexander Lobakin
  0 siblings, 0 replies; 29+ messages in thread
From: Alexander Lobakin @ 2023-05-18 16:52 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: x86, Arnd Bergmann, Thomas Gleixner, Ingo Molnar, Borislav Petkov,
	Dave Hansen, H. Peter Anvin, Andy Lutomirski, Steven Rostedt,
	Masami Hiramatsu, Mark Rutland, Juergen Gross,
	Srivatsa S. Bhat (VMware), Alexey Makhalov,
	VMware PV-Drivers Reviewers, Peter Zijlstra, Darren Hart,
	Andy Shevchenko, Boris Ostrovsky, Rafael J. Wysocki, linux-kernel,
	linux-trace-kernel, virtualization, linux-pci,
	platform-driver-x86, xen-devel, linux-pm, linux-mm

From: Arnd Bergmann <arnd@kernel.org>
Date: Tue, 16 May 2023 21:35:34 +0200

> From: Arnd Bergmann <arnd@arndb.de>
> 
> 'make W=1' warns about a function without a prototype in the x86-32 head code:
> 
> arch/x86/kernel/head32.c:72:13: error: no previous prototype for 'mk_early_pgtbl_32' [-Werror=missing-prototypes]
> 
> This is called from assembler code, so it does not actually need a prototype.
> I could not find an appropriate header for it, so just declare it in front
> of the definition to shut up th warning.

                               ^^
                               the :p

> 
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>

I'd say, for the whole series:

Reviewed-by: Alexander Lobakin <aleksander.lobakin@intel.com>

BUT apart from the Xen part, it's all black magic rituals to me :D

Thanks,
Olek

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

* Re: [PATCH 10/20] x86: xen: add missing prototypes
  2023-05-16 19:35 ` [PATCH 10/20] x86: xen: add missing prototypes Arnd Bergmann
@ 2023-05-18 17:28   ` Dave Hansen
  2023-05-19 11:04     ` Arnd Bergmann
  0 siblings, 1 reply; 29+ messages in thread
From: Dave Hansen @ 2023-05-18 17:28 UTC (permalink / raw)
  To: Arnd Bergmann, x86
  Cc: Arnd Bergmann, Thomas Gleixner, Ingo Molnar, Borislav Petkov,
	Dave Hansen, H. Peter Anvin, Andy Lutomirski, Steven Rostedt,
	Masami Hiramatsu, Mark Rutland, Juergen Gross,
	Srivatsa S. Bhat (VMware), Alexey Makhalov,
	VMware PV-Drivers Reviewers, Peter Zijlstra, Darren Hart,
	Andy Shevchenko, Boris Ostrovsky, Rafael J. Wysocki, linux-kernel,
	linux-trace-kernel, virtualization, linux-pci,
	platform-driver-x86, xen-devel, linux-pm, linux-mm

On 5/16/23 12:35, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@arndb.de>
> 
> arch/x86/xen/enlighten_pv.c:1233:34: error: no previous prototype for 'xen_start_kernel' [-Werror=missing-prototypes]
> arch/x86/xen/irq.c:22:14: error: no previous prototype for 'xen_force_evtchn_callback' [-Werror=missing-prototypes]
> arch/x86/xen/mmu_pv.c:358:20: error: no previous prototype for 'xen_pte_val' [-Werror=missing-prototypes]
> arch/x86/xen/mmu_pv.c:366:20: error: no previous prototype for 'xen_pgd_val' [-Werror=missing-prototypes]

What's the deal with this one?

The patch is doing a bunch functions on top of the ones from the commit
message.  Were you just showing a snippet of what the actual set of
warnings is?

Also, fwiw, it would be nice to have actual words in the changelog, even
for these maddeningly repetitive series.  Even something like:

	Xen has a bunch of these because of how the paravirt code uses
	inline assembly.

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

* Re: [PATCH 00/20] x86: address -Wmissing-prototype warnings
  2023-05-16 19:35 [PATCH 00/20] x86: address -Wmissing-prototype warnings Arnd Bergmann
                   ` (19 preceding siblings ...)
  2023-05-16 19:35 ` [PATCH 20/20] x86: olpc: avoid missing-prototype warnings Arnd Bergmann
@ 2023-05-18 17:31 ` Dave Hansen
  2023-05-18 21:56 ` Dave Hansen
  21 siblings, 0 replies; 29+ messages in thread
From: Dave Hansen @ 2023-05-18 17:31 UTC (permalink / raw)
  To: Arnd Bergmann, x86
  Cc: Arnd Bergmann, Thomas Gleixner, Ingo Molnar, Borislav Petkov,
	Dave Hansen, H. Peter Anvin, Andy Lutomirski, Steven Rostedt,
	Masami Hiramatsu, Mark Rutland, Juergen Gross,
	Srivatsa S. Bhat (VMware), Alexey Makhalov,
	VMware PV-Drivers Reviewers, Peter Zijlstra, Darren Hart,
	Andy Shevchenko, Boris Ostrovsky, Rafael J. Wysocki, linux-kernel,
	linux-trace-kernel, virtualization, linux-pci,
	platform-driver-x86, xen-devel, linux-pm, linux-mm

On 5/16/23 12:35, Arnd Bergmann wrote:
> The ones that are a bit awkward are those that just add a prototype to
> shut up the warning, but the prototypes are never used for calling the
> function because the only caller is in assembler code. I tried to come up
> with other ways to shut up the compiler using the asmlinkage annotation,
> but with no success.

I went looking for the same thing.  It's too bad gcc doesn't have an
__attribute__ for it.

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

* Re: [PATCH 00/20] x86: address -Wmissing-prototype warnings
  2023-05-16 19:35 [PATCH 00/20] x86: address -Wmissing-prototype warnings Arnd Bergmann
                   ` (20 preceding siblings ...)
  2023-05-18 17:31 ` [PATCH 00/20] x86: address -Wmissing-prototype warnings Dave Hansen
@ 2023-05-18 21:56 ` Dave Hansen
  2023-05-19  9:51   ` Andy Shevchenko
  2023-05-19 12:09   ` Arnd Bergmann
  21 siblings, 2 replies; 29+ messages in thread
From: Dave Hansen @ 2023-05-18 21:56 UTC (permalink / raw)
  To: Arnd Bergmann, x86
  Cc: Arnd Bergmann, Thomas Gleixner, Ingo Molnar, Borislav Petkov,
	Dave Hansen, H. Peter Anvin, Andy Lutomirski, Steven Rostedt,
	Masami Hiramatsu, Mark Rutland, Juergen Gross,
	Srivatsa S. Bhat (VMware), Alexey Makhalov,
	VMware PV-Drivers Reviewers, Peter Zijlstra, Darren Hart,
	Andy Shevchenko, Boris Ostrovsky, Rafael J. Wysocki, linux-kernel,
	linux-trace-kernel, virtualization, linux-pci,
	platform-driver-x86, xen-devel, linux-pm, linux-mm

On 5/16/23 12:35, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@arndb.de>
> 
> This addresses all x86 specific prototype warnings. The majority of the
> patches should be straightforward, either adding an #include statement
> to get the right header, or ensuring that an unused global function is
> left out of the build when the prototype is hidden.
> 
> The ones that are a bit awkward are those that just add a prototype to
> shut up the warning, but the prototypes are never used for calling the
> function because the only caller is in assembler code. I tried to come up
> with other ways to shut up the compiler using the asmlinkage annotation,
> but with no success.
> 
> All of the warnings have to be addressed in some form before the warning
> can be enabled by default.

I picked up the ones that were blatantly obvious, but left out 03, 04,
10, 12 and 19 for the moment.

BTW, I think the i386 allyesconfig is getting pretty lightly tested
these days.  I think you and I hit the same mlx4 __bad_copy_from()
compile issue.

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

* Re: [PATCH 00/20] x86: address -Wmissing-prototype warnings
  2023-05-18 21:56 ` Dave Hansen
@ 2023-05-19  9:51   ` Andy Shevchenko
  2023-05-19 12:09   ` Arnd Bergmann
  1 sibling, 0 replies; 29+ messages in thread
From: Andy Shevchenko @ 2023-05-19  9:51 UTC (permalink / raw)
  To: Dave Hansen
  Cc: Arnd Bergmann, x86, Arnd Bergmann, Thomas Gleixner, Ingo Molnar,
	Borislav Petkov, Dave Hansen, H. Peter Anvin, Andy Lutomirski,
	Steven Rostedt, Masami Hiramatsu, Mark Rutland, Juergen Gross,
	Srivatsa S. Bhat (VMware), Alexey Makhalov,
	VMware PV-Drivers Reviewers, Peter Zijlstra, Darren Hart,
	Andy Shevchenko, Boris Ostrovsky, Rafael J. Wysocki, linux-kernel,
	linux-trace-kernel, virtualization, linux-pci,
	platform-driver-x86, xen-devel, linux-pm, linux-mm

On Fri, May 19, 2023 at 12:56 AM Dave Hansen <dave.hansen@intel.com> wrote:
> On 5/16/23 12:35, Arnd Bergmann wrote:

> I picked up the ones that were blatantly obvious, but left out 03, 04,
> 10, 12 and 19 for the moment.

Btw, there is series that went unnoticed

https://lore.kernel.org/all/20211119110017.48510-1-andriy.shevchenko@linux.intel.com/

I dunno why.

-- 
With Best Regards,
Andy Shevchenko

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

* Re: [PATCH 10/20] x86: xen: add missing prototypes
  2023-05-18 17:28   ` Dave Hansen
@ 2023-05-19 11:04     ` Arnd Bergmann
  0 siblings, 0 replies; 29+ messages in thread
From: Arnd Bergmann @ 2023-05-19 11:04 UTC (permalink / raw)
  To: Dave Hansen, Arnd Bergmann, x86
  Cc: Thomas Gleixner, Ingo Molnar, Borislav Petkov, Dave Hansen,
	H. Peter Anvin, Andy Lutomirski, Steven Rostedt, Masami Hiramatsu,
	Mark Rutland, Juergen Gross, Srivatsa S. Bhat (VMware),
	Alexey Makhalov, VMware PV-Drivers Reviewers, Peter Zijlstra,
	Darren Hart, Andy Shevchenko, Boris Ostrovsky, Rafael J . Wysocki,
	linux-kernel, linux-trace-kernel, virtualization, linux-pci,
	platform-driver-x86, xen-devel, linux-pm, linux-mm

On Thu, May 18, 2023, at 19:28, Dave Hansen wrote:
> On 5/16/23 12:35, Arnd Bergmann wrote:
>> 
>> arch/x86/xen/enlighten_pv.c:1233:34: error: no previous prototype for 'xen_start_kernel' [-Werror=missing-prototypes]
>> arch/x86/xen/irq.c:22:14: error: no previous prototype for 'xen_force_evtchn_callback' [-Werror=missing-prototypes]
>> arch/x86/xen/mmu_pv.c:358:20: error: no previous prototype for 'xen_pte_val' [-Werror=missing-prototypes]
>> arch/x86/xen/mmu_pv.c:366:20: error: no previous prototype for 'xen_pgd_val' [-Werror=missing-prototypes]
>
> What's the deal with this one?
>
> The patch is doing a bunch functions on top of the ones from the commit
> message.  Were you just showing a snippet of what the actual set of
> warnings is?

I missed this one going through the changelogs before sending them out,
I thought I had added a proper text to each one, but it fell through the
cracks. I've followed up with a v2 patch that has a proper changelog
now.

      Arnd

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

* Re: [PATCH 00/20] x86: address -Wmissing-prototype warnings
  2023-05-18 21:56 ` Dave Hansen
  2023-05-19  9:51   ` Andy Shevchenko
@ 2023-05-19 12:09   ` Arnd Bergmann
  1 sibling, 0 replies; 29+ messages in thread
From: Arnd Bergmann @ 2023-05-19 12:09 UTC (permalink / raw)
  To: Dave Hansen, Arnd Bergmann, x86
  Cc: Thomas Gleixner, Ingo Molnar, Borislav Petkov, Dave Hansen,
	H. Peter Anvin, Andy Lutomirski, Steven Rostedt, Masami Hiramatsu,
	Mark Rutland, Juergen Gross, Srivatsa S. Bhat (VMware),
	Alexey Makhalov, VMware PV-Drivers Reviewers, Peter Zijlstra,
	Darren Hart, Andy Shevchenko, Boris Ostrovsky, Rafael J . Wysocki,
	linux-kernel, linux-trace-kernel, virtualization, linux-pci,
	platform-driver-x86, xen-devel, linux-pm, linux-mm

On Thu, May 18, 2023, at 23:56, Dave Hansen wrote:
> On 5/16/23 12:35, Arnd Bergmann wrote:
>> 
>> All of the warnings have to be addressed in some form before the warning
>> can be enabled by default.
>
> I picked up the ones that were blatantly obvious, but left out 03, 04,
> 10, 12 and 19 for the moment.

Ok, thanks!

I've already sent a fixed version of patch 10, let me know if you
need anything else for the other ones.

> BTW, I think the i386 allyesconfig is getting pretty lightly tested
> these days.  I think you and I hit the same mlx4 __bad_copy_from()
> compile issue.

I did all my testing on randconfig builds, so I probably caught a lot
of the more obscure corner cases, but it doesn't always hit everything
that is in allyesconfig/allmodconfig.

       Arnd

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

end of thread, other threads:[~2023-05-19 12:09 UTC | newest]

Thread overview: 29+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-05-16 19:35 [PATCH 00/20] x86: address -Wmissing-prototype warnings Arnd Bergmann
2023-05-16 19:35 ` [PATCH 01/20] x86: move prepare_ftrace_return prototype to header Arnd Bergmann
2023-05-16 21:44   ` Steven Rostedt
2023-05-16 19:35 ` [PATCH 02/20] x86: ce4100: Mark local functions as 'static' Arnd Bergmann
2023-05-16 19:35 ` [PATCH 03/20] x86: apic: hide unused safe_smp_processor_id on UP Arnd Bergmann
2023-05-16 19:35 ` [PATCH 04/20] x86: avoid unneeded __div64_32 function definition Arnd Bergmann
2023-05-16 19:35 ` [PATCH 05/20] x86: head: add dummy prototype for mk_early_pgtbl_32 Arnd Bergmann
2023-05-18 16:52   ` Alexander Lobakin
2023-05-16 19:35 ` [PATCH 06/20] x86: math-emu: include asm/fpu/regset.h Arnd Bergmann
2023-05-16 19:35 ` [PATCH 07/20] x86: doublefault: avoid missing-prototype warnings Arnd Bergmann
2023-05-16 19:35 ` [PATCH 08/20] x86: highmem: include asm/numa.h for set_highmem_pages_init Arnd Bergmann
2023-05-16 19:35 ` [PATCH 09/20] x86: platform_quirks: include linux/pnp.h for arch_pnpbios_disabled Arnd Bergmann
2023-05-16 19:35 ` [PATCH 10/20] x86: xen: add missing prototypes Arnd Bergmann
2023-05-18 17:28   ` Dave Hansen
2023-05-19 11:04     ` Arnd Bergmann
2023-05-16 19:35 ` [PATCH 11/20] x86: entry: add do_SYSENTER_32() prototype Arnd Bergmann
2023-05-16 19:35 ` [PATCH 12/20] x86: qspinlock-paravirt: fix mising-prototype warnings Arnd Bergmann
2023-05-16 19:35 ` [PATCH 13/20] x86: hibernate: declare global functions in suspend.h Arnd Bergmann
2023-05-16 19:35 ` [PATCH 14/20] x86: fbdev: include asm/fb.h as needed Arnd Bergmann
2023-05-16 19:35 ` [PATCH 15/20] x86: mce: add copy_mc_fragile_handle_tail prototype Arnd Bergmann
2023-05-16 19:35 ` [PATCH 16/20] x86: vdso: include vdso/processor.h Arnd Bergmann
2023-05-16 19:35 ` [PATCH 17/20] x86: usercopy: include arch_wb_cache_pmem declaration Arnd Bergmann
2023-05-16 19:35 ` [PATCH 18/20] x86: ioremap: add early_memremap_pgprot_adjust prototype Arnd Bergmann
2023-05-16 19:35 ` [PATCH 19/20] x86: purgatory: include header for warn() declaration Arnd Bergmann
2023-05-16 19:35 ` [PATCH 20/20] x86: olpc: avoid missing-prototype warnings Arnd Bergmann
2023-05-18 17:31 ` [PATCH 00/20] x86: address -Wmissing-prototype warnings Dave Hansen
2023-05-18 21:56 ` Dave Hansen
2023-05-19  9:51   ` Andy Shevchenko
2023-05-19 12:09   ` Arnd Bergmann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).