Skip to content

Commit 2f44a51

Browse files
DragonBlueprobimarko
authored andcommitted
kernel: tune 24kc instead of 34kc for mips32r2
GCC generates the same code for 24kc and 34kc. Since we have converted all 34kc targets to the 24kc, it's better to switch kernel -mtune to 24kc to avoid confusing developers. Signed-off-by: Shiji Yang <yangshiji66@outlook.com> Link: openwrt/openwrt#22703 Signed-off-by: Robert Marko <robimarko@gmail.com>
1 parent e0cfd7f commit 2f44a51

4 files changed

Lines changed: 10 additions & 10 deletions

File tree

target/linux/generic/pending-6.12/308-mips32r2_tune.patch

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
From: Felix Fietkau <nbd@nbd.name>
2-
Subject: kernel: add -mtune=34kc to MIPS CFLAGS when building for mips32r2
2+
Subject: kernel: add -mtune=24kc to MIPS CFLAGS when building for mips32r2
33

44
This provides a good tradeoff across at least 24Kc-74Kc, while also
55
producing smaller code.
@@ -16,7 +16,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
1616
cflags-$(CONFIG_CPU_TX49XX) += $(call cc-option,-march=r4600,-march=mips3) -Wa,--trap
1717
cflags-$(CONFIG_CPU_MIPS32_R1) += -march=mips32 -Wa,--trap
1818
-cflags-$(CONFIG_CPU_MIPS32_R2) += -march=mips32r2 -Wa,--trap
19-
+cflags-$(CONFIG_CPU_MIPS32_R2) += -march=mips32r2 -mtune=34kc -Wa,--trap
19+
+cflags-$(CONFIG_CPU_MIPS32_R2) += -march=mips32r2 -mtune=24kc -Wa,--trap
2020
cflags-$(CONFIG_CPU_MIPS32_R5) += -march=mips32r5 -Wa,--trap -modd-spreg
2121
cflags-$(CONFIG_CPU_MIPS32_R6) += -march=mips32r6 -Wa,--trap -modd-spreg
2222
cflags-$(CONFIG_CPU_MIPS64_R1) += -march=mips64 -Wa,--trap

target/linux/generic/pending-6.18/308-mips32r2_tune.patch

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
From: Felix Fietkau <nbd@nbd.name>
2-
Subject: kernel: add -mtune=34kc to MIPS CFLAGS when building for mips32r2
2+
Subject: kernel: add -mtune=24kc to MIPS CFLAGS when building for mips32r2
33

44
This provides a good tradeoff across at least 24Kc-74Kc, while also
55
producing smaller code.
@@ -16,7 +16,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
1616
cflags-$(CONFIG_CPU_TX49XX) += $(call cc-option,-march=r4600,-march=mips3) -Wa,--trap
1717
cflags-$(CONFIG_CPU_MIPS32_R1) += -march=mips32 -Wa,--trap
1818
-cflags-$(CONFIG_CPU_MIPS32_R2) += -march=mips32r2 -Wa,--trap
19-
+cflags-$(CONFIG_CPU_MIPS32_R2) += -march=mips32r2 -mtune=34kc -Wa,--trap
19+
+cflags-$(CONFIG_CPU_MIPS32_R2) += -march=mips32r2 -mtune=24kc -Wa,--trap
2020
cflags-$(CONFIG_CPU_MIPS32_R5) += -march=mips32r5 -Wa,--trap -modd-spreg
2121
cflags-$(CONFIG_CPU_MIPS32_R6) += -march=mips32r6 -Wa,--trap -modd-spreg
2222
cflags-$(CONFIG_CPU_MIPS64_R1) += -march=mips64 -Wa,--trap

target/linux/realtek/patches-6.12/308-tune-switch-4kec.patch

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ From: Markus Stockhausen <markus.stockhausen@gmx.de>
22
Date: Fri, 13 Jun 2025 20:25:37 +0100
33
Subject: [PATCH] realtek: set mtune 4kec for RTL838x targets
44

5-
Generic patches will always force the gcc kernel tuning to 34kc. With RTL838x
5+
Generic patches will always force the gcc kernel tuning to 24kc. With RTL838x
66
being only 4kec this does not harm but is not right. Match the tuning properly.
77

88
Signed-off-by: Markus Stockhausen <markus.stockhausen@gmx.de>
@@ -13,10 +13,10 @@ Signed-off-by: Markus Stockhausen <markus.stockhausen@gmx.de>
1313
@@ -164,6 +164,11 @@ cflags-$(CONFIG_CPU_R4X00) += $(call cc-
1414
cflags-$(CONFIG_CPU_TX49XX) += $(call cc-option,-march=r4600,-march=mips3) -Wa,--trap
1515
cflags-$(CONFIG_CPU_MIPS32_R1) += -march=mips32 -Wa,--trap
16-
cflags-$(CONFIG_CPU_MIPS32_R2) += -march=mips32r2 -mtune=34kc -Wa,--trap
16+
cflags-$(CONFIG_CPU_MIPS32_R2) += -march=mips32r2 -mtune=24kc -Wa,--trap
1717
+
1818
+#ifdef CONFIG_RTL838X
19-
+cflags-$(CONFIG_CPU_MIPS32_R2) := $(subst 34kc,4kec,$(cflags-$(CONFIG_CPU_MIPS32_R2)))
19+
+cflags-$(CONFIG_CPU_MIPS32_R2) := $(subst 24kc,4kec,$(cflags-$(CONFIG_CPU_MIPS32_R2)))
2020
+#endif
2121
+
2222
cflags-$(CONFIG_CPU_MIPS32_R5) += -march=mips32r5 -Wa,--trap -modd-spreg

target/linux/realtek/patches-6.18/308-tune-switch-4kec.patch

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ From: Markus Stockhausen <markus.stockhausen@gmx.de>
22
Date: Fri, 13 Jun 2025 20:25:37 +0100
33
Subject: [PATCH] realtek: set mtune 4kec for RTL838x targets
44

5-
Generic patches will always force the gcc kernel tuning to 34kc. With RTL838x
5+
Generic patches will always force the gcc kernel tuning to 24kc. With RTL838x
66
being only 4kec this does not harm but is not right. Match the tuning properly.
77

88
Signed-off-by: Markus Stockhausen <markus.stockhausen@gmx.de>
@@ -13,10 +13,10 @@ Signed-off-by: Markus Stockhausen <markus.stockhausen@gmx.de>
1313
@@ -160,6 +160,11 @@ cflags-$(CONFIG_CPU_R4X00) += $(call cc-
1414
cflags-$(CONFIG_CPU_TX49XX) += $(call cc-option,-march=r4600,-march=mips3) -Wa,--trap
1515
cflags-$(CONFIG_CPU_MIPS32_R1) += -march=mips32 -Wa,--trap
16-
cflags-$(CONFIG_CPU_MIPS32_R2) += -march=mips32r2 -mtune=34kc -Wa,--trap
16+
cflags-$(CONFIG_CPU_MIPS32_R2) += -march=mips32r2 -mtune=24kc -Wa,--trap
1717
+
1818
+#ifdef CONFIG_RTL838X
19-
+cflags-$(CONFIG_CPU_MIPS32_R2) := $(subst 34kc,4kec,$(cflags-$(CONFIG_CPU_MIPS32_R2)))
19+
+cflags-$(CONFIG_CPU_MIPS32_R2) := $(subst 24kc,4kec,$(cflags-$(CONFIG_CPU_MIPS32_R2)))
2020
+#endif
2121
+
2222
cflags-$(CONFIG_CPU_MIPS32_R5) += -march=mips32r5 -Wa,--trap -modd-spreg

0 commit comments

Comments
 (0)