blob: 10c80d4f8386bacd3809ded146bec92539832438 [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);
Thomas Gleixner2e088432008-05-02 19:00:30 +020043
Andi Kleen1d9090e2013-08-05 15:02:37 -070044extern asmlinkage void call_function_interrupt(void);
45extern asmlinkage void call_function_single_interrupt(void);
Thomas Gleixner2e088432008-05-02 19:00:30 +020046
Seiji Aguchicf910e82013-06-20 11:46:53 -040047#ifdef CONFIG_TRACING
48/* Interrupt handlers registered during init_IRQ */
49extern void trace_apic_timer_interrupt(void);
50extern void trace_x86_platform_ipi(void);
51extern void trace_error_interrupt(void);
52extern void trace_irq_work_interrupt(void);
53extern void trace_spurious_interrupt(void);
54extern void trace_thermal_interrupt(void);
55extern void trace_reschedule_interrupt(void);
56extern void trace_threshold_interrupt(void);
57extern void trace_call_function_interrupt(void);
58extern void trace_call_function_single_interrupt(void);
59#define trace_irq_move_cleanup_interrupt irq_move_cleanup_interrupt
60#define trace_reboot_interrupt reboot_interrupt
61#define trace_kvm_posted_intr_ipi kvm_posted_intr_ipi
Feng Wuf6b3c72c2015-05-19 17:07:16 +080062#define trace_kvm_posted_intr_wakeup_ipi kvm_posted_intr_wakeup_ipi
Seiji Aguchicf910e82013-06-20 11:46:53 -040063#endif /* CONFIG_TRACING */
64
Jiang Liu26011ee2014-10-27 16:11:56 +080065#ifdef CONFIG_X86_LOCAL_APIC
Jiang Liu74afab72014-10-27 16:12:00 +080066struct irq_data;
Jiang Liu947045a2015-04-13 14:11:30 +080067struct pci_dev;
68struct msi_desc;
69
70enum irq_alloc_type {
71 X86_IRQ_ALLOC_TYPE_IOAPIC = 1,
72 X86_IRQ_ALLOC_TYPE_HPET,
73 X86_IRQ_ALLOC_TYPE_MSI,
74 X86_IRQ_ALLOC_TYPE_MSIX,
Jiang Liu0921f1d2015-04-13 14:11:42 +080075 X86_IRQ_ALLOC_TYPE_DMAR,
Jiang Liu43fe1ab2015-04-13 14:11:44 +080076 X86_IRQ_ALLOC_TYPE_UV,
Jiang Liu947045a2015-04-13 14:11:30 +080077};
Jiang Liub5dc8e62015-04-13 14:11:24 +080078
79struct irq_alloc_info {
Jiang Liu947045a2015-04-13 14:11:30 +080080 enum irq_alloc_type type;
Jiang Liub5dc8e62015-04-13 14:11:24 +080081 u32 flags;
82 const struct cpumask *mask; /* CPU mask for vector allocation */
Jiang Liu947045a2015-04-13 14:11:30 +080083 union {
84 int unused;
85#ifdef CONFIG_HPET_TIMER
86 struct {
87 int hpet_id;
88 int hpet_index;
89 void *hpet_data;
90 };
91#endif
92#ifdef CONFIG_PCI_MSI
93 struct {
94 struct pci_dev *msi_dev;
95 irq_hw_number_t msi_hwirq;
96 };
97#endif
98#ifdef CONFIG_X86_IO_APIC
99 struct {
100 int ioapic_id;
101 int ioapic_pin;
102 int ioapic_node;
103 u32 ioapic_trigger : 1;
104 u32 ioapic_polarity : 1;
105 u32 ioapic_valid : 1;
106 struct IO_APIC_route_entry *ioapic_entry;
107 };
108#endif
Jiang Liu0921f1d2015-04-13 14:11:42 +0800109#ifdef CONFIG_DMAR_TABLE
110 struct {
111 int dmar_id;
112 void *dmar_data;
113 };
114#endif
Jiang Liu49e07d82015-04-13 14:11:43 +0800115#ifdef CONFIG_HT_IRQ
116 struct {
117 int ht_pos;
118 int ht_idx;
119 struct pci_dev *ht_dev;
120 void *ht_update;
121 };
122#endif
Jiang Liu43fe1ab2015-04-13 14:11:44 +0800123#ifdef CONFIG_X86_UV
124 struct {
125 int uv_limit;
126 int uv_blade;
127 unsigned long uv_offset;
128 char *uv_name;
129 };
130#endif
Jiang Liu947045a2015-04-13 14:11:30 +0800131 };
Jiang Liub5dc8e62015-04-13 14:11:24 +0800132};
133
Jiang Liu26011ee2014-10-27 16:11:56 +0800134struct irq_cfg {
Jiang Liu5f0052f2015-04-13 14:11:23 +0800135 unsigned int dest_apicid;
Jiang Liu26011ee2014-10-27 16:11:56 +0800136 u8 vector;
Jiang Liu26011ee2014-10-27 16:11:56 +0800137};
138
Jiang Liu55a0e2b2014-10-27 16:11:59 +0800139extern struct irq_cfg *irq_cfg(unsigned int irq);
140extern struct irq_cfg *irqd_cfg(struct irq_data *irq_data);
Jiang Liu74afab72014-10-27 16:12:00 +0800141extern void lock_vector_lock(void);
142extern void unlock_vector_lock(void);
Jiang Liu74afab72014-10-27 16:12:00 +0800143extern void setup_vector_irq(int cpu);
Jiang Liu26011ee2014-10-27 16:11:56 +0800144#ifdef CONFIG_SMP
145extern void send_cleanup_vector(struct irq_cfg *);
Thomas Gleixnerf0e5bf72014-11-05 10:12:27 +0100146extern void irq_complete_move(struct irq_cfg *cfg);
Jiang Liu26011ee2014-10-27 16:11:56 +0800147#else
148static inline void send_cleanup_vector(struct irq_cfg *c) { }
Thomas Gleixnerf0e5bf72014-11-05 10:12:27 +0100149static inline void irq_complete_move(struct irq_cfg *c) { }
Jiang Liu26011ee2014-10-27 16:11:56 +0800150#endif
151
Jiang Liu74afab72014-10-27 16:12:00 +0800152extern void apic_ack_edge(struct irq_data *data);
Jiang Liu74afab72014-10-27 16:12:00 +0800153#else /* CONFIG_X86_LOCAL_APIC */
Jiang Liu26011ee2014-10-27 16:11:56 +0800154static inline void lock_vector_lock(void) {}
155static inline void unlock_vector_lock(void) {}
Jiang Liu74afab72014-10-27 16:12:00 +0800156#endif /* CONFIG_X86_LOCAL_APIC */
Jiang Liu26011ee2014-10-27 16:11:56 +0800157
Thomas Gleixner2e088432008-05-02 19:00:30 +0200158/* Statistics */
159extern atomic_t irq_err_count;
160extern atomic_t irq_mis_count;
161
Paul Gortmakerea6cd252015-05-09 20:27:37 -0400162extern void elcr_set_level_irq(unsigned int irq);
Thomas Gleixner1a331952008-05-03 00:30:50 +0200163
Jaswinder Singh2b97df02008-07-23 17:13:14 +0530164/* SMP */
Andi Kleen1d9090e2013-08-05 15:02:37 -0700165extern __visible void smp_apic_timer_interrupt(struct pt_regs *);
166extern __visible void smp_spurious_interrupt(struct pt_regs *);
167extern __visible void smp_x86_platform_ipi(struct pt_regs *);
168extern __visible void smp_error_interrupt(struct pt_regs *);
Jaswinder Singh Rajput2c1b2842009-04-11 00:03:10 +0530169#ifdef CONFIG_X86_IO_APIC
170extern asmlinkage void smp_irq_move_cleanup_interrupt(void);
171#endif
Ingo Molnar3e5095d2009-01-27 17:07:08 +0100172#ifdef CONFIG_SMP
Andi Kleen1d9090e2013-08-05 15:02:37 -0700173extern __visible void smp_reschedule_interrupt(struct pt_regs *);
174extern __visible void smp_call_function_interrupt(struct pt_regs *);
175extern __visible void smp_call_function_single_interrupt(struct pt_regs *);
Jaswinder Singhe7f08df2008-07-25 10:42:26 +0530176#endif
Jaswinder Singh2b97df02008-07-23 17:13:14 +0530177
Denys Vlasenko3304c9c2015-04-03 21:49:13 +0200178extern char irq_entries_start[];
Seiji Aguchi25c74b12013-10-30 16:37:00 -0400179#ifdef CONFIG_TRACING
Denys Vlasenko3304c9c2015-04-03 21:49:13 +0200180#define trace_irq_entries_start irq_entries_start
Seiji Aguchi25c74b12013-10-30 16:37:00 -0400181#endif
Eric W. Biedermand388e5f2008-08-09 15:09:02 -0700182
Prarit Bhargava79a51b22014-04-02 08:13:47 -0400183#define VECTOR_UNDEFINED (-1)
184#define VECTOR_RETRIGGERED (-2)
Prarit Bhargava93450052014-01-05 11:10:52 -0500185
Yinghai Lu497c9a12008-08-19 20:50:28 -0700186typedef int vector_irq_t[NR_VECTORS];
187DECLARE_PER_CPU(vector_irq_t, vector_irq);
Thomas Gleixner2e088432008-05-02 19:00:30 +0200188
Thomas Gleixner22dc12d2008-05-02 22:10:39 +0200189#endif /* !ASSEMBLY_ */
190
H. Peter Anvin1965aae2008-10-22 22:26:29 -0700191#endif /* _ASM_X86_HW_IRQ_H */