]> git.proxmox.com Git - mirror_ubuntu-focal-kernel.git/blame - arch/x86/include/asm/hw_irq.h
x86/irq: Improve definition of VECTOR_SHUTDOWN et al
[mirror_ubuntu-focal-kernel.git] / arch / x86 / include / asm / hw_irq.h
CommitLineData
b2441318 1/* SPDX-License-Identifier: GPL-2.0 */
1965aae3
PA
2#ifndef _ASM_X86_HW_IRQ_H
3#define _ASM_X86_HW_IRQ_H
2e088436
TG
4
5/*
6 * (C) 1992, 1993 Linus Torvalds, (C) 1997 Ingo Molnar
7 *
8 * moved some of the old arch/i386/kernel/irq.h to here. VY
9 *
10 * IRQ/IPI changes taken from work by Thomas Radke
11 * <tomsoft@informatik.tu-chemnitz.de>
12 *
13 * hacked by Andi Kleen for x86-64.
14 * unified by tglx
15 */
16
9b7dc567 17#include <asm/irq_vectors.h>
2e088436 18
0fa115da
TG
19#define IRQ_MATRIX_BITS NR_VECTORS
20
2e088436
TG
21#ifndef __ASSEMBLY__
22
23#include <linux/percpu.h>
24#include <linux/profile.h>
25#include <linux/smp.h>
26
60063497 27#include <linux/atomic.h>
2e088436
TG
28#include <asm/irq.h>
29#include <asm/sections.h>
30
2e088436 31/* Interrupt handlers registered during init_IRQ */
1d9090e2
AK
32extern asmlinkage void apic_timer_interrupt(void);
33extern asmlinkage void x86_platform_ipi(void);
34extern asmlinkage void kvm_posted_intr_ipi(void);
f6b3c72c 35extern asmlinkage void kvm_posted_intr_wakeup_ipi(void);
210f84b0 36extern asmlinkage void kvm_posted_intr_nested_ipi(void);
1d9090e2
AK
37extern asmlinkage void error_interrupt(void);
38extern asmlinkage void irq_work_interrupt(void);
151ad17f 39extern asmlinkage void uv_bau_message_intr1(void);
1d9090e2
AK
40
41extern asmlinkage void spurious_interrupt(void);
42extern asmlinkage void thermal_interrupt(void);
43extern asmlinkage void reschedule_interrupt(void);
44
1d9090e2
AK
45extern asmlinkage void irq_move_cleanup_interrupt(void);
46extern asmlinkage void reboot_interrupt(void);
47extern asmlinkage void threshold_interrupt(void);
24fd78a8 48extern asmlinkage void deferred_error_interrupt(void);
1d9090e2
AK
49
50extern asmlinkage void call_function_interrupt(void);
51extern asmlinkage void call_function_single_interrupt(void);
2e088436 52
26011eee 53#ifdef CONFIG_X86_LOCAL_APIC
74afab7a 54struct irq_data;
947045a2
JL
55struct pci_dev;
56struct msi_desc;
57
58enum irq_alloc_type {
59 X86_IRQ_ALLOC_TYPE_IOAPIC = 1,
60 X86_IRQ_ALLOC_TYPE_HPET,
61 X86_IRQ_ALLOC_TYPE_MSI,
62 X86_IRQ_ALLOC_TYPE_MSIX,
0921f1da 63 X86_IRQ_ALLOC_TYPE_DMAR,
43fe1abc 64 X86_IRQ_ALLOC_TYPE_UV,
947045a2 65};
b5dc8e6c
JL
66
67struct irq_alloc_info {
947045a2 68 enum irq_alloc_type type;
b5dc8e6c
JL
69 u32 flags;
70 const struct cpumask *mask; /* CPU mask for vector allocation */
947045a2
JL
71 union {
72 int unused;
73#ifdef CONFIG_HPET_TIMER
74 struct {
75 int hpet_id;
76 int hpet_index;
77 void *hpet_data;
78 };
79#endif
80#ifdef CONFIG_PCI_MSI
81 struct {
82 struct pci_dev *msi_dev;
83 irq_hw_number_t msi_hwirq;
84 };
85#endif
86#ifdef CONFIG_X86_IO_APIC
87 struct {
88 int ioapic_id;
89 int ioapic_pin;
90 int ioapic_node;
91 u32 ioapic_trigger : 1;
92 u32 ioapic_polarity : 1;
93 u32 ioapic_valid : 1;
94 struct IO_APIC_route_entry *ioapic_entry;
95 };
0921f1da
JL
96#endif
97#ifdef CONFIG_DMAR_TABLE
98 struct {
99 int dmar_id;
100 void *dmar_data;
101 };
49e07d8f 102#endif
43fe1abc
JL
103#ifdef CONFIG_X86_UV
104 struct {
105 int uv_limit;
106 int uv_blade;
107 unsigned long uv_offset;
108 char *uv_name;
109 };
185a383a
KB
110#endif
111#if IS_ENABLED(CONFIG_VMD)
112 struct {
113 struct msi_desc *desc;
114 };
947045a2
JL
115#endif
116 };
b5dc8e6c
JL
117};
118
9338ad6f 119struct irq_cfg {
5f0052f9 120 unsigned int dest_apicid;
ba224fea 121 unsigned int vector;
9338ad6f
DS
122};
123
55a0e2b1
JL
124extern struct irq_cfg *irq_cfg(unsigned int irq);
125extern struct irq_cfg *irqd_cfg(struct irq_data *irq_data);
74afab7a
JL
126extern void lock_vector_lock(void);
127extern void unlock_vector_lock(void);
e32c67e0 128#ifdef CONFIG_SMP
9338ad6f 129extern void send_cleanup_vector(struct irq_cfg *);
f0e5bf75 130extern void irq_complete_move(struct irq_cfg *cfg);
e32c67e0
JL
131#else
132static inline void send_cleanup_vector(struct irq_cfg *c) { }
f0e5bf75 133static inline void irq_complete_move(struct irq_cfg *c) { }
e32c67e0 134#endif
7ec13187 135
74afab7a 136extern void apic_ack_edge(struct irq_data *data);
74afab7a 137#else /* CONFIG_X86_LOCAL_APIC */
26011eee
JL
138static inline void lock_vector_lock(void) {}
139static inline void unlock_vector_lock(void) {}
74afab7a 140#endif /* CONFIG_X86_LOCAL_APIC */
26011eee 141
2e088436
TG
142/* Statistics */
143extern atomic_t irq_err_count;
144extern atomic_t irq_mis_count;
145
ea6cd250 146extern void elcr_set_level_irq(unsigned int irq);
1a331957 147
3304c9c3 148extern char irq_entries_start[];
25c74b10 149#ifdef CONFIG_TRACING
3304c9c3 150#define trace_irq_entries_start irq_entries_start
25c74b10 151#endif
497c9a19 152
f8a8fe61
TG
153extern char spurious_entries_start[];
154
a782a7e4 155#define VECTOR_UNUSED NULL
e30c44e2
HK
156#define VECTOR_SHUTDOWN ((void *)-1L)
157#define VECTOR_RETRIGGERED ((void *)-2L)
9345005f 158
a782a7e4 159typedef struct irq_desc* vector_irq_t[NR_VECTORS];
22dc12d1 160DECLARE_PER_CPU(vector_irq_t, vector_irq);
2e088436 161
22dc12d1
TG
162#endif /* !ASSEMBLY_ */
163
1965aae3 164#endif /* _ASM_X86_HW_IRQ_H */