[PATCH 2/7] hwspinlock: Enable hwspinlock sharing

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Richard Maina <quic_rmaina@xxxxxxxxxxx>

The hwspinlock used by qcom,smem is used to synchronize smem access
between the cpu and other remoteprocs in the soc. If one of these
remoteprocs crashes while holding the hwspinlock, then the remoteproc
driver should try to  release the lock on behalf of the rproc. This
would require rproc and smem drivers to share access to a hwspinlock
handle.

With the introduction of reference counting this is now achievable,
therefore, remove the code in hwspin_lock_request_specific() preventing
this.

The single owner condition is retained in the hwspin_lock_request()
function, as this is specifically intended for requesting an unused
hwspinlock and should not have any shared references.

Signed-off-by: Richard Maina <quic_rmaina@xxxxxxxxxxx>
Signed-off-by: Chris Lew <quic_clew@xxxxxxxxxxx>
---
 Documentation/locking/hwspinlock.rst | 8 ++++----
 drivers/hwspinlock/hwspinlock_core.c | 8 --------
 2 files changed, 4 insertions(+), 12 deletions(-)

diff --git a/Documentation/locking/hwspinlock.rst b/Documentation/locking/hwspinlock.rst
index 6f03713b7003..c1c2c827b575 100644
--- a/Documentation/locking/hwspinlock.rst
+++ b/Documentation/locking/hwspinlock.rst
@@ -53,10 +53,10 @@ Should be called from a process context (might sleep).
 
   struct hwspinlock *hwspin_lock_request_specific(unsigned int id);
 
-Assign a specific hwspinlock id and return its address, or NULL
-if that hwspinlock is already in use. Usually board code will
-be calling this function in order to reserve specific hwspinlock
-ids for predefined purposes.
+Assign a specific hwspinlock id or increment the reference count if the
+hwspinlock is already in use. Return NULL if unable to request the
+hwspinlock. Usually board code will be calling this function in order
+to reserve specific hwspinlock ids for predefined purposes.
 
 Should be called from a process context (might sleep).
 
diff --git a/drivers/hwspinlock/hwspinlock_core.c b/drivers/hwspinlock/hwspinlock_core.c
index 29b33072ff57..73a6dff5cbac 100644
--- a/drivers/hwspinlock/hwspinlock_core.c
+++ b/drivers/hwspinlock/hwspinlock_core.c
@@ -774,14 +774,6 @@ struct hwspinlock *hwspin_lock_request_specific(unsigned int id)
 	/* sanity check (this shouldn't happen) */
 	WARN_ON(hwlock_to_id(hwlock) != id);
 
-	/* make sure this hwspinlock is unused */
-	ret = radix_tree_tag_get(&hwspinlock_tree, id, HWSPINLOCK_UNUSED);
-	if (ret == 0) {
-		pr_warn("hwspinlock %u is already in use\n", id);
-		hwlock = NULL;
-		goto out;
-	}
-
 	/* mark as used and power up */
 	ret = __hwspin_lock_request(hwlock);
 	if (ret < 0)

-- 
2.25.1





[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]


  Powered by Linux