H. Peter Anvin | 1965aae | 2008-10-22 22:26:29 -0700 | [diff] [blame] | 1 | #ifndef _ASM_X86_HW_IRQ_H |
| 2 | #define _ASM_X86_HW_IRQ_H |
Thomas Gleixner | 2e08843 | 2008-05-02 19:00:30 +0200 | [diff] [blame] | 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 | |
Thomas Gleixner | 9b7dc56 | 2008-05-02 20:10:09 +0200 | [diff] [blame] | 16 | #include <asm/irq_vectors.h> |
Thomas Gleixner | 2e08843 | 2008-05-02 19:00:30 +0200 | [diff] [blame] | 17 | |
| 18 | #ifndef __ASSEMBLY__ |
| 19 | |
| 20 | #include <linux/percpu.h> |
| 21 | #include <linux/profile.h> |
| 22 | #include <linux/smp.h> |
| 23 | |
Arun Sharma | 60063497 | 2011-07-26 16:09:06 -0700 | [diff] [blame] | 24 | #include <linux/atomic.h> |
Thomas Gleixner | 2e08843 | 2008-05-02 19:00:30 +0200 | [diff] [blame] | 25 | #include <asm/irq.h> |
| 26 | #include <asm/sections.h> |
| 27 | |
Thomas Gleixner | 2e08843 | 2008-05-02 19:00:30 +0200 | [diff] [blame] | 28 | /* Interrupt handlers registered during init_IRQ */ |
Andi Kleen | 1d9090e | 2013-08-05 15:02:37 -0700 | [diff] [blame] | 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 error_interrupt(void); |
| 33 | extern asmlinkage void irq_work_interrupt(void); |
Ingo Molnar | 241771e | 2008-12-03 10:39:53 +0100 | [diff] [blame] | 34 | |
Andi Kleen | 1d9090e | 2013-08-05 15:02:37 -0700 | [diff] [blame] | 35 | extern asmlinkage void spurious_interrupt(void); |
| 36 | extern asmlinkage void thermal_interrupt(void); |
| 37 | extern asmlinkage void reschedule_interrupt(void); |
Thomas Gleixner | 2e08843 | 2008-05-02 19:00:30 +0200 | [diff] [blame] | 38 | |
Andi Kleen | 1d9090e | 2013-08-05 15:02:37 -0700 | [diff] [blame] | 39 | extern asmlinkage void invalidate_interrupt(void); |
| 40 | extern asmlinkage void invalidate_interrupt0(void); |
| 41 | extern asmlinkage void invalidate_interrupt1(void); |
| 42 | extern asmlinkage void invalidate_interrupt2(void); |
| 43 | extern asmlinkage void invalidate_interrupt3(void); |
| 44 | extern asmlinkage void invalidate_interrupt4(void); |
| 45 | extern asmlinkage void invalidate_interrupt5(void); |
| 46 | extern asmlinkage void invalidate_interrupt6(void); |
| 47 | extern asmlinkage void invalidate_interrupt7(void); |
| 48 | extern asmlinkage void invalidate_interrupt8(void); |
| 49 | extern asmlinkage void invalidate_interrupt9(void); |
| 50 | extern asmlinkage void invalidate_interrupt10(void); |
| 51 | extern asmlinkage void invalidate_interrupt11(void); |
| 52 | extern asmlinkage void invalidate_interrupt12(void); |
| 53 | extern asmlinkage void invalidate_interrupt13(void); |
| 54 | extern asmlinkage void invalidate_interrupt14(void); |
| 55 | extern asmlinkage void invalidate_interrupt15(void); |
| 56 | extern asmlinkage void invalidate_interrupt16(void); |
| 57 | extern asmlinkage void invalidate_interrupt17(void); |
| 58 | extern asmlinkage void invalidate_interrupt18(void); |
| 59 | extern asmlinkage void invalidate_interrupt19(void); |
| 60 | extern asmlinkage void invalidate_interrupt20(void); |
| 61 | extern asmlinkage void invalidate_interrupt21(void); |
| 62 | extern asmlinkage void invalidate_interrupt22(void); |
| 63 | extern asmlinkage void invalidate_interrupt23(void); |
| 64 | extern asmlinkage void invalidate_interrupt24(void); |
| 65 | extern asmlinkage void invalidate_interrupt25(void); |
| 66 | extern asmlinkage void invalidate_interrupt26(void); |
| 67 | extern asmlinkage void invalidate_interrupt27(void); |
| 68 | extern asmlinkage void invalidate_interrupt28(void); |
| 69 | extern asmlinkage void invalidate_interrupt29(void); |
| 70 | extern asmlinkage void invalidate_interrupt30(void); |
| 71 | extern asmlinkage void invalidate_interrupt31(void); |
Thomas Gleixner | 2e08843 | 2008-05-02 19:00:30 +0200 | [diff] [blame] | 72 | |
Andi Kleen | 1d9090e | 2013-08-05 15:02:37 -0700 | [diff] [blame] | 73 | extern asmlinkage void irq_move_cleanup_interrupt(void); |
| 74 | extern asmlinkage void reboot_interrupt(void); |
| 75 | extern asmlinkage void threshold_interrupt(void); |
Thomas Gleixner | 2e08843 | 2008-05-02 19:00:30 +0200 | [diff] [blame] | 76 | |
Andi Kleen | 1d9090e | 2013-08-05 15:02:37 -0700 | [diff] [blame] | 77 | extern asmlinkage void call_function_interrupt(void); |
| 78 | extern asmlinkage void call_function_single_interrupt(void); |
Thomas Gleixner | 2e08843 | 2008-05-02 19:00:30 +0200 | [diff] [blame] | 79 | |
Seiji Aguchi | cf910e8 | 2013-06-20 11:46:53 -0400 | [diff] [blame] | 80 | #ifdef CONFIG_TRACING |
| 81 | /* Interrupt handlers registered during init_IRQ */ |
| 82 | extern void trace_apic_timer_interrupt(void); |
| 83 | extern void trace_x86_platform_ipi(void); |
| 84 | extern void trace_error_interrupt(void); |
| 85 | extern void trace_irq_work_interrupt(void); |
| 86 | extern void trace_spurious_interrupt(void); |
| 87 | extern void trace_thermal_interrupt(void); |
| 88 | extern void trace_reschedule_interrupt(void); |
| 89 | extern void trace_threshold_interrupt(void); |
| 90 | extern void trace_call_function_interrupt(void); |
| 91 | extern void trace_call_function_single_interrupt(void); |
| 92 | #define trace_irq_move_cleanup_interrupt irq_move_cleanup_interrupt |
| 93 | #define trace_reboot_interrupt reboot_interrupt |
| 94 | #define trace_kvm_posted_intr_ipi kvm_posted_intr_ipi |
| 95 | #endif /* CONFIG_TRACING */ |
| 96 | |
Jiang Liu | 26011ee | 2014-10-27 16:11:56 +0800 | [diff] [blame] | 97 | #ifdef CONFIG_IRQ_REMAP |
| 98 | /* Intel specific interrupt remapping information */ |
| 99 | struct irq_2_iommu { |
| 100 | struct intel_iommu *iommu; |
| 101 | u16 irte_index; |
| 102 | u16 sub_handle; |
| 103 | u8 irte_mask; |
| 104 | }; |
| 105 | |
| 106 | /* AMD specific interrupt remapping information */ |
| 107 | struct irq_2_irte { |
| 108 | u16 devid; /* Device ID for IRTE table */ |
| 109 | u16 index; /* Index into IRTE table*/ |
| 110 | }; |
| 111 | #endif /* CONFIG_IRQ_REMAP */ |
| 112 | |
Jiang Liu | 52f518a | 2015-04-13 14:11:35 +0800 | [diff] [blame] | 113 | struct irq_domain; |
| 114 | |
Jiang Liu | 26011ee | 2014-10-27 16:11:56 +0800 | [diff] [blame] | 115 | #ifdef CONFIG_X86_LOCAL_APIC |
Jiang Liu | 74afab7 | 2014-10-27 16:12:00 +0800 | [diff] [blame] | 116 | struct irq_data; |
Jiang Liu | 947045a | 2015-04-13 14:11:30 +0800 | [diff] [blame] | 117 | struct pci_dev; |
| 118 | struct msi_desc; |
| 119 | |
| 120 | enum irq_alloc_type { |
| 121 | X86_IRQ_ALLOC_TYPE_IOAPIC = 1, |
| 122 | X86_IRQ_ALLOC_TYPE_HPET, |
| 123 | X86_IRQ_ALLOC_TYPE_MSI, |
| 124 | X86_IRQ_ALLOC_TYPE_MSIX, |
Jiang Liu | 0921f1d | 2015-04-13 14:11:42 +0800 | [diff] [blame] | 125 | X86_IRQ_ALLOC_TYPE_DMAR, |
Jiang Liu | 947045a | 2015-04-13 14:11:30 +0800 | [diff] [blame] | 126 | }; |
Jiang Liu | b5dc8e6 | 2015-04-13 14:11:24 +0800 | [diff] [blame] | 127 | |
| 128 | struct irq_alloc_info { |
Jiang Liu | 947045a | 2015-04-13 14:11:30 +0800 | [diff] [blame] | 129 | enum irq_alloc_type type; |
Jiang Liu | b5dc8e6 | 2015-04-13 14:11:24 +0800 | [diff] [blame] | 130 | u32 flags; |
| 131 | const struct cpumask *mask; /* CPU mask for vector allocation */ |
Jiang Liu | 947045a | 2015-04-13 14:11:30 +0800 | [diff] [blame] | 132 | union { |
| 133 | int unused; |
| 134 | #ifdef CONFIG_HPET_TIMER |
| 135 | struct { |
| 136 | int hpet_id; |
| 137 | int hpet_index; |
| 138 | void *hpet_data; |
| 139 | }; |
| 140 | #endif |
| 141 | #ifdef CONFIG_PCI_MSI |
| 142 | struct { |
| 143 | struct pci_dev *msi_dev; |
| 144 | irq_hw_number_t msi_hwirq; |
| 145 | }; |
| 146 | #endif |
| 147 | #ifdef CONFIG_X86_IO_APIC |
| 148 | struct { |
| 149 | int ioapic_id; |
| 150 | int ioapic_pin; |
| 151 | int ioapic_node; |
| 152 | u32 ioapic_trigger : 1; |
| 153 | u32 ioapic_polarity : 1; |
| 154 | u32 ioapic_valid : 1; |
| 155 | struct IO_APIC_route_entry *ioapic_entry; |
| 156 | }; |
| 157 | #endif |
Jiang Liu | 0921f1d | 2015-04-13 14:11:42 +0800 | [diff] [blame] | 158 | #ifdef CONFIG_DMAR_TABLE |
| 159 | struct { |
| 160 | int dmar_id; |
| 161 | void *dmar_data; |
| 162 | }; |
| 163 | #endif |
Jiang Liu | 49e07d8 | 2015-04-13 14:11:43 +0800 | [diff] [blame^] | 164 | #ifdef CONFIG_HT_IRQ |
| 165 | struct { |
| 166 | int ht_pos; |
| 167 | int ht_idx; |
| 168 | struct pci_dev *ht_dev; |
| 169 | void *ht_update; |
| 170 | }; |
| 171 | #endif |
Jiang Liu | 947045a | 2015-04-13 14:11:30 +0800 | [diff] [blame] | 172 | }; |
Jiang Liu | b5dc8e6 | 2015-04-13 14:11:24 +0800 | [diff] [blame] | 173 | }; |
| 174 | |
| 175 | enum { |
| 176 | /* Allocate contiguous CPU vectors */ |
| 177 | X86_IRQ_ALLOC_CONTIGUOUS_VECTORS = 0x1, |
| 178 | }; |
Jiang Liu | 74afab7 | 2014-10-27 16:12:00 +0800 | [diff] [blame] | 179 | |
Jiang Liu | 26011ee | 2014-10-27 16:11:56 +0800 | [diff] [blame] | 180 | struct irq_cfg { |
| 181 | cpumask_var_t domain; |
| 182 | cpumask_var_t old_domain; |
Jiang Liu | 5f0052f | 2015-04-13 14:11:23 +0800 | [diff] [blame] | 183 | unsigned int dest_apicid; |
Jiang Liu | 26011ee | 2014-10-27 16:11:56 +0800 | [diff] [blame] | 184 | u8 vector; |
| 185 | u8 move_in_progress : 1; |
| 186 | #ifdef CONFIG_IRQ_REMAP |
| 187 | u8 remapped : 1; |
| 188 | union { |
| 189 | struct irq_2_iommu irq_2_iommu; |
| 190 | struct irq_2_irte irq_2_irte; |
| 191 | }; |
| 192 | #endif |
| 193 | union { |
| 194 | #ifdef CONFIG_X86_IO_APIC |
| 195 | struct { |
| 196 | struct list_head irq_2_pin; |
| 197 | }; |
| 198 | #endif |
| 199 | }; |
| 200 | }; |
| 201 | |
Jiang Liu | b5dc8e6 | 2015-04-13 14:11:24 +0800 | [diff] [blame] | 202 | extern struct irq_domain *x86_vector_domain; |
| 203 | |
| 204 | extern void init_irq_alloc_info(struct irq_alloc_info *info, |
| 205 | const struct cpumask *mask); |
| 206 | extern void copy_irq_alloc_info(struct irq_alloc_info *dst, |
| 207 | struct irq_alloc_info *src); |
Jiang Liu | 55a0e2b | 2014-10-27 16:11:59 +0800 | [diff] [blame] | 208 | extern struct irq_cfg *irq_cfg(unsigned int irq); |
| 209 | extern struct irq_cfg *irqd_cfg(struct irq_data *irq_data); |
Jiang Liu | 74afab7 | 2014-10-27 16:12:00 +0800 | [diff] [blame] | 210 | extern struct irq_cfg *alloc_irq_and_cfg_at(unsigned int at, int node); |
| 211 | extern void lock_vector_lock(void); |
| 212 | extern void unlock_vector_lock(void); |
Jiang Liu | 26011ee | 2014-10-27 16:11:56 +0800 | [diff] [blame] | 213 | extern int assign_irq_vector(int, struct irq_cfg *, const struct cpumask *); |
Jiang Liu | 74afab7 | 2014-10-27 16:12:00 +0800 | [diff] [blame] | 214 | extern void clear_irq_vector(int irq, struct irq_cfg *cfg); |
| 215 | extern void setup_vector_irq(int cpu); |
Jiang Liu | 26011ee | 2014-10-27 16:11:56 +0800 | [diff] [blame] | 216 | #ifdef CONFIG_SMP |
| 217 | extern void send_cleanup_vector(struct irq_cfg *); |
Thomas Gleixner | f0e5bf7 | 2014-11-05 10:12:27 +0100 | [diff] [blame] | 218 | extern void irq_complete_move(struct irq_cfg *cfg); |
Jiang Liu | 26011ee | 2014-10-27 16:11:56 +0800 | [diff] [blame] | 219 | #else |
| 220 | static inline void send_cleanup_vector(struct irq_cfg *c) { } |
Thomas Gleixner | f0e5bf7 | 2014-11-05 10:12:27 +0100 | [diff] [blame] | 221 | static inline void irq_complete_move(struct irq_cfg *c) { } |
Jiang Liu | 26011ee | 2014-10-27 16:11:56 +0800 | [diff] [blame] | 222 | #endif |
| 223 | |
Jiang Liu | 74afab7 | 2014-10-27 16:12:00 +0800 | [diff] [blame] | 224 | extern int apic_retrigger_irq(struct irq_data *data); |
| 225 | extern void apic_ack_edge(struct irq_data *data); |
| 226 | extern int apic_set_affinity(struct irq_data *data, const struct cpumask *mask, |
| 227 | unsigned int *dest_id); |
| 228 | #else /* CONFIG_X86_LOCAL_APIC */ |
Jiang Liu | 26011ee | 2014-10-27 16:11:56 +0800 | [diff] [blame] | 229 | static inline void lock_vector_lock(void) {} |
| 230 | static inline void unlock_vector_lock(void) {} |
Jiang Liu | 74afab7 | 2014-10-27 16:12:00 +0800 | [diff] [blame] | 231 | #endif /* CONFIG_X86_LOCAL_APIC */ |
Jiang Liu | 26011ee | 2014-10-27 16:11:56 +0800 | [diff] [blame] | 232 | |
Jiang Liu | 52f518a | 2015-04-13 14:11:35 +0800 | [diff] [blame] | 233 | #ifdef CONFIG_PCI_MSI |
| 234 | extern void arch_init_msi_domain(struct irq_domain *domain); |
| 235 | #else |
| 236 | static inline void arch_init_msi_domain(struct irq_domain *domain) { } |
| 237 | #endif |
Jiang Liu | 49e07d8 | 2015-04-13 14:11:43 +0800 | [diff] [blame^] | 238 | #ifdef CONFIG_HT_IRQ |
| 239 | extern void arch_init_htirq_domain(struct irq_domain *domain); |
| 240 | #else |
| 241 | static inline void arch_init_htirq_domain(struct irq_domain *domain) { } |
| 242 | #endif |
Jiang Liu | 52f518a | 2015-04-13 14:11:35 +0800 | [diff] [blame] | 243 | |
Thomas Gleixner | 2e08843 | 2008-05-02 19:00:30 +0200 | [diff] [blame] | 244 | /* Statistics */ |
| 245 | extern atomic_t irq_err_count; |
| 246 | extern atomic_t irq_mis_count; |
| 247 | |
Thomas Gleixner | 1a33195 | 2008-05-03 00:30:50 +0200 | [diff] [blame] | 248 | /* EISA */ |
| 249 | extern void eisa_set_level_irq(unsigned int irq); |
| 250 | |
Jaswinder Singh | 2b97df0 | 2008-07-23 17:13:14 +0530 | [diff] [blame] | 251 | /* SMP */ |
Andi Kleen | 1d9090e | 2013-08-05 15:02:37 -0700 | [diff] [blame] | 252 | extern __visible void smp_apic_timer_interrupt(struct pt_regs *); |
| 253 | extern __visible void smp_spurious_interrupt(struct pt_regs *); |
| 254 | extern __visible void smp_x86_platform_ipi(struct pt_regs *); |
| 255 | extern __visible void smp_error_interrupt(struct pt_regs *); |
Jaswinder Singh Rajput | 2c1b284 | 2009-04-11 00:03:10 +0530 | [diff] [blame] | 256 | #ifdef CONFIG_X86_IO_APIC |
| 257 | extern asmlinkage void smp_irq_move_cleanup_interrupt(void); |
| 258 | #endif |
Ingo Molnar | 3e5095d | 2009-01-27 17:07:08 +0100 | [diff] [blame] | 259 | #ifdef CONFIG_SMP |
Andi Kleen | 1d9090e | 2013-08-05 15:02:37 -0700 | [diff] [blame] | 260 | extern __visible void smp_reschedule_interrupt(struct pt_regs *); |
| 261 | extern __visible void smp_call_function_interrupt(struct pt_regs *); |
| 262 | extern __visible void smp_call_function_single_interrupt(struct pt_regs *); |
| 263 | extern __visible void smp_invalidate_interrupt(struct pt_regs *); |
Jaswinder Singh | e7f08df | 2008-07-25 10:42:26 +0530 | [diff] [blame] | 264 | #endif |
Jaswinder Singh | 2b97df0 | 2008-07-23 17:13:14 +0530 | [diff] [blame] | 265 | |
Denys Vlasenko | 3304c9c | 2015-04-03 21:49:13 +0200 | [diff] [blame] | 266 | extern char irq_entries_start[]; |
Seiji Aguchi | 25c74b1 | 2013-10-30 16:37:00 -0400 | [diff] [blame] | 267 | #ifdef CONFIG_TRACING |
Denys Vlasenko | 3304c9c | 2015-04-03 21:49:13 +0200 | [diff] [blame] | 268 | #define trace_irq_entries_start irq_entries_start |
Seiji Aguchi | 25c74b1 | 2013-10-30 16:37:00 -0400 | [diff] [blame] | 269 | #endif |
Eric W. Biederman | d388e5f | 2008-08-09 15:09:02 -0700 | [diff] [blame] | 270 | |
Prarit Bhargava | 79a51b2 | 2014-04-02 08:13:47 -0400 | [diff] [blame] | 271 | #define VECTOR_UNDEFINED (-1) |
| 272 | #define VECTOR_RETRIGGERED (-2) |
Prarit Bhargava | 9345005 | 2014-01-05 11:10:52 -0500 | [diff] [blame] | 273 | |
Yinghai Lu | 497c9a1 | 2008-08-19 20:50:28 -0700 | [diff] [blame] | 274 | typedef int vector_irq_t[NR_VECTORS]; |
| 275 | DECLARE_PER_CPU(vector_irq_t, vector_irq); |
Thomas Gleixner | 2e08843 | 2008-05-02 19:00:30 +0200 | [diff] [blame] | 276 | |
Thomas Gleixner | 22dc12d | 2008-05-02 22:10:39 +0200 | [diff] [blame] | 277 | #endif /* !ASSEMBLY_ */ |
| 278 | |
H. Peter Anvin | 1965aae | 2008-10-22 22:26:29 -0700 | [diff] [blame] | 279 | #endif /* _ASM_X86_HW_IRQ_H */ |