Skip to contentSkip to conversation

gpio: mvebu: use raw spinlock for MMIO regmaps

PATCH In review Rosen Penev 2 participants 2 messages Sep 17 – Sep 30

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 gpio: mvebu: use raw spinlock for MMIO regmaps

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.

---
v2: remove inline comment

 drivers/gpio/gpio-mvebu.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/gpio/gpio-mvebu.c +2 -0
index 267e6d5bacd0..92ce02441cc9 100644
@@ -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 = {
Signature · 1 line
2.55.0
maintainer Reviewed-by on v2 1/1
#1 lore raw
Quoted 7 lines · Rosen Penev

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.

Quoted 6 lines

Configure both GPIO regmaps with .use_raw_spinlock = true so the MMIO accesses stay atomic in hardirq and raw-locked context.

Yours,
Linus Walleij