All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v4 0/2] pinctrl: stm32: fix hwspinlock timeout and EXTI mux locking
@ 2026-10-14 16:09 Ju Nan
  2026-10-14 16:09 ` [PATCH v4 1/2] pinctrl: stm32: Fix the unit of the hwspinlock timeout Ju Nan
  2026-10-14 16:09 ` [PATCH v4 2/2] pinctrl: stm32: program the EXTI mux from .alloc instead of .activate Ju Nan
  0 siblings, 2 replies; 4+ messages in thread
From: Ju Nan @ 2026-10-14 16:09 UTC (permalink / raw)
  To: junan76, antonio.borneo, bigeasy, linusw
  Cc: alexandre.torgue, arnd, clrkwllms, lee, linux-arm-kernel,
	linux-gpio, linux-kernel, linux-rt-devel, linux-stm32,
	mcoquelin.stm32, mfd, rostedt, u.kleine-koenig

This series fixes two problems around the hwspinlock-protected EXTI mux
and pin configuration accesses in the STM32 pinctrl driver.

Patch 1 fixes the timeout passed to hwspin_lock_timeout_in_atomic().
The value was written as 1000 microseconds, but the argument is in
milliseconds, so the driver could busy-wait for up to one second with
interrupts disabled instead of the intended one millisecond. It is a
standalone fix and can be applied on its own.

Patch 2 moves the EXTI mux programming from the irq domain .activate
callback to .alloc. .activate runs under the raw desc->lock, while the
mux is written through a syscon regmap protected by a spinlock_t, which
lockdep reports as an invalid wait context and which is a real bug on
PREEMPT_RT. This was originally reported by Uwe Kleine-König in 2022.
.alloc runs in sleepable context and already reserves the mux line, so
the write now happens in the same irqmux_lock section as the
reservation. While at it, the reservation is released when the
hwspinlock cannot be taken.

---
Changes in v4:

- make the two patches a series to resolve the dependency issue
- reproduce the bug fixed by patch 2 on a modified version of
  STM32MP157-DK board with kernel version 7.1.13
- check the concurrent-requester case raised by Antonio in v3: the
  second bank is rejected in .alloc under irqmux_lock (details in
  patch 2)

v3: https://lore.kernel.org/all/20260804141402.86911-2-junan76@163.com/
v2: https://lore.kernel.org/all/20260804032227.35017-3-junan76@163.com/
v1: https://lore.kernel.org/all/20260803061718.43210-1-junan76@163.com/

Ju Nan (2):
  pinctrl: stm32: Fix the unit of the hwspinlock timeout
  pinctrl: stm32: program the EXTI mux from .alloc instead of .activate

 drivers/pinctrl/stm32/pinctrl-stm32.c | 60 ++++++++++++---------------
 1 file changed, 26 insertions(+), 34 deletions(-)

-- 
2.56.0


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-10-14 16:20 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-14 16:09 [PATCH v4 0/2] pinctrl: stm32: fix hwspinlock timeout and EXTI mux locking Ju Nan
2026-10-14 16:09 ` [PATCH v4 1/2] pinctrl: stm32: Fix the unit of the hwspinlock timeout Ju Nan
2026-10-14 16:20   ` sashiko-bot
2026-10-14 16:09 ` [PATCH v4 2/2] pinctrl: stm32: program the EXTI mux from .alloc instead of .activate Ju Nan

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.