Skip to content

Commit 5a88f35

Browse files
KAGA-KOKOhansendc
authored andcommitted
x86/apic: Split register_apic_address()
Split the fixmap setup out of register_lapic_address() and reuse it when the X2APIC is disabled during setup. This avoids registering the APIC ID (setting 'mp_lapic_addr') twice. [ dhansen: changelog wording tweak ] Signed-off-by: Thomas Gleixner <[email protected]> Signed-off-by: Dave Hansen <[email protected]> Acked-by: Peter Zijlstra (Intel) <[email protected]> Tested-by: Michael Kelley <[email protected]> Tested-by: Sohil Mehta <[email protected]> Tested-by: Juergen Gross <[email protected]> # Xen PV (dom0 and unpriv. guest)
1 parent 1751ade commit 5a88f35

File tree

1 file changed

+14
-8
lines changed

1 file changed

+14
-8
lines changed

arch/x86/kernel/apic/apic.c

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1852,6 +1852,8 @@ void x2apic_setup(void)
18521852
__x2apic_enable();
18531853
}
18541854

1855+
static __init void apic_set_fixmap(void);
1856+
18551857
static __init void x2apic_disable(void)
18561858
{
18571859
u32 x2apic_id, state = x2apic_state;
@@ -1872,7 +1874,7 @@ static __init void x2apic_disable(void)
18721874
}
18731875

18741876
__x2apic_disable();
1875-
register_lapic_address(mp_lapic_addr);
1877+
apic_set_fixmap();
18761878
}
18771879

18781880
static __init void x2apic_enable(void)
@@ -2145,17 +2147,21 @@ void __init init_apic_mappings(void)
21452147
}
21462148
}
21472149

2150+
static __init void apic_set_fixmap(void)
2151+
{
2152+
set_fixmap_nocache(FIX_APIC_BASE, mp_lapic_addr);
2153+
apic_mmio_base = APIC_BASE;
2154+
apic_printk(APIC_VERBOSE, "mapped APIC to %16lx (%16lx)\n",
2155+
apic_mmio_base, mp_lapic_addr);
2156+
apic_read_boot_cpu_id(false);
2157+
}
2158+
21482159
void __init register_lapic_address(unsigned long address)
21492160
{
21502161
mp_lapic_addr = address;
21512162

2152-
if (x2apic_mode)
2153-
return;
2154-
2155-
set_fixmap_nocache(FIX_APIC_BASE, address);
2156-
apic_mmio_base = APIC_BASE;
2157-
apic_printk(APIC_VERBOSE, "mapped APIC to %16lx (%16lx)\n", APIC_BASE, address);
2158-
apic_read_boot_cpu_id(false);
2163+
if (!x2apic_mode)
2164+
apic_set_fixmap();
21592165
}
21602166

21612167
/*

0 commit comments

Comments
 (0)