On Fri, May 24, 2024 at 06:26:42PM GMT, Chris Lew wrote:..
Add qcom_smem_bust_hwspin_lock_by_host to enable remoteproc to bust the
hwspin_lock owned by smem. In the event the remoteproc crashes
unexpectedly, the remoteproc driver can invoke this API to try and bust
the hwspin_lock and release the lock if still held by the remoteproc
device.
Signed-off-by: Chris Lew <quic_clew@xxxxxxxxxxx>
---
drivers/soc/qcom/smem.c | 28 ++++++++++++++++++++++++++++
include/linux/soc/qcom/smem.h | 2 ++
2 files changed, 30 insertions(+)
diff --git a/drivers/soc/qcom/smem.c b/drivers/soc/qcom/smem.c
index 7191fa0c087f..683599990387 100644
--- a/drivers/soc/qcom/smem.c
+++ b/drivers/soc/qcom/smem.c
+ *
+ * Context: Process context.
+ *
+ * Returns: 0 on success, otherwise negative errno.
+ */
+int qcom_smem_bust_hwspin_lock_by_host(unsigned host)
+{
+ if (!__smem)
+ return -EPROBE_DEFER;
This would be called at a time where -EPROBE_DEFER isn't appropriate,
the client should invoke qcom_smem_is_available() at probe time to guard
against this.