From 07c707858d2547aff283f2e639559627f98d3a9c Mon Sep 17 00:00:00 2001 From: Ard Biesheuvel Date: Mon, 9 Nov 2015 13:28:33 +0000 Subject: [PATCH] ArmPkg/ArmDmaLib: use the cache writeback granularity for alignment When allocating memory to perform non-coherent DMA, use the cache writeback granule rather than the data cache linesize for alignment. This prevents the explicit cache maintenance from corrupting unrelated adjacent data if the cache writeback granule exceeds the cache linesize. Reported-by: Mark Rutland Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ard Biesheuvel Reviewed-by: Mark Rutland Reviewed-by: Leif Lindholm git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18759 6f19259b-4bc3-4df7-8a09-765794883524 --- ArmPkg/Library/ArmDmaLib/ArmDmaLib.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ArmPkg/Library/ArmDmaLib/ArmDmaLib.c b/ArmPkg/Library/ArmDmaLib/ArmDmaLib.c index 12b194046a..54a49a18d3 100755 --- a/ArmPkg/Library/ArmDmaLib/ArmDmaLib.c +++ b/ArmPkg/Library/ArmDmaLib/ArmDmaLib.c @@ -277,7 +277,7 @@ ArmDmaLibConstructor ( Status = gBS->LocateProtocol (&gEfiCpuArchProtocolGuid, NULL, (VOID **)&gCpu); ASSERT_EFI_ERROR(Status); - gCacheAlignment = ArmDataCacheLineLength (); + gCacheAlignment = ArmCacheWritebackGranule (); return Status; }