x86/apic: Consolidate boot_cpu_physical_apicid initialization sites
authorThomas Gleixner <tglx@linutronix.de>
Tue, 8 Aug 2023 22:03:45 +0000 (15:03 -0700)
committerDave Hansen <dave.hansen@linux.intel.com>
Wed, 9 Aug 2023 18:58:18 +0000 (11:58 -0700)
commitd10a904435fa63fccc740e750e32b80e5f63c6c8
treec23ec2adff2db973fd951de171b1c28b6a1e034f
parent1d90c9f7313011b67643228810435038d20b0744
x86/apic: Consolidate boot_cpu_physical_apicid initialization sites

boot_cpu_physical_apicid is written in random places and in the last
consequence filled with the APIC ID read from the local APIC. That causes
it to have inconsistent state when the MPTABLE is broken. As a consequence
tons of moronic checks are sprinkled all over the place.

Consolidate the code and read it exactly once when either X2APIC mode is
detected early or when the APIC mapping is established.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Dave Hansen <dave.hansen@linux.intel.com>
Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Tested-by: Michael Kelley <mikelley@microsoft.com>
Tested-by: Sohil Mehta <sohil.mehta@intel.com>
Tested-by: Juergen Gross <jgross@suse.com> # Xen PV (dom0 and unpriv. guest)
arch/x86/include/asm/apic.h
arch/x86/kernel/apic/apic.c
arch/x86/kernel/mpparse.c