x86: xen: add missing prototypes
Subsystems (3)
PATCH v3 1/1 x86: xen: add missing prototypes
From: Arnd Bergmann <[email protected]>
These function are all called from assembler files, or from inline assembler, so there is no immediate need for a prototype in a header, but if -Wmissing-prototypes is enabled, the compiler warns about them:
arch/x86/xen/efi.c:130:13: error: no previous prototype for 'xen_efi_init' [-Werror=missing-prototypes] arch/x86/platform/pvh/enlighten.c:120:13: error: no previous prototype for 'xen_prepare_pvh' [-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] arch/x86/xen/mmu_pv.c:372:17: error: no previous prototype for 'xen_make_pte' [-Werror=missing-prototypes] arch/x86/xen/mmu_pv.c:380:17: error: no previous prototype for 'xen_make_pgd' [-Werror=missing-prototypes] arch/x86/xen/mmu_pv.c:387:20: error: no previous prototype for 'xen_pmd_val' [-Werror=missing-prototypes] arch/x86/xen/mmu_pv.c:425:17: error: no previous prototype for 'xen_make_pmd' [-Werror=missing-prototypes] arch/x86/xen/mmu_pv.c:432:20: error: no previous prototype for 'xen_pud_val' [-Werror=missing-prototypes] arch/x86/xen/mmu_pv.c:438:17: error: no previous prototype for 'xen_make_pud' [-Werror=missing-prototypes] arch/x86/xen/mmu_pv.c:522:20: error: no previous prototype for 'xen_p4d_val' [-Werror=missing-prototypes] arch/x86/xen/mmu_pv.c:528:17: error: no previous prototype for 'xen_make_p4d' [-Werror=missing-prototypes] arch/x86/xen/mmu_pv.c:1442:17: error: no previous prototype for 'xen_make_pte_init' [-Werror=missing-prototypes] 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/entry/common.c:302:24: error: no previous prototype for 'xen_pv_evtchn_do_upcall' [-Werror=missing-prototypes]
Declare all of them in an appropriate header file to avoid the warnings. For consistency, also move the asm_cpu_bringup_and_idle() declaration out of smp_pv.c.
---
v3: move declations of conditional function in an #ifdef with a stub
v2: fix up changelog
--- arch/x86/xen/efi.c | 2 ++ arch/x86/xen/smp.h | 11 +++++++++++ arch/x86/xen/smp_pv.c | 1 - arch/x86/xen/xen-ops.h | 26 ++++++++++++++++++++++++++ include/xen/xen.h | 3 +++ 5 files changed, 42 insertions(+), 1 deletion(-)
arch/x86/xen/efi.c +2 -0
@@ -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 = {
arch/x86/xen/smp.h +11 -0
@@ -2,6 +2,10 @@#ifndef _XEN_SMP_H#ifdef CONFIG_SMP + +void asm_cpu_bringup_and_idle (void ); +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,
@@ -29,6 +33,13 @@ struct xen_common_irq { };#else /* CONFIG_SMP */ +static inline void asm_cpu_bringup_and_idle (void ) +{ +} +static inline void cpu_bringup_and_idle (void ) +{ +} +static inline int xen_smp_intr_init (unsigned int cpu) {return 0 ;
arch/x86/xen/smp_pv.c +0 -1
@@ -55,7 +55,6 @@ static DEFINE_PER_CPU(struct xen_common_irq, xen_irq_work) = { .irq = -1 }; static DEFINE_PER_CPU(struct xen_common_irq, xen_pmu_irq) = { .irq = -1 };static irqreturn_t xen_irq_work_interrupt (int irq,void *dev_id); -void asm_cpu_bringup_and_idle (void );static void cpu_bringup (void ) {
arch/x86/xen/xen-ops.h +26 -0
@@ -146,12 +146,38 @@ int xen_cpuhp_setup(int (*cpu_up_prepare_cb)(unsigned int),void xen_pin_vcpu (int cpu);void xen_emergency_restart (void ); +void xen_force_evtchn_callback (void ); +#ifdef CONFIG_XEN_PV void xen_pv_pre_suspend (void );void xen_pv_post_suspend (int suspend_cancelled); +pteval_t xen_pte_val (pte_t pte); +pgdval_t xen_pgd_val (pgd_t pgd); +pmdval_t xen_pmd_val (pmd_t pmd); +pudval_t xen_pud_val (pud_t pud); +p4dval_t xen_p4d_val (p4d_t p4d); +pte_t xen_make_pte (pteval_t pte); +pgd_t xen_make_pgd (pgdval_t pgd); +pmd_t xen_make_pmd (pmdval_t pmd); +pud_t xen_make_pud (pudval_t pud); +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);#else static inline void xen_pv_pre_suspend (void ) {}static inline void xen_pv_post_suspend (int suspend_cancelled) {} +static inline pteval_t xen_pte_val (pte_t pte) {return pte.pte; } +static inline pgdval_t xen_pgd_val (pgd_t pgd) {return pgd.pgd; } +static inline pmdval_t xen_pmd_val (pmd_t pmd) {return pmd.pmd; } +static inline pudval_t xen_pud_val (pud_t pud) {return pud.pud; } +static inline p4dval_t xen_p4d_val (p4d_t p4d) {return p4d.p4d; } +static inline pte_t xen_make_pte (pteval_t pte) {return (pte_t ){pte}; } +static inline pgd_t xen_make_pgd (pgdval_t pgd) {return (pgd_t ){pgd}; } +static inline pmd_t xen_make_pmd (pmdval_t pmd) {return (pmd_t ){pmd}; } +static inline pud_t xen_make_pud (pudval_t pud) {return (pud_t ){pud}; } +static inline p4d_t xen_make_p4d (p4dval_t p4d) {return (p4d_t ){p4d}; } +static inline pte_t xen_make_pte_init (pteval_t pte) {return (pte_t ){pte}; } +static inline void xen_start_kernel (struct start_info *si) {}#endif #ifdef CONFIG_XEN_PVHVM
include/xen/xen.h +3 -0
@@ -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>
Signature · 1 line
2.39.2
Juergen Gross
maintainerQuoted 6 lines · Arnd Bergmann
From: Arnd Bergmann <[email protected]>
These function are all called from assembler files, or from inline assembler, so there is no immediate need for a prototype in a header, but if -Wmissing-prototypes is enabled, the compiler warns about them:
Quoted 13 lines
arch/x86/xen/efi.c:130:13: error: no previous prototype for 'xen_efi_init' [-Werror=missing-prototypes]arch/x86/platform/pvh/enlighten.c:120:13: error: no previous prototype for 'xen_prepare_pvh' [-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]arch/x86/xen/mmu_pv.c:372:17: error: no previous prototype for 'xen_make_pte' [-Werror=missing-prototypes]arch/x86/xen/mmu_pv.c:380:17: error: no previous prototype for 'xen_make_pgd' [-Werror=missing-prototypes]arch/x86/xen/mmu_pv.c:387:20: error: no previous prototype for 'xen_pmd_val' [-Werror=missing-prototypes]arch/x86/xen/mmu_pv.c:425:17: error: no previous prototype for 'xen_make_pmd' [-Werror=missing-prototypes]arch/x86/xen/mmu_pv.c:432:20: error: no previous prototype for 'xen_pud_val' [-Werror=missing-prototypes]arch/x86/xen/mmu_pv.c:438:17: error: no previous prototype for 'xen_make_pud' [-Werror=missing-prototypes]arch/x86/xen/mmu_pv.c:522:20: error: no previous prototype for 'xen_p4d_val' [-Werror=missing-prototypes]arch/x86/xen/mmu_pv.c:528:17: error: no previous prototype for 'xen_make_p4d' [-Werror=missing-prototypes]arch/x86/xen/mmu_pv.c:1442:17: error: no previous prototype for 'xen_make_pte_init' [-Werror=missing-prototypes]
I'd suggest to add the prototypes of the functions defined in arch/x86/xen/mmu_pv.c to the same source, as they are referenced nowhere else. This avoids the need of #ifdefs for those functions.
Quoted 49 lines
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/entry/common.c:302:24: error: no previous prototype for 'xen_pv_evtchn_do_upcall' [-Werror=missing-prototypes]Declare all of them in an appropriate header file to avoid the warnings. For consistency, also move the
asm_cpu_bringup_and_idle()declaration out ofsmp_pv.c.Signed-off-by Arnd Bergmann <[email protected]>---
v3: move declations of conditional function in an #ifdef with a stub
v2: fix up changelog--- arch/x86/xen/efi.c | 2 ++ arch/x86/xen/smp.h | 11 +++++++++++ arch/x86/xen/smp_pv.c | 1 - arch/x86/xen/xen-ops.h | 26 ++++++++++++++++++++++++++ include/xen/xen.h | 3 +++ 5 files changed, 42 insertions(+), 1 deletion(-)arch/x86/xen/efi.c +2
-0@@ -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 = {arch/x86/xen/smp.h +4
-0@@ -2,6 +2,10 @@#ifndef _XEN_SMP_H#ifdef CONFIG_SMP + +void asm_cpu_bringup_and_idle (void ); +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,
arch/x86/xen/smp.h struct xen_common_irq { · line 42
Quoted 10 lines
arch/x86/xen/smp.h +7
-0@@ -29,6 +33,13 @@ struct xen_common_irq { };#else /* CONFIG_SMP */ +static inline void asm_cpu_bringup_and_idle (void ) +{ +} +static inline void cpu_bringup_and_idle (void ) +{ +} +
No need for above stubs, as there is no way they can get called without CONFIG_SMP.
Quoted 29 lines
arch/x86/xen/smp.h +0
-0static inline int xen_smp_intr_init (unsigned int cpu) {return 0 ;arch/x86/xen/smp_pv.c +0
-1@@ -55,7 +55,6 @@ static DEFINE_PER_CPU(struct xen_common_irq, xen_irq_work) = { .irq = -1 }; static DEFINE_PER_CPU(struct xen_common_irq, xen_pmu_irq) = { .irq = -1 };static irqreturn_t xen_irq_work_interrupt (int irq,void *dev_id); -void asm_cpu_bringup_and_idle (void );static void cpu_bringup (void ) {arch/x86/xen/xen-ops.h +3
-0@@ -146,12 +146,38 @@ int xen_cpuhp_setup(int (*cpu_up_prepare_cb)(unsigned int),void xen_pin_vcpu (int cpu);void xen_emergency_restart (void ); +void xen_force_evtchn_callback (void ); +#ifdef CONFIG_XEN_PV void xen_pv_pre_suspend (void );void xen_pv_post_suspend (int suspend_cancelled); +pteval_t xen_pte_val (pte_t pte);
arch/x86/xen/xen-ops.h int xen_cpuhp_setup(int (*cpu_up_prepare_cb)(unsigned int), · line 164
Quoted 10 lines
arch/x86/xen/xen-ops.h +10
-0+pgdval_t xen_pgd_val (pgd_t pgd); +pmdval_t xen_pmd_val (pmd_t pmd); +pudval_t xen_pud_val (pud_t pud); +p4dval_t xen_p4d_val (p4d_t p4d); +pte_t xen_make_pte (pteval_t pte); +pgd_t xen_make_pgd (pgdval_t pgd); +pmd_t xen_make_pmd (pmdval_t pmd); +pud_t xen_make_pud (pudval_t pud); +p4d_t xen_make_p4d (p4dval_t p4d); +pte_t xen_make_pte_init (pteval_t pte);
See above.
Quoted 6 lines
arch/x86/xen/xen-ops.h +3
-0+void xen_start_kernel (struct start_info *si);#else static inline void xen_pv_pre_suspend (void ) {}static inline void xen_pv_post_suspend (int suspend_cancelled) {} +static inline pteval_t xen_pte_val (pte_t pte) {return pte.pte; } +static inline pgdval_t xen_pgd_val (pgd_t pgd) {return pgd.pgd; }
arch/x86/xen/xen-ops.h int xen_cpuhp_setup(int (*cpu_up_prepare_cb)(unsigned int), · line 180
Quoted 10 lines
arch/x86/xen/xen-ops.h +10
-0+static inline pmdval_t xen_pmd_val (pmd_t pmd) {return pmd.pmd; } +static inline pudval_t xen_pud_val (pud_t pud) {return pud.pud; } +static inline p4dval_t xen_p4d_val (p4d_t p4d) {return p4d.p4d; } +static inline pte_t xen_make_pte (pteval_t pte) {return (pte_t ){pte}; } +static inline pgd_t xen_make_pgd (pgdval_t pgd) {return (pgd_t ){pgd}; } +static inline pmd_t xen_make_pmd (pmdval_t pmd) {return (pmd_t ){pmd}; } +static inline pud_t xen_make_pud (pudval_t pud) {return (pud_t ){pud}; } +static inline p4d_t xen_make_p4d (p4dval_t p4d) {return (p4d_t ){p4d}; } +static inline pte_t xen_make_pte_init (pteval_t pte) {return (pte_t ){pte}; } +static inline void xen_start_kernel (struct start_info *si) {}
Drop those stubs, they are not used without CONFIG_XEN_PV, and they shouldn't be used in this case anyway.
Quoted 8 lines
arch/x86/xen/xen-ops.h +0
-0#endif #ifdef CONFIG_XEN_PVHVM include/xen/xen.h +0
-0
include/xen/xen.h extern uint32_t xen_start_flags; · line 39
Quoted 9 lines
include/xen/xen.h +3
-0@@ -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>
Juergen