diff options
| author | Jens Emil Schulz Østergaard <jensemil.schulzostergaard@microchip.com> | 2026-11-09 14:50:41 +0100 |
|---|---|---|
| committer | Linus Walleij <linusw@kernel.org> | 2026-11-17 15:05:54 +0100 |
| commit | 754c5f89ae2eafd6aabb4ef01917211faa0485ce (patch) | |
| tree | 3143a1abcf2d2bfe7888850e7043116cc8696a2a /include/uapi/linux/misc | |
| parent | 9d69679d7d48c2a122f158185422392e576c3374 (diff) | |
pinctrl: ocelot: use a raw spinlock for the GPIO regmap
The irq_chip callbacks .irq_mask, .irq_unmask and .irq_ack access the
GPIO regmap. genirq calls them with the raw spinlock irq_desc::lock
held, for example from irq_startup() in __setup_irq(). The regmap is
created with devm_regmap_init_mmio() and guarded by a spinlock_t, which
is a sleeping lock on PREEMPT_RT and must not be taken under a raw
spinlock.
Make the GPIO regmap use a raw spinlock. Its accesses are short MMIO
reads and writes. The other regmaps of the driver are not used from the
irq_chip callbacks and are left unchanged.
The issue was found with CONFIG_PROVE_RAW_LOCK_NESTING on a lan9668
board (pcb8385), when a level low interrupt on one of its GPIOs is
requested, and was seen on lan969x when a PHY interrupt on a GPIO is
requested:
=============================
[ BUG: Invalid wait context ]
-----------------------------
swapper/0/1 is trying to lock:
c3046c10 (pinctrl_ocelot:34:(config)->lock){....}-{3:3}, at: regmap_lock_spinlock+0xc/0x40
other info that might help us debug this:
context-{5:5}
locks held by swapper/0/1: 6, last CPU#0:
...
#4: c3200b5c (request_class){+.+.}-{4:4}, at: __setup_irq+0x140/0x840
#5: c3200a7c (lock_class){....}-{2:2}, at: __setup_irq+0x168/0x840
stack backtrace:
...
_raw_spin_lock_irqsave from regmap_lock_spinlock+0xc/0x40
regmap_lock_spinlock from regmap_read+0x2c/0x80
regmap_read from ocelot_irq_unmask_level+0x6c/0x240
ocelot_irq_unmask_level from irq_enable+0x38/0xc0
irq_enable from __irq_startup+0x70/0xc0
__irq_startup from irq_startup+0xb8/0x180
irq_startup from __setup_irq+0x4d0/0x840
__setup_irq from request_threaded_irq+0xbc/0x180
request_threaded_irq from devm_request_threaded_irq+0x70/0x140
With the fix the report is gone on the lan9668 board.
Fixes: c297561bc98a ("pinctrl: ocelot: Fix interrupt controller")
Signed-off-by: Jens Emil Schulz Østergaard <jensemil.schulzostergaard@microchip.com>
Signed-off-by: Linus Walleij <linusw@kernel.org>
Diffstat (limited to 'include/uapi/linux/misc')
0 files changed, 0 insertions, 0 deletions
