Commit 25b7e6bb authored by Nicholas Piggin's avatar Nicholas Piggin Committed by Michael Ellerman

powerpc: add interrupt wrapper entry / exit stub functions

These will be used by subsequent patches.
Signed-off-by: default avatarNicholas Piggin <npiggin@gmail.com>
Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20210130130852.2952424-28-npiggin@gmail.com
parent 8d41fc61
...@@ -5,6 +5,50 @@ ...@@ -5,6 +5,50 @@
#include <linux/context_tracking.h> #include <linux/context_tracking.h>
#include <asm/ftrace.h> #include <asm/ftrace.h>
struct interrupt_state {
};
static inline void interrupt_enter_prepare(struct pt_regs *regs, struct interrupt_state *state)
{
}
/*
* Care should be taken to note that interrupt_exit_prepare and
* interrupt_async_exit_prepare do not necessarily return immediately to
* regs context (e.g., if regs is usermode, we don't necessarily return to
* user mode). Other interrupts might be taken between here and return,
* context switch / preemption may occur in the exit path after this, or a
* signal may be delivered, etc.
*
* The real interrupt exit code is platform specific, e.g.,
* interrupt_exit_user_prepare / interrupt_exit_kernel_prepare for 64s.
*
* However interrupt_nmi_exit_prepare does return directly to regs, because
* NMIs do not do "exit work" or replay soft-masked interrupts.
*/
static inline void interrupt_exit_prepare(struct pt_regs *regs, struct interrupt_state *state)
{
}
static inline void interrupt_async_enter_prepare(struct pt_regs *regs, struct interrupt_state *state)
{
}
static inline void interrupt_async_exit_prepare(struct pt_regs *regs, struct interrupt_state *state)
{
}
struct interrupt_nmi_state {
};
static inline void interrupt_nmi_enter_prepare(struct pt_regs *regs, struct interrupt_nmi_state *state)
{
}
static inline void interrupt_nmi_exit_prepare(struct pt_regs *regs, struct interrupt_nmi_state *state)
{
}
/** /**
* DECLARE_INTERRUPT_HANDLER_RAW - Declare raw interrupt handler function * DECLARE_INTERRUPT_HANDLER_RAW - Declare raw interrupt handler function
* @func: Function name of the entry point * @func: Function name of the entry point
...@@ -71,7 +115,13 @@ static __always_inline void ____##func(struct pt_regs *regs); \ ...@@ -71,7 +115,13 @@ static __always_inline void ____##func(struct pt_regs *regs); \
\ \
__visible noinstr void func(struct pt_regs *regs) \ __visible noinstr void func(struct pt_regs *regs) \
{ \ { \
struct interrupt_state state; \
\
interrupt_enter_prepare(regs, &state); \
\
____##func (regs); \ ____##func (regs); \
\
interrupt_exit_prepare(regs, &state); \
} \ } \
\ \
static __always_inline void ____##func(struct pt_regs *regs) static __always_inline void ____##func(struct pt_regs *regs)
...@@ -99,10 +149,15 @@ static __always_inline long ____##func(struct pt_regs *regs); \ ...@@ -99,10 +149,15 @@ static __always_inline long ____##func(struct pt_regs *regs); \
\ \
__visible noinstr long func(struct pt_regs *regs) \ __visible noinstr long func(struct pt_regs *regs) \
{ \ { \
struct interrupt_state state; \
long ret; \ long ret; \
\ \
interrupt_enter_prepare(regs, &state); \
\
ret = ____##func (regs); \ ret = ____##func (regs); \
\ \
interrupt_exit_prepare(regs, &state); \
\
return ret; \ return ret; \
} \ } \
\ \
...@@ -129,7 +184,13 @@ static __always_inline void ____##func(struct pt_regs *regs); \ ...@@ -129,7 +184,13 @@ static __always_inline void ____##func(struct pt_regs *regs); \
\ \
__visible noinstr void func(struct pt_regs *regs) \ __visible noinstr void func(struct pt_regs *regs) \
{ \ { \
struct interrupt_state state; \
\
interrupt_async_enter_prepare(regs, &state); \
\
____##func (regs); \ ____##func (regs); \
\
interrupt_async_exit_prepare(regs, &state); \
} \ } \
\ \
static __always_inline void ____##func(struct pt_regs *regs) static __always_inline void ____##func(struct pt_regs *regs)
...@@ -157,10 +218,15 @@ static __always_inline long ____##func(struct pt_regs *regs); \ ...@@ -157,10 +218,15 @@ static __always_inline long ____##func(struct pt_regs *regs); \
\ \
__visible noinstr long func(struct pt_regs *regs) \ __visible noinstr long func(struct pt_regs *regs) \
{ \ { \
struct interrupt_nmi_state state; \
long ret; \ long ret; \
\ \
interrupt_nmi_enter_prepare(regs, &state); \
\
ret = ____##func (regs); \ ret = ____##func (regs); \
\ \
interrupt_nmi_exit_prepare(regs, &state); \
\
return ret; \ return ret; \
} \ } \
\ \
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment