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