blob: 9ec5d37d8da3d0d171609aab8efc39ffc2a13a54 [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);
32extern asmlinkage void error_interrupt(void);
33extern asmlinkage void irq_work_interrupt(void);
Ingo Molnar241771e2008-12-03 10:39:53 +010034
Andi Kleen1d9090e2013-08-05 15:02:37 -070035extern asmlinkage void spurious_interrupt(void);
36extern asmlinkage void thermal_interrupt(void);
37extern asmlinkage void reschedule_interrupt(void);
Thomas Gleixner2e088432008-05-02 19:00:30 +020038
Andi Kleen1d9090e2013-08-05 15:02:37 -070039extern asmlinkage void irq_move_cleanup_interrupt(void);
40extern asmlinkage void reboot_interrupt(void);
41extern asmlinkage void threshold_interrupt(void);
Thomas Gleixner2e088432008-05-02 19:00:30 +020042
Andi Kleen1d9090e2013-08-05 15:02:37 -070043extern asmlinkage void call_function_interrupt(void);
44extern asmlinkage void call_function_single_interrupt(void);
Thomas Gleixner2e088432008-05-02 19:00:30 +020045
Seiji Aguchicf910e82013-06-20 11:46:53 -040046#ifdef CONFIG_TRACING
47/* Interrupt handlers registered during init_IRQ */
48extern void trace_apic_timer_interrupt(void);
49extern void trace_x86_platform_ipi(void);
50extern void trace_error_interrupt(void);
51extern void trace_irq_work_interrupt(void);
52extern void trace_spurious_interrupt(void);
53extern void trace_thermal_interrupt(void);
54extern void trace_reschedule_interrupt(void);
55extern void trace_threshold_interrupt(void);
56extern void trace_call_function_interrupt(void);
57extern void trace_call_function_single_interrupt(void);
58#define trace_irq_move_cleanup_interrupt irq_move_cleanup_interrupt
59#define trace_reboot_interrupt reboot_interrupt
60#define trace_kvm_posted_intr_ipi kvm_posted_intr_ipi
61#endif /* CONFIG_TRACING */
62
Jiang Liu26011ee2014-10-27 16:11:56 +080063#ifdef CONFIG_X86_LOCAL_APIC
Jiang Liu74afab72014-10-27 16:12:00 +080064struct irq_data;
Jiang Liu947045a2015-04-13 14:11:30 +080065struct pci_dev;
66struct msi_desc;
67
68enum irq_alloc_type {
69 X86_IRQ_ALLOC_TYPE_IOAPIC = 1,
70 X86_IRQ_ALLOC_TYPE_HPET,
71 X86_IRQ_ALLOC_TYPE_MSI,
72 X86_IRQ_ALLOC_TYPE_MSIX,
Jiang Liu0921f1d2015-04-13 14:11:42 +080073 X86_IRQ_ALLOC_TYPE_DMAR,
Jiang Liu43fe1ab2015-04-13 14:11:44 +080074 X86_IRQ_ALLOC_TYPE_UV,
Jiang Liu947045a2015-04-13 14:11:30 +080075};
Jiang Liub5dc8e62015-04-13 14:11:24 +080076
77struct irq_alloc_info {
Jiang Liu947045a2015-04-13 14:11:30 +080078 enum irq_alloc_type type;
Jiang Liub5dc8e62015-04-13 14:11:24 +080079 u32 flags;
80 const struct cpumask *mask; /* CPU mask for vector allocation */
Jiang Liu947045a2015-04-13 14:11:30 +080081 union {
82 int unused;
83#ifdef CONFIG_HPET_TIMER
84 struct {
85 int hpet_id;
86 int hpet_index;
87 void *hpet_data;
88 };
89#endif
90#ifdef CONFIG_PCI_MSI
91 struct {
92 struct pci_dev *msi_dev;
93 irq_hw_number_t msi_hwirq;
94 };
95#endif
96#ifdef CONFIG_X86_IO_APIC
97 struct {
98 int ioapic_id;
99 int ioapic_pin;
100 int ioapic_node;
101 u32 ioapic_trigger : 1;
102 u32 ioapic_polarity : 1;
103 u32 ioapic_valid : 1;
104 struct IO_APIC_route_entry *ioapic_entry;
105 };
106#endif
Jiang Liu0921f1d2015-04-13 14:11:42 +0800107#ifdef CONFIG_DMAR_TABLE
108 struct {
109 int dmar_id;
110 void *dmar_data;
111 };
112#endif
Jiang Liu49e07d82015-04-13 14:11:43 +0800113#ifdef CONFIG_HT_IRQ
114 struct {
115 int ht_pos;
116 int ht_idx;
117 struct pci_dev *ht_dev;
118 void *ht_update;
119 };
120#endif
Jiang Liu43fe1ab2015-04-13 14:11:44 +0800121#ifdef CONFIG_X86_UV
122 struct {
123 int uv_limit;
124 int uv_blade;
125 unsigned long uv_offset;
126 char *uv_name;
127 };
128#endif
Jiang Liu947045a2015-04-13 14:11:30 +0800129 };
Jiang Liub5dc8e62015-04-13 14:11:24 +0800130};
131
Jiang Liu26011ee2014-10-27 16:11:56 +0800132struct irq_cfg {
Jiang Liu5f0052f2015-04-13 14:11:23 +0800133 unsigned int dest_apicid;
Jiang Liu26011ee2014-10-27 16:11:56 +0800134 u8 vector;
Jiang Liu26011ee2014-10-27 16:11:56 +0800135};
136
Jiang Liu55a0e2b2014-10-27 16:11:59 +0800137extern struct irq_cfg *irq_cfg(unsigned int irq);
138extern struct irq_cfg *irqd_cfg(struct irq_data *irq_data);
Jiang Liu74afab72014-10-27 16:12:00 +0800139extern void lock_vector_lock(void);
140extern void unlock_vector_lock(void);
Jiang Liu74afab72014-10-27 16:12:00 +0800141extern void setup_vector_irq(int cpu);
Jiang Liu26011ee2014-10-27 16:11:56 +0800142#ifdef CONFIG_SMP
143extern void send_cleanup_vector(struct irq_cfg *);
Thomas Gleixnerf0e5bf72014-11-05 10:12:27 +0100144extern void irq_complete_move(struct irq_cfg *cfg);
Jiang Liu26011ee2014-10-27 16:11:56 +0800145#else
146static inline void send_cleanup_vector(struct irq_cfg *c) { }
Thomas Gleixnerf0e5bf72014-11-05 10:12:27 +0100147static inline void irq_complete_move(struct irq_cfg *c) { }
Jiang Liu26011ee2014-10-27 16:11:56 +0800148#endif
149
Jiang Liu74afab72014-10-27 16:12:00 +0800150extern void apic_ack_edge(struct irq_data *data);
Jiang Liu74afab72014-10-27 16:12:00 +0800151#else /* CONFIG_X86_LOCAL_APIC */
Jiang Liu26011ee2014-10-27 16:11:56 +0800152static inline void lock_vector_lock(void) {}
153static inline void unlock_vector_lock(void) {}
Jiang Liu74afab72014-10-27 16:12:00 +0800154#endif /* CONFIG_X86_LOCAL_APIC */
Jiang Liu26011ee2014-10-27 16:11:56 +0800155
Thomas Gleixner2e088432008-05-02 19:00:30 +0200156/* Statistics */
157extern atomic_t irq_err_count;
158extern atomic_t irq_mis_count;
159
Paul Gortmakerea6cd252015-05-09 20:27:37 -0400160extern void elcr_set_level_irq(unsigned int irq);
Thomas Gleixner1a331952008-05-03 00:30:50 +0200161
Jaswinder Singh2b97df02008-07-23 17:13:14 +0530162/* SMP */
Andi Kleen1d9090e2013-08-05 15:02:37 -0700163extern __visible void smp_apic_timer_interrupt(struct pt_regs *);
164extern __visible void smp_spurious_interrupt(struct pt_regs *);
165extern __visible void smp_x86_platform_ipi(struct pt_regs *);
166extern __visible void smp_error_interrupt(struct pt_regs *);
Jaswinder Singh Rajput2c1b2842009-04-11 00:03:10 +0530167#ifdef CONFIG_X86_IO_APIC
168extern asmlinkage void smp_irq_move_cleanup_interrupt(void);
169#endif
Ingo Molnar3e5095d2009-01-27 17:07:08 +0100170#ifdef CONFIG_SMP
Andi Kleen1d9090e2013-08-05 15:02:37 -0700171extern __visible void smp_reschedule_interrupt(struct pt_regs *);
172extern __visible void smp_call_function_interrupt(struct pt_regs *);
173extern __visible void smp_call_function_single_interrupt(struct pt_regs *);
Jaswinder Singhe7f08df2008-07-25 10:42:26 +0530174#endif
Jaswinder Singh2b97df02008-07-23 17:13:14 +0530175
Denys Vlasenko3304c9c2015-04-03 21:49:13 +0200176extern char irq_entries_start[];
Seiji Aguchi25c74b12013-10-30 16:37:00 -0400177#ifdef CONFIG_TRACING
Denys Vlasenko3304c9c2015-04-03 21:49:13 +0200178#define trace_irq_entries_start irq_entries_start
Seiji Aguchi25c74b12013-10-30 16:37:00 -0400179#endif
Eric W. Biedermand388e5f2008-08-09 15:09:02 -0700180
Prarit Bhargava79a51b22014-04-02 08:13:47 -0400181#define VECTOR_UNDEFINED (-1)
182#define VECTOR_RETRIGGERED (-2)
Prarit Bhargava93450052014-01-05 11:10:52 -0500183
Yinghai Lu497c9a12008-08-19 20:50:28 -0700184typedef int vector_irq_t[NR_VECTORS];
185DECLARE_PER_CPU(vector_irq_t, vector_irq);
Thomas Gleixner2e088432008-05-02 19:00:30 +0200186
Thomas Gleixner22dc12d2008-05-02 22:10:39 +0200187#endif /* !ASSEMBLY_ */
188
H. Peter Anvin1965aae2008-10-22 22:26:29 -0700189#endif /* _ASM_X86_HW_IRQ_H */