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