[PATCH 7/7] powerpc/entry: fix 32bit compile issue for common entry

From: Luming Yu
Date: Sat Oct 12 2024 - 00:01:53 EST


fix irqentry in 32bit code path and hw_irq helpers.

Signed-off-by: Luming Yu <luming.yu@xxxxxxxxxxxx>
---
arch/powerpc/include/asm/hw_irq.h | 6 ++++++
arch/powerpc/kernel/interrupt.c | 4 ++++
include/linux/entry-common.h | 1 +
3 files changed, 11 insertions(+)

diff --git a/arch/powerpc/include/asm/hw_irq.h b/arch/powerpc/include/asm/hw_irq.h
index a3d591784c95..99104f95e1d7 100644
--- a/arch/powerpc/include/asm/hw_irq.h
+++ b/arch/powerpc/include/asm/hw_irq.h
@@ -469,6 +469,12 @@ static inline bool arch_irqs_disabled(void)
return arch_irqs_disabled_flags(arch_local_save_flags());
}

+/*for common entry*/
+static __always_inline bool regs_irqs_disabled(struct pt_regs *regs)
+{
+ return arch_irqs_disabled();
+}
+
#define hard_irq_disable() arch_local_irq_disable()

static inline bool arch_irq_disabled_regs(struct pt_regs *regs)
diff --git a/arch/powerpc/kernel/interrupt.c b/arch/powerpc/kernel/interrupt.c
index 8e4cabb0c592..31167700f894 100644
--- a/arch/powerpc/kernel/interrupt.c
+++ b/arch/powerpc/kernel/interrupt.c
@@ -311,7 +311,9 @@ 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);
+#ifdef CONFIG_PPC64
local_paca->irqentry_s = irqentry_enter(regs);
+#endif

/*
* We don't need to restore AMR on the way back to userspace for KUAP.
@@ -424,7 +426,9 @@ notrace unsigned long interrupt_exit_kernel_prepare(struct pt_regs *regs)
* AMR value from the check above.
*/
kuap_kernel_restore(regs, kuap);
+#ifdef CONFIG_PPC64
irqentry_exit(regs, local_paca->irqentry_s);
+#endif

return ret;
}
diff --git a/include/linux/entry-common.h b/include/linux/entry-common.h
index 6521171469f2..b68eada65a8a 100644
--- a/include/linux/entry-common.h
+++ b/include/linux/entry-common.h
@@ -8,6 +8,7 @@
#include <linux/seccomp.h>
#include <linux/sched.h>

+#include <linux/irqentry-state.h>
#include <asm/entry-common.h>

/*
--
2.42.0.windows.2