hw_irq.h 3.9 KB

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