irq_vectors.h 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176
  1. #ifndef _ASM_X86_IRQ_VECTORS_H
  2. #define _ASM_X86_IRQ_VECTORS_H
  3. /*
  4. * Linux IRQ vector layout.
  5. *
  6. * There are 256 IDT entries (per CPU - each entry is 8 bytes) which can
  7. * be defined by Linux. They are used as a jump table by the CPU when a
  8. * given vector is triggered - by a CPU-external, CPU-internal or
  9. * software-triggered event.
  10. *
  11. * Linux sets the kernel code address each entry jumps to early during
  12. * bootup, and never changes them. This is the general layout of the
  13. * IDT entries:
  14. *
  15. * Vectors 0 ... 31 : system traps and exceptions - hardcoded events
  16. * Vectors 32 ... 127 : device interrupts
  17. * Vector 128 : legacy int80 syscall interface
  18. * Vectors 129 ... 237 : device interrupts
  19. * Vectors 238 ... 255 : special interrupts
  20. *
  21. * 64-bit x86 has per CPU IDT tables, 32-bit has one shared IDT table.
  22. *
  23. * This file enumerates the exact layout of them:
  24. */
  25. #define NMI_VECTOR 0x02
  26. /*
  27. * IDT vectors usable for external interrupt sources start
  28. * at 0x20:
  29. */
  30. #define FIRST_EXTERNAL_VECTOR 0x20
  31. #ifdef CONFIG_X86_32
  32. # define SYSCALL_VECTOR 0x80
  33. # define IA32_SYSCALL_VECTOR 0x80
  34. #else
  35. # define IA32_SYSCALL_VECTOR 0x80
  36. #endif
  37. /*
  38. * Reserve the lowest usable priority level 0x20 - 0x2f for triggering
  39. * cleanup after irq migration.
  40. */
  41. #define IRQ_MOVE_CLEANUP_VECTOR FIRST_EXTERNAL_VECTOR
  42. /*
  43. * Vectors 0x30-0x3f are used for ISA interrupts.
  44. */
  45. #define IRQ0_VECTOR (FIRST_EXTERNAL_VECTOR + 0x10)
  46. #define IRQ1_VECTOR (IRQ0_VECTOR + 1)
  47. #define IRQ2_VECTOR (IRQ0_VECTOR + 2)
  48. #define IRQ3_VECTOR (IRQ0_VECTOR + 3)
  49. #define IRQ4_VECTOR (IRQ0_VECTOR + 4)
  50. #define IRQ5_VECTOR (IRQ0_VECTOR + 5)
  51. #define IRQ6_VECTOR (IRQ0_VECTOR + 6)
  52. #define IRQ7_VECTOR (IRQ0_VECTOR + 7)
  53. #define IRQ8_VECTOR (IRQ0_VECTOR + 8)
  54. #define IRQ9_VECTOR (IRQ0_VECTOR + 9)
  55. #define IRQ10_VECTOR (IRQ0_VECTOR + 10)
  56. #define IRQ11_VECTOR (IRQ0_VECTOR + 11)
  57. #define IRQ12_VECTOR (IRQ0_VECTOR + 12)
  58. #define IRQ13_VECTOR (IRQ0_VECTOR + 13)
  59. #define IRQ14_VECTOR (IRQ0_VECTOR + 14)
  60. #define IRQ15_VECTOR (IRQ0_VECTOR + 15)
  61. /*
  62. * Special IRQ vectors used by the SMP architecture, 0xf0-0xff
  63. *
  64. * some of the following vectors are 'rare', they are merged
  65. * into a single vector (CALL_FUNCTION_VECTOR) to save vector space.
  66. * TLB, reschedule and local APIC vectors are performance-critical.
  67. */
  68. #define SPURIOUS_APIC_VECTOR 0xff
  69. /*
  70. * Sanity check
  71. */
  72. #if ((SPURIOUS_APIC_VECTOR & 0x0F) != 0x0F)
  73. # error SPURIOUS_APIC_VECTOR definition error
  74. #endif
  75. #define ERROR_APIC_VECTOR 0xfe
  76. #define RESCHEDULE_VECTOR 0xfd
  77. #define CALL_FUNCTION_VECTOR 0xfc
  78. #define CALL_FUNCTION_SINGLE_VECTOR 0xfb
  79. #define THERMAL_APIC_VECTOR 0xfa
  80. #define THRESHOLD_APIC_VECTOR 0xf9
  81. #define REBOOT_VECTOR 0xf8
  82. /* f0-f7 used for spreading out TLB flushes: */
  83. #define INVALIDATE_TLB_VECTOR_END 0xf7
  84. #define INVALIDATE_TLB_VECTOR_START 0xf0
  85. #define NUM_INVALIDATE_TLB_VECTORS 8
  86. /*
  87. * Local APIC timer IRQ vector is on a different priority level,
  88. * to work around the 'lost local interrupt if more than 2 IRQ
  89. * sources per level' errata.
  90. */
  91. #define LOCAL_TIMER_VECTOR 0xef
  92. /*
  93. * Performance monitoring interrupt vector:
  94. */
  95. #define LOCAL_PERF_VECTOR 0xee
  96. /*
  97. * Generic system vector for platform specific use
  98. */
  99. #define GENERIC_INTERRUPT_VECTOR 0xed
  100. #define UV_BAU_MESSAGE 0xec
  101. /*
  102. * Self IPI vector for machine checks
  103. */
  104. #define MCE_SELF_VECTOR 0xeb
  105. /*
  106. * First APIC vector available to drivers: (vectors 0x30-0xee) we
  107. * start at 0x31(0x41) to spread out vectors evenly between priority
  108. * levels. (0x80 is the syscall vector)
  109. */
  110. #define FIRST_DEVICE_VECTOR (IRQ15_VECTOR + 2)
  111. #define NR_VECTORS 256
  112. #define FPU_IRQ 13
  113. #define FIRST_VM86_IRQ 3
  114. #define LAST_VM86_IRQ 15
  115. #ifndef __ASSEMBLY__
  116. static inline int invalid_vm86_irq(int irq)
  117. {
  118. return irq < FIRST_VM86_IRQ || irq > LAST_VM86_IRQ;
  119. }
  120. #endif
  121. /*
  122. * Size the maximum number of interrupts.
  123. *
  124. * If the irq_desc[] array has a sparse layout, we can size things
  125. * generously - it scales up linearly with the maximum number of CPUs,
  126. * and the maximum number of IO-APICs, whichever is higher.
  127. *
  128. * In other cases we size more conservatively, to not create too large
  129. * static arrays.
  130. */
  131. #define NR_IRQS_LEGACY 16
  132. #define CPU_VECTOR_LIMIT ( 8 * NR_CPUS )
  133. #define IO_APIC_VECTOR_LIMIT ( 32 * MAX_IO_APICS )
  134. #ifdef CONFIG_X86_IO_APIC
  135. # ifdef CONFIG_SPARSE_IRQ
  136. # define NR_IRQS \
  137. (CPU_VECTOR_LIMIT > IO_APIC_VECTOR_LIMIT ? \
  138. (NR_VECTORS + CPU_VECTOR_LIMIT) : \
  139. (NR_VECTORS + IO_APIC_VECTOR_LIMIT))
  140. # else
  141. # if NR_CPUS < MAX_IO_APICS
  142. # define NR_IRQS (NR_VECTORS + 4*CPU_VECTOR_LIMIT)
  143. # else
  144. # define NR_IRQS (NR_VECTORS + IO_APIC_VECTOR_LIMIT)
  145. # endif
  146. # endif
  147. #else /* !CONFIG_X86_IO_APIC: */
  148. # define NR_IRQS NR_IRQS_LEGACY
  149. #endif
  150. #endif /* _ASM_X86_IRQ_VECTORS_H */