-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
powerpc: interrupt handler wrapper functions
Add wrapper functions (derived from x86 macros) for interrupt handler functions. This allows interrupt entry code to be written in C. Signed-off-by: Nicholas Piggin <npiggin@gmail.com> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au> Link: https://lore.kernel.org/r/20210130130852.2952424-27-npiggin@gmail.com
- Loading branch information
Nicholas Piggin
authored and
Michael Ellerman
committed
Feb 8, 2021
1 parent
11cb0a2
commit 8d41fc6
Showing
1 changed file
with
169 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,169 @@ | ||
/* SPDX-License-Identifier: GPL-2.0-or-later */ | ||
#ifndef _ASM_POWERPC_INTERRUPT_H | ||
#define _ASM_POWERPC_INTERRUPT_H | ||
|
||
#include <linux/context_tracking.h> | ||
#include <asm/ftrace.h> | ||
|
||
/** | ||
* DECLARE_INTERRUPT_HANDLER_RAW - Declare raw interrupt handler function | ||
* @func: Function name of the entry point | ||
* @returns: Returns a value back to asm caller | ||
*/ | ||
#define DECLARE_INTERRUPT_HANDLER_RAW(func) \ | ||
__visible long func(struct pt_regs *regs) | ||
|
||
/** | ||
* DEFINE_INTERRUPT_HANDLER_RAW - Define raw interrupt handler function | ||
* @func: Function name of the entry point | ||
* @returns: Returns a value back to asm caller | ||
* | ||
* @func is called from ASM entry code. | ||
* | ||
* This is a plain function which does no tracing, reconciling, etc. | ||
* The macro is written so it acts as function definition. Append the | ||
* body with a pair of curly brackets. | ||
* | ||
* raw interrupt handlers must not enable or disable interrupts, or | ||
* schedule, tracing and instrumentation (ftrace, lockdep, etc) would | ||
* not be advisable either, although may be possible in a pinch, the | ||
* trace will look odd at least. | ||
* | ||
* A raw handler may call one of the other interrupt handler functions | ||
* to be converted into that interrupt context without these restrictions. | ||
* | ||
* On PPC64, _RAW handlers may return with fast_interrupt_return. | ||
* | ||
* Specific handlers may have additional restrictions. | ||
*/ | ||
#define DEFINE_INTERRUPT_HANDLER_RAW(func) \ | ||
static __always_inline long ____##func(struct pt_regs *regs); \ | ||
\ | ||
__visible noinstr long func(struct pt_regs *regs) \ | ||
{ \ | ||
long ret; \ | ||
\ | ||
ret = ____##func (regs); \ | ||
\ | ||
return ret; \ | ||
} \ | ||
\ | ||
static __always_inline long ____##func(struct pt_regs *regs) | ||
|
||
/** | ||
* DECLARE_INTERRUPT_HANDLER - Declare synchronous interrupt handler function | ||
* @func: Function name of the entry point | ||
*/ | ||
#define DECLARE_INTERRUPT_HANDLER(func) \ | ||
__visible void func(struct pt_regs *regs) | ||
|
||
/** | ||
* DEFINE_INTERRUPT_HANDLER - Define synchronous interrupt handler function | ||
* @func: Function name of the entry point | ||
* | ||
* @func is called from ASM entry code. | ||
* | ||
* The macro is written so it acts as function definition. Append the | ||
* body with a pair of curly brackets. | ||
*/ | ||
#define DEFINE_INTERRUPT_HANDLER(func) \ | ||
static __always_inline void ____##func(struct pt_regs *regs); \ | ||
\ | ||
__visible noinstr void func(struct pt_regs *regs) \ | ||
{ \ | ||
____##func (regs); \ | ||
} \ | ||
\ | ||
static __always_inline void ____##func(struct pt_regs *regs) | ||
|
||
/** | ||
* DECLARE_INTERRUPT_HANDLER_RET - Declare synchronous interrupt handler function | ||
* @func: Function name of the entry point | ||
* @returns: Returns a value back to asm caller | ||
*/ | ||
#define DECLARE_INTERRUPT_HANDLER_RET(func) \ | ||
__visible long func(struct pt_regs *regs) | ||
|
||
/** | ||
* DEFINE_INTERRUPT_HANDLER_RET - Define synchronous interrupt handler function | ||
* @func: Function name of the entry point | ||
* @returns: Returns a value back to asm caller | ||
* | ||
* @func is called from ASM entry code. | ||
* | ||
* The macro is written so it acts as function definition. Append the | ||
* body with a pair of curly brackets. | ||
*/ | ||
#define DEFINE_INTERRUPT_HANDLER_RET(func) \ | ||
static __always_inline long ____##func(struct pt_regs *regs); \ | ||
\ | ||
__visible noinstr long func(struct pt_regs *regs) \ | ||
{ \ | ||
long ret; \ | ||
\ | ||
ret = ____##func (regs); \ | ||
\ | ||
return ret; \ | ||
} \ | ||
\ | ||
static __always_inline long ____##func(struct pt_regs *regs) | ||
|
||
/** | ||
* DECLARE_INTERRUPT_HANDLER_ASYNC - Declare asynchronous interrupt handler function | ||
* @func: Function name of the entry point | ||
*/ | ||
#define DECLARE_INTERRUPT_HANDLER_ASYNC(func) \ | ||
__visible void func(struct pt_regs *regs) | ||
|
||
/** | ||
* DEFINE_INTERRUPT_HANDLER_ASYNC - Define asynchronous interrupt handler function | ||
* @func: Function name of the entry point | ||
* | ||
* @func is called from ASM entry code. | ||
* | ||
* The macro is written so it acts as function definition. Append the | ||
* body with a pair of curly brackets. | ||
*/ | ||
#define DEFINE_INTERRUPT_HANDLER_ASYNC(func) \ | ||
static __always_inline void ____##func(struct pt_regs *regs); \ | ||
\ | ||
__visible noinstr void func(struct pt_regs *regs) \ | ||
{ \ | ||
____##func (regs); \ | ||
} \ | ||
\ | ||
static __always_inline void ____##func(struct pt_regs *regs) | ||
|
||
/** | ||
* DECLARE_INTERRUPT_HANDLER_NMI - Declare NMI interrupt handler function | ||
* @func: Function name of the entry point | ||
* @returns: Returns a value back to asm caller | ||
*/ | ||
#define DECLARE_INTERRUPT_HANDLER_NMI(func) \ | ||
__visible long func(struct pt_regs *regs) | ||
|
||
/** | ||
* DEFINE_INTERRUPT_HANDLER_NMI - Define NMI interrupt handler function | ||
* @func: Function name of the entry point | ||
* @returns: Returns a value back to asm caller | ||
* | ||
* @func is called from ASM entry code. | ||
* | ||
* The macro is written so it acts as function definition. Append the | ||
* body with a pair of curly brackets. | ||
*/ | ||
#define DEFINE_INTERRUPT_HANDLER_NMI(func) \ | ||
static __always_inline long ____##func(struct pt_regs *regs); \ | ||
\ | ||
__visible noinstr long func(struct pt_regs *regs) \ | ||
{ \ | ||
long ret; \ | ||
\ | ||
ret = ____##func (regs); \ | ||
\ | ||
return ret; \ | ||
} \ | ||
\ | ||
static __always_inline long ____##func(struct pt_regs *regs) | ||
|
||
#endif /* _ASM_POWERPC_INTERRUPT_H */ |