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); |
Feng Wu | f6b3c72c | 2015-05-19 17:07:16 +0800 | [diff] [blame] | 32 | extern asmlinkage void kvm_posted_intr_wakeup_ipi(void); |
Wincy Van | 210f84b | 2017-04-28 13:13:58 +0800 | [diff] [blame] | 33 | extern asmlinkage void kvm_posted_intr_nested_ipi(void); |
Andi Kleen | 1d9090e | 2013-08-05 15:02:37 -0700 | [diff] [blame] | 34 | extern asmlinkage void error_interrupt(void); |
| 35 | extern asmlinkage void irq_work_interrupt(void); |
Ingo Molnar | 241771e | 2008-12-03 10:39:53 +0100 | [diff] [blame] | 36 | |
Andi Kleen | 1d9090e | 2013-08-05 15:02:37 -0700 | [diff] [blame] | 37 | extern asmlinkage void spurious_interrupt(void); |
| 38 | extern asmlinkage void thermal_interrupt(void); |
| 39 | extern asmlinkage void reschedule_interrupt(void); |
Thomas Gleixner | 2e08843 | 2008-05-02 19:00:30 +0200 | [diff] [blame] | 40 | |
Andi Kleen | 1d9090e | 2013-08-05 15:02:37 -0700 | [diff] [blame] | 41 | extern asmlinkage void irq_move_cleanup_interrupt(void); |
| 42 | extern asmlinkage void reboot_interrupt(void); |
| 43 | extern asmlinkage void threshold_interrupt(void); |
Aravind Gopalakrishnan | 24fd78a | 2015-05-06 06:58:56 -0500 | [diff] [blame] | 44 | extern asmlinkage void deferred_error_interrupt(void); |
Thomas Gleixner | 2e08843 | 2008-05-02 19:00:30 +0200 | [diff] [blame] | 45 | |
Andi Kleen | 1d9090e | 2013-08-05 15:02:37 -0700 | [diff] [blame] | 46 | extern asmlinkage void call_function_interrupt(void); |
| 47 | extern asmlinkage void call_function_single_interrupt(void); |
Thomas Gleixner | 2e08843 | 2008-05-02 19:00:30 +0200 | [diff] [blame] | 48 | |
Seiji Aguchi | cf910e8 | 2013-06-20 11:46:53 -0400 | [diff] [blame] | 49 | #ifdef CONFIG_TRACING |
| 50 | /* Interrupt handlers registered during init_IRQ */ |
Seiji Aguchi | cf910e8 | 2013-06-20 11:46:53 -0400 | [diff] [blame] | 51 | extern void trace_x86_platform_ipi(void); |
| 52 | extern void trace_error_interrupt(void); |
| 53 | extern void trace_irq_work_interrupt(void); |
| 54 | extern void trace_spurious_interrupt(void); |
| 55 | extern void trace_thermal_interrupt(void); |
| 56 | extern void trace_reschedule_interrupt(void); |
| 57 | extern void trace_threshold_interrupt(void); |
Aravind Gopalakrishnan | 24fd78a | 2015-05-06 06:58:56 -0500 | [diff] [blame] | 58 | extern void trace_deferred_error_interrupt(void); |
Seiji Aguchi | cf910e8 | 2013-06-20 11:46:53 -0400 | [diff] [blame] | 59 | extern void trace_call_function_interrupt(void); |
| 60 | extern void trace_call_function_single_interrupt(void); |
Thomas Gleixner | 302a98f | 2017-08-28 08:47:23 +0200 | [diff] [blame] | 61 | #define trace_apic_timer_interrupt apic_timer_interrupt |
Seiji Aguchi | cf910e8 | 2013-06-20 11:46:53 -0400 | [diff] [blame] | 62 | #define trace_irq_move_cleanup_interrupt irq_move_cleanup_interrupt |
| 63 | #define trace_reboot_interrupt reboot_interrupt |
| 64 | #define trace_kvm_posted_intr_ipi kvm_posted_intr_ipi |
Feng Wu | f6b3c72c | 2015-05-19 17:07:16 +0800 | [diff] [blame] | 65 | #define trace_kvm_posted_intr_wakeup_ipi kvm_posted_intr_wakeup_ipi |
Wincy Van | 210f84b | 2017-04-28 13:13:58 +0800 | [diff] [blame] | 66 | #define trace_kvm_posted_intr_nested_ipi kvm_posted_intr_nested_ipi |
Seiji Aguchi | cf910e8 | 2013-06-20 11:46:53 -0400 | [diff] [blame] | 67 | #endif /* CONFIG_TRACING */ |
| 68 | |
Jiang Liu | 26011ee | 2014-10-27 16:11:56 +0800 | [diff] [blame] | 69 | #ifdef CONFIG_X86_LOCAL_APIC |
Jiang Liu | 74afab7 | 2014-10-27 16:12:00 +0800 | [diff] [blame] | 70 | struct irq_data; |
Jiang Liu | 947045a | 2015-04-13 14:11:30 +0800 | [diff] [blame] | 71 | struct pci_dev; |
| 72 | struct msi_desc; |
| 73 | |
| 74 | enum irq_alloc_type { |
| 75 | X86_IRQ_ALLOC_TYPE_IOAPIC = 1, |
| 76 | X86_IRQ_ALLOC_TYPE_HPET, |
| 77 | X86_IRQ_ALLOC_TYPE_MSI, |
| 78 | X86_IRQ_ALLOC_TYPE_MSIX, |
Jiang Liu | 0921f1d | 2015-04-13 14:11:42 +0800 | [diff] [blame] | 79 | X86_IRQ_ALLOC_TYPE_DMAR, |
Jiang Liu | 43fe1ab | 2015-04-13 14:11:44 +0800 | [diff] [blame] | 80 | X86_IRQ_ALLOC_TYPE_UV, |
Jiang Liu | 947045a | 2015-04-13 14:11:30 +0800 | [diff] [blame] | 81 | }; |
Jiang Liu | b5dc8e6 | 2015-04-13 14:11:24 +0800 | [diff] [blame] | 82 | |
| 83 | struct irq_alloc_info { |
Jiang Liu | 947045a | 2015-04-13 14:11:30 +0800 | [diff] [blame] | 84 | enum irq_alloc_type type; |
Jiang Liu | b5dc8e6 | 2015-04-13 14:11:24 +0800 | [diff] [blame] | 85 | u32 flags; |
| 86 | const struct cpumask *mask; /* CPU mask for vector allocation */ |
Jiang Liu | 947045a | 2015-04-13 14:11:30 +0800 | [diff] [blame] | 87 | union { |
| 88 | int unused; |
| 89 | #ifdef CONFIG_HPET_TIMER |
| 90 | struct { |
| 91 | int hpet_id; |
| 92 | int hpet_index; |
| 93 | void *hpet_data; |
| 94 | }; |
| 95 | #endif |
| 96 | #ifdef CONFIG_PCI_MSI |
| 97 | struct { |
| 98 | struct pci_dev *msi_dev; |
| 99 | irq_hw_number_t msi_hwirq; |
| 100 | }; |
| 101 | #endif |
| 102 | #ifdef CONFIG_X86_IO_APIC |
| 103 | struct { |
| 104 | int ioapic_id; |
| 105 | int ioapic_pin; |
| 106 | int ioapic_node; |
| 107 | u32 ioapic_trigger : 1; |
| 108 | u32 ioapic_polarity : 1; |
| 109 | u32 ioapic_valid : 1; |
| 110 | struct IO_APIC_route_entry *ioapic_entry; |
| 111 | }; |
| 112 | #endif |
Jiang Liu | 0921f1d | 2015-04-13 14:11:42 +0800 | [diff] [blame] | 113 | #ifdef CONFIG_DMAR_TABLE |
| 114 | struct { |
| 115 | int dmar_id; |
| 116 | void *dmar_data; |
| 117 | }; |
| 118 | #endif |
Jiang Liu | 49e07d8 | 2015-04-13 14:11:43 +0800 | [diff] [blame] | 119 | #ifdef CONFIG_HT_IRQ |
| 120 | struct { |
| 121 | int ht_pos; |
| 122 | int ht_idx; |
| 123 | struct pci_dev *ht_dev; |
| 124 | void *ht_update; |
| 125 | }; |
| 126 | #endif |
Jiang Liu | 43fe1ab | 2015-04-13 14:11:44 +0800 | [diff] [blame] | 127 | #ifdef CONFIG_X86_UV |
| 128 | struct { |
| 129 | int uv_limit; |
| 130 | int uv_blade; |
| 131 | unsigned long uv_offset; |
| 132 | char *uv_name; |
| 133 | }; |
| 134 | #endif |
Keith Busch | 185a383 | 2016-01-12 13:18:10 -0700 | [diff] [blame] | 135 | #if IS_ENABLED(CONFIG_VMD) |
| 136 | struct { |
| 137 | struct msi_desc *desc; |
| 138 | }; |
| 139 | #endif |
Jiang Liu | 947045a | 2015-04-13 14:11:30 +0800 | [diff] [blame] | 140 | }; |
Jiang Liu | b5dc8e6 | 2015-04-13 14:11:24 +0800 | [diff] [blame] | 141 | }; |
| 142 | |
Jiang Liu | 26011ee | 2014-10-27 16:11:56 +0800 | [diff] [blame] | 143 | struct irq_cfg { |
Jiang Liu | 5f0052f | 2015-04-13 14:11:23 +0800 | [diff] [blame] | 144 | unsigned int dest_apicid; |
Jiang Liu | 26011ee | 2014-10-27 16:11:56 +0800 | [diff] [blame] | 145 | u8 vector; |
Thomas Gleixner | 551adc6 | 2016-03-14 09:40:46 +0100 | [diff] [blame] | 146 | u8 old_vector; |
Jiang Liu | 26011ee | 2014-10-27 16:11:56 +0800 | [diff] [blame] | 147 | }; |
| 148 | |
Jiang Liu | 55a0e2b | 2014-10-27 16:11:59 +0800 | [diff] [blame] | 149 | extern struct irq_cfg *irq_cfg(unsigned int irq); |
| 150 | extern struct irq_cfg *irqd_cfg(struct irq_data *irq_data); |
Jiang Liu | 74afab7 | 2014-10-27 16:12:00 +0800 | [diff] [blame] | 151 | extern void lock_vector_lock(void); |
| 152 | extern void unlock_vector_lock(void); |
Jiang Liu | 74afab7 | 2014-10-27 16:12:00 +0800 | [diff] [blame] | 153 | extern void setup_vector_irq(int cpu); |
Jiang Liu | 26011ee | 2014-10-27 16:11:56 +0800 | [diff] [blame] | 154 | #ifdef CONFIG_SMP |
| 155 | extern void send_cleanup_vector(struct irq_cfg *); |
Thomas Gleixner | f0e5bf7 | 2014-11-05 10:12:27 +0100 | [diff] [blame] | 156 | extern void irq_complete_move(struct irq_cfg *cfg); |
Jiang Liu | 26011ee | 2014-10-27 16:11:56 +0800 | [diff] [blame] | 157 | #else |
| 158 | static inline void send_cleanup_vector(struct irq_cfg *c) { } |
Thomas Gleixner | f0e5bf7 | 2014-11-05 10:12:27 +0100 | [diff] [blame] | 159 | static inline void irq_complete_move(struct irq_cfg *c) { } |
Jiang Liu | 26011ee | 2014-10-27 16:11:56 +0800 | [diff] [blame] | 160 | #endif |
| 161 | |
Jiang Liu | 74afab7 | 2014-10-27 16:12:00 +0800 | [diff] [blame] | 162 | extern void apic_ack_edge(struct irq_data *data); |
Jiang Liu | 74afab7 | 2014-10-27 16:12:00 +0800 | [diff] [blame] | 163 | #else /* CONFIG_X86_LOCAL_APIC */ |
Jiang Liu | 26011ee | 2014-10-27 16:11:56 +0800 | [diff] [blame] | 164 | static inline void lock_vector_lock(void) {} |
| 165 | static inline void unlock_vector_lock(void) {} |
Jiang Liu | 74afab7 | 2014-10-27 16:12:00 +0800 | [diff] [blame] | 166 | #endif /* CONFIG_X86_LOCAL_APIC */ |
Jiang Liu | 26011ee | 2014-10-27 16:11:56 +0800 | [diff] [blame] | 167 | |
Thomas Gleixner | 2e08843 | 2008-05-02 19:00:30 +0200 | [diff] [blame] | 168 | /* Statistics */ |
| 169 | extern atomic_t irq_err_count; |
| 170 | extern atomic_t irq_mis_count; |
| 171 | |
Paul Gortmaker | ea6cd25 | 2015-05-09 20:27:37 -0400 | [diff] [blame] | 172 | extern void elcr_set_level_irq(unsigned int irq); |
Thomas Gleixner | 1a33195 | 2008-05-03 00:30:50 +0200 | [diff] [blame] | 173 | |
Denys Vlasenko | 3304c9c | 2015-04-03 21:49:13 +0200 | [diff] [blame] | 174 | extern char irq_entries_start[]; |
Seiji Aguchi | 25c74b1 | 2013-10-30 16:37:00 -0400 | [diff] [blame] | 175 | #ifdef CONFIG_TRACING |
Denys Vlasenko | 3304c9c | 2015-04-03 21:49:13 +0200 | [diff] [blame] | 176 | #define trace_irq_entries_start irq_entries_start |
Seiji Aguchi | 25c74b1 | 2013-10-30 16:37:00 -0400 | [diff] [blame] | 177 | #endif |
Eric W. Biederman | d388e5f | 2008-08-09 15:09:02 -0700 | [diff] [blame] | 178 | |
Thomas Gleixner | a782a7e | 2015-08-02 20:38:27 +0000 | [diff] [blame] | 179 | #define VECTOR_UNUSED NULL |
| 180 | #define VECTOR_RETRIGGERED ((void *)~0UL) |
Prarit Bhargava | 9345005 | 2014-01-05 11:10:52 -0500 | [diff] [blame] | 181 | |
Thomas Gleixner | a782a7e | 2015-08-02 20:38:27 +0000 | [diff] [blame] | 182 | typedef struct irq_desc* vector_irq_t[NR_VECTORS]; |
Yinghai Lu | 497c9a1 | 2008-08-19 20:50:28 -0700 | [diff] [blame] | 183 | DECLARE_PER_CPU(vector_irq_t, vector_irq); |
Thomas Gleixner | 2e08843 | 2008-05-02 19:00:30 +0200 | [diff] [blame] | 184 | |
Thomas Gleixner | 22dc12d | 2008-05-02 22:10:39 +0200 | [diff] [blame] | 185 | #endif /* !ASSEMBLY_ */ |
| 186 | |
H. Peter Anvin | 1965aae | 2008-10-22 22:26:29 -0700 | [diff] [blame] | 187 | #endif /* _ASM_X86_HW_IRQ_H */ |