diff options
author | Joerg Roedel <joro@8bytes.org> | 2012-09-26 06:44:33 -0400 |
---|---|---|
committer | Joerg Roedel <joro@8bytes.org> | 2013-01-28 04:48:29 -0500 |
commit | 70733e0c7ed22177e2cfe660fa2a0e90f1f39126 (patch) | |
tree | c5e73c4c773dcfe8309f7b2734835f55495a9c15 | |
parent | 5ca72c4f7c412c2002363218901eba5516c476b1 (diff) |
x86, apic: Move irq_remapping_enabled checks into IRQ-remapping code
Move the three easy to move checks in the x86' apic.c file
into the IRQ-remapping code.
Signed-off-by: Joerg Roedel <joro@8bytes.org>
Acked-by: Sebastian Andrzej Siewior <sebastian@breakpoint.cc>
Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
-rw-r--r-- | arch/x86/kernel/apic/apic.c | 9 | ||||
-rw-r--r-- | drivers/iommu/irq_remapping.c | 11 |
2 files changed, 12 insertions, 8 deletions
diff --git a/arch/x86/kernel/apic/apic.c b/arch/x86/kernel/apic/apic.c index b994cc84aa7e..8d741e65ff64 100644 --- a/arch/x86/kernel/apic/apic.c +++ b/arch/x86/kernel/apic/apic.c | |||
@@ -1477,8 +1477,7 @@ void __init bsp_end_local_APIC_setup(void) | |||
1477 | * Now that local APIC setup is completed for BP, configure the fault | 1477 | * Now that local APIC setup is completed for BP, configure the fault |
1478 | * handling for interrupt remapping. | 1478 | * handling for interrupt remapping. |
1479 | */ | 1479 | */ |
1480 | if (irq_remapping_enabled) | 1480 | irq_remap_enable_fault_handling(); |
1481 | irq_remap_enable_fault_handling(); | ||
1482 | 1481 | ||
1483 | } | 1482 | } |
1484 | 1483 | ||
@@ -2251,8 +2250,7 @@ static int lapic_suspend(void) | |||
2251 | local_irq_save(flags); | 2250 | local_irq_save(flags); |
2252 | disable_local_APIC(); | 2251 | disable_local_APIC(); |
2253 | 2252 | ||
2254 | if (irq_remapping_enabled) | 2253 | irq_remapping_disable(); |
2255 | irq_remapping_disable(); | ||
2256 | 2254 | ||
2257 | local_irq_restore(flags); | 2255 | local_irq_restore(flags); |
2258 | return 0; | 2256 | return 0; |
@@ -2320,8 +2318,7 @@ static void lapic_resume(void) | |||
2320 | apic_write(APIC_ESR, 0); | 2318 | apic_write(APIC_ESR, 0); |
2321 | apic_read(APIC_ESR); | 2319 | apic_read(APIC_ESR); |
2322 | 2320 | ||
2323 | if (irq_remapping_enabled) | 2321 | irq_remapping_reenable(x2apic_mode); |
2324 | irq_remapping_reenable(x2apic_mode); | ||
2325 | 2322 | ||
2326 | local_irq_restore(flags); | 2323 | local_irq_restore(flags); |
2327 | } | 2324 | } |
diff --git a/drivers/iommu/irq_remapping.c b/drivers/iommu/irq_remapping.c index faf85d6e33fe..19381b90e619 100644 --- a/drivers/iommu/irq_remapping.c +++ b/drivers/iommu/irq_remapping.c | |||
@@ -87,7 +87,9 @@ int __init irq_remapping_enable(void) | |||
87 | 87 | ||
88 | void irq_remapping_disable(void) | 88 | void irq_remapping_disable(void) |
89 | { | 89 | { |
90 | if (!remap_ops || !remap_ops->disable) | 90 | if (!irq_remapping_enabled || |
91 | !remap_ops || | ||
92 | !remap_ops->disable) | ||
91 | return; | 93 | return; |
92 | 94 | ||
93 | remap_ops->disable(); | 95 | remap_ops->disable(); |
@@ -95,7 +97,9 @@ void irq_remapping_disable(void) | |||
95 | 97 | ||
96 | int irq_remapping_reenable(int mode) | 98 | int irq_remapping_reenable(int mode) |
97 | { | 99 | { |
98 | if (!remap_ops || !remap_ops->reenable) | 100 | if (!irq_remapping_enabled || |
101 | !remap_ops || | ||
102 | !remap_ops->reenable) | ||
99 | return 0; | 103 | return 0; |
100 | 104 | ||
101 | return remap_ops->reenable(mode); | 105 | return remap_ops->reenable(mode); |
@@ -103,6 +107,9 @@ int irq_remapping_reenable(int mode) | |||
103 | 107 | ||
104 | int __init irq_remap_enable_fault_handling(void) | 108 | int __init irq_remap_enable_fault_handling(void) |
105 | { | 109 | { |
110 | if (!irq_remapping_enabled) | ||
111 | return 0; | ||
112 | |||
106 | if (!remap_ops || !remap_ops->enable_faulting) | 113 | if (!remap_ops || !remap_ops->enable_faulting) |
107 | return -ENODEV; | 114 | return -ENODEV; |
108 | 115 | ||