hw_irq.h 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167
  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_X86_LOCAL_APIC
  40. struct irq_data;
  41. struct pci_dev;
  42. struct msi_desc;
  43. enum irq_alloc_type {
  44. X86_IRQ_ALLOC_TYPE_IOAPIC = 1,
  45. X86_IRQ_ALLOC_TYPE_HPET,
  46. X86_IRQ_ALLOC_TYPE_MSI,
  47. X86_IRQ_ALLOC_TYPE_MSIX,
  48. X86_IRQ_ALLOC_TYPE_DMAR,
  49. X86_IRQ_ALLOC_TYPE_UV,
  50. };
  51. struct irq_alloc_info {
  52. enum irq_alloc_type type;
  53. u32 flags;
  54. const struct cpumask *mask; /* CPU mask for vector allocation */
  55. union {
  56. int unused;
  57. #ifdef CONFIG_HPET_TIMER
  58. struct {
  59. int hpet_id;
  60. int hpet_index;
  61. void *hpet_data;
  62. };
  63. #endif
  64. #ifdef CONFIG_PCI_MSI
  65. struct {
  66. struct pci_dev *msi_dev;
  67. irq_hw_number_t msi_hwirq;
  68. };
  69. #endif
  70. #ifdef CONFIG_X86_IO_APIC
  71. struct {
  72. int ioapic_id;
  73. int ioapic_pin;
  74. int ioapic_node;
  75. u32 ioapic_trigger : 1;
  76. u32 ioapic_polarity : 1;
  77. u32 ioapic_valid : 1;
  78. struct IO_APIC_route_entry *ioapic_entry;
  79. };
  80. #endif
  81. #ifdef CONFIG_DMAR_TABLE
  82. struct {
  83. int dmar_id;
  84. void *dmar_data;
  85. };
  86. #endif
  87. #ifdef CONFIG_HT_IRQ
  88. struct {
  89. int ht_pos;
  90. int ht_idx;
  91. struct pci_dev *ht_dev;
  92. void *ht_update;
  93. };
  94. #endif
  95. #ifdef CONFIG_X86_UV
  96. struct {
  97. int uv_limit;
  98. int uv_blade;
  99. unsigned long uv_offset;
  100. char *uv_name;
  101. };
  102. #endif
  103. #if IS_ENABLED(CONFIG_VMD)
  104. struct {
  105. struct msi_desc *desc;
  106. };
  107. #endif
  108. };
  109. };
  110. struct irq_cfg {
  111. unsigned int dest_apicid;
  112. u8 vector;
  113. u8 old_vector;
  114. };
  115. extern struct irq_cfg *irq_cfg(unsigned int irq);
  116. extern struct irq_cfg *irqd_cfg(struct irq_data *irq_data);
  117. extern void lock_vector_lock(void);
  118. extern void unlock_vector_lock(void);
  119. extern void setup_vector_irq(int cpu);
  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 */