Message ID | 20230519092905.3828633-1-arnd@kernel.org (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | [v2] x86: xen: add missing prototypes | expand |
On 5/19/23 5:28 AM, Arnd Bergmann wrote: > diff --git a/arch/x86/xen/smp.h b/arch/x86/xen/smp.h > index 22fb982ff971..81a7821dd07f 100644 > --- a/arch/x86/xen/smp.h > +++ b/arch/x86/xen/smp.h > @@ -1,7 +1,11 @@ > /* SPDX-License-Identifier: GPL-2.0 */ > #ifndef _XEN_SMP_H > > +void asm_cpu_bringup_and_idle(void); > +asmlinkage void cpu_bringup_and_idle(void); These can go under CONFIG_SMP > + > #ifdef CONFIG_SMP > + > 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/smp_pv.c b/arch/x86/xen/smp_pv.c > index a92e8002b5cf..d5ae5de2daa2 100644 > 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); These ... > +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); ... should go under '#ifdef CONFIG_XEN_PV' -boris
On Sat, May 20, 2023, at 00:24, Boris Ostrovsky wrote: > On 5/19/23 5:28 AM, Arnd Bergmann wrote: > >> diff --git a/arch/x86/xen/smp.h b/arch/x86/xen/smp.h >> index 22fb982ff971..81a7821dd07f 100644 >> --- a/arch/x86/xen/smp.h >> +++ b/arch/x86/xen/smp.h >> @@ -1,7 +1,11 @@ >> /* SPDX-License-Identifier: GPL-2.0 */ >> #ifndef _XEN_SMP_H >> >> +void asm_cpu_bringup_and_idle(void); >> +asmlinkage void cpu_bringup_and_idle(void); > > These can go under CONFIG_SMP Not sure if there is much point for the second one, since it's only called from assembler, so the #else path is never seen, but I can do that for consistency if you like. I generally prefer to avoid the extra #if checks when there is no strict need for an empty stub. I guess you also want me to add the empty stubs for the other functions that only have a bit in #ifdef but not #else then? >> +void xen_force_evtchn_callback(void); > > These ... > >> +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); > > > ... should go under '#ifdef CONFIG_XEN_PV' What should the stubs do here? I guess just return the unmodified value? Arnd
On 5/23/23 4:37 PM, Arnd Bergmann wrote: > On Sat, May 20, 2023, at 00:24, Boris Ostrovsky wrote: >> On 5/19/23 5:28 AM, Arnd Bergmann wrote: >> >>> diff --git a/arch/x86/xen/smp.h b/arch/x86/xen/smp.h >>> index 22fb982ff971..81a7821dd07f 100644 >>> --- a/arch/x86/xen/smp.h >>> +++ b/arch/x86/xen/smp.h >>> @@ -1,7 +1,11 @@ >>> /* SPDX-License-Identifier: GPL-2.0 */ >>> #ifndef _XEN_SMP_H >>> >>> +void asm_cpu_bringup_and_idle(void); >>> +asmlinkage void cpu_bringup_and_idle(void); >> >> These can go under CONFIG_SMP > > Not sure if there is much point for the second one, since > it's only called from assembler, so the #else path is > never seen, but I can do that for consistency if you > like. > > I generally prefer to avoid the extra #if checks > when there is no strict need for an empty stub. Do we need the empty stubs? Neither of these should be referenced if !SMP (or more precisely if !CONFIG_XEN_PV_SMP) > > I guess you also want me to add the empty stubs for the > other functions that only have a bit in #ifdef but not > #else then? > >>> +void xen_force_evtchn_callback(void); >> >> These ... >> >>> +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); >> >> >> ... should go under '#ifdef CONFIG_XEN_PV' > > What should the stubs do here? I guess just return the > unmodified value? Same here -- these should only be referenced if CONFIG_XEN_PV is defined which is why I suggested moving them under ifdef. -boris
On Wed, May 24, 2023, at 01:09, Boris Ostrovsky wrote: > On 5/23/23 4:37 PM, Arnd Bergmann wrote: >> On Sat, May 20, 2023, at 00:24, Boris Ostrovsky wrote: >>> On 5/19/23 5:28 AM, Arnd Bergmann wrote: >> >> Not sure if there is much point for the second one, since >> it's only called from assembler, so the #else path is >> never seen, but I can do that for consistency if you >> like. >> >> I generally prefer to avoid the extra #if checks >> when there is no strict need for an empty stub. > > Do we need the empty stubs? Neither of these should be referenced if > !SMP (or more precisely if !CONFIG_XEN_PV_SMP) We don't need the prototypes at all for building, they are only there to avoid the missing-prototype warning! I added the stubs in v3 because you asked for an #ifdef, and having an #ifdef without an else clause seemed even weirder: that would only add complexity for something that is already unused while making it harder to maintain or use if an actual user comes up. I'll let someone else figure out what you actually want here. Arnd
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..81a7821dd07f 100644 --- a/arch/x86/xen/smp.h +++ b/arch/x86/xen/smp.h @@ -1,7 +1,11 @@ /* SPDX-License-Identifier: GPL-2.0 */ #ifndef _XEN_SMP_H +void asm_cpu_bringup_and_idle(void); +asmlinkage void cpu_bringup_and_idle(void); + #ifdef CONFIG_SMP + 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/smp_pv.c b/arch/x86/xen/smp_pv.c index a92e8002b5cf..d5ae5de2daa2 100644 --- a/arch/x86/xen/smp_pv.c +++ b/arch/x86/xen/smp_pv.c @@ -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) { 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>