diff options
author | Joerg Roedel <joerg.roedel@amd.com> | 2012-03-30 14:47:02 -0400 |
---|---|---|
committer | Joerg Roedel <joerg.roedel@amd.com> | 2012-05-07 08:34:59 -0400 |
commit | 0c3f173a88c4ae3e4253427cf574a59ad5352918 (patch) | |
tree | d34364dc8d7926de75ec486ce579b478d23098e3 /arch/x86/kernel/apic | |
parent | 4f3d8b67ad3090f9fb72f8235d21cde53cd24b79 (diff) |
iommu/vt-d: Convert IR ioapic-setup to use remap_ops
The IOAPIC setup routine for interrupt remapping is VT-d
specific. Move it to the irq_remap_ops and add a call helper
function.
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')
-rw-r--r-- | arch/x86/kernel/apic/io_apic.c | 68 |
1 files changed, 2 insertions, 66 deletions
diff --git a/arch/x86/kernel/apic/io_apic.c b/arch/x86/kernel/apic/io_apic.c index 1151fdccaad6..e1ab625fb9ca 100644 --- a/arch/x86/kernel/apic/io_apic.c +++ b/arch/x86/kernel/apic/io_apic.c | |||
@@ -1362,77 +1362,13 @@ static void ioapic_register_intr(unsigned int irq, struct irq_cfg *cfg, | |||
1362 | fasteoi ? "fasteoi" : "edge"); | 1362 | fasteoi ? "fasteoi" : "edge"); |
1363 | } | 1363 | } |
1364 | 1364 | ||
1365 | |||
1366 | static int setup_ir_ioapic_entry(int irq, | ||
1367 | struct IR_IO_APIC_route_entry *entry, | ||
1368 | unsigned int destination, int vector, | ||
1369 | struct io_apic_irq_attr *attr) | ||
1370 | { | ||
1371 | int index; | ||
1372 | struct irte irte; | ||
1373 | int ioapic_id = mpc_ioapic_id(attr->ioapic); | ||
1374 | struct intel_iommu *iommu = map_ioapic_to_ir(ioapic_id); | ||
1375 | |||
1376 | if (!iommu) { | ||
1377 | pr_warn("No mapping iommu for ioapic %d\n", ioapic_id); | ||
1378 | return -ENODEV; | ||
1379 | } | ||
1380 | |||
1381 | index = alloc_irte(iommu, irq, 1); | ||
1382 | if (index < 0) { | ||
1383 | pr_warn("Failed to allocate IRTE for ioapic %d\n", ioapic_id); | ||
1384 | return -ENOMEM; | ||
1385 | } | ||
1386 | |||
1387 | prepare_irte(&irte, vector, destination); | ||
1388 | |||
1389 | /* Set source-id of interrupt request */ | ||
1390 | set_ioapic_sid(&irte, ioapic_id); | ||
1391 | |||
1392 | modify_irte(irq, &irte); | ||
1393 | |||
1394 | apic_printk(APIC_VERBOSE, KERN_DEBUG "IOAPIC[%d]: " | ||
1395 | "Set IRTE entry (P:%d FPD:%d Dst_Mode:%d " | ||
1396 | "Redir_hint:%d Trig_Mode:%d Dlvry_Mode:%X " | ||
1397 | "Avail:%X Vector:%02X Dest:%08X " | ||
1398 | "SID:%04X SQ:%X SVT:%X)\n", | ||
1399 | attr->ioapic, irte.present, irte.fpd, irte.dst_mode, | ||
1400 | irte.redir_hint, irte.trigger_mode, irte.dlvry_mode, | ||
1401 | irte.avail, irte.vector, irte.dest_id, | ||
1402 | irte.sid, irte.sq, irte.svt); | ||
1403 | |||
1404 | memset(entry, 0, sizeof(*entry)); | ||
1405 | |||
1406 | entry->index2 = (index >> 15) & 0x1; | ||
1407 | entry->zero = 0; | ||
1408 | entry->format = 1; | ||
1409 | entry->index = (index & 0x7fff); | ||
1410 | /* | ||
1411 | * IO-APIC RTE will be configured with virtual vector. | ||
1412 | * irq handler will do the explicit EOI to the io-apic. | ||
1413 | */ | ||
1414 | entry->vector = attr->ioapic_pin; | ||
1415 | entry->mask = 0; /* enable IRQ */ | ||
1416 | entry->trigger = attr->trigger; | ||
1417 | entry->polarity = attr->polarity; | ||
1418 | |||
1419 | /* Mask level triggered irqs. | ||
1420 | * Use IRQ_DELAYED_DISABLE for edge triggered irqs. | ||
1421 | */ | ||
1422 | if (attr->trigger) | ||
1423 | entry->mask = 1; | ||
1424 | |||
1425 | return 0; | ||
1426 | } | ||
1427 | |||
1428 | static int setup_ioapic_entry(int irq, struct IO_APIC_route_entry *entry, | 1365 | static int setup_ioapic_entry(int irq, struct IO_APIC_route_entry *entry, |
1429 | unsigned int destination, int vector, | 1366 | unsigned int destination, int vector, |
1430 | struct io_apic_irq_attr *attr) | 1367 | struct io_apic_irq_attr *attr) |
1431 | { | 1368 | { |
1432 | if (intr_remapping_enabled) | 1369 | if (intr_remapping_enabled) |
1433 | return setup_ir_ioapic_entry(irq, | 1370 | return intr_setup_ioapic_entry(irq, entry, destination, |
1434 | (struct IR_IO_APIC_route_entry *)entry, | 1371 | vector, attr); |
1435 | destination, vector, attr); | ||
1436 | 1372 | ||
1437 | memset(entry, 0, sizeof(*entry)); | 1373 | memset(entry, 0, sizeof(*entry)); |
1438 | 1374 | ||