aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kernel/apic/io_apic.c
diff options
context:
space:
mode:
authorJoerg Roedel <joerg.roedel@amd.com>2012-03-30 14:47:03 -0400
committerJoerg Roedel <joerg.roedel@amd.com>2012-05-07 08:34:59 -0400
commit4c1bad6a0af1e297c8d05365e65af89d8c7bf9d1 (patch)
treea369a0bfd4c744b67e218ef294753a1ccc38b13a /arch/x86/kernel/apic/io_apic.c
parent0c3f173a88c4ae3e4253427cf574a59ad5352918 (diff)
iommu/vt-d: Convert IR set_affinity function to remap_ops
The function to set interrupt affinity with interrupt remapping enabled is Intel specific too. So move it to the irq_remap_ops too. Signed-off-by: Joerg Roedel <joerg.roedel@amd.com> Acked-by: Yinghai Lu <yinghai@kernel.org> Cc: David Woodhouse <dwmw2@infradead.org> Cc: Alex Williamson <alex.williamson@redhat.com> Signed-off-by: Suresh Siddha <suresh.b.siddha@intel.com> Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
Diffstat (limited to 'arch/x86/kernel/apic/io_apic.c')
-rw-r--r--arch/x86/kernel/apic/io_apic.c69
1 files changed, 2 insertions, 67 deletions
diff --git a/arch/x86/kernel/apic/io_apic.c b/arch/x86/kernel/apic/io_apic.c
index e1ab625fb9ca..a97c79aa25cf 100644
--- a/arch/x86/kernel/apic/io_apic.c
+++ b/arch/x86/kernel/apic/io_apic.c
@@ -2327,71 +2327,6 @@ ioapic_set_affinity(struct irq_data *data, const struct cpumask *mask,
2327 return ret; 2327 return ret;
2328} 2328}
2329 2329
2330#ifdef CONFIG_IRQ_REMAP
2331
2332/*
2333 * Migrate the IO-APIC irq in the presence of intr-remapping.
2334 *
2335 * For both level and edge triggered, irq migration is a simple atomic
2336 * update(of vector and cpu destination) of IRTE and flush the hardware cache.
2337 *
2338 * For level triggered, we eliminate the io-apic RTE modification (with the
2339 * updated vector information), by using a virtual vector (io-apic pin number).
2340 * Real vector that is used for interrupting cpu will be coming from
2341 * the interrupt-remapping table entry.
2342 *
2343 * As the migration is a simple atomic update of IRTE, the same mechanism
2344 * is used to migrate MSI irq's in the presence of interrupt-remapping.
2345 */
2346static int
2347ir_ioapic_set_affinity(struct irq_data *data, const struct cpumask *mask,
2348 bool force)
2349{
2350 struct irq_cfg *cfg = data->chip_data;
2351 unsigned int dest, irq = data->irq;
2352 struct irte irte;
2353
2354 if (!cpumask_intersects(mask, cpu_online_mask))
2355 return -EINVAL;
2356
2357 if (get_irte(irq, &irte))
2358 return -EBUSY;
2359
2360 if (assign_irq_vector(irq, cfg, mask))
2361 return -EBUSY;
2362
2363 dest = apic->cpu_mask_to_apicid_and(cfg->domain, mask);
2364
2365 irte.vector = cfg->vector;
2366 irte.dest_id = IRTE_DEST(dest);
2367
2368 /*
2369 * Atomically updates the IRTE with the new destination, vector
2370 * and flushes the interrupt entry cache.
2371 */
2372 modify_irte(irq, &irte);
2373
2374 /*
2375 * After this point, all the interrupts will start arriving
2376 * at the new destination. So, time to cleanup the previous
2377 * vector allocation.
2378 */
2379 if (cfg->move_in_progress)
2380 send_cleanup_vector(cfg);
2381
2382 cpumask_copy(data->affinity, mask);
2383 return 0;
2384}
2385
2386#else
2387static inline int
2388ir_ioapic_set_affinity(struct irq_data *data, const struct cpumask *mask,
2389 bool force)
2390{
2391 return 0;
2392}
2393#endif
2394
2395asmlinkage void smp_irq_move_cleanup_interrupt(void) 2330asmlinkage void smp_irq_move_cleanup_interrupt(void)
2396{ 2331{
2397 unsigned vector, me; 2332 unsigned vector, me;
@@ -2636,7 +2571,7 @@ static void irq_remap_modify_chip_defaults(struct irq_chip *chip)
2636 chip->irq_eoi = ir_ack_apic_level; 2571 chip->irq_eoi = ir_ack_apic_level;
2637 2572
2638#ifdef CONFIG_SMP 2573#ifdef CONFIG_SMP
2639 chip->irq_set_affinity = ir_ioapic_set_affinity; 2574 chip->irq_set_affinity = intr_set_affinity;
2640#endif 2575#endif
2641} 2576}
2642#endif /* CONFIG_IRQ_REMAP */ 2577#endif /* CONFIG_IRQ_REMAP */
@@ -3826,7 +3761,7 @@ void __init setup_ioapic_dest(void)
3826 mask = apic->target_cpus(); 3761 mask = apic->target_cpus();
3827 3762
3828 if (intr_remapping_enabled) 3763 if (intr_remapping_enabled)
3829 ir_ioapic_set_affinity(idata, mask, false); 3764 intr_set_affinity(idata, mask, false);
3830 else 3765 else
3831 ioapic_set_affinity(idata, mask, false); 3766 ioapic_set_affinity(idata, mask, false);
3832 } 3767 }