irqchip/sifive-plic: Make better use of the effective affinity mask
authorSamuel Holland <samuel@sholland.org>
Fri, 1 Jul 2022 20:24:39 +0000 (15:24 -0500)
committerMarc Zyngier <maz@kernel.org>
Sun, 10 Jul 2022 08:50:04 +0000 (09:50 +0100)
commitde078949218242d57f791b63fac87cdb09cb0424
tree94c8fbd22b5375d5d603ed4006a9d2c960f0a734
parent4f4b8f8f95f2f4055a7725283ba144a16e05f2bb
irqchip/sifive-plic: Make better use of the effective affinity mask

The PLIC driver already updates the effective affinity mask in its
.irq_set_affinity callback. Take advantage of that information to only
touch bits (and take spinlocks) for the specific relevant hart contexts.

First, make sure the effective affinity mask is set before IRQ startup.

Then, since this mask already takes priv->lmask into account, checking
that mask later is no longer needed (and handler->present is equivalent
to the bit being set in priv->lmask).

Finally, when (un)masking or changing affinity, only clear/set the
enable bits in the specific old/new context(s). The cpumask operations
in plic_irq_unmask() are not needed because they duplicate the code in
plic_set_affinity().

Signed-off-by: Samuel Holland <samuel@sholland.org>
Signed-off-by: Marc Zyngier <maz@kernel.org>
Link: https://lore.kernel.org/r/20220701202440.59059-2-samuel@sholland.org
drivers/irqchip/Kconfig
drivers/irqchip/irq-sifive-plic.c