public inbox for linux-mips@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] irqchip/mips-gic: allow forced affinity for current cpu during hotplug
@ 2025-05-23 15:15 Markus Stockhausen
  2025-05-25  9:10 ` Thomas Gleixner
  0 siblings, 1 reply; 4+ messages in thread
From: Markus Stockhausen @ 2025-05-23 15:15 UTC (permalink / raw)
  To: tsbogend, tglx, linux-mips, linux-kernel, s.gottschall; +Cc: Markus Stockhausen

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@gmx.de>
Signed-off-by: Sebastian Gottschall <s.gottschall@dd-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


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2025-05-25 18:40 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-05-23 15:15 [PATCH] irqchip/mips-gic: allow forced affinity for current cpu during hotplug Markus Stockhausen
2025-05-25  9:10 ` Thomas Gleixner
2025-05-25  9:43   ` AW: " markus.stockhausen
2025-05-25 18:40     ` Thomas Gleixner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox