blob: 6615032e19c80b79f3cd023ee291c790bcb07ae2 [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);
Andi Kleen1d9090e2013-08-05 15:02:37 -070033extern asmlinkage void error_interrupt(void);
34extern asmlinkage void irq_work_interrupt(void);
Ingo Molnar241771e2008-12-03 10:39:53 +010035
Andi Kleen1d9090e2013-08-05 15:02:37 -070036extern asmlinkage void spurious_interrupt(void);
37extern asmlinkage void thermal_interrupt(void);
38extern asmlinkage void reschedule_interrupt(void);
Thomas Gleixner2e088432008-05-02 19:00:30 +020039
Andi Kleen1d9090e2013-08-05 15:02:37 -070040extern asmlinkage void irq_move_cleanup_interrupt(void);
41extern asmlinkage void reboot_interrupt(void);
42extern asmlinkage void threshold_interrupt(void);
Aravind Gopalakrishnan24fd78a2015-05-06 06:58:56 -050043extern asmlinkage void deferred_error_interrupt(void);
Thomas Gleixner2e088432008-05-02 19:00:30 +020044
Andi Kleen1d9090e2013-08-05 15:02:37 -070045extern asmlinkage void call_function_interrupt(void);
46extern asmlinkage void call_function_single_interrupt(void);
Thomas Gleixner2e088432008-05-02 19:00:30 +020047
Seiji Aguchicf910e82013-06-20 11:46:53 -040048#ifdef CONFIG_TRACING
49/* Interrupt handlers registered during init_IRQ */
50extern void trace_apic_timer_interrupt(void);
51extern 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);
61#define trace_irq_move_cleanup_interrupt irq_move_cleanup_interrupt
62#define trace_reboot_interrupt reboot_interrupt
63#define trace_kvm_posted_intr_ipi kvm_posted_intr_ipi
Feng Wuf6b3c72c2015-05-19 17:07:16 +080064#define trace_kvm_posted_intr_wakeup_ipi kvm_posted_intr_wakeup_ipi
Seiji Aguchicf910e82013-06-20 11:46:53 -040065#endif /* CONFIG_TRACING */
66
Jiang Liu26011ee2014-10-27 16:11:56 +080067#ifdef CONFIG_X86_LOCAL_APIC
Jiang Liu74afab72014-10-27 16:12:00 +080068struct irq_data;
Jiang Liu947045a2015-04-13 14:11:30 +080069struct pci_dev;
70struct msi_desc;
71
72enum irq_alloc_type {
73 X86_IRQ_ALLOC_TYPE_IOAPIC = 1,
74 X86_IRQ_ALLOC_TYPE_HPET,
75 X86_IRQ_ALLOC_TYPE_MSI,
76 X86_IRQ_ALLOC_TYPE_MSIX,
Jiang Liu0921f1d2015-04-13 14:11:42 +080077 X86_IRQ_ALLOC_TYPE_DMAR,
Jiang Liu43fe1ab2015-04-13 14:11:44 +080078 X86_IRQ_ALLOC_TYPE_UV,
Jiang Liu947045a2015-04-13 14:11:30 +080079};
Jiang Liub5dc8e62015-04-13 14:11:24 +080080
81struct irq_alloc_info {
Jiang Liu947045a2015-04-13 14:11:30 +080082 enum irq_alloc_type type;
Jiang Liub5dc8e62015-04-13 14:11:24 +080083 u32 flags;
84 const struct cpumask *mask; /* CPU mask for vector allocation */
Jiang Liu947045a2015-04-13 14:11:30 +080085 union {
86 int unused;
87#ifdef CONFIG_HPET_TIMER
88 struct {
89 int hpet_id;
90 int hpet_index;
91 void *hpet_data;
92 };
93#endif
94#ifdef CONFIG_PCI_MSI
95 struct {
96 struct pci_dev *msi_dev;
97 irq_hw_number_t msi_hwirq;
98 };
99#endif
100#ifdef CONFIG_X86_IO_APIC
101 struct {
102 int ioapic_id;
103 int ioapic_pin;
104 int ioapic_node;
105 u32 ioapic_trigger : 1;
106 u32 ioapic_polarity : 1;
107 u32 ioapic_valid : 1;
108 struct IO_APIC_route_entry *ioapic_entry;
109 };
110#endif
Jiang Liu0921f1d2015-04-13 14:11:42 +0800111#ifdef CONFIG_DMAR_TABLE
112 struct {
113 int dmar_id;
114 void *dmar_data;
115 };
116#endif
Jiang Liu49e07d82015-04-13 14:11:43 +0800117#ifdef CONFIG_HT_IRQ
118 struct {
119 int ht_pos;
120 int ht_idx;
121 struct pci_dev *ht_dev;
122 void *ht_update;
123 };
124#endif
Jiang Liu43fe1ab2015-04-13 14:11:44 +0800125#ifdef CONFIG_X86_UV
126 struct {
127 int uv_limit;
128 int uv_blade;
129 unsigned long uv_offset;
130 char *uv_name;
131 };
132#endif
Jiang Liu947045a2015-04-13 14:11:30 +0800133 };
Jiang Liub5dc8e62015-04-13 14:11:24 +0800134};
135
Jiang Liu26011ee2014-10-27 16:11:56 +0800136struct irq_cfg {
Jiang Liu5f0052f2015-04-13 14:11:23 +0800137 unsigned int dest_apicid;
Jiang Liu26011ee2014-10-27 16:11:56 +0800138 u8 vector;
Jiang Liu26011ee2014-10-27 16:11:56 +0800139};
140
Jiang Liu55a0e2b2014-10-27 16:11:59 +0800141extern struct irq_cfg *irq_cfg(unsigned int irq);
142extern struct irq_cfg *irqd_cfg(struct irq_data *irq_data);
Jiang Liu74afab72014-10-27 16:12:00 +0800143extern void lock_vector_lock(void);
144extern void unlock_vector_lock(void);
Jiang Liu74afab72014-10-27 16:12:00 +0800145extern void setup_vector_irq(int cpu);
Jiang Liu26011ee2014-10-27 16:11:56 +0800146#ifdef CONFIG_SMP
147extern void send_cleanup_vector(struct irq_cfg *);
Thomas Gleixnerf0e5bf72014-11-05 10:12:27 +0100148extern void irq_complete_move(struct irq_cfg *cfg);
Jiang Liu26011ee2014-10-27 16:11:56 +0800149#else
150static inline void send_cleanup_vector(struct irq_cfg *c) { }
Thomas Gleixnerf0e5bf72014-11-05 10:12:27 +0100151static inline void irq_complete_move(struct irq_cfg *c) { }
Jiang Liu26011ee2014-10-27 16:11:56 +0800152#endif
153
Jiang Liu74afab72014-10-27 16:12:00 +0800154extern void apic_ack_edge(struct irq_data *data);
Jiang Liu74afab72014-10-27 16:12:00 +0800155#else /* CONFIG_X86_LOCAL_APIC */
Jiang Liu26011ee2014-10-27 16:11:56 +0800156static inline void lock_vector_lock(void) {}
157static inline void unlock_vector_lock(void) {}
Jiang Liu74afab72014-10-27 16:12:00 +0800158#endif /* CONFIG_X86_LOCAL_APIC */
Jiang Liu26011ee2014-10-27 16:11:56 +0800159
Thomas Gleixner2e088432008-05-02 19:00:30 +0200160/* Statistics */
161extern atomic_t irq_err_count;
162extern atomic_t irq_mis_count;
163
Paul Gortmakerea6cd252015-05-09 20:27:37 -0400164extern void elcr_set_level_irq(unsigned int irq);
Thomas Gleixner1a331952008-05-03 00:30:50 +0200165
Jaswinder Singh2b97df02008-07-23 17:13:14 +0530166/* SMP */
Andi Kleen1d9090e2013-08-05 15:02:37 -0700167extern __visible void smp_apic_timer_interrupt(struct pt_regs *);
168extern __visible void smp_spurious_interrupt(struct pt_regs *);
169extern __visible void smp_x86_platform_ipi(struct pt_regs *);
170extern __visible void smp_error_interrupt(struct pt_regs *);
Jaswinder Singh Rajput2c1b2842009-04-11 00:03:10 +0530171#ifdef CONFIG_X86_IO_APIC
172extern asmlinkage void smp_irq_move_cleanup_interrupt(void);
173#endif
Ingo Molnar3e5095d2009-01-27 17:07:08 +0100174#ifdef CONFIG_SMP
Andi Kleen1d9090e2013-08-05 15:02:37 -0700175extern __visible void smp_reschedule_interrupt(struct pt_regs *);
176extern __visible void smp_call_function_interrupt(struct pt_regs *);
177extern __visible void smp_call_function_single_interrupt(struct pt_regs *);
Jaswinder Singhe7f08df2008-07-25 10:42:26 +0530178#endif
Jaswinder Singh2b97df02008-07-23 17:13:14 +0530179
Denys Vlasenko3304c9c2015-04-03 21:49:13 +0200180extern char irq_entries_start[];
Seiji Aguchi25c74b12013-10-30 16:37:00 -0400181#ifdef CONFIG_TRACING
Denys Vlasenko3304c9c2015-04-03 21:49:13 +0200182#define trace_irq_entries_start irq_entries_start
Seiji Aguchi25c74b12013-10-30 16:37:00 -0400183#endif
Eric W. Biedermand388e5f2008-08-09 15:09:02 -0700184
Prarit Bhargava79a51b22014-04-02 08:13:47 -0400185#define VECTOR_UNDEFINED (-1)
186#define VECTOR_RETRIGGERED (-2)
Prarit Bhargava93450052014-01-05 11:10:52 -0500187
Yinghai Lu497c9a12008-08-19 20:50:28 -0700188typedef int vector_irq_t[NR_VECTORS];
189DECLARE_PER_CPU(vector_irq_t, vector_irq);
Thomas Gleixner2e088432008-05-02 19:00:30 +0200190
Thomas Gleixner22dc12d2008-05-02 22:10:39 +0200191#endif /* !ASSEMBLY_ */
192
H. Peter Anvin1965aae2008-10-22 22:26:29 -0700193#endif /* _ASM_X86_HW_IRQ_H */