Skip to contentSkip to conversation

HID: intel-thc-hid: intel-thc: raw spinlocks for registers

PATCH Superseded Emfox Zhou 3 participants 3 messages Nov 18 – Nov 20

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Emfox Zhou

author
#0 lore raw

PATCH 1/1 HID: intel-thc-hid: intel-thc: raw spinlocks for registers

The primary interrupt handlers of intel-quickspi, intel-quicki2c and intel-ipts reach the registers from hardirq context. The map is a fast_io one, so its lock is a spinlock_t, which on PREEMPT_RT is a sleeping lock:
taking it there is an invalid wait context.

Ask for a raw spinlock instead. The accessors only touch MMIO, and the map is fast_io precisely because it is used where sleeping is not possible, so nothing else changes.

---
 drivers/hid/intel-thc-hid/intel-thc/intel-thc-dev.c | 1 +
 1 file changed, 1 insertion(+)
drivers/hid/intel-thc-hid/intel-thc/intel-thc-dev.c +1 -0
index 7feda4160..e318f26ad 100644
@@ -49,6 +49,7 @@ static const struct regmap_config thc_regmap_cfg = {
 	.reg_write = thc_regmap_write,
 	.cache_type = REGCACHE_NONE,
 	.fast_io = true,
+	.use_raw_spinlock = true,
 	.rd_table = &thc_rw_table,
 	.wr_table = &thc_rw_table,
 	.volatile_table	= &thc_rw_table,

base-commit: aebb7274476403040d582c61478df8f4a7bf9cd3

#1 lore raw
Thank you for your contribution! Sashiko AI review found 1 potential issue to consider: - [Low] HID: intel-thc-hid: missing Fixes trailer for thc_regmap_cfg raw spinlock fix --

Thank you for your contribution! Sashiko AI review found 1 potential issue to consider:
- [Low] HID: intel-thc-hid: missing Fixes trailer for thc_regmap_cfg raw spinlock fix
--

commit 68e15b8b74f173320164f31790193df2ee43dccc
Author: Emfox Zhou <[email protected]>

Quoted 7 lines

HID: intel-thc-hid: intel-thc: raw spinlocks for registers

The primary interrupt handlers of intel-quickspi, intel-quicki2c and intel-ipts reach the registers from hardirq context. The map is a fast_io one, so its lock is a spinlock_t, which on PREEMPT_RT is a sleeping lock:
taking it there is an invalid wait context.

Quoted 5 lines

Ask for a raw spinlock instead. The accessors only touch MMIO, and the map is fast_io precisely because it is used where sleeping is not possible, so nothing else changes.

[Severity: Low]
Since this fixes an invalid wait context when accessing thc_regmap_cfg from hardirq handlers, should this include a Fixes tag?

Fixes 1b2d05384c29 ("HID: intel-thc-hid: Add basic THC driver skeleton")
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
maintainer Reviewed-by on v1 1/1
#2 lore raw
In reply to Emfox Zhou
Quoted 10 lines

-----Original Message-----
From: Emfox Zhou <[email protected]>
Sent: Wednesday, November 18, 2026 2:57 PM
To: Xu, Even <[email protected]>; Sun, Xinpeng <[email protected]>; Jiri Kosina <[email protected]>; Benjamin Tissoires <[email protected]>
Cc: [email protected]; [email protected]
Subject: [PATCH] HID: intel-thc-hid: intel-thc: raw spinlocks for registers

Quoted 8 lines

The primary interrupt handlers of intel-quickspi, intel-quicki2c and intel-ipts reach the registers from hardirq context. The map is a fast_io one, so its lock is a spinlock_t, which on PREEMPT_RT is a sleeping lock:
taking it there is an invalid wait context.

Ask for a raw spinlock instead. The accessors only touch MMIO, and the map is fast_io precisely because it is used where sleeping is not possible, so nothing else changes.

Make sense.
Thanks for the patch!

Quoted 21 lines
---
 drivers/hid/intel-thc-hid/intel-thc/intel-thc-dev.c | 1 +
 1 file changed, 1 insertion(+)
drivers/hid/intel- renamed from drivers/hid/intel-thc-hid/intel-thc/intel-thc-dev.c +0 -0

thc-hid/intel-thc/intel-thc-dev.c
index 7feda4160..e318f26ad 100644

drivers/hid/intel-thc-hid/intel-thc/intel-thc-dev.c +1 -0
@@ -49,6 +49,7 @@ static const struct regmap_config thc_regmap_cfg = {
 	.reg_write = thc_regmap_write,
 	.cache_type = REGCACHE_NONE,
 	.fast_io = true,
+	.use_raw_spinlock = true,
 	.rd_table = &thc_rw_table,
 	.wr_table = &thc_rw_table,
 	.volatile_table	= &thc_rw_table,

base-commit: aebb7274476403040d582c61478df8f4a7bf9cd3