Skip to content

Commit 2250db8

Browse files
plappermaulKAGA-KOKO
authored andcommitted
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 <s.gottschall@dd-wrt.com> Signed-off-by: Sebastian Gottschall <s.gottschall@dd-wrt.com> Signed-off-by: Markus Stockhausen <markus.stockhausen@gmx.de> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Link: https://lore.kernel.org/all/20250621054952.380374-1-markus.stockhausen@gmx.de
1 parent 93174c0 commit 2250db8

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

drivers/irqchip/irq-mips-gic.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -375,9 +375,13 @@ static int gic_set_affinity(struct irq_data *d, const struct cpumask *cpumask,
375375
/*
376376
* The GIC specifies that we can only route an interrupt to one VP(E),
377377
* ie. CPU in Linux parlance, at a time. Therefore we always route to
378-
* the first online CPU in the mask.
378+
* the first forced or online CPU in the mask.
379379
*/
380-
cpu = cpumask_first_and(cpumask, cpu_online_mask);
380+
if (force)
381+
cpu = cpumask_first(cpumask);
382+
else
383+
cpu = cpumask_first_and(cpumask, cpu_online_mask);
384+
381385
if (cpu >= NR_CPUS)
382386
return -EINVAL;
383387

0 commit comments

Comments
 (0)