Skip to content

Commit 176e2a4

Browse files
Fymytejhedberg
authored andcommitted
drivers: hwspinlock: add zephyr spinlock per hwspinlock
HWSPINLOCK are used to protect accesses to shared resources between clusters. However, we don't want to sleep or be preempted while holding a HWSPINLOCK. This means we need to lock IRQs while holding the HWSPINLOCK. Moreover, in an SMP context, we need to protect accesses to a HWSPINLOCK between cores, so it is not possible to lock or release the same HWSPINLOCK multiple times. Introduce a zephyr spinlock per HWSPINLOCK to counter those issues. User facing APIs have been udpated to take into account those changes, and a new hwspinlock_dt_spec struct has been added to align with other subsystem on the management of complex device's data. Take the opportunity to rename public APIs to match the naming scheme of normal zephyr spinlocks: hwspinlock_lock -> hw_spin_lock hwspinlock_trylock -> hw_spin_trylock hwspinlock_unlock -> hw_spin_unlock Signed-off-by: Pierrick Guillaume <[email protected]>
1 parent 36e5672 commit 176e2a4

File tree

2 files changed

+303
-40
lines changed

2 files changed

+303
-40
lines changed

drivers/hwspinlock/Kconfig

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ menuconfig HWSPINLOCK
1010

1111
if HWSPINLOCK
1212

13+
module = HWSPINLOCK
14+
module-str = hwspinlock
15+
source "subsys/logging/Kconfig.template.log_config"
16+
1317
config HWSPINLOCK_INIT_PRIORITY
1418
int "HW spinlock init priority"
1519
default KERNEL_INIT_PRIORITY_DEVICE

0 commit comments

Comments
 (0)