Merge branch 'for-4.14' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/wq
[sfrench/cifs-2.6.git] / arch / x86 / include / asm / hw_irq.h
1 #ifndef _ASM_X86_HW_IRQ_H
2 #define _ASM_X86_HW_IRQ_H
3
4 /*
5  * (C) 1992, 1993 Linus Torvalds, (C) 1997 Ingo Molnar
6  *
7  * moved some of the old arch/i386/kernel/irq.h to here. VY
8  *
9  * IRQ/IPI changes taken from work by Thomas Radke
10  * <tomsoft@informatik.tu-chemnitz.de>
11  *
12  * hacked by Andi Kleen for x86-64.
13  * unified by tglx
14  */
15
16 #include <asm/irq_vectors.h>
17
18 #ifndef __ASSEMBLY__
19
20 #include <linux/percpu.h>
21 #include <linux/profile.h>
22 #include <linux/smp.h>
23
24 #include <linux/atomic.h>
25 #include <asm/irq.h>
26 #include <asm/sections.h>
27
28 /* Interrupt handlers registered during init_IRQ */
29 extern asmlinkage void apic_timer_interrupt(void);
30 extern asmlinkage void x86_platform_ipi(void);
31 extern asmlinkage void kvm_posted_intr_ipi(void);
32 extern asmlinkage void kvm_posted_intr_wakeup_ipi(void);
33 extern asmlinkage void kvm_posted_intr_nested_ipi(void);
34 extern asmlinkage void error_interrupt(void);
35 extern asmlinkage void irq_work_interrupt(void);
36
37 extern asmlinkage void spurious_interrupt(void);
38 extern asmlinkage void thermal_interrupt(void);
39 extern asmlinkage void reschedule_interrupt(void);
40
41 extern asmlinkage void irq_move_cleanup_interrupt(void);
42 extern asmlinkage void reboot_interrupt(void);
43 extern asmlinkage void threshold_interrupt(void);
44 extern asmlinkage void deferred_error_interrupt(void);
45
46 extern asmlinkage void call_function_interrupt(void);
47 extern asmlinkage void call_function_single_interrupt(void);
48
49 #ifdef  CONFIG_X86_LOCAL_APIC
50 struct irq_data;
51 struct pci_dev;
52 struct msi_desc;
53
54 enum irq_alloc_type {
55         X86_IRQ_ALLOC_TYPE_IOAPIC = 1,
56         X86_IRQ_ALLOC_TYPE_HPET,
57         X86_IRQ_ALLOC_TYPE_MSI,
58         X86_IRQ_ALLOC_TYPE_MSIX,
59         X86_IRQ_ALLOC_TYPE_DMAR,
60         X86_IRQ_ALLOC_TYPE_UV,
61 };
62
63 struct irq_alloc_info {
64         enum irq_alloc_type     type;
65         u32                     flags;
66         const struct cpumask    *mask;  /* CPU mask for vector allocation */
67         union {
68                 int             unused;
69 #ifdef  CONFIG_HPET_TIMER
70                 struct {
71                         int             hpet_id;
72                         int             hpet_index;
73                         void            *hpet_data;
74                 };
75 #endif
76 #ifdef  CONFIG_PCI_MSI
77                 struct {
78                         struct pci_dev  *msi_dev;
79                         irq_hw_number_t msi_hwirq;
80                 };
81 #endif
82 #ifdef  CONFIG_X86_IO_APIC
83                 struct {
84                         int             ioapic_id;
85                         int             ioapic_pin;
86                         int             ioapic_node;
87                         u32             ioapic_trigger : 1;
88                         u32             ioapic_polarity : 1;
89                         u32             ioapic_valid : 1;
90                         struct IO_APIC_route_entry *ioapic_entry;
91                 };
92 #endif
93 #ifdef  CONFIG_DMAR_TABLE
94                 struct {
95                         int             dmar_id;
96                         void            *dmar_data;
97                 };
98 #endif
99 #ifdef  CONFIG_HT_IRQ
100                 struct {
101                         int             ht_pos;
102                         int             ht_idx;
103                         struct pci_dev  *ht_dev;
104                         void            *ht_update;
105                 };
106 #endif
107 #ifdef  CONFIG_X86_UV
108                 struct {
109                         int             uv_limit;
110                         int             uv_blade;
111                         unsigned long   uv_offset;
112                         char            *uv_name;
113                 };
114 #endif
115 #if IS_ENABLED(CONFIG_VMD)
116                 struct {
117                         struct msi_desc *desc;
118                 };
119 #endif
120         };
121 };
122
123 struct irq_cfg {
124         unsigned int            dest_apicid;
125         u8                      vector;
126         u8                      old_vector;
127 };
128
129 extern struct irq_cfg *irq_cfg(unsigned int irq);
130 extern struct irq_cfg *irqd_cfg(struct irq_data *irq_data);
131 extern void lock_vector_lock(void);
132 extern void unlock_vector_lock(void);
133 extern void setup_vector_irq(int cpu);
134 #ifdef CONFIG_SMP
135 extern void send_cleanup_vector(struct irq_cfg *);
136 extern void irq_complete_move(struct irq_cfg *cfg);
137 #else
138 static inline void send_cleanup_vector(struct irq_cfg *c) { }
139 static inline void irq_complete_move(struct irq_cfg *c) { }
140 #endif
141
142 extern void apic_ack_edge(struct irq_data *data);
143 #else   /*  CONFIG_X86_LOCAL_APIC */
144 static inline void lock_vector_lock(void) {}
145 static inline void unlock_vector_lock(void) {}
146 #endif  /* CONFIG_X86_LOCAL_APIC */
147
148 /* Statistics */
149 extern atomic_t irq_err_count;
150 extern atomic_t irq_mis_count;
151
152 extern void elcr_set_level_irq(unsigned int irq);
153
154 extern char irq_entries_start[];
155 #ifdef CONFIG_TRACING
156 #define trace_irq_entries_start irq_entries_start
157 #endif
158
159 #define VECTOR_UNUSED           NULL
160 #define VECTOR_RETRIGGERED      ((void *)~0UL)
161
162 typedef struct irq_desc* vector_irq_t[NR_VECTORS];
163 DECLARE_PER_CPU(vector_irq_t, vector_irq);
164
165 #endif /* !ASSEMBLY_ */
166
167 #endif /* _ASM_X86_HW_IRQ_H */