]> git.proxmox.com Git - mirror_edk2.git/commit - OvmfPkg/Library/PlatformInitLib/MemDetect.c
OvmfPkg/PlatformInitLib: qemu cpuid physbits detection
authorGerd Hoffmann <kraxel@redhat.com>
Tue, 4 Oct 2022 13:47:25 +0000 (15:47 +0200)
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Fri, 7 Oct 2022 18:14:05 +0000 (18:14 +0000)
commit8f9ef9c9a064839644ceca89df52a3693744a685
treef890e165cc8a51b017456a7808a237055180f16f
parent5ff7d712d489a4fba4e8b0f609218e33c1208e52
OvmfPkg/PlatformInitLib: qemu cpuid physbits detection

Add some qemu specific quirks to PlatformAddressWidthFromCpuid()
to figure whenever the PhysBits value returned by CPUID is
something real we can work with or not.

See the source code comment for details on the logic.

Also apply some limits to the address space we are going to use:
 * Place a hard cap at 47 PhysBits (128 TB) to avoid using addresses
   which require 5-level paging support.
 * Cap at 40 PhysBits (1 TB) in case the CPU has no support for
   gigabyte pages, to avoid excessive amounts of pages being
   used for page tables.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Ard Biesheuvel <ardb@kernel.org>
OvmfPkg/Library/PlatformInitLib/MemDetect.c