From c394fa4c9eef5621e419e51e28ba0de5ba7ec2a3 Mon Sep 17 00:00:00 2001 From: Brijesh Singh Date: Wed, 19 May 2021 13:19:46 -0500 Subject: [PATCH] OvmfPkg/AmdSevDxe: use MemEncryptSevClearMmioPageEncMask() to clear EncMask BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=3275 Use the MemEncryptSevClearMmioPageEncMask() to clear memory encryption mask for the Mmio and NonExistent address range. Cc: James Bottomley Cc: Min Xu Cc: Jiewen Yao Cc: Tom Lendacky Cc: Jordan Justen Cc: Ard Biesheuvel Cc: Laszlo Ersek Cc: Erdem Aktas Reviewed-by: Laszlo Ersek Signed-off-by: Brijesh Singh Message-Id: <20210519181949.6574-11-brijesh.singh@amd.com> --- OvmfPkg/AmdSevDxe/AmdSevDxe.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/OvmfPkg/AmdSevDxe/AmdSevDxe.c b/OvmfPkg/AmdSevDxe/AmdSevDxe.c index 689bfb376d..80831b81fa 100644 --- a/OvmfPkg/AmdSevDxe/AmdSevDxe.c +++ b/OvmfPkg/AmdSevDxe/AmdSevDxe.c @@ -53,11 +53,10 @@ AmdSevDxeEntryPoint ( Desc = &AllDescMap[Index]; if (Desc->GcdMemoryType == EfiGcdMemoryTypeMemoryMappedIo || Desc->GcdMemoryType == EfiGcdMemoryTypeNonExistent) { - Status = MemEncryptSevClearPageEncMask ( + Status = MemEncryptSevClearMmioPageEncMask ( 0, Desc->BaseAddress, - EFI_SIZE_TO_PAGES (Desc->Length), - FALSE + EFI_SIZE_TO_PAGES (Desc->Length) ); ASSERT_EFI_ERROR (Status); } @@ -73,11 +72,10 @@ AmdSevDxeEntryPoint ( // the range. // if (PcdGet16 (PcdOvmfHostBridgePciDevId) == INTEL_Q35_MCH_DEVICE_ID) { - Status = MemEncryptSevClearPageEncMask ( + Status = MemEncryptSevClearMmioPageEncMask ( 0, FixedPcdGet64 (PcdPciExpressBaseAddress), - EFI_SIZE_TO_PAGES (SIZE_256MB), - FALSE + EFI_SIZE_TO_PAGES (SIZE_256MB) ); ASSERT_EFI_ERROR (Status);