Loading...
1#ifndef _ASM_X86_HW_IRQ_H
2#define _ASM_X86_HW_IRQ_H
3
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
16#include <asm/irq_vectors.h>
17
18#ifndef __ASSEMBLY__
19
20#include <linux/percpu.h>
21#include <linux/profile.h>
22#include <linux/smp.h>
23
24#include <linux/atomic.h>
25#include <asm/irq.h>
26#include <asm/sections.h>
27
28/* Interrupt handlers registered during init_IRQ */
29extern asmlinkage void apic_timer_interrupt(void);
30extern asmlinkage void x86_platform_ipi(void);
31extern asmlinkage void kvm_posted_intr_ipi(void);
32extern asmlinkage void kvm_posted_intr_wakeup_ipi(void);
33extern asmlinkage void error_interrupt(void);
34extern asmlinkage void irq_work_interrupt(void);
35
36extern asmlinkage void spurious_interrupt(void);
37extern asmlinkage void thermal_interrupt(void);
38extern asmlinkage void reschedule_interrupt(void);
39
40extern asmlinkage void irq_move_cleanup_interrupt(void);
41extern asmlinkage void reboot_interrupt(void);
42extern asmlinkage void threshold_interrupt(void);
43extern asmlinkage void deferred_error_interrupt(void);
44
45extern asmlinkage void call_function_interrupt(void);
46extern asmlinkage void call_function_single_interrupt(void);
47
48#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);
58extern void trace_deferred_error_interrupt(void);
59extern 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
64#define trace_kvm_posted_intr_wakeup_ipi kvm_posted_intr_wakeup_ipi
65#endif /* CONFIG_TRACING */
66
67#ifdef CONFIG_X86_LOCAL_APIC
68struct irq_data;
69struct 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,
77 X86_IRQ_ALLOC_TYPE_DMAR,
78 X86_IRQ_ALLOC_TYPE_UV,
79};
80
81struct irq_alloc_info {
82 enum irq_alloc_type type;
83 u32 flags;
84 const struct cpumask *mask; /* CPU mask for vector allocation */
85 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
111#ifdef CONFIG_DMAR_TABLE
112 struct {
113 int dmar_id;
114 void *dmar_data;
115 };
116#endif
117#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
125#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
133#if IS_ENABLED(CONFIG_VMD)
134 struct {
135 struct msi_desc *desc;
136 };
137#endif
138 };
139};
140
141struct irq_cfg {
142 unsigned int dest_apicid;
143 u8 vector;
144 u8 old_vector;
145};
146
147extern struct irq_cfg *irq_cfg(unsigned int irq);
148extern struct irq_cfg *irqd_cfg(struct irq_data *irq_data);
149extern void lock_vector_lock(void);
150extern void unlock_vector_lock(void);
151extern void setup_vector_irq(int cpu);
152#ifdef CONFIG_SMP
153extern void send_cleanup_vector(struct irq_cfg *);
154extern void irq_complete_move(struct irq_cfg *cfg);
155#else
156static inline void send_cleanup_vector(struct irq_cfg *c) { }
157static inline void irq_complete_move(struct irq_cfg *c) { }
158#endif
159
160extern void apic_ack_edge(struct irq_data *data);
161#else /* CONFIG_X86_LOCAL_APIC */
162static inline void lock_vector_lock(void) {}
163static inline void unlock_vector_lock(void) {}
164#endif /* CONFIG_X86_LOCAL_APIC */
165
166/* Statistics */
167extern atomic_t irq_err_count;
168extern atomic_t irq_mis_count;
169
170extern void elcr_set_level_irq(unsigned int irq);
171
172extern char irq_entries_start[];
173#ifdef CONFIG_TRACING
174#define trace_irq_entries_start irq_entries_start
175#endif
176
177#define VECTOR_UNUSED NULL
178#define VECTOR_RETRIGGERED ((void *)~0UL)
179
180typedef struct irq_desc* vector_irq_t[NR_VECTORS];
181DECLARE_PER_CPU(vector_irq_t, vector_irq);
182
183#endif /* !ASSEMBLY_ */
184
185#endif /* _ASM_X86_HW_IRQ_H */
1/* SPDX-License-Identifier: GPL-2.0 */
2#ifndef _ASM_X86_HW_IRQ_H
3#define _ASM_X86_HW_IRQ_H
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
17#include <asm/irq_vectors.h>
18
19#define IRQ_MATRIX_BITS NR_VECTORS
20
21#ifndef __ASSEMBLY__
22
23#include <linux/percpu.h>
24#include <linux/profile.h>
25#include <linux/smp.h>
26
27#include <linux/atomic.h>
28#include <asm/irq.h>
29#include <asm/sections.h>
30
31#ifdef CONFIG_IRQ_DOMAIN_HIERARCHY
32struct irq_data;
33struct pci_dev;
34struct msi_desc;
35
36enum irq_alloc_type {
37 X86_IRQ_ALLOC_TYPE_IOAPIC = 1,
38 X86_IRQ_ALLOC_TYPE_HPET,
39 X86_IRQ_ALLOC_TYPE_PCI_MSI,
40 X86_IRQ_ALLOC_TYPE_PCI_MSIX,
41 X86_IRQ_ALLOC_TYPE_DMAR,
42 X86_IRQ_ALLOC_TYPE_AMDVI,
43 X86_IRQ_ALLOC_TYPE_UV,
44};
45
46struct ioapic_alloc_info {
47 int pin;
48 int node;
49 u32 is_level : 1;
50 u32 active_low : 1;
51 u32 valid : 1;
52};
53
54struct uv_alloc_info {
55 int limit;
56 int blade;
57 unsigned long offset;
58 char *name;
59
60};
61
62/**
63 * irq_alloc_info - X86 specific interrupt allocation info
64 * @type: X86 specific allocation type
65 * @flags: Flags for allocation tweaks
66 * @devid: Device ID for allocations
67 * @hwirq: Associated hw interrupt number in the domain
68 * @mask: CPU mask for vector allocation
69 * @desc: Pointer to msi descriptor
70 * @data: Allocation specific data
71 *
72 * @ioapic: IOAPIC specific allocation data
73 * @uv: UV specific allocation data
74*/
75struct irq_alloc_info {
76 enum irq_alloc_type type;
77 u32 flags;
78 u32 devid;
79 irq_hw_number_t hwirq;
80 const struct cpumask *mask;
81 struct msi_desc *desc;
82 void *data;
83
84 union {
85 struct ioapic_alloc_info ioapic;
86 struct uv_alloc_info uv;
87 };
88};
89
90struct irq_cfg {
91 unsigned int dest_apicid;
92 unsigned int vector;
93};
94
95extern struct irq_cfg *irq_cfg(unsigned int irq);
96extern struct irq_cfg *irqd_cfg(struct irq_data *irq_data);
97extern void lock_vector_lock(void);
98extern void unlock_vector_lock(void);
99#ifdef CONFIG_SMP
100extern void vector_schedule_cleanup(struct irq_cfg *);
101extern void irq_complete_move(struct irq_cfg *cfg);
102#else
103static inline void vector_schedule_cleanup(struct irq_cfg *c) { }
104static inline void irq_complete_move(struct irq_cfg *c) { }
105#endif
106
107extern void apic_ack_edge(struct irq_data *data);
108#else /* CONFIG_IRQ_DOMAIN_HIERARCHY */
109static inline void lock_vector_lock(void) {}
110static inline void unlock_vector_lock(void) {}
111#endif /* CONFIG_IRQ_DOMAIN_HIERARCHY */
112
113/* Statistics */
114extern atomic_t irq_err_count;
115extern atomic_t irq_mis_count;
116
117extern void elcr_set_level_irq(unsigned int irq);
118
119extern char irq_entries_start[];
120#ifdef CONFIG_TRACING
121#define trace_irq_entries_start irq_entries_start
122#endif
123
124extern char spurious_entries_start[];
125
126#define VECTOR_UNUSED NULL
127#define VECTOR_SHUTDOWN ((void *)-1L)
128#define VECTOR_RETRIGGERED ((void *)-2L)
129
130typedef struct irq_desc* vector_irq_t[NR_VECTORS];
131DECLARE_PER_CPU(vector_irq_t, vector_irq);
132
133#endif /* !ASSEMBLY_ */
134
135#endif /* _ASM_X86_HW_IRQ_H */