hw_irq.h 3.9 KB

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