xref: /linux/arch/x86/include/asm/hw_irq.h (revision da5b2ad1c2f18834cb1ce429e2e5a5cf5cbdf21b)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef _ASM_X86_HW_IRQ_H
3 #define _ASM_X86_HW_IRQ_H
4 
5 /*
6  * (C) 1992, 1993 Linus Torvalds, (C) 1997 Ingo Molnar
7  *
8  * moved some of the old arch/i386/kernel/irq.h to here. VY
9  *
10  * IRQ/IPI changes taken from work by Thomas Radke
11  * <tomsoft@informatik.tu-chemnitz.de>
12  *
13  * hacked by Andi Kleen for x86-64.
14  * unified by tglx
15  */
16 
17 #include <asm/irq_vectors.h>
18 
19 #ifndef __ASSEMBLY__
20 
21 #include <linux/percpu.h>
22 #include <linux/profile.h>
23 #include <linux/smp.h>
24 
25 #include <linux/atomic.h>
26 #include <asm/irq.h>
27 #include <asm/sections.h>
28 
29 #ifdef	CONFIG_IRQ_DOMAIN_HIERARCHY
30 struct irq_data;
31 struct pci_dev;
32 struct msi_desc;
33 
34 enum irq_alloc_type {
35 	X86_IRQ_ALLOC_TYPE_IOAPIC = 1,
36 	X86_IRQ_ALLOC_TYPE_HPET,
37 	X86_IRQ_ALLOC_TYPE_PCI_MSI,
38 	X86_IRQ_ALLOC_TYPE_PCI_MSIX,
39 	X86_IRQ_ALLOC_TYPE_DMAR,
40 	X86_IRQ_ALLOC_TYPE_AMDVI,
41 	X86_IRQ_ALLOC_TYPE_UV,
42 };
43 
44 struct ioapic_alloc_info {
45 	int		pin;
46 	int		node;
47 	u32		is_level	: 1;
48 	u32		active_low	: 1;
49 	u32		valid		: 1;
50 };
51 
52 struct uv_alloc_info {
53 	int		limit;
54 	int		blade;
55 	unsigned long	offset;
56 	char		*name;
57 
58 };
59 
60 /**
61  * irq_alloc_info - X86 specific interrupt allocation info
62  * @type:	X86 specific allocation type
63  * @flags:	Flags for allocation tweaks
64  * @devid:	Device ID for allocations
65  * @hwirq:	Associated hw interrupt number in the domain
66  * @mask:	CPU mask for vector allocation
67  * @desc:	Pointer to msi descriptor
68  * @data:	Allocation specific data
69  *
70  * @ioapic:	IOAPIC specific allocation data
71  * @uv:		UV specific allocation data
72 */
73 struct irq_alloc_info {
74 	enum irq_alloc_type	type;
75 	u32			flags;
76 	u32			devid;
77 	irq_hw_number_t		hwirq;
78 	const struct cpumask	*mask;
79 	struct msi_desc		*desc;
80 	void			*data;
81 
82 	union {
83 		struct ioapic_alloc_info	ioapic;
84 		struct uv_alloc_info		uv;
85 	};
86 };
87 
88 struct irq_cfg {
89 	unsigned int		dest_apicid;
90 	unsigned int		vector;
91 };
92 
93 extern struct irq_cfg *irq_cfg(unsigned int irq);
94 extern struct irq_cfg *irqd_cfg(struct irq_data *irq_data);
95 extern void lock_vector_lock(void);
96 extern void unlock_vector_lock(void);
97 #ifdef CONFIG_SMP
98 extern void vector_schedule_cleanup(struct irq_cfg *);
99 extern void irq_complete_move(struct irq_cfg *cfg);
100 #else
101 static inline void vector_schedule_cleanup(struct irq_cfg *c) { }
102 static inline void irq_complete_move(struct irq_cfg *c) { }
103 #endif
104 
105 extern void apic_ack_edge(struct irq_data *data);
106 #else	/*  CONFIG_IRQ_DOMAIN_HIERARCHY */
107 static inline void lock_vector_lock(void) {}
108 static inline void unlock_vector_lock(void) {}
109 #endif	/* CONFIG_IRQ_DOMAIN_HIERARCHY */
110 
111 /* Statistics */
112 extern atomic_t irq_err_count;
113 extern atomic_t irq_mis_count;
114 
115 extern void elcr_set_level_irq(unsigned int irq);
116 
117 extern char irq_entries_start[];
118 #ifdef CONFIG_TRACING
119 #define trace_irq_entries_start irq_entries_start
120 #endif
121 
122 extern char spurious_entries_start[];
123 
124 #define VECTOR_UNUSED		NULL
125 #define VECTOR_SHUTDOWN		((void *)-1L)
126 #define VECTOR_RETRIGGERED	((void *)-2L)
127 
128 typedef struct irq_desc* vector_irq_t[NR_VECTORS];
129 DECLARE_PER_CPU(vector_irq_t, vector_irq);
130 
131 #endif /* !ASSEMBLY_ */
132 
133 #endif /* _ASM_X86_HW_IRQ_H */
134