To have lowlevel paca.h include high level entry-common.h cause include file dependency mess. Split irqentry-state.h to have the irqentry_state.h can be included in low level paca.h
Signed-off-by: Luming Yu <luming...@shingroup.cn> --- arch/powerpc/include/asm/paca.h | 2 ++ arch/powerpc/kernel/interrupt.c | 2 ++ include/linux/entry-common.h | 24 ------------------------ include/linux/irqentry-state.h | 28 ++++++++++++++++++++++++++++ 4 files changed, 32 insertions(+), 24 deletions(-) create mode 100644 include/linux/irqentry-state.h diff --git a/arch/powerpc/include/asm/paca.h b/arch/powerpc/include/asm/paca.h index e667d455ecb4..83ebe8e914b7 100644 --- a/arch/powerpc/include/asm/paca.h +++ b/arch/powerpc/include/asm/paca.h @@ -13,6 +13,7 @@ #ifdef CONFIG_PPC64 #include <linux/cache.h> +#include <linux/irqentry-state.h> #include <linux/string.h> #include <asm/types.h> #include <asm/mmu.h> @@ -282,6 +283,7 @@ struct paca_struct { struct mce_info *mce_info; u8 mce_pending_irq_work; #endif /* CONFIG_PPC_BOOK3S_64 */ + irqentry_state_t irqentry_s; } ____cacheline_aligned; extern void copy_mm_to_paca(struct mm_struct *mm); diff --git a/arch/powerpc/kernel/interrupt.c b/arch/powerpc/kernel/interrupt.c index 42af9217136d..8e4cabb0c592 100644 --- a/arch/powerpc/kernel/interrupt.c +++ b/arch/powerpc/kernel/interrupt.c @@ -311,6 +311,7 @@ notrace unsigned long interrupt_exit_user_prepare(struct pt_regs *regs) BUG_ON(regs_is_unrecoverable(regs)); BUG_ON(arch_irq_disabled_regs(regs)); CT_WARN_ON(ct_state() == CONTEXT_USER); + local_paca->irqentry_s = irqentry_enter(regs); /* * We don't need to restore AMR on the way back to userspace for KUAP. @@ -423,6 +424,7 @@ notrace unsigned long interrupt_exit_kernel_prepare(struct pt_regs *regs) * AMR value from the check above. */ kuap_kernel_restore(regs, kuap); + irqentry_exit(regs, local_paca->irqentry_s); return ret; } diff --git a/include/linux/entry-common.h b/include/linux/entry-common.h index d95ab85f96ba..6521171469f2 100644 --- a/include/linux/entry-common.h +++ b/include/linux/entry-common.h @@ -352,30 +352,6 @@ void irqentry_enter_from_user_mode(struct pt_regs *regs); */ void irqentry_exit_to_user_mode(struct pt_regs *regs); -#ifndef irqentry_state -/** - * struct irqentry_state - Opaque object for exception state storage - * @exit_rcu: Used exclusively in the irqentry_*() calls; signals whether the - * exit path has to invoke ct_irq_exit(). - * @lockdep: Used exclusively in the irqentry_nmi_*() calls; ensures that - * lockdep state is restored correctly on exit from nmi. - * - * This opaque object is filled in by the irqentry_*_enter() functions and - * must be passed back into the corresponding irqentry_*_exit() functions - * when the exception is complete. - * - * Callers of irqentry_*_[enter|exit]() must consider this structure opaque - * and all members private. Descriptions of the members are provided to aid in - * the maintenance of the irqentry_*() functions. - */ -typedef struct irqentry_state { - union { - bool exit_rcu; - bool lockdep; - }; -} irqentry_state_t; -#endif - /** * irqentry_enter - Handle state tracking on ordinary interrupt entries * @regs: Pointer to pt_regs of interrupted context diff --git a/include/linux/irqentry-state.h b/include/linux/irqentry-state.h new file mode 100644 index 000000000000..d4ddeb1c6ab6 --- /dev/null +++ b/include/linux/irqentry-state.h @@ -0,0 +1,28 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef __LINUX_IRQENTRYCOMMON_H +#define __LINUX_IRQENTRYCOMMON_H + +#ifndef irqentry_state +/** + * struct irqentry_state - Opaque object for exception state storage + * @exit_rcu: Used exclusively in the irqentry_*() calls; signals whether the + * exit path has to invoke ct_irq_exit(). + * @lockdep: Used exclusively in the irqentry_nmi_*() calls; ensures that + * lockdep state is restored correctly on exit from nmi. + * + * This opaque object is filled in by the irqentry_*_enter() functions and + * must be passed back into the corresponding irqentry_*_exit() functions + * when the exception is complete. + * + * Callers of irqentry_*_[enter|exit]() must consider this structure opaque + * and all members private. Descriptions of the members are provided to aid in + * the maintenance of the irqentry_*() functions. + */ +typedef struct irqentry_state { + union { + bool exit_rcu; + bool lockdep; + }; +} irqentry_state_t; +#endif +#endif -- 2.42.0.windows.2