irq_vectors.h 4.6 KB

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