diff options
author | Jiang Liu <jiang.liu@linux.intel.com> | 2014-10-27 04:11:56 -0400 |
---|---|---|
committer | Thomas Gleixner <tglx@linutronix.de> | 2014-12-16 08:08:16 -0500 |
commit | 26011eee04f7144a4bcb150386b43e6e881f8fa1 (patch) | |
tree | a0d2b41249d62ffc6797863273a667d123e3ac23 | |
parent | a178b87b20803aa1cf991f39616e51f4939fbcaf (diff) |
x86, irq: Refine hw_irq.h to prepare for irqdomain support
Refine hw_irq.h to prepare for irqdomain support by:
1) guarding common APIC related interfaces with CONFIG_X86_LOCAL_APIC
2) guarding interrupt remapping related interfaces with CONFIG_IRQ_REMAP
3) guarding IOAPIC related interfaces with CONFIG_X86_IO_APIC
No functional changes.
Signed-off-by: Jiang Liu <jiang.liu@linux.intel.com>
Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Cc: Tony Luck <tony.luck@intel.com>
Cc: Joerg Roedel <joro@8bytes.org>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Rafael J. Wysocki <rjw@rjwysocki.net>
Cc: Bjorn Helgaas <bhelgaas@google.com>
Cc: Randy Dunlap <rdunlap@infradead.org>
Cc: Yinghai Lu <yinghai@kernel.org>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Prarit Bhargava <prarit@redhat.com>
Link: http://lkml.kernel.org/r/1414397531-28254-6-git-send-email-jiang.liu@linux.intel.com
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
-rw-r--r-- | arch/x86/include/asm/hw_irq.h | 94 |
1 files changed, 51 insertions, 43 deletions
diff --git a/arch/x86/include/asm/hw_irq.h b/arch/x86/include/asm/hw_irq.h index 66e59e646deb..9e2d08b4737b 100644 --- a/arch/x86/include/asm/hw_irq.h +++ b/arch/x86/include/asm/hw_irq.h | |||
@@ -94,30 +94,7 @@ extern void trace_call_function_single_interrupt(void); | |||
94 | #define trace_kvm_posted_intr_ipi kvm_posted_intr_ipi | 94 | #define trace_kvm_posted_intr_ipi kvm_posted_intr_ipi |
95 | #endif /* CONFIG_TRACING */ | 95 | #endif /* CONFIG_TRACING */ |
96 | 96 | ||
97 | /* IOAPIC */ | 97 | #ifdef CONFIG_IRQ_REMAP |
98 | #define IO_APIC_IRQ(x) (((x) >= NR_IRQS_LEGACY) || ((1<<(x)) & io_apic_irqs)) | ||
99 | extern unsigned long io_apic_irqs; | ||
100 | |||
101 | extern void setup_IO_APIC(void); | ||
102 | extern void disable_IO_APIC(void); | ||
103 | |||
104 | struct io_apic_irq_attr { | ||
105 | int ioapic; | ||
106 | int ioapic_pin; | ||
107 | int trigger; | ||
108 | int polarity; | ||
109 | }; | ||
110 | |||
111 | static inline void set_io_apic_irq_attr(struct io_apic_irq_attr *irq_attr, | ||
112 | int ioapic, int ioapic_pin, | ||
113 | int trigger, int polarity) | ||
114 | { | ||
115 | irq_attr->ioapic = ioapic; | ||
116 | irq_attr->ioapic_pin = ioapic_pin; | ||
117 | irq_attr->trigger = trigger; | ||
118 | irq_attr->polarity = polarity; | ||
119 | } | ||
120 | |||
121 | /* Intel specific interrupt remapping information */ | 98 | /* Intel specific interrupt remapping information */ |
122 | struct irq_2_iommu { | 99 | struct irq_2_iommu { |
123 | struct intel_iommu *iommu; | 100 | struct intel_iommu *iommu; |
@@ -131,14 +108,10 @@ struct irq_2_irte { | |||
131 | u16 devid; /* Device ID for IRTE table */ | 108 | u16 devid; /* Device ID for IRTE table */ |
132 | u16 index; /* Index into IRTE table*/ | 109 | u16 index; /* Index into IRTE table*/ |
133 | }; | 110 | }; |
111 | #endif /* CONFIG_IRQ_REMAP */ | ||
134 | 112 | ||
135 | /* | 113 | #ifdef CONFIG_X86_LOCAL_APIC |
136 | * This is performance-critical, we want to do it O(1) | ||
137 | * | ||
138 | * Most irqs are mapped 1:1 with pins. | ||
139 | */ | ||
140 | struct irq_cfg { | 114 | struct irq_cfg { |
141 | struct list_head irq_2_pin; | ||
142 | cpumask_var_t domain; | 115 | cpumask_var_t domain; |
143 | cpumask_var_t old_domain; | 116 | cpumask_var_t old_domain; |
144 | u8 vector; | 117 | u8 vector; |
@@ -150,8 +123,16 @@ struct irq_cfg { | |||
150 | struct irq_2_irte irq_2_irte; | 123 | struct irq_2_irte irq_2_irte; |
151 | }; | 124 | }; |
152 | #endif | 125 | #endif |
126 | union { | ||
127 | #ifdef CONFIG_X86_IO_APIC | ||
128 | struct { | ||
129 | struct list_head irq_2_pin; | ||
130 | }; | ||
131 | #endif | ||
132 | }; | ||
153 | }; | 133 | }; |
154 | 134 | ||
135 | extern void setup_vector_irq(int cpu); | ||
155 | extern int assign_irq_vector(int, struct irq_cfg *, const struct cpumask *); | 136 | extern int assign_irq_vector(int, struct irq_cfg *, const struct cpumask *); |
156 | #ifdef CONFIG_SMP | 137 | #ifdef CONFIG_SMP |
157 | extern void send_cleanup_vector(struct irq_cfg *); | 138 | extern void send_cleanup_vector(struct irq_cfg *); |
@@ -162,10 +143,48 @@ static inline void send_cleanup_vector(struct irq_cfg *c) { } | |||
162 | struct irq_data; | 143 | struct irq_data; |
163 | int __ioapic_set_affinity(struct irq_data *, const struct cpumask *, | 144 | int __ioapic_set_affinity(struct irq_data *, const struct cpumask *, |
164 | unsigned int *dest_id); | 145 | unsigned int *dest_id); |
165 | extern int IO_APIC_get_PCI_irq_vector(int bus, int devfn, int pin); | 146 | #endif /* CONFIG_X86_LOCAL_APIC */ |
166 | extern void setup_ioapic_dest(void); | 147 | |
148 | #ifdef CONFIG_X86_IO_APIC | ||
149 | extern void lock_vector_lock(void); | ||
150 | extern void unlock_vector_lock(void); | ||
151 | extern void __setup_vector_irq(int cpu); | ||
152 | #else | ||
153 | static inline void lock_vector_lock(void) {} | ||
154 | static inline void unlock_vector_lock(void) {} | ||
155 | static inline void __setup_vector_irq(int cpu) {} | ||
156 | #endif | ||
157 | |||
158 | /* IOAPIC */ | ||
159 | #ifdef CONFIG_X86_IO_APIC | ||
160 | struct io_apic_irq_attr { | ||
161 | int ioapic; | ||
162 | int ioapic_pin; | ||
163 | int trigger; | ||
164 | int polarity; | ||
165 | }; | ||
166 | |||
167 | static inline void set_io_apic_irq_attr(struct io_apic_irq_attr *irq_attr, | ||
168 | int ioapic, int ioapic_pin, | ||
169 | int trigger, int polarity) | ||
170 | { | ||
171 | irq_attr->ioapic = ioapic; | ||
172 | irq_attr->ioapic_pin = ioapic_pin; | ||
173 | irq_attr->trigger = trigger; | ||
174 | irq_attr->polarity = polarity; | ||
175 | } | ||
167 | 176 | ||
177 | extern void setup_IO_APIC(void); | ||
168 | extern void enable_IO_APIC(void); | 178 | extern void enable_IO_APIC(void); |
179 | extern void disable_IO_APIC(void); | ||
180 | extern void setup_ioapic_dest(void); | ||
181 | extern int IO_APIC_get_PCI_irq_vector(int bus, int devfn, int pin); | ||
182 | |||
183 | extern unsigned long io_apic_irqs; | ||
184 | #define IO_APIC_IRQ(x) (((x) >= NR_IRQS_LEGACY) || ((1 << (x)) & io_apic_irqs)) | ||
185 | #else /* CONFIG_X86_IO_APIC */ | ||
186 | #define IO_APIC_IRQ(x) 0 | ||
187 | #endif /* CONFIG_X86_IO_APIC */ | ||
169 | 188 | ||
170 | /* Statistics */ | 189 | /* Statistics */ |
171 | extern atomic_t irq_err_count; | 190 | extern atomic_t irq_err_count; |
@@ -200,17 +219,6 @@ extern void (*__initconst interrupt[FIRST_SYSTEM_VECTOR | |||
200 | 219 | ||
201 | typedef int vector_irq_t[NR_VECTORS]; | 220 | typedef int vector_irq_t[NR_VECTORS]; |
202 | DECLARE_PER_CPU(vector_irq_t, vector_irq); | 221 | DECLARE_PER_CPU(vector_irq_t, vector_irq); |
203 | extern void setup_vector_irq(int cpu); | ||
204 | |||
205 | #ifdef CONFIG_X86_IO_APIC | ||
206 | extern void lock_vector_lock(void); | ||
207 | extern void unlock_vector_lock(void); | ||
208 | extern void __setup_vector_irq(int cpu); | ||
209 | #else | ||
210 | static inline void lock_vector_lock(void) {} | ||
211 | static inline void unlock_vector_lock(void) {} | ||
212 | static inline void __setup_vector_irq(int cpu) {} | ||
213 | #endif | ||
214 | 222 | ||
215 | #endif /* !ASSEMBLY_ */ | 223 | #endif /* !ASSEMBLY_ */ |
216 | 224 | ||