]> git.ipfire.org Git - thirdparty/openwrt.git/commitdiff
ramips: reduce ARCH_DMA_MINALIGN 23314/head
authorQingfang Deng <dqfext@gmail.com>
Wed, 27 May 2026 01:29:06 +0000 (09:29 +0800)
committerHauke Mehrtens <hauke@hauke-m.de>
Wed, 27 May 2026 22:33:18 +0000 (00:33 +0200)
Currently, Ralink SoCs use the default ARCH_DMA_MINALIGN value of 128
bytes defined in mach-generic. This is excessive for these platforms
and leads to significant memory waste in kmalloc.

Override ARCH_DMA_MINALIGN to use L1_CACHE_BYTES, which is 16 bytes for
RT288X and 32 bytes for other Ralink SoCs.

Signed-off-by: Qingfang Deng <dqfext@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/23314
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
target/linux/ramips/patches-6.18/110-MIPS-ralink-reduce-ARCH_DMA_MINALIGN.patch [new file with mode: 0644]

diff --git a/target/linux/ramips/patches-6.18/110-MIPS-ralink-reduce-ARCH_DMA_MINALIGN.patch b/target/linux/ramips/patches-6.18/110-MIPS-ralink-reduce-ARCH_DMA_MINALIGN.patch
new file mode 100644 (file)
index 0000000..76c7dc3
--- /dev/null
@@ -0,0 +1,31 @@
+From 1dc85756b759c3ecd21a22b0aef84ed41ddc7596 Mon Sep 17 00:00:00 2001
+From: Qingfang Deng <qingfang.deng@linux.dev>
+Date: Tue, 28 Apr 2026 16:25:40 +0800
+Subject: [PATCH] MIPS: ralink: reduce ARCH_DMA_MINALIGN
+
+Currently, Ralink SoCs use the default ARCH_DMA_MINALIGN value of 128
+bytes defined in mach-generic. This is excessive for these platforms
+and leads to significant memory waste in kmalloc.
+
+Override ARCH_DMA_MINALIGN to use L1_CACHE_BYTES, which is 16 bytes for
+RT288X and 32 bytes for other Ralink SoCs.
+
+Signed-off-by: Qingfang Deng <qingfang.deng@linux.dev>
+Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
+---
+ arch/mips/include/asm/mach-ralink/kmalloc.h | 9 +++++++++
+ 1 file changed, 9 insertions(+)
+ create mode 100644 arch/mips/include/asm/mach-ralink/kmalloc.h
+
+--- /dev/null
++++ b/arch/mips/include/asm/mach-ralink/kmalloc.h
+@@ -0,0 +1,9 @@
++/* SPDX-License-Identifier: GPL-2.0 */
++#ifndef __ASM_MACH_RALINK_KMALLOC_H
++#define __ASM_MACH_RALINK_KMALLOC_H
++
++#ifdef CONFIG_DMA_NONCOHERENT
++#define ARCH_DMA_MINALIGN     L1_CACHE_BYTES
++#endif
++
++#endif /* __ASM_MACH_RALINK_KMALLOC_H */