irq_vectors.h 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174
  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. #ifdef CONFIG_X86_32
  82. /* 0xf8 : free */
  83. #else
  84. # define UV_BAU_MESSAGE 0xf8
  85. #endif
  86. /* f0-f7 used for spreading out TLB flushes: */
  87. #define INVALIDATE_TLB_VECTOR_END 0xf7
  88. #define INVALIDATE_TLB_VECTOR_START 0xf0
  89. #define NUM_INVALIDATE_TLB_VECTORS 8
  90. /*
  91. * Local APIC timer IRQ vector is on a different priority level,
  92. * to work around the 'lost local interrupt if more than 2 IRQ
  93. * sources per level' errata.
  94. */
  95. #define LOCAL_TIMER_VECTOR 0xef
  96. /*
  97. * Performance monitoring interrupt vector:
  98. */
  99. #define LOCAL_PERF_VECTOR 0xee
  100. /*
  101. * Generic system vector for platform specific use
  102. */
  103. #define GENERIC_INTERRUPT_VECTOR 0xed
  104. /*
  105. * First APIC vector available to drivers: (vectors 0x30-0xee) we
  106. * start at 0x31(0x41) to spread out vectors evenly between priority
  107. * levels. (0x80 is the syscall vector)
  108. */
  109. #define FIRST_DEVICE_VECTOR (IRQ15_VECTOR + 2)
  110. #define NR_VECTORS 256
  111. #define FPU_IRQ 13
  112. #define FIRST_VM86_IRQ 3
  113. #define LAST_VM86_IRQ 15
  114. #ifndef __ASSEMBLY__
  115. static inline int invalid_vm86_irq(int irq)
  116. {
  117. return irq < FIRST_VM86_IRQ || irq > LAST_VM86_IRQ;
  118. }
  119. #endif
  120. /*
  121. * Size the maximum number of interrupts.
  122. *
  123. * If the irq_desc[] array has a sparse layout, we can size things
  124. * generously - it scales up linearly with the maximum number of CPUs,
  125. * and the maximum number of IO-APICs, whichever is higher.
  126. *
  127. * In other cases we size more conservatively, to not create too large
  128. * static arrays.
  129. */
  130. #define NR_IRQS_LEGACY 16
  131. #define CPU_VECTOR_LIMIT ( 8 * NR_CPUS )
  132. #define IO_APIC_VECTOR_LIMIT ( 32 * MAX_IO_APICS )
  133. #ifdef CONFIG_X86_IO_APIC
  134. # ifdef CONFIG_SPARSE_IRQ
  135. # define NR_IRQS \
  136. (CPU_VECTOR_LIMIT > IO_APIC_VECTOR_LIMIT ? \
  137. (NR_VECTORS + CPU_VECTOR_LIMIT) : \
  138. (NR_VECTORS + IO_APIC_VECTOR_LIMIT))
  139. # else
  140. # if NR_CPUS < MAX_IO_APICS
  141. # define NR_IRQS (NR_VECTORS + 4*CPU_VECTOR_LIMIT)
  142. # else
  143. # define NR_IRQS (NR_VECTORS + IO_APIC_VECTOR_LIMIT)
  144. # endif
  145. # endif
  146. #else /* !CONFIG_X86_IO_APIC: */
  147. # define NR_IRQS NR_IRQS_LEGACY
  148. #endif
  149. #endif /* _ASM_X86_IRQ_VECTORS_H */