blob: 44137bb1213680608906f99083e54effdd3d77e9 [file] [log] [blame]
H. Peter Anvin1965aae2008-10-22 22:26:29 -07001#ifndef _ASM_X86_HW_IRQ_H
2#define _ASM_X86_HW_IRQ_H
Thomas Gleixner2e088432008-05-02 19:00:30 +02003
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 Gleixner9b7dc562008-05-02 20:10:09 +020016#include <asm/irq_vectors.h>
Thomas Gleixner2e088432008-05-02 19:00:30 +020017
18#ifndef __ASSEMBLY__
19
20#include <linux/percpu.h>
21#include <linux/profile.h>
22#include <linux/smp.h>
23
Arun Sharma600634972011-07-26 16:09:06 -070024#include <linux/atomic.h>
Thomas Gleixner2e088432008-05-02 19:00:30 +020025#include <asm/irq.h>
26#include <asm/sections.h>
27
Thomas Gleixner2e088432008-05-02 19:00:30 +020028/* Interrupt handlers registered during init_IRQ */
Andi Kleen1d9090e2013-08-05 15:02:37 -070029extern asmlinkage void apic_timer_interrupt(void);
30extern asmlinkage void x86_platform_ipi(void);
31extern asmlinkage void kvm_posted_intr_ipi(void);
Feng Wuf6b3c72c2015-05-19 17:07:16 +080032extern asmlinkage void kvm_posted_intr_wakeup_ipi(void);
Wincy Van210f84b2017-04-28 13:13:58 +080033extern asmlinkage void kvm_posted_intr_nested_ipi(void);
Andi Kleen1d9090e2013-08-05 15:02:37 -070034extern asmlinkage void error_interrupt(void);
35extern asmlinkage void irq_work_interrupt(void);
Ingo Molnar241771e2008-12-03 10:39:53 +010036
Andi Kleen1d9090e2013-08-05 15:02:37 -070037extern asmlinkage void spurious_interrupt(void);
38extern asmlinkage void thermal_interrupt(void);
39extern asmlinkage void reschedule_interrupt(void);
Thomas Gleixner2e088432008-05-02 19:00:30 +020040
Andi Kleen1d9090e2013-08-05 15:02:37 -070041extern asmlinkage void irq_move_cleanup_interrupt(void);
42extern asmlinkage void reboot_interrupt(void);
43extern asmlinkage void threshold_interrupt(void);
Aravind Gopalakrishnan24fd78a2015-05-06 06:58:56 -050044extern asmlinkage void deferred_error_interrupt(void);
Thomas Gleixner2e088432008-05-02 19:00:30 +020045
Andi Kleen1d9090e2013-08-05 15:02:37 -070046extern asmlinkage void call_function_interrupt(void);
47extern asmlinkage void call_function_single_interrupt(void);
Thomas Gleixner2e088432008-05-02 19:00:30 +020048
Seiji Aguchicf910e82013-06-20 11:46:53 -040049#ifdef CONFIG_TRACING
50/* Interrupt handlers registered during init_IRQ */
Seiji Aguchicf910e82013-06-20 11:46:53 -040051extern void trace_x86_platform_ipi(void);
52extern void trace_error_interrupt(void);
53extern void trace_irq_work_interrupt(void);
54extern void trace_spurious_interrupt(void);
55extern void trace_thermal_interrupt(void);
56extern void trace_reschedule_interrupt(void);
57extern void trace_threshold_interrupt(void);
Aravind Gopalakrishnan24fd78a2015-05-06 06:58:56 -050058extern void trace_deferred_error_interrupt(void);
Seiji Aguchicf910e82013-06-20 11:46:53 -040059extern void trace_call_function_interrupt(void);
60extern void trace_call_function_single_interrupt(void);
Thomas Gleixner302a98f2017-08-28 08:47:23 +020061#define trace_apic_timer_interrupt apic_timer_interrupt
Seiji Aguchicf910e82013-06-20 11:46:53 -040062#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 Wuf6b3c72c2015-05-19 17:07:16 +080065#define trace_kvm_posted_intr_wakeup_ipi kvm_posted_intr_wakeup_ipi
Wincy Van210f84b2017-04-28 13:13:58 +080066#define trace_kvm_posted_intr_nested_ipi kvm_posted_intr_nested_ipi
Seiji Aguchicf910e82013-06-20 11:46:53 -040067#endif /* CONFIG_TRACING */
68
Jiang Liu26011ee2014-10-27 16:11:56 +080069#ifdef CONFIG_X86_LOCAL_APIC
Jiang Liu74afab72014-10-27 16:12:00 +080070struct irq_data;
Jiang Liu947045a2015-04-13 14:11:30 +080071struct pci_dev;
72struct msi_desc;
73
74enum 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 Liu0921f1d2015-04-13 14:11:42 +080079 X86_IRQ_ALLOC_TYPE_DMAR,
Jiang Liu43fe1ab2015-04-13 14:11:44 +080080 X86_IRQ_ALLOC_TYPE_UV,
Jiang Liu947045a2015-04-13 14:11:30 +080081};
Jiang Liub5dc8e62015-04-13 14:11:24 +080082
83struct irq_alloc_info {
Jiang Liu947045a2015-04-13 14:11:30 +080084 enum irq_alloc_type type;
Jiang Liub5dc8e62015-04-13 14:11:24 +080085 u32 flags;
86 const struct cpumask *mask; /* CPU mask for vector allocation */
Jiang Liu947045a2015-04-13 14:11:30 +080087 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 Liu0921f1d2015-04-13 14:11:42 +0800113#ifdef CONFIG_DMAR_TABLE
114 struct {
115 int dmar_id;
116 void *dmar_data;
117 };
118#endif
Jiang Liu49e07d82015-04-13 14:11:43 +0800119#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 Liu43fe1ab2015-04-13 14:11:44 +0800127#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 Busch185a3832016-01-12 13:18:10 -0700135#if IS_ENABLED(CONFIG_VMD)
136 struct {
137 struct msi_desc *desc;
138 };
139#endif
Jiang Liu947045a2015-04-13 14:11:30 +0800140 };
Jiang Liub5dc8e62015-04-13 14:11:24 +0800141};
142
Jiang Liu26011ee2014-10-27 16:11:56 +0800143struct irq_cfg {
Jiang Liu5f0052f2015-04-13 14:11:23 +0800144 unsigned int dest_apicid;
Jiang Liu26011ee2014-10-27 16:11:56 +0800145 u8 vector;
Thomas Gleixner551adc62016-03-14 09:40:46 +0100146 u8 old_vector;
Jiang Liu26011ee2014-10-27 16:11:56 +0800147};
148
Jiang Liu55a0e2b2014-10-27 16:11:59 +0800149extern struct irq_cfg *irq_cfg(unsigned int irq);
150extern struct irq_cfg *irqd_cfg(struct irq_data *irq_data);
Jiang Liu74afab72014-10-27 16:12:00 +0800151extern void lock_vector_lock(void);
152extern void unlock_vector_lock(void);
Jiang Liu74afab72014-10-27 16:12:00 +0800153extern void setup_vector_irq(int cpu);
Jiang Liu26011ee2014-10-27 16:11:56 +0800154#ifdef CONFIG_SMP
155extern void send_cleanup_vector(struct irq_cfg *);
Thomas Gleixnerf0e5bf72014-11-05 10:12:27 +0100156extern void irq_complete_move(struct irq_cfg *cfg);
Jiang Liu26011ee2014-10-27 16:11:56 +0800157#else
158static inline void send_cleanup_vector(struct irq_cfg *c) { }
Thomas Gleixnerf0e5bf72014-11-05 10:12:27 +0100159static inline void irq_complete_move(struct irq_cfg *c) { }
Jiang Liu26011ee2014-10-27 16:11:56 +0800160#endif
161
Jiang Liu74afab72014-10-27 16:12:00 +0800162extern void apic_ack_edge(struct irq_data *data);
Jiang Liu74afab72014-10-27 16:12:00 +0800163#else /* CONFIG_X86_LOCAL_APIC */
Jiang Liu26011ee2014-10-27 16:11:56 +0800164static inline void lock_vector_lock(void) {}
165static inline void unlock_vector_lock(void) {}
Jiang Liu74afab72014-10-27 16:12:00 +0800166#endif /* CONFIG_X86_LOCAL_APIC */
Jiang Liu26011ee2014-10-27 16:11:56 +0800167
Thomas Gleixner2e088432008-05-02 19:00:30 +0200168/* Statistics */
169extern atomic_t irq_err_count;
170extern atomic_t irq_mis_count;
171
Paul Gortmakerea6cd252015-05-09 20:27:37 -0400172extern void elcr_set_level_irq(unsigned int irq);
Thomas Gleixner1a331952008-05-03 00:30:50 +0200173
Denys Vlasenko3304c9c2015-04-03 21:49:13 +0200174extern char irq_entries_start[];
Seiji Aguchi25c74b12013-10-30 16:37:00 -0400175#ifdef CONFIG_TRACING
Denys Vlasenko3304c9c2015-04-03 21:49:13 +0200176#define trace_irq_entries_start irq_entries_start
Seiji Aguchi25c74b12013-10-30 16:37:00 -0400177#endif
Eric W. Biedermand388e5f2008-08-09 15:09:02 -0700178
Thomas Gleixnera782a7e2015-08-02 20:38:27 +0000179#define VECTOR_UNUSED NULL
180#define VECTOR_RETRIGGERED ((void *)~0UL)
Prarit Bhargava93450052014-01-05 11:10:52 -0500181
Thomas Gleixnera782a7e2015-08-02 20:38:27 +0000182typedef struct irq_desc* vector_irq_t[NR_VECTORS];
Yinghai Lu497c9a12008-08-19 20:50:28 -0700183DECLARE_PER_CPU(vector_irq_t, vector_irq);
Thomas Gleixner2e088432008-05-02 19:00:30 +0200184
Thomas Gleixner22dc12d2008-05-02 22:10:39 +0200185#endif /* !ASSEMBLY_ */
186
H. Peter Anvin1965aae2008-10-22 22:26:29 -0700187#endif /* _ASM_X86_HW_IRQ_H */