]> git.ipfire.org Git - thirdparty/openwrt.git/commit
realtek: mach: specify alignment topology 23492/head
authorMarkus Stockhausen <markus.stockhausen@gmx.de>
Sat, 23 May 2026 10:59:39 +0000 (12:59 +0200)
committerMarkus Stockhausen <markus.stockhausen@gmx.de>
Thu, 28 May 2026 19:02:24 +0000 (21:02 +0200)
commitfc61e795ee93f9eecd640f021a536e54a19eb1e0
tree880e236f6969e8eebf5aa30475e6e61bc87fd939
parent0324d9e4e04c4b30d58af1b2ee76bb56c2c82f96
realtek: mach: specify alignment topology

The kernel has two helper defines that guide about hardware
characteristics.

MIPS_L1_CACHE_SHIFT defines the cache line sizes (1<<x) of the
target. It defaults to 5 - so it is assumed that the device has
a cache line size of 32 bytes. This is not true for MIPS 4KEc
cores that are driving the RTL838x SOCs. These cores have 16
byte cache line sizes. Adapt the CONFIG properties for this
target to match the hardware.

ARCH_DMA_MINALIGN definies the alignment for memory allocations.
Other than its name suggests on MIPS devices that have non
coherent DMA kmalloc() respects this configuration. This ensures
that no normal memory is corrupted by DMA blocks that share the
same cache line.

The default for this is 128 bytes. And kernel states itself
"Total overkill for most systems but need as a safe default. Set
this one if any device in the system might do non-coherent DMA".

Realtek devices use non coherent DMA so they are affected by the
setting of ARCH_DMA_MINALIGN. Set this to cache line size for
all devices to reduce memory waste.

Link: https://github.com/openwrt/openwrt/pull/23492
Signed-off-by: Markus Stockhausen <markus.stockhausen@gmx.de>
target/linux/realtek/files-6.18/arch/mips/include/asm/mach-rtl-otto/kmalloc.h [new file with mode: 0644]
target/linux/realtek/patches-6.18/300-mips-add-rtl838x-platform.patch
target/linux/realtek/rtl838x/config-6.18