]> git.proxmox.com Git - mirror_edk2.git/commitdiff
ArmPkg/ArmDmaLib: do not remap arbitrary memory regions as uncached
authorArd Biesheuvel <ard.biesheuvel@linaro.org>
Tue, 19 Apr 2016 14:37:04 +0000 (16:37 +0200)
committerArd Biesheuvel <ard.biesheuvel@linaro.org>
Tue, 10 May 2016 12:44:40 +0000 (14:44 +0200)
In the DmaMap () operation, if the region to be mapped happens to be
aligned to the Cache Writeback Granule (CWG) (whose value is typically
64 or 128 bytes and 2 KB maximum), we remap the memory as uncached.

Since remapping memory occurs at page granularity, while the buffer and the
CWG may be much smaller, there is no telling what other memory we affect
by doing this, especially since the operation is not reverted in DmaUnmap().

So remove the remapping call.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
ArmPkg/Library/ArmDmaLib/ArmDmaLib.c

index 0e6fdce8ab52e3a05baba5e63d3a4b2ab387fc88..f5788b3756e98ad23741140943c9b63cf83910f3 100644 (file)
@@ -138,12 +138,6 @@ DmaMap (
 \r
     // Flush the Data Cache (should not have any effect if the memory region is uncached)\r
     gCpu->FlushDataCache (gCpu, *DeviceAddress, *NumberOfBytes, EfiCpuFlushTypeWriteBackInvalidate);\r
-\r
-    if ((Operation == MapOperationBusMasterRead) || (Operation == MapOperationBusMasterCommonBuffer)) {\r
-      // In case the buffer is used for instance to send command to a PCI controller, we must ensure the memory is uncached\r
-      Status = gDS->SetMemorySpaceAttributes (*DeviceAddress & ~(BASE_4KB - 1), ALIGN_VALUE (*NumberOfBytes, BASE_4KB), EFI_MEMORY_WC);\r
-      ASSERT_EFI_ERROR (Status);\r
-    }\r
   }\r
 \r
   Map->HostAddress   = (UINTN)HostAddress;\r