Skip to content

Commit 25b7e6b

Browse files
npigginmpe
authored andcommitted
powerpc: add interrupt wrapper entry / exit stub functions
These will be used by subsequent patches. Signed-off-by: Nicholas Piggin <[email protected]> Signed-off-by: Michael Ellerman <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 8d41fc6 commit 25b7e6b

File tree

1 file changed

+66
-0
lines changed

1 file changed

+66
-0
lines changed

arch/powerpc/include/asm/interrupt.h

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,50 @@
55
#include <linux/context_tracking.h>
66
#include <asm/ftrace.h>
77

8+
struct interrupt_state {
9+
};
10+
11+
static inline void interrupt_enter_prepare(struct pt_regs *regs, struct interrupt_state *state)
12+
{
13+
}
14+
15+
/*
16+
* Care should be taken to note that interrupt_exit_prepare and
17+
* interrupt_async_exit_prepare do not necessarily return immediately to
18+
* regs context (e.g., if regs is usermode, we don't necessarily return to
19+
* user mode). Other interrupts might be taken between here and return,
20+
* context switch / preemption may occur in the exit path after this, or a
21+
* signal may be delivered, etc.
22+
*
23+
* The real interrupt exit code is platform specific, e.g.,
24+
* interrupt_exit_user_prepare / interrupt_exit_kernel_prepare for 64s.
25+
*
26+
* However interrupt_nmi_exit_prepare does return directly to regs, because
27+
* NMIs do not do "exit work" or replay soft-masked interrupts.
28+
*/
29+
static inline void interrupt_exit_prepare(struct pt_regs *regs, struct interrupt_state *state)
30+
{
31+
}
32+
33+
static inline void interrupt_async_enter_prepare(struct pt_regs *regs, struct interrupt_state *state)
34+
{
35+
}
36+
37+
static inline void interrupt_async_exit_prepare(struct pt_regs *regs, struct interrupt_state *state)
38+
{
39+
}
40+
41+
struct interrupt_nmi_state {
42+
};
43+
44+
static inline void interrupt_nmi_enter_prepare(struct pt_regs *regs, struct interrupt_nmi_state *state)
45+
{
46+
}
47+
48+
static inline void interrupt_nmi_exit_prepare(struct pt_regs *regs, struct interrupt_nmi_state *state)
49+
{
50+
}
51+
852
/**
953
* DECLARE_INTERRUPT_HANDLER_RAW - Declare raw interrupt handler function
1054
* @func: Function name of the entry point
@@ -71,7 +115,13 @@ static __always_inline void ____##func(struct pt_regs *regs); \
71115
\
72116
__visible noinstr void func(struct pt_regs *regs) \
73117
{ \
118+
struct interrupt_state state; \
119+
\
120+
interrupt_enter_prepare(regs, &state); \
121+
\
74122
____##func (regs); \
123+
\
124+
interrupt_exit_prepare(regs, &state); \
75125
} \
76126
\
77127
static __always_inline void ____##func(struct pt_regs *regs)
@@ -99,10 +149,15 @@ static __always_inline long ____##func(struct pt_regs *regs); \
99149
\
100150
__visible noinstr long func(struct pt_regs *regs) \
101151
{ \
152+
struct interrupt_state state; \
102153
long ret; \
103154
\
155+
interrupt_enter_prepare(regs, &state); \
156+
\
104157
ret = ____##func (regs); \
105158
\
159+
interrupt_exit_prepare(regs, &state); \
160+
\
106161
return ret; \
107162
} \
108163
\
@@ -129,7 +184,13 @@ static __always_inline void ____##func(struct pt_regs *regs); \
129184
\
130185
__visible noinstr void func(struct pt_regs *regs) \
131186
{ \
187+
struct interrupt_state state; \
188+
\
189+
interrupt_async_enter_prepare(regs, &state); \
190+
\
132191
____##func (regs); \
192+
\
193+
interrupt_async_exit_prepare(regs, &state); \
133194
} \
134195
\
135196
static __always_inline void ____##func(struct pt_regs *regs)
@@ -157,10 +218,15 @@ static __always_inline long ____##func(struct pt_regs *regs); \
157218
\
158219
__visible noinstr long func(struct pt_regs *regs) \
159220
{ \
221+
struct interrupt_nmi_state state; \
160222
long ret; \
161223
\
224+
interrupt_nmi_enter_prepare(regs, &state); \
225+
\
162226
ret = ____##func (regs); \
163227
\
228+
interrupt_nmi_exit_prepare(regs, &state); \
229+
\
164230
return ret; \
165231
} \
166232
\

0 commit comments

Comments
 (0)