summaryrefslogtreecommitdiff
path: root/arch/x86/realmode/init.c
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>2021-12-06 09:31:18 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2021-12-06 09:31:18 +0100
commitd598c3c46ea69ea974f0613a651cd4ef3be0c870 (patch)
tree92c4b32aa13596484d81988f530d888586ff7c7a /arch/x86/realmode/init.c
parent9899aa5ba525c293ea14f20891f3d98690661aea (diff)
parent0fcfb00b28c0b7884635dacf38e46d60bf3d4eb1 (diff)
Merge 5.16-rc4 into usb-next
We need the USB fixes in here as well. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'arch/x86/realmode/init.c')
-rw-r--r--arch/x86/realmode/init.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/arch/x86/realmode/init.c b/arch/x86/realmode/init.c
index 4a3da7592b99..38d24d2ab38b 100644
--- a/arch/x86/realmode/init.c
+++ b/arch/x86/realmode/init.c
@@ -72,6 +72,7 @@ static void __init setup_real_mode(void)
#ifdef CONFIG_X86_64
u64 *trampoline_pgd;
u64 efer;
+ int i;
#endif
base = (unsigned char *)real_mode_header;
@@ -128,8 +129,17 @@ static void __init setup_real_mode(void)
trampoline_header->flags = 0;
trampoline_pgd = (u64 *) __va(real_mode_header->trampoline_pgd);
+
+ /* Map the real mode stub as virtual == physical */
trampoline_pgd[0] = trampoline_pgd_entry.pgd;
- trampoline_pgd[511] = init_top_pgt[511].pgd;
+
+ /*
+ * Include the entirety of the kernel mapping into the trampoline
+ * PGD. This way, all mappings present in the normal kernel page
+ * tables are usable while running on trampoline_pgd.
+ */
+ for (i = pgd_index(__PAGE_OFFSET); i < PTRS_PER_PGD; i++)
+ trampoline_pgd[i] = init_top_pgt[i].pgd;
#endif
sme_sev_setup_real_mode(trampoline_header);