diff options
Diffstat (limited to 'arch/x86/kernel/apic/apic.c')
-rw-r--r-- | arch/x86/kernel/apic/apic.c | 42 |
1 files changed, 24 insertions, 18 deletions
diff --git a/arch/x86/kernel/apic/apic.c b/arch/x86/kernel/apic/apic.c index edc24480469..39a222e094a 100644 --- a/arch/x86/kernel/apic/apic.c +++ b/arch/x86/kernel/apic/apic.c | |||
@@ -35,6 +35,7 @@ | |||
35 | #include <linux/smp.h> | 35 | #include <linux/smp.h> |
36 | #include <linux/mm.h> | 36 | #include <linux/mm.h> |
37 | 37 | ||
38 | #include <asm/irq_remapping.h> | ||
38 | #include <asm/perf_event.h> | 39 | #include <asm/perf_event.h> |
39 | #include <asm/x86_init.h> | 40 | #include <asm/x86_init.h> |
40 | #include <asm/pgalloc.h> | 41 | #include <asm/pgalloc.h> |
@@ -1325,11 +1326,13 @@ void __cpuinit setup_local_APIC(void) | |||
1325 | acked); | 1326 | acked); |
1326 | break; | 1327 | break; |
1327 | } | 1328 | } |
1328 | if (cpu_has_tsc) { | 1329 | if (queued) { |
1329 | rdtscll(ntsc); | 1330 | if (cpu_has_tsc) { |
1330 | max_loops = (cpu_khz << 10) - (ntsc - tsc); | 1331 | rdtscll(ntsc); |
1331 | } else | 1332 | max_loops = (cpu_khz << 10) - (ntsc - tsc); |
1332 | max_loops--; | 1333 | } else |
1334 | max_loops--; | ||
1335 | } | ||
1333 | } while (queued && max_loops > 0); | 1336 | } while (queued && max_loops > 0); |
1334 | WARN_ON(max_loops <= 0); | 1337 | WARN_ON(max_loops <= 0); |
1335 | 1338 | ||
@@ -1441,8 +1444,8 @@ void __init bsp_end_local_APIC_setup(void) | |||
1441 | * Now that local APIC setup is completed for BP, configure the fault | 1444 | * Now that local APIC setup is completed for BP, configure the fault |
1442 | * handling for interrupt remapping. | 1445 | * handling for interrupt remapping. |
1443 | */ | 1446 | */ |
1444 | if (intr_remapping_enabled) | 1447 | if (irq_remapping_enabled) |
1445 | enable_drhd_fault_handling(); | 1448 | irq_remap_enable_fault_handling(); |
1446 | 1449 | ||
1447 | } | 1450 | } |
1448 | 1451 | ||
@@ -1517,7 +1520,7 @@ void enable_x2apic(void) | |||
1517 | int __init enable_IR(void) | 1520 | int __init enable_IR(void) |
1518 | { | 1521 | { |
1519 | #ifdef CONFIG_IRQ_REMAP | 1522 | #ifdef CONFIG_IRQ_REMAP |
1520 | if (!intr_remapping_supported()) { | 1523 | if (!irq_remapping_supported()) { |
1521 | pr_debug("intr-remapping not supported\n"); | 1524 | pr_debug("intr-remapping not supported\n"); |
1522 | return -1; | 1525 | return -1; |
1523 | } | 1526 | } |
@@ -1528,7 +1531,7 @@ int __init enable_IR(void) | |||
1528 | return -1; | 1531 | return -1; |
1529 | } | 1532 | } |
1530 | 1533 | ||
1531 | return enable_intr_remapping(); | 1534 | return irq_remapping_enable(); |
1532 | #endif | 1535 | #endif |
1533 | return -1; | 1536 | return -1; |
1534 | } | 1537 | } |
@@ -1537,10 +1540,13 @@ void __init enable_IR_x2apic(void) | |||
1537 | { | 1540 | { |
1538 | unsigned long flags; | 1541 | unsigned long flags; |
1539 | int ret, x2apic_enabled = 0; | 1542 | int ret, x2apic_enabled = 0; |
1540 | int dmar_table_init_ret; | 1543 | int hardware_init_ret; |
1544 | |||
1545 | /* Make sure irq_remap_ops are initialized */ | ||
1546 | setup_irq_remapping_ops(); | ||
1541 | 1547 | ||
1542 | dmar_table_init_ret = dmar_table_init(); | 1548 | hardware_init_ret = irq_remapping_prepare(); |
1543 | if (dmar_table_init_ret && !x2apic_supported()) | 1549 | if (hardware_init_ret && !x2apic_supported()) |
1544 | return; | 1550 | return; |
1545 | 1551 | ||
1546 | ret = save_ioapic_entries(); | 1552 | ret = save_ioapic_entries(); |
@@ -1556,7 +1562,7 @@ void __init enable_IR_x2apic(void) | |||
1556 | if (x2apic_preenabled && nox2apic) | 1562 | if (x2apic_preenabled && nox2apic) |
1557 | disable_x2apic(); | 1563 | disable_x2apic(); |
1558 | 1564 | ||
1559 | if (dmar_table_init_ret) | 1565 | if (hardware_init_ret) |
1560 | ret = -1; | 1566 | ret = -1; |
1561 | else | 1567 | else |
1562 | ret = enable_IR(); | 1568 | ret = enable_IR(); |
@@ -2176,8 +2182,8 @@ static int lapic_suspend(void) | |||
2176 | local_irq_save(flags); | 2182 | local_irq_save(flags); |
2177 | disable_local_APIC(); | 2183 | disable_local_APIC(); |
2178 | 2184 | ||
2179 | if (intr_remapping_enabled) | 2185 | if (irq_remapping_enabled) |
2180 | disable_intr_remapping(); | 2186 | irq_remapping_disable(); |
2181 | 2187 | ||
2182 | local_irq_restore(flags); | 2188 | local_irq_restore(flags); |
2183 | return 0; | 2189 | return 0; |
@@ -2193,7 +2199,7 @@ static void lapic_resume(void) | |||
2193 | return; | 2199 | return; |
2194 | 2200 | ||
2195 | local_irq_save(flags); | 2201 | local_irq_save(flags); |
2196 | if (intr_remapping_enabled) { | 2202 | if (irq_remapping_enabled) { |
2197 | /* | 2203 | /* |
2198 | * IO-APIC and PIC have their own resume routines. | 2204 | * IO-APIC and PIC have their own resume routines. |
2199 | * We just mask them here to make sure the interrupt | 2205 | * We just mask them here to make sure the interrupt |
@@ -2245,8 +2251,8 @@ static void lapic_resume(void) | |||
2245 | apic_write(APIC_ESR, 0); | 2251 | apic_write(APIC_ESR, 0); |
2246 | apic_read(APIC_ESR); | 2252 | apic_read(APIC_ESR); |
2247 | 2253 | ||
2248 | if (intr_remapping_enabled) | 2254 | if (irq_remapping_enabled) |
2249 | reenable_intr_remapping(x2apic_mode); | 2255 | irq_remapping_reenable(x2apic_mode); |
2250 | 2256 | ||
2251 | local_irq_restore(flags); | 2257 | local_irq_restore(flags); |
2252 | } | 2258 | } |