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