hw_irq.h 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185
  1. #ifndef _ASM_X86_HW_IRQ_H
  2. #define _ASM_X86_HW_IRQ_H
  3. /*
  4. * (C) 1992, 1993 Linus Torvalds, (C) 1997 Ingo Molnar
  5. *
  6. * moved some of the old arch/i386/kernel/irq.h to here. VY
  7. *
  8. * IRQ/IPI changes taken from work by Thomas Radke
  9. * <tomsoft@informatik.tu-chemnitz.de>
  10. *
  11. * hacked by Andi Kleen for x86-64.
  12. * unified by tglx
  13. */
  14. #include <asm/irq_vectors.h>
  15. #ifndef __ASSEMBLY__
  16. #include <linux/percpu.h>
  17. #include <linux/profile.h>
  18. #include <linux/smp.h>
  19. #include <linux/atomic.h>
  20. #include <asm/irq.h>
  21. #include <asm/sections.h>
  22. /* Interrupt handlers registered during init_IRQ */
  23. extern asmlinkage void apic_timer_interrupt(void);
  24. extern asmlinkage void x86_platform_ipi(void);
  25. extern asmlinkage void kvm_posted_intr_ipi(void);
  26. extern asmlinkage void kvm_posted_intr_wakeup_ipi(void);
  27. extern asmlinkage void error_interrupt(void);
  28. extern asmlinkage void irq_work_interrupt(void);
  29. extern asmlinkage void spurious_interrupt(void);
  30. extern asmlinkage void thermal_interrupt(void);
  31. extern asmlinkage void reschedule_interrupt(void);
  32. extern asmlinkage void irq_move_cleanup_interrupt(void);
  33. extern asmlinkage void reboot_interrupt(void);
  34. extern asmlinkage void threshold_interrupt(void);
  35. extern asmlinkage void deferred_error_interrupt(void);
  36. extern asmlinkage void call_function_interrupt(void);
  37. extern asmlinkage void call_function_single_interrupt(void);
  38. #ifdef CONFIG_TRACING
  39. /* Interrupt handlers registered during init_IRQ */
  40. extern void trace_apic_timer_interrupt(void);
  41. extern void trace_x86_platform_ipi(void);
  42. extern void trace_error_interrupt(void);
  43. extern void trace_irq_work_interrupt(void);
  44. extern void trace_spurious_interrupt(void);
  45. extern void trace_thermal_interrupt(void);
  46. extern void trace_reschedule_interrupt(void);
  47. extern void trace_threshold_interrupt(void);
  48. extern void trace_deferred_error_interrupt(void);
  49. extern void trace_call_function_interrupt(void);
  50. extern void trace_call_function_single_interrupt(void);
  51. #define trace_irq_move_cleanup_interrupt irq_move_cleanup_interrupt
  52. #define trace_reboot_interrupt reboot_interrupt
  53. #define trace_kvm_posted_intr_ipi kvm_posted_intr_ipi
  54. #define trace_kvm_posted_intr_wakeup_ipi kvm_posted_intr_wakeup_ipi
  55. #endif /* CONFIG_TRACING */
  56. #ifdef CONFIG_X86_LOCAL_APIC
  57. struct irq_data;
  58. struct pci_dev;
  59. struct msi_desc;
  60. enum irq_alloc_type {
  61. X86_IRQ_ALLOC_TYPE_IOAPIC = 1,
  62. X86_IRQ_ALLOC_TYPE_HPET,
  63. X86_IRQ_ALLOC_TYPE_MSI,
  64. X86_IRQ_ALLOC_TYPE_MSIX,
  65. X86_IRQ_ALLOC_TYPE_DMAR,
  66. X86_IRQ_ALLOC_TYPE_UV,
  67. };
  68. struct irq_alloc_info {
  69. enum irq_alloc_type type;
  70. u32 flags;
  71. const struct cpumask *mask; /* CPU mask for vector allocation */
  72. union {
  73. int unused;
  74. #ifdef CONFIG_HPET_TIMER
  75. struct {
  76. int hpet_id;
  77. int hpet_index;
  78. void *hpet_data;
  79. };
  80. #endif
  81. #ifdef CONFIG_PCI_MSI
  82. struct {
  83. struct pci_dev *msi_dev;
  84. irq_hw_number_t msi_hwirq;
  85. };
  86. #endif
  87. #ifdef CONFIG_X86_IO_APIC
  88. struct {
  89. int ioapic_id;
  90. int ioapic_pin;
  91. int ioapic_node;
  92. u32 ioapic_trigger : 1;
  93. u32 ioapic_polarity : 1;
  94. u32 ioapic_valid : 1;
  95. struct IO_APIC_route_entry *ioapic_entry;
  96. };
  97. #endif
  98. #ifdef CONFIG_DMAR_TABLE
  99. struct {
  100. int dmar_id;
  101. void *dmar_data;
  102. };
  103. #endif
  104. #ifdef CONFIG_HT_IRQ
  105. struct {
  106. int ht_pos;
  107. int ht_idx;
  108. struct pci_dev *ht_dev;
  109. void *ht_update;
  110. };
  111. #endif
  112. #ifdef CONFIG_X86_UV
  113. struct {
  114. int uv_limit;
  115. int uv_blade;
  116. unsigned long uv_offset;
  117. char *uv_name;
  118. };
  119. #endif
  120. #if IS_ENABLED(CONFIG_VMD)
  121. struct {
  122. struct msi_desc *desc;
  123. };
  124. #endif
  125. };
  126. };
  127. struct irq_cfg {
  128. unsigned int dest_apicid;
  129. u8 vector;
  130. u8 old_vector;
  131. };
  132. extern struct irq_cfg *irq_cfg(unsigned int irq);
  133. extern struct irq_cfg *irqd_cfg(struct irq_data *irq_data);
  134. extern void lock_vector_lock(void);
  135. extern void unlock_vector_lock(void);
  136. extern void setup_vector_irq(int cpu);
  137. #ifdef CONFIG_SMP
  138. extern void send_cleanup_vector(struct irq_cfg *);
  139. extern void irq_complete_move(struct irq_cfg *cfg);
  140. #else
  141. static inline void send_cleanup_vector(struct irq_cfg *c) { }
  142. static inline void irq_complete_move(struct irq_cfg *c) { }
  143. #endif
  144. extern void apic_ack_edge(struct irq_data *data);
  145. #else /* CONFIG_X86_LOCAL_APIC */
  146. static inline void lock_vector_lock(void) {}
  147. static inline void unlock_vector_lock(void) {}
  148. #endif /* CONFIG_X86_LOCAL_APIC */
  149. /* Statistics */
  150. extern atomic_t irq_err_count;
  151. extern atomic_t irq_mis_count;
  152. extern void elcr_set_level_irq(unsigned int irq);
  153. extern char irq_entries_start[];
  154. #ifdef CONFIG_TRACING
  155. #define trace_irq_entries_start irq_entries_start
  156. #endif
  157. #define VECTOR_UNUSED NULL
  158. #define VECTOR_RETRIGGERED ((void *)~0UL)
  159. typedef struct irq_desc* vector_irq_t[NR_VECTORS];
  160. DECLARE_PER_CPU(vector_irq_t, vector_irq);
  161. #endif /* !ASSEMBLY_ */
  162. #endif /* _ASM_X86_HW_IRQ_H */