hw_irq.h 4.9 KB

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