UPSTREAM: dm: core: Round up size when allocating so that it is cache line aligned

The size variable may not be always be a mulitple of
ARCH_DMA_MINALIGN and using it to flush cache leads to cache
misaligned warnings.

Therefore, round up the size to a multiple of ARCH_DMA_MINLAIGN
when allocating private data.

Change-Id: I29c4fb89f4be628518c2f5350d3efbccd28acd36
Signed-off-by: Faiz Abbas <faiz_abbas@ti.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
(cherry picked from commit 5924da1dfe56d32a45b8adf29bdc8caf788bd4c8)
This commit is contained in:
Faiz Abbas 2017-09-19 16:53:50 +05:30 committed by Kever Yang
parent 90d0ce442b
commit 9ab2e5eb63
1 changed files with 1 additions and 0 deletions

View File

@ -254,6 +254,7 @@ static void *alloc_priv(int size, uint flags)
void *priv;
if (flags & DM_FLAG_ALLOC_PRIV_DMA) {
size = ROUND(size, ARCH_DMA_MINALIGN);
priv = memalign(ARCH_DMA_MINALIGN, size);
if (priv) {
memset(priv, '\0', size);