summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHuacai Chen <chenhuacai@loongson.cn>2025-03-30 16:31:09 +0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2025-04-10 14:33:41 +0200
commitf39af67f03b564b763b06e44cb960c10a382d54a (patch)
tree5d366b2a287add8b8721f06096493522912e956a
parent0f10f83acfd619e13c64d6705908dfd792f19544 (diff)
downloadlinux-f39af67f03b564b763b06e44cb960c10a382d54a.tar.gz
linux-f39af67f03b564b763b06e44cb960c10a382d54a.tar.bz2
linux-f39af67f03b564b763b06e44cb960c10a382d54a.zip
LoongArch: Increase ARCH_DMA_MINALIGN up to 16
commit 4103cfe9dcb88010ae4911d3ff417457d1b6a720 upstream. 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> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--arch/loongarch/include/asm/cache.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/arch/loongarch/include/asm/cache.h b/arch/loongarch/include/asm/cache.h
index 1b6d09617199..aa622c754414 100644
--- a/arch/loongarch/include/asm/cache.h
+++ b/arch/loongarch/include/asm/cache.h
@@ -8,6 +8,8 @@
#define L1_CACHE_SHIFT CONFIG_L1_CACHE_SHIFT
#define L1_CACHE_BYTES (1 << L1_CACHE_SHIFT)
+#define ARCH_DMA_MINALIGN (16)
+
#define __read_mostly __section(".data..read_mostly")
#endif /* _ASM_CACHE_H */