]> git.baikalelectronics.ru Git - kernel.git/commit
pinctrl: armada-37xx: use raw spinlocks for regmap to avoid invalid wait context
authorVladimir Oltean <vladimir.oltean@nxp.com>
Sat, 16 Jul 2022 23:37:45 +0000 (02:37 +0300)
committerLinus Walleij <linus.walleij@linaro.org>
Mon, 18 Jul 2022 22:57:38 +0000 (00:57 +0200)
commit6e36b284ae377c34b063931a919078c157eb85a9
tree434d715651fd75e52833db072a00e5e3a6540152
parent0545ec72bc378864748dc55374438dedd23cd645
pinctrl: armada-37xx: use raw spinlocks for regmap to avoid invalid wait context

The irqchip->irq_set_type method is called by __irq_set_trigger() under
the desc->lock raw spinlock.

The armada-37xx implementation, armada_37xx_irq_set_type(), uses an MMIO
regmap created by of_syscon_register(), which uses plain spinlocks
(the kind that are sleepable on RT).

Therefore, this is an invalid locking scheme for which we get a kernel
splat stating just that ("[ BUG: Invalid wait context ]"), because the
context in which the plain spinlock may sleep is atomic due to the raw
spinlock. We need to go raw spinlocks all the way.

Make this driver create its own MMIO regmap, with use_raw_spinlock=true,
and stop relying on syscon to provide it.

This patch depends on commit 71d3d18b5155 ("regmap: teach regmap to use
raw spinlocks if requested in the config").

Cc: <stable@vger.kernel.org> # 5.15+
Fixes: 971d093ed2a3 ("pinctrl: armada-37xx: Add irqchip support")
Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Link: https://lore.kernel.org/r/20220716233745.1704677-3-vladimir.oltean@nxp.com
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
drivers/pinctrl/mvebu/pinctrl-armada-37xx.c