diff options
author | Richard Maina <quic_rmaina@quicinc.com> | 2024-05-29 20:09:55 +0200 |
---|---|---|
committer | Bjorn Andersson <andersson@kernel.org> | 2024-05-29 21:52:26 +0200 |
commit | 7c327d56597d8de1680cf24e956b704270d3d84a (patch) | |
tree | 46e51f75c8a0a7c15e25938abbf0ab770ed05dce /drivers/hwspinlock/hwspinlock_internal.h | |
parent | Linux 6.10-rc1 (diff) | |
download | linux-7c327d56597d8de1680cf24e956b704270d3d84a.tar.xz linux-7c327d56597d8de1680cf24e956b704270d3d84a.zip |
hwspinlock: Introduce hwspin_lock_bust()
When a remoteproc crashes or goes down unexpectedly this can result in
a state where locks held by the remoteproc will remain locked possibly
resulting in deadlock. This new API hwspin_lock_bust() allows
hwspinlock implementers to define a bust operation for freeing previously
acquired hwspinlocks after verifying ownership of the acquired lock.
Signed-off-by: Richard Maina <quic_rmaina@quicinc.com>
Reviewed-by: Bjorn Andersson <andersson@kernel.org>
Signed-off-by: Chris Lew <quic_clew@quicinc.com>
Link: https://lore.kernel.org/r/20240529-hwspinlock-bust-v3-1-c8b924ffa5a2@quicinc.com
Signed-off-by: Bjorn Andersson <andersson@kernel.org>
Diffstat (limited to 'drivers/hwspinlock/hwspinlock_internal.h')
-rw-r--r-- | drivers/hwspinlock/hwspinlock_internal.h | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/hwspinlock/hwspinlock_internal.h b/drivers/hwspinlock/hwspinlock_internal.h index 29892767bb7a..f298fc0ee5ad 100644 --- a/drivers/hwspinlock/hwspinlock_internal.h +++ b/drivers/hwspinlock/hwspinlock_internal.h @@ -21,6 +21,8 @@ struct hwspinlock_device; * @trylock: make a single attempt to take the lock. returns 0 on * failure and true on success. may _not_ sleep. * @unlock: release the lock. always succeed. may _not_ sleep. + * @bust: optional, platform-specific bust handler, called by hwspinlock + * core to bust a specific lock. * @relax: optional, platform-specific relax handler, called by hwspinlock * core while spinning on a lock, between two successive * invocations of @trylock. may _not_ sleep. @@ -28,6 +30,7 @@ struct hwspinlock_device; struct hwspinlock_ops { int (*trylock)(struct hwspinlock *lock); void (*unlock)(struct hwspinlock *lock); + int (*bust)(struct hwspinlock *lock, unsigned int id); void (*relax)(struct hwspinlock *lock); }; |