xref: /openbmc/linux/arch/x86/include/asm/irq_vectors.h (revision 9fc2e79d)
11965aae3SH. Peter Anvin #ifndef _ASM_X86_IRQ_VECTORS_H
21965aae3SH. Peter Anvin #define _ASM_X86_IRQ_VECTORS_H
3bb898558SAl Viro 
4bb898558SAl Viro #include <linux/threads.h>
5bb898558SAl Viro 
69fc2e79dSIngo Molnar /*
79fc2e79dSIngo Molnar  * Linux IRQ vector layout.
89fc2e79dSIngo Molnar  *
99fc2e79dSIngo Molnar  * There are 256 IDT entries (per CPU - each entry is 8 bytes) which can
109fc2e79dSIngo Molnar  * be defined by Linux. They are used as a jump table by the CPU when a
119fc2e79dSIngo Molnar  * given vector is triggered - by a CPU-external, CPU-internal or
129fc2e79dSIngo Molnar  * software-triggered event.
139fc2e79dSIngo Molnar  *
149fc2e79dSIngo Molnar  * Linux sets the kernel code address each entry jumps to early during
159fc2e79dSIngo Molnar  * bootup, and never changes them. This is the general layout of the
169fc2e79dSIngo Molnar  * IDT entries:
179fc2e79dSIngo Molnar  *
189fc2e79dSIngo Molnar  *  Vectors   0 ...  31 : system traps and exceptions - hardcoded events
199fc2e79dSIngo Molnar  *  Vectors  32 ... 127 : device interrupts
209fc2e79dSIngo Molnar  *  Vector  128         : legacy int80 syscall interface
219fc2e79dSIngo Molnar  *  Vectors 129 ... 237 : device interrupts
229fc2e79dSIngo Molnar  *  Vectors 238 ... 255 : special interrupts
239fc2e79dSIngo Molnar  *
249fc2e79dSIngo Molnar  * 64-bit x86 has per CPU IDT tables, 32-bit has one shared IDT table.
259fc2e79dSIngo Molnar  *
269fc2e79dSIngo Molnar  * This file enumerates the exact layout of them:
279fc2e79dSIngo Molnar  */
289fc2e79dSIngo Molnar 
29bb898558SAl Viro #define NMI_VECTOR			0x02
30bb898558SAl Viro 
31bb898558SAl Viro /*
32bb898558SAl Viro  * IDT vectors usable for external interrupt sources start
33bb898558SAl Viro  * at 0x20:
34bb898558SAl Viro  */
35bb898558SAl Viro #define FIRST_EXTERNAL_VECTOR		0x20
36bb898558SAl Viro 
37bb898558SAl Viro #ifdef CONFIG_X86_32
38bb898558SAl Viro # define SYSCALL_VECTOR			0x80
39bb898558SAl Viro #else
40bb898558SAl Viro # define IA32_SYSCALL_VECTOR		0x80
41bb898558SAl Viro #endif
42bb898558SAl Viro 
43bb898558SAl Viro /*
44bb898558SAl Viro  * Reserve the lowest usable priority level 0x20 - 0x2f for triggering
45bb898558SAl Viro  * cleanup after irq migration.
46bb898558SAl Viro  */
47bb898558SAl Viro #define IRQ_MOVE_CLEANUP_VECTOR		FIRST_EXTERNAL_VECTOR
48bb898558SAl Viro 
49bb898558SAl Viro /*
50bb898558SAl Viro  * Vectors 0x30-0x3f are used for ISA interrupts.
51bb898558SAl Viro  */
52bb898558SAl Viro #define IRQ0_VECTOR			(FIRST_EXTERNAL_VECTOR + 0x10)
539fc2e79dSIngo Molnar 
54bb898558SAl Viro #define IRQ1_VECTOR			(IRQ0_VECTOR +  1)
55bb898558SAl Viro #define IRQ2_VECTOR			(IRQ0_VECTOR +  2)
56bb898558SAl Viro #define IRQ3_VECTOR			(IRQ0_VECTOR +  3)
57bb898558SAl Viro #define IRQ4_VECTOR			(IRQ0_VECTOR +  4)
58bb898558SAl Viro #define IRQ5_VECTOR			(IRQ0_VECTOR +  5)
59bb898558SAl Viro #define IRQ6_VECTOR			(IRQ0_VECTOR +  6)
60bb898558SAl Viro #define IRQ7_VECTOR			(IRQ0_VECTOR +  7)
61bb898558SAl Viro #define IRQ8_VECTOR			(IRQ0_VECTOR +  8)
62bb898558SAl Viro #define IRQ9_VECTOR			(IRQ0_VECTOR +  9)
63bb898558SAl Viro #define IRQ10_VECTOR			(IRQ0_VECTOR + 10)
64bb898558SAl Viro #define IRQ11_VECTOR			(IRQ0_VECTOR + 11)
65bb898558SAl Viro #define IRQ12_VECTOR			(IRQ0_VECTOR + 12)
66bb898558SAl Viro #define IRQ13_VECTOR			(IRQ0_VECTOR + 13)
67bb898558SAl Viro #define IRQ14_VECTOR			(IRQ0_VECTOR + 14)
68bb898558SAl Viro #define IRQ15_VECTOR			(IRQ0_VECTOR + 15)
69bb898558SAl Viro 
70bb898558SAl Viro /*
71bb898558SAl Viro  * Special IRQ vectors used by the SMP architecture, 0xf0-0xff
72bb898558SAl Viro  *
73bb898558SAl Viro  *  some of the following vectors are 'rare', they are merged
74bb898558SAl Viro  *  into a single vector (CALL_FUNCTION_VECTOR) to save vector space.
75bb898558SAl Viro  *  TLB, reschedule and local APIC vectors are performance-critical.
76bb898558SAl Viro  */
775da690d2SIngo Molnar 
785da690d2SIngo Molnar #define SPURIOUS_APIC_VECTOR		0xff
79647ad94fSIngo Molnar /*
80647ad94fSIngo Molnar  * Sanity check
81647ad94fSIngo Molnar  */
82647ad94fSIngo Molnar #if ((SPURIOUS_APIC_VECTOR & 0x0F) != 0x0F)
83647ad94fSIngo Molnar # error SPURIOUS_APIC_VECTOR definition error
84647ad94fSIngo Molnar #endif
85647ad94fSIngo Molnar 
865da690d2SIngo Molnar #define ERROR_APIC_VECTOR		0xfe
875da690d2SIngo Molnar #define RESCHEDULE_VECTOR		0xfd
885da690d2SIngo Molnar #define CALL_FUNCTION_VECTOR		0xfc
895da690d2SIngo Molnar #define CALL_FUNCTION_SINGLE_VECTOR	0xfb
905da690d2SIngo Molnar #define THERMAL_APIC_VECTOR		0xfa
915da690d2SIngo Molnar 
92bb898558SAl Viro #ifdef CONFIG_X86_32
9302cf94c3STejun Heo /* 0xf8 - 0xf9 : free */
94bb898558SAl Viro #else
95bb898558SAl Viro # define THRESHOLD_APIC_VECTOR		0xf9
96bb898558SAl Viro # define UV_BAU_MESSAGE			0xf8
97bb898558SAl Viro #endif
98bb898558SAl Viro 
995da690d2SIngo Molnar /* f0-f7 used for spreading out TLB flushes: */
1005da690d2SIngo Molnar #define INVALIDATE_TLB_VECTOR_END	0xf7
1015da690d2SIngo Molnar #define INVALIDATE_TLB_VECTOR_START	0xf0
1025da690d2SIngo Molnar #define NUM_INVALIDATE_TLB_VECTORS	   8
1035da690d2SIngo Molnar 
104bb898558SAl Viro /*
105bb898558SAl Viro  * Local APIC timer IRQ vector is on a different priority level,
106bb898558SAl Viro  * to work around the 'lost local interrupt if more than 2 IRQ
107bb898558SAl Viro  * sources per level' errata.
108bb898558SAl Viro  */
109bb898558SAl Viro #define LOCAL_TIMER_VECTOR		0xef
110bb898558SAl Viro 
111bb898558SAl Viro /*
112193c81b9SIngo Molnar  * Performance monitoring interrupt vector:
113193c81b9SIngo Molnar  */
114193c81b9SIngo Molnar #define LOCAL_PERF_VECTOR		0xee
115193c81b9SIngo Molnar 
116193c81b9SIngo Molnar /*
117bb898558SAl Viro  * First APIC vector available to drivers: (vectors 0x30-0xee) we
118bb898558SAl Viro  * start at 0x31(0x41) to spread out vectors evenly between priority
119bb898558SAl Viro  * levels. (0x80 is the syscall vector)
120bb898558SAl Viro  */
121bb898558SAl Viro #define FIRST_DEVICE_VECTOR		(IRQ15_VECTOR + 2)
122bb898558SAl Viro 
123bb898558SAl Viro #define NR_VECTORS			 256
124bb898558SAl Viro 
125bb898558SAl Viro #define FPU_IRQ				  13
126bb898558SAl Viro 
127bb898558SAl Viro #define	FIRST_VM86_IRQ			   3
128bb898558SAl Viro #define LAST_VM86_IRQ			  15
129bb898558SAl Viro #define invalid_vm86_irq(irq)		((irq) < 3 || (irq) > 15)
130bb898558SAl Viro 
13199d093d1SYinghai Lu #define NR_IRQS_LEGACY			  16
13299d093d1SYinghai Lu 
1333e92ab3dSIngo Molnar #ifdef CONFIG_X86_IO_APIC
1340b8f1efaSYinghai Lu 
1359332fccdSMike Travis #include <asm/apicnum.h>	/* need MAX_IO_APICS */
1369332fccdSMike Travis 
1370b8f1efaSYinghai Lu #ifndef CONFIG_SPARSE_IRQ
138bb898558SAl Viro # if NR_CPUS < MAX_IO_APICS
139bb898558SAl Viro #  define NR_IRQS 			(NR_VECTORS + (32 * NR_CPUS))
140bb898558SAl Viro # else
141bb898558SAl Viro #  define NR_IRQS			(NR_VECTORS + (32 * MAX_IO_APICS))
142bb898558SAl Viro # endif
1430b8f1efaSYinghai Lu #else
1444a046d17SYinghai Lu # define NR_IRQS					\
1454a046d17SYinghai Lu 	((8 * NR_CPUS) > (32 * MAX_IO_APICS) ?		\
1469332fccdSMike Travis 		(NR_VECTORS + (8 * NR_CPUS)) :		\
1473e92ab3dSIngo Molnar 		(NR_VECTORS + (32 * MAX_IO_APICS)))
1480b8f1efaSYinghai Lu #endif
149bb898558SAl Viro 
1503e92ab3dSIngo Molnar #else /* !CONFIG_X86_IO_APIC: */
151bb898558SAl Viro # define NR_IRQS			16
152bb898558SAl Viro #endif
153bb898558SAl Viro 
1541965aae3SH. Peter Anvin #endif /* _ASM_X86_IRQ_VECTORS_H */
155