]> git.proxmox.com Git - mirror_edk2.git/commitdiff
ArmPkg/UncachedMemoryAllocationLib: use CWG value to align pool allocations
authorArd Biesheuvel <ard.biesheuvel@linaro.org>
Tue, 28 Feb 2017 12:13:11 +0000 (12:13 +0000)
committerArd Biesheuvel <ard.biesheuvel@linaro.org>
Wed, 8 Mar 2017 08:50:00 +0000 (09:50 +0100)
Uncached pool allocations are aligned to the data cache line length under
the assumption that this is sufficient to prevent cache maintenance from
corrupting adjacent allocations. However, the value to use in such cases
is architecturally called the Cache Writeback Granule (CWG), which is
essentially the maximum Dcache line length rather than the minimum.

Note that this is mostly a cosmetical fix, given that the pool allocation
is turned into a page allocation later, and rounded up accordingly.

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/UncachedMemoryAllocationLib/UncachedMemoryAllocationLib.c

index cd13a7da92e0468f2ec81caf2ba0cd62b7a7b61b..0d8abad2343379d24533ee6552ed1705fc3cba0e 100644 (file)
@@ -545,7 +545,7 @@ UncachedInternalAllocatePool (
   IN UINTN            AllocationSize\r
   )\r
 {\r
-  UINTN CacheLineLength = ArmDataCacheLineLength ();\r
+  UINTN CacheLineLength = ArmCacheWritebackGranule ();\r
   return UncachedInternalAllocateAlignedPool (MemoryType, AllocationSize, CacheLineLength);\r
 }\r
 \r