[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250523151542.3903598-1-markus.stockhausen@gmx.de>
Date: Fri, 23 May 2025 11:15:42 -0400
From: Markus Stockhausen <markus.stockhausen@....de>
To: tsbogend@...ha.franken.de,
tglx@...utronix.de,
linux-mips@...r.kernel.org,
linux-kernel@...r.kernel.org,
s.gottschall@...wrt.com
Cc: Markus Stockhausen <markus.stockhausen@....de>
Subject: [PATCH] irqchip/mips-gic: allow forced affinity for current cpu during hotplug
Devices of the Realtek MIPS Otto platform use the official rtl-otto-timer
as clock event generator and cpu clocksource. It is registered for 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. With this patch affinity can be set as follows:
- force = false: works like before
- force = true: allow to set affinity to the current not yet online cpu
Signed-off-by: Markus Stockhausen <markus.stockhausen@....de>
Signed-off-by: Sebastian Gottschall <s.gottschall@...wrt.com>
---
drivers/irqchip/irq-mips-gic.c | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/drivers/irqchip/irq-mips-gic.c b/drivers/irqchip/irq-mips-gic.c
index bca8053864b2..0a88f785e114 100644
--- a/drivers/irqchip/irq-mips-gic.c
+++ b/drivers/irqchip/irq-mips-gic.c
@@ -378,9 +378,18 @@ static int gic_set_affinity(struct irq_data *d, const struct cpumask *cpumask,
* the first online CPU in the mask.
*/
cpu = cpumask_first_and(cpumask, cpu_online_mask);
- if (cpu >= NR_CPUS)
+
+ if ((cpu >= NR_CPUS) && !force)
+ /* In normal mode allow only online CPUs. */
return -EINVAL;
+ if (cpu >= NR_CPUS) {
+ /* In force mode allow current not yet online CPU for hotplug handlers. */
+ cpu = cpumask_first(cpumask);
+ if (cpu != get_cpu())
+ return -EINVAL;
+ }
+
old_cpu = cpumask_first(irq_data_get_effective_affinity_mask(d));
old_cl = cpu_cluster(&cpu_data[old_cpu]);
cl = cpu_cluster(&cpu_data[cpu]);
--
2.47.0
Powered by blists - more mailing lists