aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
Diffstat (limited to 'arch')
-rw-r--r--arch/x86/kernel/apic/apic.c31
1 files changed, 15 insertions, 16 deletions
diff --git a/arch/x86/kernel/apic/apic.c b/arch/x86/kernel/apic/apic.c
index 52fa56399a50..6b9874a5c7af 100644
--- a/arch/x86/kernel/apic/apic.c
+++ b/arch/x86/kernel/apic/apic.c
@@ -1440,24 +1440,18 @@ int __init enable_IR(void)
1440#ifdef CONFIG_INTR_REMAP 1440#ifdef CONFIG_INTR_REMAP
1441 if (!intr_remapping_supported()) { 1441 if (!intr_remapping_supported()) {
1442 pr_debug("intr-remapping not supported\n"); 1442 pr_debug("intr-remapping not supported\n");
1443 return 0; 1443 return -1;
1444 } 1444 }
1445 1445
1446 if (!x2apic_preenabled && skip_ioapic_setup) { 1446 if (!x2apic_preenabled && skip_ioapic_setup) {
1447 pr_info("Skipped enabling intr-remap because of skipping " 1447 pr_info("Skipped enabling intr-remap because of skipping "
1448 "io-apic setup\n"); 1448 "io-apic setup\n");
1449 return 0; 1449 return -1;
1450 } 1450 }
1451 1451
1452 if (enable_intr_remapping(x2apic_supported())) 1452 return enable_intr_remapping();
1453 return 0;
1454
1455 pr_info("Enabled Interrupt-remapping\n");
1456
1457 return 1;
1458
1459#endif 1453#endif
1460 return 0; 1454 return -1;
1461} 1455}
1462 1456
1463void __init enable_IR_x2apic(void) 1457void __init enable_IR_x2apic(void)
@@ -1481,11 +1475,11 @@ void __init enable_IR_x2apic(void)
1481 mask_ioapic_entries(); 1475 mask_ioapic_entries();
1482 1476
1483 if (dmar_table_init_ret) 1477 if (dmar_table_init_ret)
1484 ret = 0; 1478 ret = -1;
1485 else 1479 else
1486 ret = enable_IR(); 1480 ret = enable_IR();
1487 1481
1488 if (!ret) { 1482 if (ret < 0) {
1489 /* IR is required if there is APIC ID > 255 even when running 1483 /* IR is required if there is APIC ID > 255 even when running
1490 * under KVM 1484 * under KVM
1491 */ 1485 */
@@ -1499,6 +1493,9 @@ void __init enable_IR_x2apic(void)
1499 x2apic_force_phys(); 1493 x2apic_force_phys();
1500 } 1494 }
1501 1495
1496 if (ret == IRQ_REMAP_XAPIC_MODE)
1497 goto nox2apic;
1498
1502 x2apic_enabled = 1; 1499 x2apic_enabled = 1;
1503 1500
1504 if (x2apic_supported() && !x2apic_mode) { 1501 if (x2apic_supported() && !x2apic_mode) {
@@ -1508,19 +1505,21 @@ void __init enable_IR_x2apic(void)
1508 } 1505 }
1509 1506
1510nox2apic: 1507nox2apic:
1511 if (!ret) /* IR enabling failed */ 1508 if (ret < 0) /* IR enabling failed */
1512 restore_ioapic_entries(); 1509 restore_ioapic_entries();
1513 legacy_pic->restore_mask(); 1510 legacy_pic->restore_mask();
1514 local_irq_restore(flags); 1511 local_irq_restore(flags);
1515 1512
1516out: 1513out:
1517 if (x2apic_enabled) 1514 if (x2apic_enabled || !x2apic_supported())
1518 return; 1515 return;
1519 1516
1520 if (x2apic_preenabled) 1517 if (x2apic_preenabled)
1521 panic("x2apic: enabled by BIOS but kernel init failed."); 1518 panic("x2apic: enabled by BIOS but kernel init failed.");
1522 else if (cpu_has_x2apic) 1519 else if (ret == IRQ_REMAP_XAPIC_MODE)
1523 pr_info("Not enabling x2apic, Intr-remapping init failed.\n"); 1520 pr_info("x2apic not enabled, IRQ remapping is in xapic mode\n");
1521 else if (ret < 0)
1522 pr_info("x2apic not enabled, IRQ remapping init failed\n");
1524} 1523}
1525 1524
1526#ifdef CONFIG_X86_64 1525#ifdef CONFIG_X86_64