* [PATCHv2] gpio: mvebu: use raw spinlock for MMIO regmaps
@ 2026-09-17 23:09 Rosen Penev
2026-09-30 13:25 ` Linus Walleij
0 siblings, 1 reply; 2+ messages in thread
From: Rosen Penev @ 2026-09-17 23:09 UTC (permalink / raw)
To: linux-gpio
Cc: Linus Walleij, Bartosz Golaszewski, Sebastian Andrzej Siewior,
Clark Williams, Steven Rostedt, open list,
open list:Real-time Linux (PREEMPT_RT):Keyword:PREEMPT_RT
The mask/unmask handlers run with the generic irqchip's raw spinlock
held and call regmap_read()/regmap_write() on the GPIO regmaps. By
default regmap protects itself with a plain spinlock, which becomes a
sleeping rt_mutex on CONFIG_PREEMPT_RT; taking it while holding the raw
irqchip lock trips might_sleep(), and PROVE_RAW_LOCK_NESTING flags the
same nesting on non-RT builds.
Configure both GPIO regmaps with .use_raw_spinlock = true so the MMIO
accesses stay atomic in hardirq and raw-locked context.
Assisted-by: LLM
Signed-off-by: Rosen Penev <rosenp@gmail.com>
Reviewed-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
v2: remove inline comment
drivers/gpio/gpio-mvebu.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/gpio/gpio-mvebu.c b/drivers/gpio/gpio-mvebu.c
index 267e6d5bacd0..92ce02441cc9 100644
--- a/drivers/gpio/gpio-mvebu.c
+++ b/drivers/gpio/gpio-mvebu.c
@@ -603,6 +603,7 @@ static const struct regmap_config mvebu_gpio_regmap_config = {
.reg_bits = 32,
.reg_stride = 4,
.val_bits = 32,
+ .use_raw_spinlock = true,
};
static const struct regmap_config mvebu_gpio_percpu_regmap_config = {
@@ -610,6 +611,7 @@ static const struct regmap_config mvebu_gpio_percpu_regmap_config = {
.reg_bits = 32,
.reg_stride = 4,
.val_bits = 32,
+ .use_raw_spinlock = true,
};
static const struct regmap_config mvebu_pwm_regmap_config = {
--
2.55.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCHv2] gpio: mvebu: use raw spinlock for MMIO regmaps
2026-09-17 23:09 [PATCHv2] gpio: mvebu: use raw spinlock for MMIO regmaps Rosen Penev
@ 2026-09-30 13:25 ` Linus Walleij
0 siblings, 0 replies; 2+ messages in thread
From: Linus Walleij @ 2026-09-30 13:25 UTC (permalink / raw)
To: Rosen Penev
Cc: linux-gpio, Bartosz Golaszewski, Sebastian Andrzej Siewior,
Clark Williams, Steven Rostedt, open list,
open list:Real-time Linux (PREEMPT_RT):Keyword:PREEMPT_RT
On Fri, Sep 18, 2026 at 1:09 AM Rosen Penev <rosenp@gmail.com> wrote:
> The mask/unmask handlers run with the generic irqchip's raw spinlock
> held and call regmap_read()/regmap_write() on the GPIO regmaps. By
> default regmap protects itself with a plain spinlock, which becomes a
> sleeping rt_mutex on CONFIG_PREEMPT_RT; taking it while holding the raw
> irqchip lock trips might_sleep(), and PROVE_RAW_LOCK_NESTING flags the
> same nesting on non-RT builds.
>
> Configure both GPIO regmaps with .use_raw_spinlock = true so the MMIO
> accesses stay atomic in hardirq and raw-locked context.
>
> Assisted-by: LLM
> Signed-off-by: Rosen Penev <rosenp@gmail.com>
> Reviewed-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Reviewed-by: Linus Walleij <linusw@kernel.org>
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-09-30 13:25 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-17 23:09 [PATCHv2] gpio: mvebu: use raw spinlock for MMIO regmaps Rosen Penev
2026-09-30 13:25 ` Linus Walleij
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox