Commit 70733e0c7ed22177e2cfe660fa2a0e90f1f39126

Authored by Joerg Roedel
1 parent 5ca72c4f7c

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>

Showing 2 changed files with 12 additions and 8 deletions Side-by-side Diff

arch/x86/kernel/apic/apic.c
... ... @@ -1477,8 +1477,7 @@
1477 1477 * Now that local APIC setup is completed for BP, configure the fault
1478 1478 * handling for interrupt remapping.
1479 1479 */
1480   - if (irq_remapping_enabled)
1481   - irq_remap_enable_fault_handling();
  1480 + irq_remap_enable_fault_handling();
1482 1481  
1483 1482 }
1484 1483  
... ... @@ -2251,8 +2250,7 @@
2251 2250 local_irq_save(flags);
2252 2251 disable_local_APIC();
2253 2252  
2254   - if (irq_remapping_enabled)
2255   - irq_remapping_disable();
  2253 + irq_remapping_disable();
2256 2254  
2257 2255 local_irq_restore(flags);
2258 2256 return 0;
... ... @@ -2320,8 +2318,7 @@
2320 2318 apic_write(APIC_ESR, 0);
2321 2319 apic_read(APIC_ESR);
2322 2320  
2323   - if (irq_remapping_enabled)
2324   - irq_remapping_reenable(x2apic_mode);
  2321 + irq_remapping_reenable(x2apic_mode);
2325 2322  
2326 2323 local_irq_restore(flags);
2327 2324 }
drivers/iommu/irq_remapping.c
... ... @@ -87,7 +87,9 @@
87 87  
88 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 93 return;
92 94  
93 95 remap_ops->disable();
... ... @@ -95,7 +97,9 @@
95 97  
96 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 103 return 0;
100 104  
101 105 return remap_ops->reenable(mode);
... ... @@ -103,6 +107,9 @@
103 107  
104 108 int __init irq_remap_enable_fault_handling(void)
105 109 {
  110 + if (!irq_remapping_enabled)
  111 + return 0;
  112 +
106 113 if (!remap_ops || !remap_ops->enable_faulting)
107 114 return -ENODEV;
108 115