realtek: backport MIPS GIC patch
authorMarkus Stockhausen <[email protected]>
Sun, 22 Jun 2025 07:49:29 +0000 (03:49 -0400)
committerRobert Marko <[email protected]>
Sun, 22 Jun 2025 21:12:02 +0000 (23:12 +0200)
Upstream has gained support for forced affinity settings in the MIPS
GIC interrupt controller. This is needed to enable the Otto timer on
the RTL931x platform. See

https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git/
commit/?id=2250db8628a0d8293ad2e0671138b848a185fba1

Signed-off-by: Markus Stockhausen <[email protected]>
Link: https://github.com/openwrt/openwrt/pull/19205
Signed-off-by: Robert Marko <[email protected]>
target/linux/realtek/patches-6.12/302-6.17-irqchip-mips-gic-forced-affinity.patch [new file with mode: 0644]

diff --git a/target/linux/realtek/patches-6.12/302-6.17-irqchip-mips-gic-forced-affinity.patch b/target/linux/realtek/patches-6.12/302-6.17-irqchip-mips-gic-forced-affinity.patch
new file mode 100644 (file)
index 0000000..cf04d60
--- /dev/null
@@ -0,0 +1,47 @@
+From 2250db8628a0d8293ad2e0671138b848a185fba1 Mon Sep 17 00:00:00 2001
+From: Markus Stockhausen <[email protected]>
+Date: Sat, 21 Jun 2025 01:49:51 -0400
+Subject: irqchip/mips-gic: Allow forced affinity
+
+Devices of the Realtek MIPS Otto platform use the official rtl-otto-timer
+as clock event generator and CPU clocksource. It is registered for each CPU
+startup via cpuhp_setup_state() and forces the affinity of the clockevent
+interrupts to the appropriate CPU via irq_force_affinity().
+
+On the "smaller" devices with a vendor specific interrupt controller
+(supported by irq-realtek-rtl) the registration works fine. The "larger"
+RTL931x series is based on a MIPS interAptiv dual core with a MIPS GIC
+controller. Interrupt routing setup is cancelled because gic_set_affinity()
+does not accept the current (not yet online) CPU as a target.
+
+Relax the checks by evaluating the force parameter that is provided for
+exactly this purpose like in other drivers. With this the affinity can be
+set as follows:
+
+ - force = false: allow to set affinity to any online cpu
+ - force = true:  allow to set affinity to any cpu
+
+Co-developed-by: Sebastian Gottschall <[email protected]>
+Signed-off-by: Sebastian Gottschall <[email protected]>
+Signed-off-by: Markus Stockhausen <[email protected]>
+Signed-off-by: Thomas Gleixner <[email protected]>
+Link: https://lore.kernel.org/all/[email protected]
+---
+ drivers/irqchip/irq-mips-gic.c | 8 ++++++--
+ 1 file changed, 6 insertions(+), 2 deletions(-)
+
+--- a/drivers/irqchip/irq-mips-gic.c
++++ b/drivers/irqchip/irq-mips-gic.c
+@@ -263,7 +263,11 @@ static int gic_set_affinity(struct irq_d
+       unsigned long flags;
+       unsigned int cpu;
+-      cpu = cpumask_first_and(cpumask, cpu_online_mask);
++      if (force)
++              cpu = cpumask_first(cpumask);
++      else
++              cpu = cpumask_first_and(cpumask, cpu_online_mask);
++
+       if (cpu >= NR_CPUS)
+               return -EINVAL;