mb/emulation/qemu: Copy page tables to DRAM in assembly

To work around various bugs running KVM enabled, copy page tables to
DRAM in assembly before jumping to x86_64 mode.

Tested on QEMU using KVM, no more stange bugs happen:
Tested on host
 - CPU Intel(R) Core(TM) i7-7700HQ
 - Linux 5.9
 - qemu 4.2.1
 Used to crash on emulating MMX instructions and failed to translate
 some addresses using the virtual MMU when running in long mode.

Tested on host
 - CPU AMD EPYC 7401P 24-Core Processor
 - Linux 5.4
 - qemu 4.2.1
 Used to crash on jumping to long mode.

Change-Id: Ic0bdd2bef7197edd2e7488a8efdeba7eb4ab0dd4
Signed-off-by: Patrick Rudolph <patrick.rudolph@9elements.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/49228
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
Reviewed-by: Arthur Heymans <arthur@aheymans.xyz>
This commit is contained in:
Patrick Rudolph
2021-01-07 14:12:38 +01:00
committed by Patrick Georgi
parent cbfe4ba76a
commit 82e111cc2a
6 changed files with 91 additions and 2 deletions

View File

@@ -27,6 +27,15 @@ config VBOOT
select GBB_FLAG_DISABLE_EC_SOFTWARE_SYNC
select GBB_FLAG_DISABLE_FWMP
if ARCH_BOOTBLOCK_X86_64
# 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
# Real hardware didn't show any problems until now.
config ARCH_X86_64_PGTBL_LOC
default 0x8000
endif
if VBOOT
config VBOOT_SLOTS_RW_A