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 <lersek@redhat.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Brijesh Singh <brijesh.singh@amd.com>
---
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
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
On 07/31/17 21:31, Brijesh Singh wrote: > 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 <lersek@redhat.com> > Contributed-under: TianoCore Contribution Agreement 1.0 > Cc: Jordan Justen <jordan.l.justen@intel.com> > Cc: Laszlo Ersek <lersek@redhat.com> > Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org> > Signed-off-by: Brijesh Singh <brijesh.singh@amd.com> > --- > 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); > } > This looks good to me, but "IommuDxe" in the subject should be spelled "IoMmuDxe". With that change, Reviewed-by: Laszlo Ersek <lersek@redhat.com> Thanks Laszlo _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
© 2016 - 2024 Red Hat, Inc.