diff options
author | 2023-12-09 13:42:14 -0800 | |
---|---|---|
committer | 2024-01-31 22:02:31 +0100 | |
commit | 14619d912b658ecd9573fb88400d3830a29cadcb (patch) | |
tree | 8de248a587245122eba294060ec9ec98c98b0d2e /arch/x86/entry/entry_64_fred.S | |
parent | x86/fred: Add a machine check entry stub for FRED (diff) | |
download | linux-14619d912b658ecd9573fb88400d3830a29cadcb.tar.gz linux-14619d912b658ecd9573fb88400d3830a29cadcb.tar.bz2 linux-14619d912b658ecd9573fb88400d3830a29cadcb.zip |
x86/fred: FRED entry/exit and dispatch code
The code to actually handle kernel and event entry/exit using
FRED. It is split up into two files thus:
- entry_64_fred.S contains the actual entrypoints and exit code, and
saves and restores registers.
- entry_fred.c contains the two-level event dispatch code for FRED.
The first-level dispatch is on the event type, and the second-level
is on the event vector.
[ bp: Fold in an allmodconfig clang build fix:
https://lore.kernel.org/r/20240129064521.5168-1-xin3.li@intel.com
and a CONFIG_IA32_EMULATION=n build fix:
https://lore.kernel.org/r/20240127093728.1323-3-xin3.li@intel.com]
Suggested-by: Thomas Gleixner <tglx@linutronix.de>
Originally-by: Megha Dey <megha.dey@intel.com>
Co-developed-by: Xin Li <xin3.li@intel.com>
Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
Signed-off-by: Xin Li <xin3.li@intel.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
Tested-by: Shan Kang <shan.kang@intel.com>
Link: https://lore.kernel.org/r/20231209214214.2932-1-xin3.li@intel.com
Diffstat (limited to 'arch/x86/entry/entry_64_fred.S')
-rw-r--r-- | arch/x86/entry/entry_64_fred.S | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/arch/x86/entry/entry_64_fred.S b/arch/x86/entry/entry_64_fred.S new file mode 100644 index 000000000000..c1ddaf6b068f --- /dev/null +++ b/arch/x86/entry/entry_64_fred.S @@ -0,0 +1,50 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* + * The actual FRED entry points. + */ + +#include <asm/fred.h> + +#include "calling.h" + + .code64 + .section .noinstr.text, "ax" + +.macro FRED_ENTER + UNWIND_HINT_END_OF_STACK + ENDBR + PUSH_AND_CLEAR_REGS + movq %rsp, %rdi /* %rdi -> pt_regs */ +.endm + +.macro FRED_EXIT + UNWIND_HINT_REGS + POP_REGS +.endm + +/* + * The new RIP value that FRED event delivery establishes is + * IA32_FRED_CONFIG & ~FFFH for events that occur in ring 3. + * Thus the FRED ring 3 entry point must be 4K page aligned. + */ + .align 4096 + +SYM_CODE_START_NOALIGN(asm_fred_entrypoint_user) + FRED_ENTER + call fred_entry_from_user + FRED_EXIT + ERETU +SYM_CODE_END(asm_fred_entrypoint_user) + +/* + * The new RIP value that FRED event delivery establishes is + * (IA32_FRED_CONFIG & ~FFFH) + 256 for events that occur in + * ring 0, i.e., asm_fred_entrypoint_user + 256. + */ + .org asm_fred_entrypoint_user + 256, 0xcc +SYM_CODE_START_NOALIGN(asm_fred_entrypoint_kernel) + FRED_ENTER + call fred_entry_from_kernel + FRED_EXIT + ERETS +SYM_CODE_END(asm_fred_entrypoint_kernel) |