dm: core: Round up size when allocating so that it is cache line aligned
PATCH 1/1 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.
--- drivers/core/device.c | 1 + 1 file changed, 1 insertion(+)
drivers/core/device.c +1 -0
@@ -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);
Signature · 1 line
2.7.4
PATCH 1/1 dm: core: Round up size when allocating so that it is cache line aligned
Hi Faiz,
Quoted 4 lines · Faiz Abbas
The size variable may not be always be a mulitple of
ARCH_DMA_MINALIGNand using it to flush cache leads to cache misaligned warnings.
Quoted 8 lines
Therefore, round up the size to a multiple of
ARCH_DMA_MINLAIGNwhen allocating private data.Signed-off-by Faiz Abbas <[email protected]>--- drivers/core/device.c | 1 + 1 file changed, 1 insertion(+)
Isn't DM_FLAG_ALLOC_PRIV_DMA sufficient?
Regards,
Bin
PATCH 1/1 dm: core: Round up size when allocating so that it is cache line aligned
Hi Bin,
Quoted 10 lines · Bin Meng
Hi Faiz,
Quoted 7 lines · Faiz Abbas
The size variable may not be always be a mulitple of
ARCH_DMA_MINALIGNand using it to flush cache leads to cache misaligned warnings.Therefore, round up the size to a multiple of
ARCH_DMA_MINLAIGNwhen allocating private data.
Quoted 7 lines
Quoted 5 lines
Signed-off-by Faiz Abbas <[email protected]>--- drivers/core/device.c | 1 + 1 file changed, 1 insertion(+)Isn't
DM_FLAG_ALLOC_PRIV_DMAsufficient?
The check_cache_range function checks both the beginning and the end of the range given to it for cache alignment. DM_FLAG_ALLOC_PRIV_DMA aligns only the base address but the end address decided by size need not be at a multiple of ARCH_DMA_MINALIGN.
Thanks,
Faiz
PATCH 1/1 dm: core: Round up size when allocating so that it is cache line aligned
In reply to Faiz AbbasQuoted 11 lines · Faiz Abbas
The size variable may not be always be a mulitple of
ARCH_DMA_MINALIGNand using it to flush cache leads to cache misaligned warnings.Therefore, round up the size to a multiple of
ARCH_DMA_MINLAIGNwhen allocating private data.Signed-off-by Faiz Abbas <[email protected]>--- drivers/core/device.c | 1 + 1 file changed, 1 insertion(+)
PATCH 1/1 dm: core: Round up size when allocating so that it is cache line aligned
Quoted 11 lines · Faiz Abbas
The size variable may not be always be a mulitple of
ARCH_DMA_MINALIGNand using it to flush cache leads to cache misaligned warnings.Therefore, round up the size to a multiple of
ARCH_DMA_MINLAIGNwhen allocating private data.Signed-off-by Faiz Abbas <[email protected]>--- drivers/core/device.c | 1 + 1 file changed, 1 insertion(+)
Applied to u-boot-dm thanks!