irq_vectors.h 4.8 KB

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