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_X86_LOCAL_APIC 32 struct irq_data; 33 struct pci_dev; 34 struct msi_desc; 35 36 enum irq_alloc_type { 37 X86_IRQ_ALLOC_TYPE_IOAPIC = 1, 38 X86_IRQ_ALLOC_TYPE_HPET, 39 X86_IRQ_ALLOC_TYPE_MSI, 40 X86_IRQ_ALLOC_TYPE_MSIX, 41 X86_IRQ_ALLOC_TYPE_DMAR, 42 X86_IRQ_ALLOC_TYPE_UV, 43 }; 44 45 struct irq_alloc_info { 46 enum irq_alloc_type type; 47 u32 flags; 48 const struct cpumask *mask; /* CPU mask for vector allocation */ 49 union { 50 int unused; 51 #ifdef CONFIG_HPET_TIMER 52 struct { 53 int hpet_id; 54 int hpet_index; 55 void *hpet_data; 56 }; 57 #endif 58 #ifdef CONFIG_PCI_MSI 59 struct { 60 struct pci_dev *msi_dev; 61 irq_hw_number_t msi_hwirq; 62 }; 63 #endif 64 #ifdef CONFIG_X86_IO_APIC 65 struct { 66 int ioapic_id; 67 int ioapic_pin; 68 int ioapic_node; 69 u32 ioapic_trigger : 1; 70 u32 ioapic_polarity : 1; 71 u32 ioapic_valid : 1; 72 struct IO_APIC_route_entry *ioapic_entry; 73 }; 74 #endif 75 #ifdef CONFIG_DMAR_TABLE 76 struct { 77 int dmar_id; 78 void *dmar_data; 79 }; 80 #endif 81 #ifdef CONFIG_X86_UV 82 struct { 83 int uv_limit; 84 int uv_blade; 85 unsigned long uv_offset; 86 char *uv_name; 87 }; 88 #endif 89 #if IS_ENABLED(CONFIG_VMD) 90 struct { 91 struct msi_desc *desc; 92 }; 93 #endif 94 }; 95 }; 96 97 struct irq_cfg { 98 unsigned int dest_apicid; 99 unsigned int vector; 100 }; 101 102 extern struct irq_cfg *irq_cfg(unsigned int irq); 103 extern struct irq_cfg *irqd_cfg(struct irq_data *irq_data); 104 extern void lock_vector_lock(void); 105 extern void unlock_vector_lock(void); 106 #ifdef CONFIG_SMP 107 extern void send_cleanup_vector(struct irq_cfg *); 108 extern void irq_complete_move(struct irq_cfg *cfg); 109 #else 110 static inline void send_cleanup_vector(struct irq_cfg *c) { } 111 static inline void irq_complete_move(struct irq_cfg *c) { } 112 #endif 113 114 extern void apic_ack_edge(struct irq_data *data); 115 #else /* CONFIG_X86_LOCAL_APIC */ 116 static inline void lock_vector_lock(void) {} 117 static inline void unlock_vector_lock(void) {} 118 #endif /* CONFIG_X86_LOCAL_APIC */ 119 120 /* Statistics */ 121 extern atomic_t irq_err_count; 122 extern atomic_t irq_mis_count; 123 124 extern void elcr_set_level_irq(unsigned int irq); 125 126 extern char irq_entries_start[]; 127 #ifdef CONFIG_TRACING 128 #define trace_irq_entries_start irq_entries_start 129 #endif 130 131 extern char spurious_entries_start[]; 132 133 #define VECTOR_UNUSED NULL 134 #define VECTOR_SHUTDOWN ((void *)-1L) 135 #define VECTOR_RETRIGGERED ((void *)-2L) 136 137 typedef struct irq_desc* vector_irq_t[NR_VECTORS]; 138 DECLARE_PER_CPU(vector_irq_t, vector_irq); 139 140 #endif /* !ASSEMBLY_ */ 141 142 #endif /* _ASM_X86_HW_IRQ_H */ 143