Linux Audio

Check our new training course

Loading...
v4.17
  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 */
v3.5.6
 
  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 void apic_timer_interrupt(void);
 30extern void x86_platform_ipi(void);
 31extern void error_interrupt(void);
 32extern void irq_work_interrupt(void);
 33
 34extern void spurious_interrupt(void);
 35extern void thermal_interrupt(void);
 36extern void reschedule_interrupt(void);
 37
 38extern void invalidate_interrupt(void);
 39extern void invalidate_interrupt0(void);
 40extern void invalidate_interrupt1(void);
 41extern void invalidate_interrupt2(void);
 42extern void invalidate_interrupt3(void);
 43extern void invalidate_interrupt4(void);
 44extern void invalidate_interrupt5(void);
 45extern void invalidate_interrupt6(void);
 46extern void invalidate_interrupt7(void);
 47extern void invalidate_interrupt8(void);
 48extern void invalidate_interrupt9(void);
 49extern void invalidate_interrupt10(void);
 50extern void invalidate_interrupt11(void);
 51extern void invalidate_interrupt12(void);
 52extern void invalidate_interrupt13(void);
 53extern void invalidate_interrupt14(void);
 54extern void invalidate_interrupt15(void);
 55extern void invalidate_interrupt16(void);
 56extern void invalidate_interrupt17(void);
 57extern void invalidate_interrupt18(void);
 58extern void invalidate_interrupt19(void);
 59extern void invalidate_interrupt20(void);
 60extern void invalidate_interrupt21(void);
 61extern void invalidate_interrupt22(void);
 62extern void invalidate_interrupt23(void);
 63extern void invalidate_interrupt24(void);
 64extern void invalidate_interrupt25(void);
 65extern void invalidate_interrupt26(void);
 66extern void invalidate_interrupt27(void);
 67extern void invalidate_interrupt28(void);
 68extern void invalidate_interrupt29(void);
 69extern void invalidate_interrupt30(void);
 70extern void invalidate_interrupt31(void);
 71
 72extern void irq_move_cleanup_interrupt(void);
 73extern void reboot_interrupt(void);
 74extern void threshold_interrupt(void);
 75
 76extern void call_function_interrupt(void);
 77extern void call_function_single_interrupt(void);
 78
 79/* IOAPIC */
 80#define IO_APIC_IRQ(x) (((x) >= NR_IRQS_LEGACY) || ((1<<(x)) & io_apic_irqs))
 81extern unsigned long io_apic_irqs;
 82
 83extern void init_VISWS_APIC_irqs(void);
 84extern void setup_IO_APIC(void);
 85extern void disable_IO_APIC(void);
 86
 87struct io_apic_irq_attr {
 88	int ioapic;
 89	int ioapic_pin;
 90	int trigger;
 91	int polarity;
 92};
 93
 94static inline void set_io_apic_irq_attr(struct io_apic_irq_attr *irq_attr,
 95					int ioapic, int ioapic_pin,
 96					int trigger, int polarity)
 97{
 98	irq_attr->ioapic	= ioapic;
 99	irq_attr->ioapic_pin	= ioapic_pin;
100	irq_attr->trigger	= trigger;
101	irq_attr->polarity	= polarity;
102}
103
104struct irq_2_iommu {
105	struct intel_iommu *iommu;
106	u16 irte_index;
107	u16 sub_handle;
108	u8  irte_mask;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
109};
110
111/*
112 * This is performance-critical, we want to do it O(1)
113 *
114 * Most irqs are mapped 1:1 with pins.
115 */
116struct irq_cfg {
117	struct irq_pin_list	*irq_2_pin;
118	cpumask_var_t		domain;
119	cpumask_var_t		old_domain;
120	u8			vector;
121	u8			move_in_progress : 1;
122#ifdef CONFIG_IRQ_REMAP
123	struct irq_2_iommu	irq_2_iommu;
124#endif
125};
126
127extern int assign_irq_vector(int, struct irq_cfg *, const struct cpumask *);
 
 
 
 
128extern void send_cleanup_vector(struct irq_cfg *);
 
 
 
 
 
129
130struct irq_data;
131int __ioapic_set_affinity(struct irq_data *, const struct cpumask *,
132			  unsigned int *dest_id);
133extern int IO_APIC_get_PCI_irq_vector(int bus, int devfn, int pin, struct io_apic_irq_attr *irq_attr);
134extern void setup_ioapic_dest(void);
135
136extern void enable_IO_APIC(void);
137
138/* Statistics */
139extern atomic_t irq_err_count;
140extern atomic_t irq_mis_count;
141
142/* EISA */
143extern void eisa_set_level_irq(unsigned int irq);
144
145/* SMP */
146extern void smp_apic_timer_interrupt(struct pt_regs *);
147extern void smp_spurious_interrupt(struct pt_regs *);
148extern void smp_x86_platform_ipi(struct pt_regs *);
149extern void smp_error_interrupt(struct pt_regs *);
150#ifdef CONFIG_X86_IO_APIC
151extern asmlinkage void smp_irq_move_cleanup_interrupt(void);
152#endif
153#ifdef CONFIG_SMP
154extern void smp_reschedule_interrupt(struct pt_regs *);
155extern void smp_call_function_interrupt(struct pt_regs *);
156extern void smp_call_function_single_interrupt(struct pt_regs *);
157#ifdef CONFIG_X86_32
158extern void smp_invalidate_interrupt(struct pt_regs *);
159#else
160extern asmlinkage void smp_invalidate_interrupt(struct pt_regs *);
161#endif
162#endif
163
164extern void (*__initconst interrupt[NR_VECTORS-FIRST_EXTERNAL_VECTOR])(void);
 
165
166typedef int vector_irq_t[NR_VECTORS];
167DECLARE_PER_CPU(vector_irq_t, vector_irq);
168extern void setup_vector_irq(int cpu);
169
170#ifdef CONFIG_X86_IO_APIC
171extern void lock_vector_lock(void);
172extern void unlock_vector_lock(void);
173extern void __setup_vector_irq(int cpu);
174#else
175static inline void lock_vector_lock(void) {}
176static inline void unlock_vector_lock(void) {}
177static inline void __setup_vector_irq(int cpu) {}
178#endif
179
180#endif /* !ASSEMBLY_ */
181
182#endif /* _ASM_X86_HW_IRQ_H */