audk/ArmPkg
Ard Biesheuvel 3a424c5f49 ArmPkg/ArmDmaLib: use double buffering only for bus master write
The ArmPkg implementation of DmaLib uses double buffering to ensure
that any attempt to perform non-coherent DMA on unaligned buffers cannot
corrupt adjacent unrelated data which happens to share cachelines with
the data we are exchanging with the device.

Such corruption can only occur on bus master write, in which case we have
to invalidate the caches to ensure the CPU will see the data written to
memory by the device. In the bus master read case, we can simply clean
and invalidate at the same time, which may purge unrelated adjacent data
from the caches, but will not corrupt its contents.

Also, this double buffer does not necessarily have to be allocated from
uncached memory: by the same reasoning, we can perform cache invalidation
on an ordinary pool allocation as long as we take the same alignment
constraints into account.

So update our code accordingly: remove double buffering from the bus
master read path, and switch to a pool allocation for the double buffer.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
2017-08-17 15:32:30 +01:00
..
Drivers ArmPkg: remove ArmCpuLib header and implementations 2017-04-06 14:55:11 +01:00
Filesystem/SemihostFs ArmPkg/SemihostFs: eliminate calls to deprecated string functions 2016-10-28 12:04:04 +01:00
Include ArmPkg: Move IS_DEVICE_PATH_NODE for sharing 2017-08-01 15:57:47 +01:00
Library ArmPkg/ArmDmaLib: use double buffering only for bus master write 2017-08-17 15:32:30 +01:00
ArmPkg.dec ArmPkg: remove unused PcdArmUncachedMemoryMask PCD 2017-02-27 16:18:29 +00:00
ArmPkg.dsc ArmPkg: remove ArmCpuLib header and implementations 2017-04-06 14:55:11 +01:00