Skip to content

Commit bea629d

Browse files
KAGA-KOKOPeter Zijlstra
authored andcommitted
x86/apic: Save the APIC virtual base address
For parallel CPU brinugp it's required to read the APIC ID in the low level startup code. The virtual APIC base address is a constant because its a fix-mapped address. Exposing that constant which is composed via macros to assembly code is non-trivial due to header inclusion hell. Aside of that it's constant only because of the vsyscall ABI requirement. Once vsyscall is out of the picture the fixmap can be placed at runtime. Avoid header hell, stay flexible and store the address in a variable which can be exposed to the low level startup code. Signed-off-by: Thomas Gleixner <[email protected]> Signed-off-by: Peter Zijlstra (Intel) <[email protected]> Tested-by: Michael Kelley <[email protected]> Tested-by: Oleksandr Natalenko <[email protected]> Tested-by: Helge Deller <[email protected]> # parisc Tested-by: Guilherme G. Piccoli <[email protected]> # Steam Deck Link: https://lore.kernel.org/r/[email protected]
1 parent 18415f3 commit bea629d

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

arch/x86/include/asm/smp.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,7 @@ extern void nmi_selftest(void);
196196
#endif
197197

198198
extern unsigned int smpboot_control;
199+
extern unsigned long apic_mmio_base;
199200

200201
#endif /* !__ASSEMBLY__ */
201202

arch/x86/kernel/apic/apic.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,9 @@ static int apic_extnmi __ro_after_init = APIC_EXTNMI_BSP;
101101
*/
102102
static bool virt_ext_dest_id __ro_after_init;
103103

104+
/* For parallel bootup. */
105+
unsigned long apic_mmio_base __ro_after_init;
106+
104107
/*
105108
* Map cpu index to physical APIC ID
106109
*/
@@ -2163,6 +2166,7 @@ void __init register_lapic_address(unsigned long address)
21632166

21642167
if (!x2apic_mode) {
21652168
set_fixmap_nocache(FIX_APIC_BASE, address);
2169+
apic_mmio_base = APIC_BASE;
21662170
apic_printk(APIC_VERBOSE, "mapped APIC to %16lx (%16lx)\n",
21672171
APIC_BASE, address);
21682172
}

0 commit comments

Comments
 (0)