From 5654c5c841a6d6b39ccbc7dce06051d446f6e35f Mon Sep 17 00:00:00 2001 From: Alexander Graf Date: Thu, 21 May 2020 02:08:09 +0200 Subject: [PATCH] uefi: Apply e820 reservations from fw-cfg This commit extends the parsing of the e820 fw-cfg file to also add the reserved memory regions so that guests properly see reserved memory regions. Signed-off-by: Alexander Graf Signed-off-by: Hendrik Borghorst Reviewed-by: David Woodhouse Reviewed-by: Evgeny Iakovlev Reviewed-by: Alexander Graf (AWS) diff --git a/OvmfPkg/Library/PlatformInitLib/MemDetect.c b/OvmfPkg/Library/PlatformInitLib/MemDetect.c index b8feae4309..b11aa76afc 100644 --- a/OvmfPkg/Library/PlatformInitLib/MemDetect.c +++ b/OvmfPkg/Library/PlatformInitLib/MemDetect.c @@ -181,6 +181,14 @@ PlatformScanOrAdd64BitE820Ram ( E820Entry.Length, E820Entry.Type )); + // Add e820 reserved regions + if (E820Entry.Type == EfiAcpiAddressRangeReserved) { + BuildMemoryAllocationHob ( + E820Entry.BaseAddr, + E820Entry.Length, + EfiReservedMemoryType + ); + } if (E820Entry.Type == EfiAcpiAddressRangeMemory) { if (AddHighHob && (E820Entry.BaseAddr >= BASE_4GB)) { UINT64 Base;