x86/boot/64: Use RIP_REL_REF() to access early_top_pgt[]
authorArd Biesheuvel <ardb@kernel.org>
Wed, 21 Feb 2024 11:35:13 +0000 (12:35 +0100)
committerIngo Molnar <mingo@kernel.org>
Mon, 26 Feb 2024 11:58:35 +0000 (12:58 +0100)
commit533568e06b157b175912a960efe5ebce8710b4f9
treed66813cab204555f84e7eed592f03e9665100f66
parenteb54c2ae4a4825c42a6a2b4022926bda7448f735
x86/boot/64: Use RIP_REL_REF() to access early_top_pgt[]

early_top_pgt[] is assigned from code that executes from a 1:1 mapping
so it cannot use a plain access from C. Replace the use of
fixup_pointer() with RIP_REL_REF(), which is better and simpler.

For legibility and to align with the code that populates the lower page
table levels, statically initialize the root level page table with an
entry pointing to level3_kernel_pgt[], and overwrite it when needed to
enable 5-level paging.

Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Link: https://lore.kernel.org/r/20240221113506.2565718-24-ardb+git@google.com
arch/x86/kernel/head64.c
arch/x86/kernel/head_64.S