On Tue, Apr 19, 2016 at 04:55:34PM +0200, Ard Biesheuvel wrote: > 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 <[email protected]> > --- > ArmPkg/Library/ArmDmaLib/ArmDmaLib.c | 6 ------ > 1 file changed, 6 deletions(-) > > diff --git a/ArmPkg/Library/ArmDmaLib/ArmDmaLib.c > b/ArmPkg/Library/ArmDmaLib/ArmDmaLib.c > index 7e518ed3b83e..83f4d38a8a60 100644 > --- a/ArmPkg/Library/ArmDmaLib/ArmDmaLib.c > +++ b/ArmPkg/Library/ArmDmaLib/ArmDmaLib.c > @@ -137,12 +137,6 @@ DmaMap ( > > // Flush the Data Cache (should not have any effect if the memory region > is uncached) > gCpu->FlushDataCache (gCpu, *DeviceAddress, *NumberOfBytes, > EfiCpuFlushTypeWriteBackInvalidate); > - > - if ((Operation == MapOperationBusMasterRead) || (Operation == > MapOperationBusMasterCommonBuffer)) { > - // In case the buffer is used for instance to send command to a PCI > controller, we must ensure the memory is uncached > - Status = gDS->SetMemorySpaceAttributes (*DeviceAddress & ~(BASE_4KB - > 1), ALIGN_VALUE (*NumberOfBytes, BASE_4KB), EFI_MEMORY_WC); > - ASSERT_EFI_ERROR (Status); > - }
I would be interested in knowing what problem this was intended to solve, but regardless the above won't have been a safe way of doing it. Reviewed-by: Leif Lindholm <[email protected]> > } > > Map->HostAddress = (UINTN)HostAddress; > -- > 2.5.0 > _______________________________________________ edk2-devel mailing list [email protected] https://lists.01.org/mailman/listinfo/edk2-devel

