From: Arnd Bergmann <[email protected]>
This addresses all arm64 specific protype warnings. As with the arm32
patches, the majority of them 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, and ideally this would be
triggered by the 'asmlinkage' keyword as Ard suggested in the past, but
I could not come up with a way to do this.
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 (15):
arm64: xor-neon: mark xor_arm64_neon_*() static
arm64: add scs_patch_vmlinux prototype
arm64: avoid prototype warnings for syscalls
arm64: move cpu_suspend_set_dbg_restorer() prototype to header
arm64: spectre: provide prototypes for internal functions
arm64: kvm: add prototypes for functions called in asm
arm64: cpuidle: fix #ifdef for acpi functions
arm64: efi: add efi_handle_corrupted_x18 prototype
arm64: hide unused is_valid_bugaddr()
arm64: module-plts: inline linux/moduleloader.h
arm64: flush: include linux/libnvdimm.h
arm64: kaslr: add kaslr_early_init() declaration
arm64: signal: include asm/exception.h
arm64: move early_brk64 prototype to header
arm64: add alt_cb_patch_nops prototype
arch/arm64/include/asm/alternative.h | 3 +++
arch/arm64/include/asm/archrandom.h | 2 ++
arch/arm64/include/asm/compat.h | 2 ++
arch/arm64/include/asm/efi.h | 2 ++
arch/arm64/include/asm/hw_breakpoint.h | 8 ++++++++
arch/arm64/include/asm/kvm_asm.h | 18 ++++++++++++++++++
arch/arm64/include/asm/scs.h | 1 +
arch/arm64/include/asm/spectre.h | 16 ++++++++++++++++
arch/arm64/include/asm/syscall_wrapper.h | 4 ++++
arch/arm64/include/asm/traps.h | 2 ++
arch/arm64/kernel/cpuidle.c | 2 +-
arch/arm64/kernel/hw_breakpoint.c | 8 --------
arch/arm64/kernel/module-plts.c | 1 +
arch/arm64/kernel/signal.c | 1 +
arch/arm64/kernel/traps.c | 3 ++-
arch/arm64/lib/xor-neon.c | 8 ++++----
arch/arm64/mm/fault.c | 3 ---
arch/arm64/mm/flush.c | 1 +
18 files changed, 68 insertions(+), 17 deletions(-)
--
2.39.2
Cc: Catalin Marinas <[email protected]>
Cc: Will Deacon <[email protected]>
Cc: Ard Biesheuvel <[email protected]>
Cc: Mark Rutland <[email protected]>
Cc: Marc Zyngier <[email protected]>
Cc: Oliver Upton <[email protected]>
Cc: James Morse <[email protected]>
Cc: Suzuki K Poulose <[email protected]>
Cc: Zenghui Yu <[email protected]>
Cc: Arnd Bergmann <[email protected]>
Cc: Anshuman Khandual <[email protected]>
Cc: Kees Cook <[email protected]>
Cc: Suren Baghdasaryan <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
From: Arnd Bergmann <[email protected]>
scs_patch_vmlinux() is only called from assembler code, so there
is no prototype, but adding one avoids this warning:
arch/arm64/kernel/patch-scs.c:254:24: error: no previous prototype for function 'scs_patch_vmlinux' [-Werror,-Wmissing-prototypes]
Signed-off-by: Arnd Bergmann <[email protected]>
---
arch/arm64/include/asm/scs.h | 1 +
1 file changed, 1 insertion(+)
diff --git a/arch/arm64/include/asm/scs.h b/arch/arm64/include/asm/scs.h
index 13df982a0808..3fdae5fe3142 100644
--- a/arch/arm64/include/asm/scs.h
+++ b/arch/arm64/include/asm/scs.h
@@ -73,6 +73,7 @@ static inline void dynamic_scs_init(void) {}
#endif
int scs_patch(const u8 eh_frame[], int size);
+asmlinkage void scs_patch_vmlinux(void);
#endif /* __ASSEMBLY __ */
--
2.39.2
From: Arnd Bergmann <[email protected]>
The cpu_suspend_set_dbg_restorer() function is called by the hw_breakpoint
code but defined in another file. Since the declaration is in the
same file as the caller, the compiler warns about the definition
without a prior prototype:
arch/arm64/kernel/suspend.c:35:13: error: no previous prototype for 'cpu_suspend_set_dbg_restorer' [-Werror=missing-prototypes]
Move it into the corresponding header instead to avoid the warning.
Signed-off-by: Arnd Bergmann <[email protected]>
---
arch/arm64/include/asm/hw_breakpoint.h | 8 ++++++++
arch/arm64/kernel/hw_breakpoint.c | 8 --------
2 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/arch/arm64/include/asm/hw_breakpoint.h b/arch/arm64/include/asm/hw_breakpoint.h
index fa4c6ff3aa9b..84055329cd8b 100644
--- a/arch/arm64/include/asm/hw_breakpoint.h
+++ b/arch/arm64/include/asm/hw_breakpoint.h
@@ -154,4 +154,12 @@ static inline int get_num_wrps(void)
ID_AA64DFR0_EL1_WRPs_SHIFT);
}
+#ifdef CONFIG_CPU_PM
+extern void cpu_suspend_set_dbg_restorer(int (*hw_bp_restore)(unsigned int));
+#else
+static inline void cpu_suspend_set_dbg_restorer(int (*hw_bp_restore)(unsigned int))
+{
+}
+#endif
+
#endif /* __ASM_BREAKPOINT_H */
diff --git a/arch/arm64/kernel/hw_breakpoint.c b/arch/arm64/kernel/hw_breakpoint.c
index b29a311bb055..db2a1861bb97 100644
--- a/arch/arm64/kernel/hw_breakpoint.c
+++ b/arch/arm64/kernel/hw_breakpoint.c
@@ -973,14 +973,6 @@ static int hw_breakpoint_reset(unsigned int cpu)
return 0;
}
-#ifdef CONFIG_CPU_PM
-extern void cpu_suspend_set_dbg_restorer(int (*hw_bp_restore)(unsigned int));
-#else
-static inline void cpu_suspend_set_dbg_restorer(int (*hw_bp_restore)(unsigned int))
-{
-}
-#endif
-
/*
* One-time initialisation.
*/
--
2.39.2
From: Arnd Bergmann <[email protected]>
This functions is only called from assembler and lacks a prototype,
which is seen from this W=1 warning:
arch/arm64/kernel/efi.c:155:25: error: no previous prototype for 'efi_handle_corrupted_x18' [-Werror=missing-prototypes]
Signed-off-by: Arnd Bergmann <[email protected]>
---
arch/arm64/include/asm/efi.h | 2 ++
1 file changed, 2 insertions(+)
diff --git a/arch/arm64/include/asm/efi.h b/arch/arm64/include/asm/efi.h
index f86b157a5da3..ef46f2daca62 100644
--- a/arch/arm64/include/asm/efi.h
+++ b/arch/arm64/include/asm/efi.h
@@ -166,4 +166,6 @@ static inline void efi_capsule_flush_cache_range(void *addr, int size)
dcache_clean_inval_poc((unsigned long)addr, (unsigned long)addr + size);
}
+efi_status_t efi_handle_corrupted_x18(efi_status_t s, const char *f);
+
#endif /* _ASM_EFI_H */
--
2.39.2
From: Arnd Bergmann <[email protected]>
module_frob_arch_sections() is declared in moduleloader.h, but
that is not included before the definition:
arch/arm64/kernel/module-plts.c:286:5: error: no previous prototype for 'module_frob_arch_sections' [-Werror=missing-prototypes]
Signed-off-by: Arnd Bergmann <[email protected]>
---
arch/arm64/kernel/module-plts.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/arch/arm64/kernel/module-plts.c b/arch/arm64/kernel/module-plts.c
index 543493bf924d..ad02058756b5 100644
--- a/arch/arm64/kernel/module-plts.c
+++ b/arch/arm64/kernel/module-plts.c
@@ -7,6 +7,7 @@
#include <linux/ftrace.h>
#include <linux/kernel.h>
#include <linux/module.h>
+#include <linux/moduleloader.h>
#include <linux/sort.h>
static struct plt_entry __get_adrp_add_pair(u64 dst, u64 pc,
--
2.39.2
From: Arnd Bergmann <[email protected]>
The two cache management functions are declared in libnvdimm.h
but provided by architecture specific code. Without including
the header, this causes a W=1 warning:
arch/arm64/mm/flush.c:96:6: error: no previous prototype for 'arch_wb_cache_pmem' [-Werror=missing-prototypes]
arch/arm64/mm/flush.c:104:6: error: no previous prototype for 'arch_invalidate_pmem' [-Werror=missing-prototypes]
Signed-off-by: Arnd Bergmann <[email protected]>
---
arch/arm64/mm/flush.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/arch/arm64/mm/flush.c b/arch/arm64/mm/flush.c
index 5f9379b3c8c8..4e6476094952 100644
--- a/arch/arm64/mm/flush.c
+++ b/arch/arm64/mm/flush.c
@@ -8,6 +8,7 @@
#include <linux/export.h>
#include <linux/mm.h>
+#include <linux/libnvdimm.h>
#include <linux/pagemap.h>
#include <asm/cacheflush.h>
--
2.39.2
From: Arnd Bergmann <[email protected]>
The do_notify_resume() is in a header that is not included
for the definition, which causes a W=1 warning:
arch/arm64/kernel/signal.c:1280:6: error: no previous prototype for 'do_notify_resume' [-Werror=missing-prototypes]
Signed-off-by: Arnd Bergmann <[email protected]>
---
arch/arm64/kernel/signal.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/arch/arm64/kernel/signal.c b/arch/arm64/kernel/signal.c
index 2cfc810d0a5b..3457906ba117 100644
--- a/arch/arm64/kernel/signal.c
+++ b/arch/arm64/kernel/signal.c
@@ -23,6 +23,7 @@
#include <asm/daifflags.h>
#include <asm/debug-monitors.h>
#include <asm/elf.h>
+#include <asm/exception.h>
#include <asm/cacheflush.h>
#include <asm/ucontext.h>
#include <asm/unistd.h>
--
2.39.2
From: Arnd Bergmann <[email protected]>
alt_cb_patch_nops() is called through an inline asm macro, so
it does not need a prototype for the caller, but adding it
avoids this W=1 build warning:
arch/arm64/kernel/alternative.c:295:14: error: no previous prototype for 'alt_cb_patch_nops' [-Werror=missing-prototypes]
Signed-off-by: Arnd Bergmann <[email protected]>
---
arch/arm64/include/asm/alternative.h | 3 +++
1 file changed, 3 insertions(+)
diff --git a/arch/arm64/include/asm/alternative.h b/arch/arm64/include/asm/alternative.h
index a38b92e11811..55da3fedcfe2 100644
--- a/arch/arm64/include/asm/alternative.h
+++ b/arch/arm64/include/asm/alternative.h
@@ -31,5 +31,8 @@ void apply_alternatives_module(void *start, size_t length);
static inline void apply_alternatives_module(void *start, size_t length) { }
#endif
+void alt_cb_patch_nops(struct alt_instr *alt, __le32 *origptr,
+ __le32 *updptr, int nr_inst);
+
#endif /* __ASSEMBLY__ */
#endif /* __ASM_ALTERNATIVE_H */
--
2.39.2
From: Arnd Bergmann <[email protected]>
The only references to these functions are in the same file, and
there is no prototype, which causes a harmless warning:
arch/arm64/lib/xor-neon.c:13:6: error: no previous prototype for 'xor_arm64_neon_2' [-Werror=missing-prototypes]
arch/arm64/lib/xor-neon.c:40:6: error: no previous prototype for 'xor_arm64_neon_3' [-Werror=missing-prototypes]
arch/arm64/lib/xor-neon.c:76:6: error: no previous prototype for 'xor_arm64_neon_4' [-Werror=missing-prototypes]
arch/arm64/lib/xor-neon.c:121:6: error: no previous prototype for 'xor_arm64_neon_5' [-Werror=missing-prototypes]
Fixes: cc9f8349cb33 ("arm64: crypto: add NEON accelerated XOR implementation")
Signed-off-by: Arnd Bergmann <[email protected]>
---
arch/arm64/lib/xor-neon.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/arch/arm64/lib/xor-neon.c b/arch/arm64/lib/xor-neon.c
index 96b171995d19..f9a53b7f9842 100644
--- a/arch/arm64/lib/xor-neon.c
+++ b/arch/arm64/lib/xor-neon.c
@@ -10,7 +10,7 @@
#include <linux/module.h>
#include <asm/neon-intrinsics.h>
-void xor_arm64_neon_2(unsigned long bytes, unsigned long * __restrict p1,
+static void xor_arm64_neon_2(unsigned long bytes, unsigned long * __restrict p1,
const unsigned long * __restrict p2)
{
uint64_t *dp1 = (uint64_t *)p1;
@@ -37,7 +37,7 @@ void xor_arm64_neon_2(unsigned long bytes, unsigned long * __restrict p1,
} while (--lines > 0);
}
-void xor_arm64_neon_3(unsigned long bytes, unsigned long * __restrict p1,
+static void xor_arm64_neon_3(unsigned long bytes, unsigned long * __restrict p1,
const unsigned long * __restrict p2,
const unsigned long * __restrict p3)
{
@@ -73,7 +73,7 @@ void xor_arm64_neon_3(unsigned long bytes, unsigned long * __restrict p1,
} while (--lines > 0);
}
-void xor_arm64_neon_4(unsigned long bytes, unsigned long * __restrict p1,
+static void xor_arm64_neon_4(unsigned long bytes, unsigned long * __restrict p1,
const unsigned long * __restrict p2,
const unsigned long * __restrict p3,
const unsigned long * __restrict p4)
@@ -118,7 +118,7 @@ void xor_arm64_neon_4(unsigned long bytes, unsigned long * __restrict p1,
} while (--lines > 0);
}
-void xor_arm64_neon_5(unsigned long bytes, unsigned long * __restrict p1,
+static void xor_arm64_neon_5(unsigned long bytes, unsigned long * __restrict p1,
const unsigned long * __restrict p2,
const unsigned long * __restrict p3,
const unsigned long * __restrict p4,
--
2.39.2
From: Arnd Bergmann <[email protected]>
kaslr_early_init() is called from assembler code and does not
need a declaration to work, but adding one anyway shuts up
this W=1 warning:
arch/arm64/kernel/pi/kaslr_early.c:88:16: error: no previous prototype for 'kaslr_early_init' [-Werror=missing-prototypes]
Signed-off-by: Arnd Bergmann <[email protected]>
---
arch/arm64/include/asm/archrandom.h | 2 ++
1 file changed, 2 insertions(+)
diff --git a/arch/arm64/include/asm/archrandom.h b/arch/arm64/include/asm/archrandom.h
index 2f5f3da34782..b0abc64f86b0 100644
--- a/arch/arm64/include/asm/archrandom.h
+++ b/arch/arm64/include/asm/archrandom.h
@@ -129,4 +129,6 @@ static inline bool __init __early_cpu_has_rndr(void)
return (ftr >> ID_AA64ISAR0_EL1_RNDR_SHIFT) & 0xf;
}
+u64 kaslr_early_init(void *fdt);
+
#endif /* _ASM_ARCHRANDOM_H */
--
2.39.2
From: Arnd Bergmann <[email protected]>
A lot of kvm specific functions are called only from assembler
and have no extern prototype, but that causes a W=1 warnings:
arch/arm64/kvm/handle_exit.c:365:24: error: no previous prototype for 'nvhe_hyp_panic_handler' [-Werror=missing-prototypes]
arch/arm64/kvm/va_layout.c:188:6: error: no previous prototype for 'kvm_patch_vector_branch' [-Werror=mi
ssing-prototypes]
arch/arm64/kvm/va_layout.c:287:6: error: no previous prototype for 'kvm_get_kimage_voffset' [-Werror=mis
sing-prototypes]
arch/arm64/kvm/va_layout.c:293:6: error: no previous prototype for 'kvm_compute_final_ctr_el0' [-Werror=
missing-prototypes]
arch/arm64/kvm/hyp/vhe/switch.c:259:17: error: no previous prototype for 'hyp_panic' [-Werror=missing-pr
arch/arm64/kvm/hyp/nvhe/switch.c:389:17: error: no previous prototype for 'kvm_unexpected_el2_exception'
arch/arm64/kvm/hyp/nvhe/switch.c:384:28: error: no previous prototype for 'hyp_panic_bad_stack' [-Werror
arch/arm64/kvm/hyp/nvhe/hyp-main.c:383:6: error: no previous prototype for 'handle_trap' [-Werror=missin
arch/arm64/kvm/hyp/nvhe/psci-relay.c:203:28: error: no previous prototype for 'kvm_host_psci_cpu_entry' [-Werror=missing-prototypes]
Declare those in asm/kvm_asm.h, which already has related declarations.
Signed-off-by: Arnd Bergmann <[email protected]>
---
arch/arm64/include/asm/kvm_asm.h | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/arch/arm64/include/asm/kvm_asm.h b/arch/arm64/include/asm/kvm_asm.h
index 43c3bc0f9544..86042afa86c3 100644
--- a/arch/arm64/include/asm/kvm_asm.h
+++ b/arch/arm64/include/asm/kvm_asm.h
@@ -267,6 +267,24 @@ extern u64 __kvm_get_mdcr_el2(void);
__kvm_at_err; \
} )
+void __noreturn hyp_panic(void);
+asmlinkage void kvm_unexpected_el2_exception(void);
+asmlinkage void __noreturn hyp_panic(void);
+asmlinkage void __noreturn hyp_panic_bad_stack(void);
+asmlinkage void kvm_unexpected_el2_exception(void);
+struct kvm_cpu_context;
+void handle_trap(struct kvm_cpu_context *host_ctxt);
+asmlinkage void __noreturn kvm_host_psci_cpu_entry(bool is_cpu_on);
+void __noreturn __pkvm_init_finalise(void);
+void kvm_nvhe_prepare_backtrace(unsigned long fp, unsigned long pc);
+void kvm_patch_vector_branch(struct alt_instr *alt,
+ __le32 *origptr, __le32 *updptr, int nr_inst);
+void kvm_get_kimage_voffset(struct alt_instr *alt,
+ __le32 *origptr, __le32 *updptr, int nr_inst);
+void kvm_compute_final_ctr_el0(struct alt_instr *alt,
+ __le32 *origptr, __le32 *updptr, int nr_inst);
+void __noreturn __cold nvhe_hyp_panic_handler(u64 esr, u64 spsr, u64 elr_virt,
+ u64 elr_phys, u64 par, uintptr_t vcpu, u64 far, u64 hpfar);
#else /* __ASSEMBLY__ */
--
2.39.2
From: Arnd Bergmann <[email protected]>
When generic BUG() support is disabled, this function has no declaration
and no callers but causes a W=1 warning:
arch/arm64/kernel/traps.c:950:5: error: no previous prototype for 'is_valid_bugaddr' [-Werror=missing-prototypes]
Add an #ifdef that matches the one around the declaration.
Signed-off-by: Arnd Bergmann <[email protected]>
---
arch/arm64/kernel/traps.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/arch/arm64/kernel/traps.c b/arch/arm64/kernel/traps.c
index 98898c3108b8..3f5a21e5968e 100644
--- a/arch/arm64/kernel/traps.c
+++ b/arch/arm64/kernel/traps.c
@@ -946,7 +946,7 @@ void do_serror(struct pt_regs *regs, unsigned long esr)
}
/* GENERIC_BUG traps */
-
+#ifdef CONFIG_GENERIC_BUG
int is_valid_bugaddr(unsigned long addr)
{
/*
@@ -958,6 +958,7 @@ int is_valid_bugaddr(unsigned long addr)
*/
return 1;
}
+#endif
static int bug_handler(struct pt_regs *regs, unsigned long esr)
{
--
2.39.2
From: Arnd Bergmann <[email protected]>
The helpers in proton-pack.c are called from assembler and have
no prototype in a header, which causes a W=1 warning:
arch/arm64/kernel/proton-pack.c:568:13: error: no previous prototype for 'spectre_v4_patch_fw_mitigation_enable' [-Werror=missing-prototypes]
arch/arm64/kernel/proton-pack.c:588:13: error: no previous prototype for 'smccc_patch_fw_mitigation_conduit' [-Werror=missing-prototypes]
arch/arm64/kernel/proton-pack.c:1064:14: error: no previous prototype for 'spectre_bhb_patch_loop_mitigation_enable' [-Werror=missing-prototypes]
arch/arm64/kernel/proton-pack.c:1075:14: error: no previous prototype for 'spectre_bhb_patch_fw_mitigation_enabled' [-Werror=missing-prototypes]
Add these to asm/spectre.h, which contains related declarations
already.
Signed-off-by: Arnd Bergmann <[email protected]>
---
arch/arm64/include/asm/spectre.h | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/arch/arm64/include/asm/spectre.h b/arch/arm64/include/asm/spectre.h
index db7b371b367c..9cc501450486 100644
--- a/arch/arm64/include/asm/spectre.h
+++ b/arch/arm64/include/asm/spectre.h
@@ -100,5 +100,21 @@ bool is_spectre_bhb_affected(const struct arm64_cpu_capabilities *entry, int sco
u8 spectre_bhb_loop_affected(int scope);
void spectre_bhb_enable_mitigation(const struct arm64_cpu_capabilities *__unused);
bool try_emulate_el1_ssbs(struct pt_regs *regs, u32 instr);
+
+void spectre_v4_patch_fw_mitigation_enable(struct alt_instr *alt, __le32 *origptr,
+ __le32 *updptr, int nr_inst);
+void smccc_patch_fw_mitigation_conduit(struct alt_instr *alt, __le32 *origptr,
+ __le32 *updptr, int nr_inst);
+void spectre_bhb_patch_loop_mitigation_enable(struct alt_instr *alt, __le32 *origptr,
+ __le32 *updptr, int nr_inst);
+void spectre_bhb_patch_fw_mitigation_enabled(struct alt_instr *alt, __le32 *origptr,
+ __le32 *updptr, int nr_inst);
+void spectre_bhb_patch_loop_iter(struct alt_instr *alt,
+ __le32 *origptr, __le32 *updptr, int nr_inst);
+void spectre_bhb_patch_wa3(struct alt_instr *alt,
+ __le32 *origptr, __le32 *updptr, int nr_inst);
+void spectre_bhb_patch_clearbhb(struct alt_instr *alt,
+ __le32 *origptr, __le32 *updptr, int nr_inst);
+
#endif /* __ASSEMBLY__ */
#endif /* __ASM_SPECTRE_H */
--
2.39.2
From: Arnd Bergmann <[email protected]>
The acpi_processor_ffh_lpi_* functions are defined whenever CONFIG_ACPI
is enabled, but only called and declared when CONFIG_ACPI_PROCESSOR_IDLE
is also enabled. Without that, a W=1 build triggers missing-prototope
warnings, so the #ifdef needs to be adapted:
arch/arm64/kernel/cpuidle.c:60:5: error: no previous prototype for 'acpi_processor_ffh_lpi_probe' [-Werror=missing-prototypes]
arch/arm64/kernel/cpuidle.c:65:15: error: no previous prototype for 'acpi_processor_ffh_lpi_enter' [-Werror=missing-prototypes]
Signed-off-by: Arnd Bergmann <[email protected]>
---
arch/arm64/kernel/cpuidle.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/arm64/kernel/cpuidle.c b/arch/arm64/kernel/cpuidle.c
index 42e19fff40ee..d1f68599c29f 100644
--- a/arch/arm64/kernel/cpuidle.c
+++ b/arch/arm64/kernel/cpuidle.c
@@ -13,7 +13,7 @@
#include <linux/of_device.h>
#include <linux/psci.h>
-#ifdef CONFIG_ACPI
+#ifdef CONFIG_ACPI_PROCESSOR_IDLE
#include <acpi/processor.h>
--
2.39.2
From: Arnd Bergmann <[email protected]>
The prototype used for calling early_brk64() is in the file that calls
it, which is the wrong place, as it is not included for the definition:
arch/arm64/kernel/traps.c:1100:12: error: no previous prototype for 'early_brk64' [-Werror=missing-prototypes]
Move it to an appropriate header instead.
Signed-off-by: Arnd Bergmann <[email protected]>
---
arch/arm64/include/asm/traps.h | 2 ++
arch/arm64/mm/fault.c | 3 ---
2 files changed, 2 insertions(+), 3 deletions(-)
diff --git a/arch/arm64/include/asm/traps.h b/arch/arm64/include/asm/traps.h
index 1f361e2da516..d66dfb3a72dd 100644
--- a/arch/arm64/include/asm/traps.h
+++ b/arch/arm64/include/asm/traps.h
@@ -29,6 +29,8 @@ void arm64_force_sig_fault(int signo, int code, unsigned long far, const char *s
void arm64_force_sig_mceerr(int code, unsigned long far, short lsb, const char *str);
void arm64_force_sig_ptrace_errno_trap(int errno, unsigned long far, const char *str);
+int early_brk64(unsigned long addr, unsigned long esr, struct pt_regs *regs);
+
/*
* Move regs->pc to next instruction and do necessary setup before it
* is executed.
diff --git a/arch/arm64/mm/fault.c b/arch/arm64/mm/fault.c
index 5ccdba7132ca..940391ec5e1e 100644
--- a/arch/arm64/mm/fault.c
+++ b/arch/arm64/mm/fault.c
@@ -886,9 +886,6 @@ void do_sp_pc_abort(unsigned long addr, unsigned long esr, struct pt_regs *regs)
}
NOKPROBE_SYMBOL(do_sp_pc_abort);
-int __init early_brk64(unsigned long addr, unsigned long esr,
- struct pt_regs *regs);
-
/*
* __refdata because early_brk64 is __init, but the reference to it is
* clobbered at arch_initcall time.
--
2.39.2
From: Arnd Bergmann <[email protected]>
With W=1 warnings enabled, there are lots of complaints about
missing prototypes for system calls, plus a few other related
ones:
arch/arm64/kernel/sys_compat.c:68:6: error: no previous prototype for 'compat_arm_syscall' [-Werror=missing-prototypes]
arch/arm64/include/asm/syscall_wrapper.h:76:32: error: no previous prototype for '__arm64_sys_io_setup' [-Werror=missing-prototypes]
arch/arm64/include/asm/syscall_wrapper.h:41:32: error: no previous prototype for '__arm64_compat_sys_io_setup' [-Werror=missing-prototypes]
arch/arm64/include/asm/syscall_wrapper.h:76:32: error: no previous prototype for '__arm64_sys_io_destroy' [-Werror=missing-prototypes]
arch/arm64/include/asm/syscall_wrapper.h:76:32: error: no previous prototype for '__arm64_sys_io_submit' [-Werror=missing-prototypes]
Add declarations to the syscall macros to avoid all of these, plus
one for the compat syscall entry.
Signed-off-by: Arnd Bergmann <[email protected]>
---
arch/arm64/include/asm/compat.h | 2 ++
arch/arm64/include/asm/syscall_wrapper.h | 4 ++++
2 files changed, 6 insertions(+)
diff --git a/arch/arm64/include/asm/compat.h b/arch/arm64/include/asm/compat.h
index 74575c3d6987..ae904a1ad529 100644
--- a/arch/arm64/include/asm/compat.h
+++ b/arch/arm64/include/asm/compat.h
@@ -96,6 +96,8 @@ static inline int is_compat_thread(struct thread_info *thread)
return test_ti_thread_flag(thread, TIF_32BIT);
}
+long compat_arm_syscall(struct pt_regs *regs, int scno);
+
#else /* !CONFIG_COMPAT */
static inline int is_compat_thread(struct thread_info *thread)
diff --git a/arch/arm64/include/asm/syscall_wrapper.h b/arch/arm64/include/asm/syscall_wrapper.h
index d30217c21eff..17f687510c48 100644
--- a/arch/arm64/include/asm/syscall_wrapper.h
+++ b/arch/arm64/include/asm/syscall_wrapper.h
@@ -38,6 +38,7 @@
asmlinkage long __arm64_compat_sys_##sname(const struct pt_regs *__unused)
#define COND_SYSCALL_COMPAT(name) \
+ asmlinkage long __arm64_compat_sys_##name(const struct pt_regs *regs); \
asmlinkage long __weak __arm64_compat_sys_##name(const struct pt_regs *regs) \
{ \
return sys_ni_syscall(); \
@@ -53,6 +54,7 @@
ALLOW_ERROR_INJECTION(__arm64_sys##name, ERRNO); \
static long __se_sys##name(__MAP(x,__SC_LONG,__VA_ARGS__)); \
static inline long __do_sys##name(__MAP(x,__SC_DECL,__VA_ARGS__)); \
+ asmlinkage long __arm64_sys##name(const struct pt_regs *regs); \
asmlinkage long __arm64_sys##name(const struct pt_regs *regs) \
{ \
return __se_sys##name(SC_ARM64_REGS_TO_ARGS(x,__VA_ARGS__)); \
@@ -73,11 +75,13 @@
asmlinkage long __arm64_sys_##sname(const struct pt_regs *__unused)
#define COND_SYSCALL(name) \
+ asmlinkage long __arm64_sys_##name(const struct pt_regs *regs); \
asmlinkage long __weak __arm64_sys_##name(const struct pt_regs *regs) \
{ \
return sys_ni_syscall(); \
}
+asmlinkage long __arm64_sys_ni_syscall(const struct pt_regs *__unused);
#define SYS_NI(name) SYSCALL_ALIAS(__arm64_sys_##name, sys_ni_posix_timers);
#endif /* __ASM_SYSCALL_WRAPPER_H */
--
2.39.2
On Tue, 16 May 2023 at 18:06, Arnd Bergmann <[email protected]> wrote:
>
> From: Arnd Bergmann <[email protected]>
>
> This addresses all arm64 specific protype warnings. As with the arm32
> patches, the majority of them 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, and ideally this would be
> triggered by the 'asmlinkage' keyword as Ard suggested in the past, but
> I could not come up with a way to do this.
>
> 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
>
For the record, as I mentioned a while ago, I think it is a bit
disappointing that we cannot teach the compiler that 'asmlinkage'
functions don't need a prototype. But I don't have any objections to
these changes, so
Acked-by: Ard Biesheuvel <[email protected]>
>
> Arnd Bergmann (15):
> arm64: xor-neon: mark xor_arm64_neon_*() static
> arm64: add scs_patch_vmlinux prototype
> arm64: avoid prototype warnings for syscalls
> arm64: move cpu_suspend_set_dbg_restorer() prototype to header
> arm64: spectre: provide prototypes for internal functions
> arm64: kvm: add prototypes for functions called in asm
> arm64: cpuidle: fix #ifdef for acpi functions
> arm64: efi: add efi_handle_corrupted_x18 prototype
> arm64: hide unused is_valid_bugaddr()
> arm64: module-plts: inline linux/moduleloader.h
> arm64: flush: include linux/libnvdimm.h
> arm64: kaslr: add kaslr_early_init() declaration
> arm64: signal: include asm/exception.h
> arm64: move early_brk64 prototype to header
> arm64: add alt_cb_patch_nops prototype
>
> arch/arm64/include/asm/alternative.h | 3 +++
> arch/arm64/include/asm/archrandom.h | 2 ++
> arch/arm64/include/asm/compat.h | 2 ++
> arch/arm64/include/asm/efi.h | 2 ++
> arch/arm64/include/asm/hw_breakpoint.h | 8 ++++++++
> arch/arm64/include/asm/kvm_asm.h | 18 ++++++++++++++++++
> arch/arm64/include/asm/scs.h | 1 +
> arch/arm64/include/asm/spectre.h | 16 ++++++++++++++++
> arch/arm64/include/asm/syscall_wrapper.h | 4 ++++
> arch/arm64/include/asm/traps.h | 2 ++
> arch/arm64/kernel/cpuidle.c | 2 +-
> arch/arm64/kernel/hw_breakpoint.c | 8 --------
> arch/arm64/kernel/module-plts.c | 1 +
> arch/arm64/kernel/signal.c | 1 +
> arch/arm64/kernel/traps.c | 3 ++-
> arch/arm64/lib/xor-neon.c | 8 ++++----
> arch/arm64/mm/fault.c | 3 ---
> arch/arm64/mm/flush.c | 1 +
> 18 files changed, 68 insertions(+), 17 deletions(-)
>
> --
> 2.39.2
>
> Cc: Catalin Marinas <[email protected]>
> Cc: Will Deacon <[email protected]>
> Cc: Ard Biesheuvel <[email protected]>
> Cc: Mark Rutland <[email protected]>
> Cc: Marc Zyngier <[email protected]>
> Cc: Oliver Upton <[email protected]>
> Cc: James Morse <[email protected]>
> Cc: Suzuki K Poulose <[email protected]>
> Cc: Zenghui Yu <[email protected]>
> Cc: Arnd Bergmann <[email protected]>
> Cc: Anshuman Khandual <[email protected]>
> Cc: Kees Cook <[email protected]>
> Cc: Suren Baghdasaryan <[email protected]>
> Cc: [email protected]
> Cc: [email protected]
> Cc: [email protected]
> Cc: [email protected]
>
On Tue, May 16, 2023 at 06:06:27PM +0200, Arnd Bergmann wrote:
> This addresses all arm64 specific protype warnings. As with the arm32
> patches, the majority of them 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.
These look good; thanks for tracking these all down! For the series:
Reviewed-by: Kees Cook <[email protected]>
--
Kees Cook
On Tue, 16 May 2023 18:06:27 +0200, Arnd Bergmann wrote:
> This addresses all arm64 specific protype warnings. As with the arm32
> patches, the majority of them 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, and ideally this would be
> triggered by the 'asmlinkage' keyword as Ard suggested in the past, but
> I could not come up with a way to do this.
>
> [...]
Applied to arm64 (for-next/missing-proto-warn), thanks!
[01/15] arm64: xor-neon: mark xor_arm64_neon_*() static
https://git.kernel.org/arm64/c/320a93d4df48
[02/15] arm64: add scs_patch_vmlinux prototype
https://git.kernel.org/arm64/c/aea197160d74
[03/15] arm64: avoid prototype warnings for syscalls
https://git.kernel.org/arm64/c/6ac19f96515e
[04/15] arm64: move cpu_suspend_set_dbg_restorer() prototype to header
https://git.kernel.org/arm64/c/ec3a3db7100d
[05/15] arm64: spectre: provide prototypes for internal functions
https://git.kernel.org/arm64/c/010089e9d3fe
[06/15] arm64: kvm: add prototypes for functions called in asm
https://git.kernel.org/arm64/c/05d557a5cf59
[07/15] arm64: cpuidle: fix #ifdef for acpi functions
https://git.kernel.org/arm64/c/68a879b55346
[08/15] arm64: efi: add efi_handle_corrupted_x18 prototype
https://git.kernel.org/arm64/c/fbc0cd6f6044
[09/15] arm64: hide unused is_valid_bugaddr()
https://git.kernel.org/arm64/c/b925b4314c91
[10/15] arm64: module-plts: inline linux/moduleloader.h
https://git.kernel.org/arm64/c/60a0aab7463e
[11/15] arm64: flush: include linux/libnvdimm.h
https://git.kernel.org/arm64/c/1a1183938946
[12/15] arm64: kaslr: add kaslr_early_init() declaration
https://git.kernel.org/arm64/c/a7f5cb606e99
[13/15] arm64: signal: include asm/exception.h
https://git.kernel.org/arm64/c/8ada7aab02ee
[14/15] arm64: move early_brk64 prototype to header
https://git.kernel.org/arm64/c/e13d32e99264
[15/15] arm64: add alt_cb_patch_nops prototype
https://git.kernel.org/arm64/c/c152aed4dcc2
--
Catalin