As per the discussion [1], the buffer allocated using IOMMU->AllocateBuffer()
need not result in a buffer that is immediately usable for the
DMA device operation. Client is required to call Map() unconditionally
with BusMasterCommonBuffer before performing the desired DMA bus
master operation.

[1]https://lists.01.org/pipermail/edk2-devel/2017-July/012652.html

Suggested-by: Laszlo Ersek <[email protected]>
Contributed-under: TianoCore Contribution Agreement 1.0
Cc: Jordan Justen <[email protected]>
Cc: Laszlo Ersek <[email protected]>
Cc: Ard Biesheuvel <[email protected]>
Signed-off-by: Brijesh Singh <[email protected]>
---
 OvmfPkg/IoMmuDxe/AmdSevIoMmu.c | 14 --------------
 1 file changed, 14 deletions(-)

diff --git a/OvmfPkg/IoMmuDxe/AmdSevIoMmu.c b/OvmfPkg/IoMmuDxe/AmdSevIoMmu.c
index 9e78058b7242..cc3c979d4484 100644
--- a/OvmfPkg/IoMmuDxe/AmdSevIoMmu.c
+++ b/OvmfPkg/IoMmuDxe/AmdSevIoMmu.c
@@ -333,12 +333,6 @@ IoMmuAllocateBuffer (
                   );
   if (!EFI_ERROR (Status)) {
     *HostAddress = (VOID *) (UINTN) PhysicalAddress;
-
-    //
-    // Clear memory encryption mask
-    //
-    Status = MemEncryptSevClearPageEncMask (0, PhysicalAddress, Pages, TRUE);
-    ASSERT_EFI_ERROR(Status);
   }
 
   DEBUG ((DEBUG_VERBOSE, "%a Address 0x%Lx Pages 0x%Lx\n", __FUNCTION__, 
PhysicalAddress, Pages));
@@ -365,14 +359,6 @@ IoMmuFreeBuffer (
   IN  VOID                                     *HostAddress
   )
 {
-  EFI_STATUS  Status;
-
-  //
-  // Set memory encryption mask
-  //
-  Status = MemEncryptSevSetPageEncMask (0, 
(EFI_PHYSICAL_ADDRESS)(UINTN)HostAddress, Pages, TRUE);
-  ASSERT_EFI_ERROR(Status);
-
   DEBUG ((DEBUG_VERBOSE, "%a Address 0x%Lx Pages 0x%Lx\n", __FUNCTION__, 
(UINTN)HostAddress, Pages));
   return gBS->FreePages ((EFI_PHYSICAL_ADDRESS) (UINTN) HostAddress, Pages);
 }
-- 
2.7.4

_______________________________________________
edk2-devel mailing list
[email protected]
https://lists.01.org/mailman/listinfo/edk2-devel

Reply via email to