audk/OvmfPkg/Library/PlatformInitLib
Gerd Hoffmann ce4c76e46d OvmfPkg/Sec: Setup MTRR early in the boot process.
Specifically before running lzma uncompress of the main firmware volume.
This is needed to make sure caching is enabled, otherwise the uncompress
can be extremely slow.

Adapt the ASSERTs and MTRR setup in PlatformInitLib to the changes.

Background:  Depending on virtual machine configuration kvm may uses EPT
memory types to apply guest MTRR settings.  In case MTRRs are disabled
kvm will use the uncachable memory type for all mappings.  The
vmx_get_mt_mask() function in the linux kernel handles this and can be
found here:

https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/tree/arch/x86/kvm/vmx/vmx.c?h=v6.7.1#n7580

In most VM configurations kvm uses MTRR_TYPE_WRBACK unconditionally.  In
case the VM has a mdev device assigned that is not the case though.

Before commit e8aa4c6546 ("UefiCpuPkg/ResetVector: Cache Disable
should not be set by default in CR0") kvm also ended up using
MTRR_TYPE_WRBACK due to KVM_X86_QUIRK_CD_NW_CLEARED.  After that commit
kvm evaluates guest mtrr settings, which why setting up MTRRs early is
important now.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2024-06-26 06:04:49 +00:00
..
Cmos.c OvmfPkg: Create initial version of PlatformInitLib 2022-04-02 08:15:12 +00:00
IntelTdx.c OvmfPkg: Use newly defined Unaccepted Memory Type 2024-05-08 11:34:49 +00:00
IntelTdxNull.c OvmfPkg: Refactor ProcessHobList 2023-02-04 03:38:15 +00:00
MemDetect.c OvmfPkg/Sec: Setup MTRR early in the boot process. 2024-06-26 06:04:49 +00:00
Platform.c OvmfPkg: Update code to be more C11 compliant by using __func__ 2023-04-10 14:19:57 +00:00
PlatformInitLib.inf OvmfPkg: Refine SmmAccess implementation 2024-05-08 01:53:58 +00:00