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