Skip to content

Commit 4103cfe

Browse files
committed
LoongArch: Increase ARCH_DMA_MINALIGN up to 16
ARCH_DMA_MINALIGN is 1 by default, but some LoongArch-specific devices (such as APBDMA) require 16 bytes alignment. When the data buffer length is too small, the hardware may make an error writing cacheline. Thus, it is dangerous to allocate a small memory buffer for DMA. It's always safe to define ARCH_DMA_MINALIGN as L1_CACHE_BYTES but unnecessary (kmalloc() need small memory objects). Therefore, just increase it to 16. Cc: stable@vger.kernel.org Tested-by: Binbin Zhou <zhoubinbin@loongson.cn> Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
1 parent ec105ca commit 4103cfe

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

arch/loongarch/include/asm/cache.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
#define L1_CACHE_SHIFT CONFIG_L1_CACHE_SHIFT
99
#define L1_CACHE_BYTES (1 << L1_CACHE_SHIFT)
1010

11+
#define ARCH_DMA_MINALIGN (16)
12+
1113
#define __read_mostly __section(".data..read_mostly")
1214

1315
#endif /* _ASM_CACHE_H */

0 commit comments

Comments
 (0)