hw_irq.h 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  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. * <[email protected]>
  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. #ifdef CONFIG_X86_LOCAL_APIC
  25. struct irq_data;
  26. struct pci_dev;
  27. struct msi_desc;
  28. enum irq_alloc_type {
  29. X86_IRQ_ALLOC_TYPE_IOAPIC = 1,
  30. X86_IRQ_ALLOC_TYPE_HPET,
  31. X86_IRQ_ALLOC_TYPE_PCI_MSI,
  32. X86_IRQ_ALLOC_TYPE_PCI_MSIX,
  33. X86_IRQ_ALLOC_TYPE_DMAR,
  34. X86_IRQ_ALLOC_TYPE_AMDVI,
  35. X86_IRQ_ALLOC_TYPE_UV,
  36. };
  37. struct ioapic_alloc_info {
  38. int pin;
  39. int node;
  40. u32 is_level : 1;
  41. u32 active_low : 1;
  42. u32 valid : 1;
  43. };
  44. struct uv_alloc_info {
  45. int limit;
  46. int blade;
  47. unsigned long offset;
  48. char *name;
  49. };
  50. /**
  51. * irq_alloc_info - X86 specific interrupt allocation info
  52. * @type: X86 specific allocation type
  53. * @flags: Flags for allocation tweaks
  54. * @devid: Device ID for allocations
  55. * @hwirq: Associated hw interrupt number in the domain
  56. * @mask: CPU mask for vector allocation
  57. * @desc: Pointer to msi descriptor
  58. * @data: Allocation specific data
  59. *
  60. * @ioapic: IOAPIC specific allocation data
  61. * @uv: UV specific allocation data
  62. */
  63. struct irq_alloc_info {
  64. enum irq_alloc_type type;
  65. u32 flags;
  66. u32 devid;
  67. irq_hw_number_t hwirq;
  68. const struct cpumask *mask;
  69. struct msi_desc *desc;
  70. void *data;
  71. union {
  72. struct ioapic_alloc_info ioapic;
  73. struct uv_alloc_info uv;
  74. };
  75. };
  76. struct irq_cfg {
  77. unsigned int dest_apicid;
  78. unsigned int vector;
  79. };
  80. extern struct irq_cfg *irq_cfg(unsigned int irq);
  81. extern struct irq_cfg *irqd_cfg(struct irq_data *irq_data);
  82. extern void lock_vector_lock(void);
  83. extern void unlock_vector_lock(void);
  84. #ifdef CONFIG_SMP
  85. extern void send_cleanup_vector(struct irq_cfg *);
  86. extern void irq_complete_move(struct irq_cfg *cfg);
  87. #else
  88. static inline void send_cleanup_vector(struct irq_cfg *c) { }
  89. static inline void irq_complete_move(struct irq_cfg *c) { }
  90. #endif
  91. extern void apic_ack_edge(struct irq_data *data);
  92. #else /* CONFIG_X86_LOCAL_APIC */
  93. static inline void lock_vector_lock(void) {}
  94. static inline void unlock_vector_lock(void) {}
  95. #endif /* CONFIG_X86_LOCAL_APIC */
  96. /* Statistics */
  97. extern atomic_t irq_err_count;
  98. extern atomic_t irq_mis_count;
  99. extern void elcr_set_level_irq(unsigned int irq);
  100. extern char irq_entries_start[];
  101. #ifdef CONFIG_TRACING
  102. #define trace_irq_entries_start irq_entries_start
  103. #endif
  104. extern char spurious_entries_start[];
  105. #define VECTOR_UNUSED NULL
  106. #define VECTOR_SHUTDOWN ((void *)-1L)
  107. #define VECTOR_RETRIGGERED ((void *)-2L)
  108. typedef struct irq_desc* vector_irq_t[NR_VECTORS];
  109. DECLARE_PER_CPU(vector_irq_t, vector_irq);
  110. #endif /* !ASSEMBLY_ */
  111. #endif /* _ASM_X86_HW_IRQ_H */