From ee83be4d753ae128b53dd306b380c4a6dfd739e5 Mon Sep 17 00:00:00 2001 From: Arthur Heymans Date: Fri, 2 Feb 2024 18:49:53 +0100 Subject: cpu/x86: Link page tables in stage if possible When switching back and forth between 32 to 64 bit mode, for example to call a 32-bits FSP or to call the payload, new page tables in the respective stage will be linked. The advantages of this approach are: - No need to determine a good place for page tables in CBFS that does not overlap. - Works with non memory mapped flash (however all coreboot targets currently do support this) - If later stages can use their own page tables which fits better with the vboot RO/RW flow A disadvantage is that it increases the stage size. This could be improved upon by using 1G pages and generating the pages at runtime. Note: qemu cannot have the page tables in the RO boot medium and needs to relocate them at runtime. This is why keeping the existing code with page tables in CBFS is done for now. TEST: Booted to payload on google/vilbox and qemu/q35 Signed-off-by: Arthur Heymans Change-Id: Ied54b66b930187cba5fbc578a81ed5859a616562 Reviewed-on: https://review.coreboot.org/c/coreboot/+/80337 Reviewed-by: Patrick Rudolph Tested-by: build bot (Jenkins) --- src/mainboard/emulation/qemu-i440fx/Kconfig | 5 +++++ src/mainboard/emulation/qemu-q35/Kconfig | 5 +++++ 2 files changed, 10 insertions(+) (limited to 'src/mainboard') diff --git a/src/mainboard/emulation/qemu-i440fx/Kconfig b/src/mainboard/emulation/qemu-i440fx/Kconfig index cec6f97839..24dfa7a2fc 100644 --- a/src/mainboard/emulation/qemu-i440fx/Kconfig +++ b/src/mainboard/emulation/qemu-i440fx/Kconfig @@ -30,6 +30,11 @@ config VBOOT select GBB_FLAG_DISABLE_FWMP if ARCH_BOOTBLOCK_X86_64 + +config PAGE_TABLES_IN_CBFS + bool + default y + # Need to install page tables in DRAM as the virtual MMU has problems translating paging # request when the page table resides in emulated ROM. This causes undefined behaviour # when handling data requests, as well as fetching and decoding instructions diff --git a/src/mainboard/emulation/qemu-q35/Kconfig b/src/mainboard/emulation/qemu-q35/Kconfig index d68a5462bf..11ea750496 100644 --- a/src/mainboard/emulation/qemu-q35/Kconfig +++ b/src/mainboard/emulation/qemu-q35/Kconfig @@ -32,6 +32,11 @@ config FMDFILE default "src/mainboard/\$(CONFIG_MAINBOARD_DIR)/vboot-rwab-16M.fmd" if VBOOT_SLOTS_RW_AB if ARCH_BOOTBLOCK_X86_64 + +config PAGE_TABLES_IN_CBFS + bool + default y + # Need to install page tables in DRAM as the virtual MMU has problems translating paging # request when the page table resides in emulated ROM. This causes undefined behaviour # when handling data requests, as well as fetching and decoding instructions -- cgit v1.2.3