OvmfPkg/PlatformInitLib: check PcdUse1GPageTable

If PcdUse1GPageTable is not enabled restrict the physical address space
used to 1TB, to limit the amount of memory needed for identity mapping
page tables.

The same already happens in case the processor has no support for
gigabyte pages.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Acked-by: Ard Biesheuvel <ardb@kernel.org>
This commit is contained in:
Gerd Hoffmann 2023-05-17 12:24:47 +02:00 committed by mergify[bot]
parent 27727338b2
commit d4d24001f7
2 changed files with 6 additions and 0 deletions

View File

@ -663,6 +663,11 @@ PlatformAddressWidthFromCpuid (
PhysBits = 40;
}
if (!FixedPcdGetBool (PcdUse1GPageTable) && (PhysBits > 40)) {
DEBUG ((DEBUG_INFO, "%a: limit PhysBits to 40 (PcdUse1GPageTable is false)\n", __func__));
PhysBits = 40;
}
PlatformInfoHob->PhysMemAddressWidth = PhysBits;
PlatformInfoHob->FirstNonAddress = LShiftU64 (1, PlatformInfoHob->PhysMemAddressWidth);
}

View File

@ -58,6 +58,7 @@
[Pcd]
gEfiMdePkgTokenSpaceGuid.PcdPciExpressBaseAddress
gEfiMdeModulePkgTokenSpaceGuid.PcdUse1GPageTable
[FixedPcd]
gUefiOvmfPkgTokenSpaceGuid.PcdOvmfWorkAreaBase