From: Laszlo Ersek Date: Fri, 20 Sep 2019 15:07:43 +0000 (+0200) Subject: OvmfPkg/PlatformPei: assert there's no permanent PEI RAM at default SMBASE X-Git-Tag: edk2-stable202002~188 X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=commitdiff_plain;h=adec2bd598dac8a6378d6244089158ed8d656f62 OvmfPkg/PlatformPei: assert there's no permanent PEI RAM at default SMBASE The permanent PEI RAM that is published on the normal boot path starts strictly above MEMFD_BASE_ADDRESS (8 MB -- see the FDF files), regardless of whether PEI decompression will be necessary on S3 resume due to SMM_REQUIRE. Therefore the normal boot permanent PEI RAM never overlaps with the SMRAM at the default SMBASE (192 KB). The S3 resume permanent PEI RAM is strictly above the normal boot one. Therefore the no-overlap statement holds true on the S3 resume path as well. Assert the no-overlap condition commonly for both boot paths in PublishPeiMemory(). Cc: Ard Biesheuvel Cc: Jordan Justen Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=1512 Signed-off-by: Laszlo Ersek Reviewed-by: Jiewen Yao Message-Id: <20200129214412.2361-7-lersek@redhat.com> Reviewed-by: Ard Biesheuvel --- diff --git a/OvmfPkg/PlatformPei/MemDetect.c b/OvmfPkg/PlatformPei/MemDetect.c index 2bc1c46dff..4879ee87b7 100644 --- a/OvmfPkg/PlatformPei/MemDetect.c +++ b/OvmfPkg/PlatformPei/MemDetect.c @@ -17,6 +17,7 @@ Module Name: #include #include #include +#include // // The Library classes this module consumes @@ -626,6 +627,15 @@ PublishPeiMemory ( } } + // + // MEMFD_BASE_ADDRESS separates the SMRAM at the default SMBASE from the + // normal boot permanent PEI RAM. Regarding the S3 boot path, the S3 + // permanent PEI RAM is located even higher. + // + if (FeaturePcdGet (PcdSmmSmramRequire) && mQ35SmramAtDefaultSmbase) { + ASSERT (SMM_DEFAULT_SMBASE + MCH_DEFAULT_SMBASE_SIZE <= MemoryBase); + } + // // Publish this memory to the PEI Core //