From 8ee4e52ba8dc3930512e7f6076aa76bac2e2815e Mon Sep 17 00:00:00 2001 From: Brijesh Singh Date: Wed, 19 May 2021 13:19:47 -0500 Subject: [PATCH] OvmfPkg/QemuFlashFvbServicesRuntimeDxe: use Mmio helper to clear enc mask BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=3275 Use the MemEncryptSevClearMmioPageEncMask() to clear memory encryption mask for the Mmio 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-12-brijesh.singh@amd.com> --- OvmfPkg/QemuFlashFvbServicesRuntimeDxe/FwBlockServiceDxe.c | 5 ++--- OvmfPkg/QemuFlashFvbServicesRuntimeDxe/QemuFlashSmm.c | 5 ++--- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/OvmfPkg/QemuFlashFvbServicesRuntimeDxe/FwBlockServiceDxe.c b/OvmfPkg/QemuFlashFvbServicesRuntimeDxe/FwBlockServiceDxe.c index 1f285e0083..ab40087a84 100644 --- a/OvmfPkg/QemuFlashFvbServicesRuntimeDxe/FwBlockServiceDxe.c +++ b/OvmfPkg/QemuFlashFvbServicesRuntimeDxe/FwBlockServiceDxe.c @@ -205,11 +205,10 @@ MarkIoMemoryRangeForRuntimeAccess ( // memory range. // if (MemEncryptSevIsEnabled ()) { - Status = MemEncryptSevClearPageEncMask ( + Status = MemEncryptSevClearMmioPageEncMask ( 0, BaseAddress, - EFI_SIZE_TO_PAGES (Length), - FALSE + EFI_SIZE_TO_PAGES (Length) ); ASSERT_EFI_ERROR (Status); } diff --git a/OvmfPkg/QemuFlashFvbServicesRuntimeDxe/QemuFlashSmm.c b/OvmfPkg/QemuFlashFvbServicesRuntimeDxe/QemuFlashSmm.c index 7eb80bfeff..ea75b489c7 100644 --- a/OvmfPkg/QemuFlashFvbServicesRuntimeDxe/QemuFlashSmm.c +++ b/OvmfPkg/QemuFlashFvbServicesRuntimeDxe/QemuFlashSmm.c @@ -38,11 +38,10 @@ QemuFlashBeforeProbe ( // C-bit on flash ranges from SMM page table. // - Status = MemEncryptSevClearPageEncMask ( + Status = MemEncryptSevClearMmioPageEncMask ( 0, BaseAddress, - EFI_SIZE_TO_PAGES (FdBlockSize * FdBlockCount), - FALSE + EFI_SIZE_TO_PAGES (FdBlockSize * FdBlockCount) ); ASSERT_EFI_ERROR (Status); }