^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) /* SPDX-License-Identifier: GPL-2.0 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) #ifndef _ASM_X86_IDTENTRY_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) #define _ASM_X86_IDTENTRY_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) /* Interrupts/Exceptions */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) #include <asm/trapnr.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) #ifndef __ASSEMBLY__
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) #include <linux/entry-common.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) #include <linux/hardirq.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) #include <asm/irq_stack.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) * DECLARE_IDTENTRY - Declare functions for simple IDT entry points
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) * No error code pushed by hardware
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) * @vector: Vector number (ignored for C)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) * @func: Function name of the entry point
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) * Declares three functions:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) * - The ASM entry point: asm_##func
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) * - The XEN PV trap entry point: xen_##func (maybe unused)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) * - The C handler called from the ASM entry point
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) * Note: This is the C variant of DECLARE_IDTENTRY(). As the name says it
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) * declares the entry points for usage in C code. There is an ASM variant
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) * as well which is used to emit the entry stubs in entry_32/64.S.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) #define DECLARE_IDTENTRY(vector, func) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) asmlinkage void asm_##func(void); \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) asmlinkage void xen_asm_##func(void); \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) __visible void func(struct pt_regs *regs)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) * DEFINE_IDTENTRY - Emit code for simple IDT entry points
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) * @func: Function name of the entry point
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) * @func is called from ASM entry code with interrupts disabled.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) * The macro is written so it acts as function definition. Append the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) * body with a pair of curly brackets.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) * irqentry_enter() contains common code which has to be invoked before
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) * arbitrary code in the body. irqentry_exit() contains common code
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) * which has to run before returning to the low level assembly code.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) #define DEFINE_IDTENTRY(func) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) static __always_inline void __##func(struct pt_regs *regs); \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) __visible noinstr void func(struct pt_regs *regs) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) { \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) irqentry_state_t state = irqentry_enter(regs); \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) instrumentation_begin(); \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) __##func (regs); \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) instrumentation_end(); \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) irqentry_exit(regs, state); \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) } \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) static __always_inline void __##func(struct pt_regs *regs)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) /* Special case for 32bit IRET 'trap' */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) #define DECLARE_IDTENTRY_SW DECLARE_IDTENTRY
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) #define DEFINE_IDTENTRY_SW DEFINE_IDTENTRY
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) * DECLARE_IDTENTRY_ERRORCODE - Declare functions for simple IDT entry points
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) * Error code pushed by hardware
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) * @vector: Vector number (ignored for C)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) * @func: Function name of the entry point
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) * Declares three functions:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73) * - The ASM entry point: asm_##func
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) * - The XEN PV trap entry point: xen_##func (maybe unused)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75) * - The C handler called from the ASM entry point
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77) * Same as DECLARE_IDTENTRY, but has an extra error_code argument for the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78) * C-handler.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80) #define DECLARE_IDTENTRY_ERRORCODE(vector, func) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81) asmlinkage void asm_##func(void); \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82) asmlinkage void xen_asm_##func(void); \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 83) __visible void func(struct pt_regs *regs, unsigned long error_code)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 84)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 85) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 86) * DEFINE_IDTENTRY_ERRORCODE - Emit code for simple IDT entry points
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 87) * Error code pushed by hardware
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 88) * @func: Function name of the entry point
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 89) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 90) * Same as DEFINE_IDTENTRY, but has an extra error_code argument
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 91) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 92) #define DEFINE_IDTENTRY_ERRORCODE(func) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 93) static __always_inline void __##func(struct pt_regs *regs, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 94) unsigned long error_code); \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 95) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 96) __visible noinstr void func(struct pt_regs *regs, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 97) unsigned long error_code) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 98) { \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 99) irqentry_state_t state = irqentry_enter(regs); \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) instrumentation_begin(); \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) __##func (regs, error_code); \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) instrumentation_end(); \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) irqentry_exit(regs, state); \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) } \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) static __always_inline void __##func(struct pt_regs *regs, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) unsigned long error_code)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) * DECLARE_IDTENTRY_RAW - Declare functions for raw IDT entry points
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) * No error code pushed by hardware
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) * @vector: Vector number (ignored for C)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) * @func: Function name of the entry point
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) * Maps to DECLARE_IDTENTRY().
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) #define DECLARE_IDTENTRY_RAW(vector, func) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) DECLARE_IDTENTRY(vector, func)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) * DEFINE_IDTENTRY_RAW - Emit code for raw IDT entry points
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) * @func: Function name of the entry point
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) * @func is called from ASM entry code with interrupts disabled.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) * The macro is written so it acts as function definition. Append the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) * body with a pair of curly brackets.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) * Contrary to DEFINE_IDTENTRY() this does not invoke the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) * idtentry_enter/exit() helpers before and after the body invocation. This
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) * needs to be done in the body itself if applicable. Use if extra work
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) * is required before the enter/exit() helpers are invoked.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) #define DEFINE_IDTENTRY_RAW(func) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) __visible noinstr void func(struct pt_regs *regs)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) * DECLARE_IDTENTRY_RAW_ERRORCODE - Declare functions for raw IDT entry points
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) * Error code pushed by hardware
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) * @vector: Vector number (ignored for C)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) * @func: Function name of the entry point
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) * Maps to DECLARE_IDTENTRY_ERRORCODE()
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) #define DECLARE_IDTENTRY_RAW_ERRORCODE(vector, func) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) DECLARE_IDTENTRY_ERRORCODE(vector, func)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) * DEFINE_IDTENTRY_RAW_ERRORCODE - Emit code for raw IDT entry points
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) * @func: Function name of the entry point
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) * @func is called from ASM entry code with interrupts disabled.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) * The macro is written so it acts as function definition. Append the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) * body with a pair of curly brackets.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) * Contrary to DEFINE_IDTENTRY_ERRORCODE() this does not invoke the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) * irqentry_enter/exit() helpers before and after the body invocation. This
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) * needs to be done in the body itself if applicable. Use if extra work
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) * is required before the enter/exit() helpers are invoked.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) #define DEFINE_IDTENTRY_RAW_ERRORCODE(func) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) __visible noinstr void func(struct pt_regs *regs, unsigned long error_code)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) * DECLARE_IDTENTRY_IRQ - Declare functions for device interrupt IDT entry
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) * points (common/spurious)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) * @vector: Vector number (ignored for C)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) * @func: Function name of the entry point
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) * Maps to DECLARE_IDTENTRY_ERRORCODE()
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) #define DECLARE_IDTENTRY_IRQ(vector, func) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) DECLARE_IDTENTRY_ERRORCODE(vector, func)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) * DEFINE_IDTENTRY_IRQ - Emit code for device interrupt IDT entry points
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) * @func: Function name of the entry point
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181) * The vector number is pushed by the low level entry stub and handed
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) * to the function as error_code argument which needs to be truncated
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) * to an u8 because the push is sign extending.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) * irq_enter/exit_rcu() are invoked before the function body and the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186) * KVM L1D flush request is set. Stack switching to the interrupt stack
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187) * has to be done in the function body if necessary.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189) #define DEFINE_IDTENTRY_IRQ(func) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) static __always_inline void __##func(struct pt_regs *regs, u8 vector); \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192) __visible noinstr void func(struct pt_regs *regs, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193) unsigned long error_code) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194) { \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) irqentry_state_t state = irqentry_enter(regs); \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) instrumentation_begin(); \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198) irq_enter_rcu(); \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) kvm_set_cpu_l1tf_flush_l1d(); \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200) __##func (regs, (u8)error_code); \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201) irq_exit_rcu(); \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202) instrumentation_end(); \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203) irqentry_exit(regs, state); \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204) } \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206) static __always_inline void __##func(struct pt_regs *regs, u8 vector)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209) * DECLARE_IDTENTRY_SYSVEC - Declare functions for system vector entry points
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210) * @vector: Vector number (ignored for C)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211) * @func: Function name of the entry point
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213) * Declares three functions:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214) * - The ASM entry point: asm_##func
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215) * - The XEN PV trap entry point: xen_##func (maybe unused)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216) * - The C handler called from the ASM entry point
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218) * Maps to DECLARE_IDTENTRY().
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220) #define DECLARE_IDTENTRY_SYSVEC(vector, func) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221) DECLARE_IDTENTRY(vector, func)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224) * DEFINE_IDTENTRY_SYSVEC - Emit code for system vector IDT entry points
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225) * @func: Function name of the entry point
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227) * irqentry_enter/exit() and irq_enter/exit_rcu() are invoked before the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228) * function body. KVM L1D flush request is set.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230) * Runs the function on the interrupt stack if the entry hit kernel mode
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232) #define DEFINE_IDTENTRY_SYSVEC(func) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233) static void __##func(struct pt_regs *regs); \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 235) __visible noinstr void func(struct pt_regs *regs) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 236) { \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 237) irqentry_state_t state = irqentry_enter(regs); \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 238) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 239) instrumentation_begin(); \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 240) irq_enter_rcu(); \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 241) kvm_set_cpu_l1tf_flush_l1d(); \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 242) run_sysvec_on_irqstack_cond(__##func, regs); \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 243) irq_exit_rcu(); \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 244) instrumentation_end(); \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 245) irqentry_exit(regs, state); \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 246) } \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 247) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 248) static noinline void __##func(struct pt_regs *regs)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 249)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 250) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 251) * DEFINE_IDTENTRY_SYSVEC_SIMPLE - Emit code for simple system vector IDT
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 252) * entry points
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 253) * @func: Function name of the entry point
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 254) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 255) * Runs the function on the interrupted stack. No switch to IRQ stack and
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 256) * only the minimal __irq_enter/exit() handling.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 257) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 258) * Only use for 'empty' vectors like reschedule IPI and KVM posted
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 259) * interrupt vectors.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 260) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 261) #define DEFINE_IDTENTRY_SYSVEC_SIMPLE(func) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 262) static __always_inline void __##func(struct pt_regs *regs); \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 263) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 264) __visible noinstr void func(struct pt_regs *regs) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 265) { \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 266) irqentry_state_t state = irqentry_enter(regs); \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 267) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 268) instrumentation_begin(); \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 269) __irq_enter_raw(); \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 270) kvm_set_cpu_l1tf_flush_l1d(); \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 271) __##func (regs); \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 272) __irq_exit_raw(); \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 273) instrumentation_end(); \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 274) irqentry_exit(regs, state); \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 275) } \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 276) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 277) static __always_inline void __##func(struct pt_regs *regs)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 278)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 279) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 280) * DECLARE_IDTENTRY_XENCB - Declare functions for XEN HV callback entry point
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 281) * @vector: Vector number (ignored for C)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 282) * @func: Function name of the entry point
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 283) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 284) * Declares three functions:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 285) * - The ASM entry point: asm_##func
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 286) * - The XEN PV trap entry point: xen_##func (maybe unused)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 287) * - The C handler called from the ASM entry point
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 288) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 289) * Maps to DECLARE_IDTENTRY(). Distinct entry point to handle the 32/64-bit
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 290) * difference
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 291) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 292) #define DECLARE_IDTENTRY_XENCB(vector, func) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 293) DECLARE_IDTENTRY(vector, func)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 294)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 295) #ifdef CONFIG_X86_64
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 296) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 297) * DECLARE_IDTENTRY_IST - Declare functions for IST handling IDT entry points
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 298) * @vector: Vector number (ignored for C)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 299) * @func: Function name of the entry point
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 300) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 301) * Maps to DECLARE_IDTENTRY_RAW, but declares also the NOIST C handler
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 302) * which is called from the ASM entry point on user mode entry
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 303) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 304) #define DECLARE_IDTENTRY_IST(vector, func) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 305) DECLARE_IDTENTRY_RAW(vector, func); \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 306) __visible void noist_##func(struct pt_regs *regs)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 307)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 308) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 309) * DECLARE_IDTENTRY_VC - Declare functions for the VC entry point
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 310) * @vector: Vector number (ignored for C)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 311) * @func: Function name of the entry point
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 312) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 313) * Maps to DECLARE_IDTENTRY_RAW_ERRORCODE, but declares also the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 314) * safe_stack C handler.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 315) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 316) #define DECLARE_IDTENTRY_VC(vector, func) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 317) DECLARE_IDTENTRY_RAW_ERRORCODE(vector, func); \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 318) __visible noinstr void kernel_##func(struct pt_regs *regs, unsigned long error_code); \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 319) __visible noinstr void user_##func(struct pt_regs *regs, unsigned long error_code)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 320)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 321) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 322) * DEFINE_IDTENTRY_IST - Emit code for IST entry points
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 323) * @func: Function name of the entry point
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 324) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 325) * Maps to DEFINE_IDTENTRY_RAW
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 326) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 327) #define DEFINE_IDTENTRY_IST(func) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 328) DEFINE_IDTENTRY_RAW(func)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 329)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 330) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 331) * DEFINE_IDTENTRY_NOIST - Emit code for NOIST entry points which
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 332) * belong to a IST entry point (MCE, DB)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 333) * @func: Function name of the entry point. Must be the same as
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 334) * the function name of the corresponding IST variant
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 335) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 336) * Maps to DEFINE_IDTENTRY_RAW().
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 337) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 338) #define DEFINE_IDTENTRY_NOIST(func) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 339) DEFINE_IDTENTRY_RAW(noist_##func)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 340)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 341) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 342) * DECLARE_IDTENTRY_DF - Declare functions for double fault
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 343) * @vector: Vector number (ignored for C)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 344) * @func: Function name of the entry point
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 345) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 346) * Maps to DECLARE_IDTENTRY_RAW_ERRORCODE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 347) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 348) #define DECLARE_IDTENTRY_DF(vector, func) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 349) DECLARE_IDTENTRY_RAW_ERRORCODE(vector, func)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 350)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 351) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 352) * DEFINE_IDTENTRY_DF - Emit code for double fault
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 353) * @func: Function name of the entry point
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 354) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 355) * Maps to DEFINE_IDTENTRY_RAW_ERRORCODE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 356) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 357) #define DEFINE_IDTENTRY_DF(func) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 358) DEFINE_IDTENTRY_RAW_ERRORCODE(func)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 359)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 360) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 361) * DEFINE_IDTENTRY_VC_KERNEL - Emit code for VMM communication handler
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 362) when raised from kernel mode
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 363) * @func: Function name of the entry point
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 364) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 365) * Maps to DEFINE_IDTENTRY_RAW_ERRORCODE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 366) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 367) #define DEFINE_IDTENTRY_VC_KERNEL(func) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 368) DEFINE_IDTENTRY_RAW_ERRORCODE(kernel_##func)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 369)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 370) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 371) * DEFINE_IDTENTRY_VC_USER - Emit code for VMM communication handler
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 372) when raised from user mode
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 373) * @func: Function name of the entry point
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 374) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 375) * Maps to DEFINE_IDTENTRY_RAW_ERRORCODE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 376) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 377) #define DEFINE_IDTENTRY_VC_USER(func) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 378) DEFINE_IDTENTRY_RAW_ERRORCODE(user_##func)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 379)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 380) #else /* CONFIG_X86_64 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 381)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 382) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 383) * DECLARE_IDTENTRY_DF - Declare functions for double fault 32bit variant
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 384) * @vector: Vector number (ignored for C)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 385) * @func: Function name of the entry point
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 386) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 387) * Declares two functions:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 388) * - The ASM entry point: asm_##func
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 389) * - The C handler called from the C shim
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 390) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 391) #define DECLARE_IDTENTRY_DF(vector, func) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 392) asmlinkage void asm_##func(void); \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 393) __visible void func(struct pt_regs *regs, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 394) unsigned long error_code, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 395) unsigned long address)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 396)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 397) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 398) * DEFINE_IDTENTRY_DF - Emit code for double fault on 32bit
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 399) * @func: Function name of the entry point
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 400) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 401) * This is called through the doublefault shim which already provides
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 402) * cr2 in the address argument.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 403) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 404) #define DEFINE_IDTENTRY_DF(func) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 405) __visible noinstr void func(struct pt_regs *regs, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 406) unsigned long error_code, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 407) unsigned long address)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 408)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 409) #endif /* !CONFIG_X86_64 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 410)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 411) /* C-Code mapping */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 412) #define DECLARE_IDTENTRY_NMI DECLARE_IDTENTRY_RAW
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 413) #define DEFINE_IDTENTRY_NMI DEFINE_IDTENTRY_RAW
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 414)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 415) #ifdef CONFIG_X86_64
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 416) #define DECLARE_IDTENTRY_MCE DECLARE_IDTENTRY_IST
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 417) #define DEFINE_IDTENTRY_MCE DEFINE_IDTENTRY_IST
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 418) #define DEFINE_IDTENTRY_MCE_USER DEFINE_IDTENTRY_NOIST
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 419)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 420) #define DECLARE_IDTENTRY_DEBUG DECLARE_IDTENTRY_IST
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 421) #define DEFINE_IDTENTRY_DEBUG DEFINE_IDTENTRY_IST
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 422) #define DEFINE_IDTENTRY_DEBUG_USER DEFINE_IDTENTRY_NOIST
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 423) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 424)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 425) #else /* !__ASSEMBLY__ */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 426)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 427) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 428) * The ASM variants for DECLARE_IDTENTRY*() which emit the ASM entry stubs.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 429) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 430) #define DECLARE_IDTENTRY(vector, func) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 431) idtentry vector asm_##func func has_error_code=0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 432)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 433) #define DECLARE_IDTENTRY_ERRORCODE(vector, func) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 434) idtentry vector asm_##func func has_error_code=1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 435)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 436) /* Special case for 32bit IRET 'trap'. Do not emit ASM code */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 437) #define DECLARE_IDTENTRY_SW(vector, func)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 438)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 439) #define DECLARE_IDTENTRY_RAW(vector, func) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 440) DECLARE_IDTENTRY(vector, func)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 441)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 442) #define DECLARE_IDTENTRY_RAW_ERRORCODE(vector, func) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 443) DECLARE_IDTENTRY_ERRORCODE(vector, func)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 444)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 445) /* Entries for common/spurious (device) interrupts */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 446) #define DECLARE_IDTENTRY_IRQ(vector, func) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 447) idtentry_irq vector func
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 448)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 449) /* System vector entries */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 450) #define DECLARE_IDTENTRY_SYSVEC(vector, func) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 451) idtentry_sysvec vector func
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 452)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 453) #ifdef CONFIG_X86_64
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 454) # define DECLARE_IDTENTRY_MCE(vector, func) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 455) idtentry_mce_db vector asm_##func func
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 456)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 457) # define DECLARE_IDTENTRY_DEBUG(vector, func) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 458) idtentry_mce_db vector asm_##func func
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 459)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 460) # define DECLARE_IDTENTRY_DF(vector, func) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 461) idtentry_df vector asm_##func func
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 462)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 463) # define DECLARE_IDTENTRY_XENCB(vector, func) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 464) DECLARE_IDTENTRY(vector, func)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 465)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 466) # define DECLARE_IDTENTRY_VC(vector, func) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 467) idtentry_vc vector asm_##func func
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 468)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 469) #else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 470) # define DECLARE_IDTENTRY_MCE(vector, func) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 471) DECLARE_IDTENTRY(vector, func)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 472)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 473) /* No ASM emitted for DF as this goes through a C shim */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 474) # define DECLARE_IDTENTRY_DF(vector, func)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 475)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 476) /* No ASM emitted for XEN hypervisor callback */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 477) # define DECLARE_IDTENTRY_XENCB(vector, func)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 478)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 479) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 480)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 481) /* No ASM code emitted for NMI */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 482) #define DECLARE_IDTENTRY_NMI(vector, func)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 483)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 484) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 485) * ASM code to emit the common vector entry stubs where each stub is
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 486) * packed into 8 bytes.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 487) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 488) * Note, that the 'pushq imm8' is emitted via '.byte 0x6a, vector' because
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 489) * GCC treats the local vector variable as unsigned int and would expand
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 490) * all vectors above 0x7F to a 5 byte push. The original code did an
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 491) * adjustment of the vector number to be in the signed byte range to avoid
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 492) * this. While clever it's mindboggling counterintuitive and requires the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 493) * odd conversion back to a real vector number in the C entry points. Using
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 494) * .byte achieves the same thing and the only fixup needed in the C entry
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 495) * point is to mask off the bits above bit 7 because the push is sign
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 496) * extending.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 497) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 498) .align 8
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 499) SYM_CODE_START(irq_entries_start)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 500) vector=FIRST_EXTERNAL_VECTOR
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 501) .rept (FIRST_SYSTEM_VECTOR - FIRST_EXTERNAL_VECTOR)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 502) UNWIND_HINT_IRET_REGS
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 503) 0 :
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 504) .byte 0x6a, vector
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 505) jmp asm_common_interrupt
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 506) nop
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 507) /* Ensure that the above is 8 bytes max */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 508) . = 0b + 8
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 509) vector = vector+1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 510) .endr
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 511) SYM_CODE_END(irq_entries_start)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 512)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 513) #ifdef CONFIG_X86_LOCAL_APIC
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 514) .align 8
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 515) SYM_CODE_START(spurious_entries_start)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 516) vector=FIRST_SYSTEM_VECTOR
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 517) .rept (NR_VECTORS - FIRST_SYSTEM_VECTOR)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 518) UNWIND_HINT_IRET_REGS
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 519) 0 :
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 520) .byte 0x6a, vector
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 521) jmp asm_spurious_interrupt
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 522) nop
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 523) /* Ensure that the above is 8 bytes max */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 524) . = 0b + 8
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 525) vector = vector+1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 526) .endr
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 527) SYM_CODE_END(spurious_entries_start)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 528) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 529)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 530) #endif /* __ASSEMBLY__ */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 531)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 532) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 533) * The actual entry points. Note that DECLARE_IDTENTRY*() serves two
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 534) * purposes:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 535) * - provide the function declarations when included from C-Code
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 536) * - emit the ASM stubs when included from entry_32/64.S
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 537) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 538) * This avoids duplicate defines and ensures that everything is consistent.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 539) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 540)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 541) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 542) * Dummy trap number so the low level ASM macro vector number checks do not
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 543) * match which results in emitting plain IDTENTRY stubs without bells and
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 544) * whistels.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 545) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 546) #define X86_TRAP_OTHER 0xFFFF
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 547)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 548) /* Simple exception entry points. No hardware error code */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 549) DECLARE_IDTENTRY(X86_TRAP_DE, exc_divide_error);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 550) DECLARE_IDTENTRY(X86_TRAP_OF, exc_overflow);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 551) DECLARE_IDTENTRY(X86_TRAP_BR, exc_bounds);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 552) DECLARE_IDTENTRY(X86_TRAP_NM, exc_device_not_available);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 553) DECLARE_IDTENTRY(X86_TRAP_OLD_MF, exc_coproc_segment_overrun);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 554) DECLARE_IDTENTRY(X86_TRAP_SPURIOUS, exc_spurious_interrupt_bug);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 555) DECLARE_IDTENTRY(X86_TRAP_MF, exc_coprocessor_error);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 556) DECLARE_IDTENTRY(X86_TRAP_XF, exc_simd_coprocessor_error);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 557)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 558) /* 32bit software IRET trap. Do not emit ASM code */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 559) DECLARE_IDTENTRY_SW(X86_TRAP_IRET, iret_error);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 560)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 561) /* Simple exception entries with error code pushed by hardware */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 562) DECLARE_IDTENTRY_ERRORCODE(X86_TRAP_TS, exc_invalid_tss);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 563) DECLARE_IDTENTRY_ERRORCODE(X86_TRAP_NP, exc_segment_not_present);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 564) DECLARE_IDTENTRY_ERRORCODE(X86_TRAP_SS, exc_stack_segment);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 565) DECLARE_IDTENTRY_ERRORCODE(X86_TRAP_GP, exc_general_protection);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 566) DECLARE_IDTENTRY_ERRORCODE(X86_TRAP_AC, exc_alignment_check);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 567)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 568) /* Raw exception entries which need extra work */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 569) DECLARE_IDTENTRY_RAW(X86_TRAP_UD, exc_invalid_op);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 570) DECLARE_IDTENTRY_RAW(X86_TRAP_BP, exc_int3);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 571) DECLARE_IDTENTRY_RAW_ERRORCODE(X86_TRAP_PF, exc_page_fault);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 572)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 573) #ifdef CONFIG_X86_MCE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 574) #ifdef CONFIG_X86_64
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 575) DECLARE_IDTENTRY_MCE(X86_TRAP_MC, exc_machine_check);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 576) #else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 577) DECLARE_IDTENTRY_RAW(X86_TRAP_MC, exc_machine_check);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 578) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 579) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 580)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 581) /* NMI */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 582)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 583) #if defined(CONFIG_X86_64) && IS_ENABLED(CONFIG_KVM_INTEL)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 584) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 585) * Special NOIST entry point for VMX which invokes this on the kernel
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 586) * stack. asm_exc_nmi() requires an IST to work correctly vs. the NMI
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 587) * 'executing' marker.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 588) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 589) * On 32bit this just uses the regular NMI entry point because 32-bit does
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 590) * not have ISTs.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 591) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 592) DECLARE_IDTENTRY(X86_TRAP_NMI, exc_nmi_noist);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 593) #else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 594) #define asm_exc_nmi_noist asm_exc_nmi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 595) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 596)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 597) DECLARE_IDTENTRY_NMI(X86_TRAP_NMI, exc_nmi);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 598) #ifdef CONFIG_XEN_PV
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 599) DECLARE_IDTENTRY_RAW(X86_TRAP_NMI, xenpv_exc_nmi);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 600) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 601)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 602) /* #DB */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 603) #ifdef CONFIG_X86_64
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 604) DECLARE_IDTENTRY_DEBUG(X86_TRAP_DB, exc_debug);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 605) #else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 606) DECLARE_IDTENTRY_RAW(X86_TRAP_DB, exc_debug);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 607) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 608) #ifdef CONFIG_XEN_PV
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 609) DECLARE_IDTENTRY_RAW(X86_TRAP_DB, xenpv_exc_debug);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 610) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 611)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 612) /* #DF */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 613) DECLARE_IDTENTRY_DF(X86_TRAP_DF, exc_double_fault);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 614)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 615) /* #VC */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 616) #ifdef CONFIG_AMD_MEM_ENCRYPT
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 617) DECLARE_IDTENTRY_VC(X86_TRAP_VC, exc_vmm_communication);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 618) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 619)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 620) #ifdef CONFIG_XEN_PV
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 621) DECLARE_IDTENTRY_XENCB(X86_TRAP_OTHER, exc_xen_hypervisor_callback);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 622) DECLARE_IDTENTRY_RAW(X86_TRAP_OTHER, exc_xen_unknown_trap);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 623) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 624)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 625) /* Device interrupts common/spurious */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 626) DECLARE_IDTENTRY_IRQ(X86_TRAP_OTHER, common_interrupt);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 627) #ifdef CONFIG_X86_LOCAL_APIC
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 628) DECLARE_IDTENTRY_IRQ(X86_TRAP_OTHER, spurious_interrupt);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 629) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 630)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 631) /* System vector entry points */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 632) #ifdef CONFIG_X86_LOCAL_APIC
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 633) DECLARE_IDTENTRY_SYSVEC(ERROR_APIC_VECTOR, sysvec_error_interrupt);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 634) DECLARE_IDTENTRY_SYSVEC(SPURIOUS_APIC_VECTOR, sysvec_spurious_apic_interrupt);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 635) DECLARE_IDTENTRY_SYSVEC(LOCAL_TIMER_VECTOR, sysvec_apic_timer_interrupt);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 636) DECLARE_IDTENTRY_SYSVEC(X86_PLATFORM_IPI_VECTOR, sysvec_x86_platform_ipi);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 637) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 638)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 639) #ifdef CONFIG_SMP
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 640) DECLARE_IDTENTRY(RESCHEDULE_VECTOR, sysvec_reschedule_ipi);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 641) DECLARE_IDTENTRY_SYSVEC(IRQ_MOVE_CLEANUP_VECTOR, sysvec_irq_move_cleanup);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 642) DECLARE_IDTENTRY_SYSVEC(REBOOT_VECTOR, sysvec_reboot);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 643) DECLARE_IDTENTRY_SYSVEC(CALL_FUNCTION_SINGLE_VECTOR, sysvec_call_function_single);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 644) DECLARE_IDTENTRY_SYSVEC(CALL_FUNCTION_VECTOR, sysvec_call_function);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 645) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 646)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 647) #ifdef CONFIG_X86_LOCAL_APIC
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 648) # ifdef CONFIG_X86_MCE_THRESHOLD
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 649) DECLARE_IDTENTRY_SYSVEC(THRESHOLD_APIC_VECTOR, sysvec_threshold);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 650) # endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 651)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 652) # ifdef CONFIG_X86_MCE_AMD
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 653) DECLARE_IDTENTRY_SYSVEC(DEFERRED_ERROR_VECTOR, sysvec_deferred_error);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 654) # endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 655)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 656) # ifdef CONFIG_X86_THERMAL_VECTOR
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 657) DECLARE_IDTENTRY_SYSVEC(THERMAL_APIC_VECTOR, sysvec_thermal);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 658) # endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 659)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 660) # ifdef CONFIG_IRQ_WORK
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 661) DECLARE_IDTENTRY_SYSVEC(IRQ_WORK_VECTOR, sysvec_irq_work);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 662) # endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 663) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 664)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 665) #ifdef CONFIG_HAVE_KVM
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 666) DECLARE_IDTENTRY_SYSVEC(POSTED_INTR_VECTOR, sysvec_kvm_posted_intr_ipi);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 667) DECLARE_IDTENTRY_SYSVEC(POSTED_INTR_WAKEUP_VECTOR, sysvec_kvm_posted_intr_wakeup_ipi);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 668) DECLARE_IDTENTRY_SYSVEC(POSTED_INTR_NESTED_VECTOR, sysvec_kvm_posted_intr_nested_ipi);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 669) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 670)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 671) #if IS_ENABLED(CONFIG_HYPERV)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 672) DECLARE_IDTENTRY_SYSVEC(HYPERVISOR_CALLBACK_VECTOR, sysvec_hyperv_callback);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 673) DECLARE_IDTENTRY_SYSVEC(HYPERV_REENLIGHTENMENT_VECTOR, sysvec_hyperv_reenlightenment);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 674) DECLARE_IDTENTRY_SYSVEC(HYPERV_STIMER0_VECTOR, sysvec_hyperv_stimer0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 675) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 676)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 677) #if IS_ENABLED(CONFIG_ACRN_GUEST)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 678) DECLARE_IDTENTRY_SYSVEC(HYPERVISOR_CALLBACK_VECTOR, sysvec_acrn_hv_callback);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 679) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 680)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 681) #ifdef CONFIG_XEN_PVHVM
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 682) DECLARE_IDTENTRY_SYSVEC(HYPERVISOR_CALLBACK_VECTOR, sysvec_xen_hvm_callback);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 683) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 684)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 685) #ifdef CONFIG_KVM_GUEST
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 686) DECLARE_IDTENTRY_SYSVEC(HYPERVISOR_CALLBACK_VECTOR, sysvec_kvm_asyncpf_interrupt);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 687) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 688)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 689) #undef X86_TRAP_OTHER
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 690)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 691) #endif