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/* Interrupt handlers registered during init_IRQ */ 30extern asmlinkage void apic_timer_interrupt(void); 31extern asmlinkage void x86_platform_ipi(void); 32extern asmlinkage void kvm_posted_intr_ipi(void); 33extern asmlinkage void kvm_posted_intr_wakeup_ipi(void); 34extern asmlinkage void kvm_posted_intr_nested_ipi(void); 35extern asmlinkage void error_interrupt(void); 36extern asmlinkage void irq_work_interrupt(void); 37 38extern asmlinkage void spurious_interrupt(void); 39extern asmlinkage void thermal_interrupt(void); 40extern asmlinkage void reschedule_interrupt(void); 41 42extern asmlinkage void irq_move_cleanup_interrupt(void); 43extern asmlinkage void reboot_interrupt(void); 44extern asmlinkage void threshold_interrupt(void); 45extern asmlinkage void deferred_error_interrupt(void); 46 47extern asmlinkage void call_function_interrupt(void); 48extern asmlinkage void call_function_single_interrupt(void); 49 50#ifdef CONFIG_X86_LOCAL_APIC 51struct irq_data; 52struct pci_dev; 53struct msi_desc; 54 55enum irq_alloc_type { 56 X86_IRQ_ALLOC_TYPE_IOAPIC = 1, 57 X86_IRQ_ALLOC_TYPE_HPET, 58 X86_IRQ_ALLOC_TYPE_MSI, 59 X86_IRQ_ALLOC_TYPE_MSIX, 60 X86_IRQ_ALLOC_TYPE_DMAR, 61 X86_IRQ_ALLOC_TYPE_UV, 62}; 63 64struct irq_alloc_info { 65 enum irq_alloc_type type; 66 u32 flags; 67 const struct cpumask *mask; /* CPU mask for vector allocation */ 68 union { 69 int unused; 70#ifdef CONFIG_HPET_TIMER 71 struct { 72 int hpet_id; 73 int hpet_index; 74 void *hpet_data; 75 }; 76#endif 77#ifdef CONFIG_PCI_MSI 78 struct { 79 struct pci_dev *msi_dev; 80 irq_hw_number_t msi_hwirq; 81 }; 82#endif 83#ifdef CONFIG_X86_IO_APIC 84 struct { 85 int ioapic_id; 86 int ioapic_pin; 87 int ioapic_node; 88 u32 ioapic_trigger : 1; 89 u32 ioapic_polarity : 1; 90 u32 ioapic_valid : 1; 91 struct IO_APIC_route_entry *ioapic_entry; 92 }; 93#endif 94#ifdef CONFIG_DMAR_TABLE 95 struct { 96 int dmar_id; 97 void *dmar_data; 98 }; 99#endif 100#ifdef CONFIG_HT_IRQ 101 struct { 102 int ht_pos; 103 int ht_idx; 104 struct pci_dev *ht_dev; 105 void *ht_update; 106 }; 107#endif 108#ifdef CONFIG_X86_UV 109 struct { 110 int uv_limit; 111 int uv_blade; 112 unsigned long uv_offset; 113 char *uv_name; 114 }; 115#endif 116#if IS_ENABLED(CONFIG_VMD) 117 struct { 118 struct msi_desc *desc; 119 }; 120#endif 121 }; 122}; 123 124struct irq_cfg { 125 unsigned int dest_apicid; 126 u8 vector; 127 u8 old_vector; 128}; 129 130extern struct irq_cfg *irq_cfg(unsigned int irq); 131extern struct irq_cfg *irqd_cfg(struct irq_data *irq_data); 132extern void lock_vector_lock(void); 133extern void unlock_vector_lock(void); 134extern void setup_vector_irq(int cpu); 135#ifdef CONFIG_SMP 136extern void send_cleanup_vector(struct irq_cfg *); 137extern void irq_complete_move(struct irq_cfg *cfg); 138#else 139static inline void send_cleanup_vector(struct irq_cfg *c) { } 140static inline void irq_complete_move(struct irq_cfg *c) { } 141#endif 142 143extern void apic_ack_edge(struct irq_data *data); 144#else /* CONFIG_X86_LOCAL_APIC */ 145static inline void lock_vector_lock(void) {} 146static inline void unlock_vector_lock(void) {} 147#endif /* CONFIG_X86_LOCAL_APIC */ 148 149/* Statistics */ 150extern atomic_t irq_err_count; 151extern atomic_t irq_mis_count; 152 153extern void elcr_set_level_irq(unsigned int irq); 154 155extern char irq_entries_start[]; 156#ifdef CONFIG_TRACING 157#define trace_irq_entries_start irq_entries_start 158#endif 159 160#define VECTOR_UNUSED NULL 161#define VECTOR_RETRIGGERED ((void *)~0UL) 162 163typedef struct irq_desc* vector_irq_t[NR_VECTORS]; 164DECLARE_PER_CPU(vector_irq_t, vector_irq); 165 166#endif /* !ASSEMBLY_ */ 167 168#endif /* _ASM_X86_HW_IRQ_H */ 169