From patchwork Thu May 16 22:58:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Lew X-Patchwork-Id: 13666556 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0AB702CCC2; Thu, 16 May 2024 22:59:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.168.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715900387; cv=none; b=H4ZIWSZxdlMhjI+moQ1cDyHfZ4GT/57qb+cU0G8gcSnTbaQUFISIp5BmXNzNdR+VipqQ5MnHLPw2gUdRPiJwg2wZy7DW9utzoA/9/KyV2yqaxmv/q+/SKSAlQ+7/ItrtXtqot2n8vi7qlQg73ebusi/RDfOj7c8cc23Hg28ZOtM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715900387; c=relaxed/simple; bh=ZPDmk7U3xa9ciGMMpt439g4ATxp4CcHH9SRjaxdv558=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=MGQSuUNnhwolx/1NppVqRR14M5q9qDRMfatzdq8Iu1fA2YptYxJfCECeHNeD7M7BAVZQuQQhkRI0RxI70rJ1McDkU3VV8ewHQ3UbiHJCFH9OA+V4WEIK9qhFHnNc753cAhAWvCR4VaQBLKF3D/eeoM8rpo5TYA4bzbpw9/MTSs0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com; spf=pass smtp.mailfrom=quicinc.com; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b=AOQtd1TE; arc=none smtp.client-ip=205.220.168.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=quicinc.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="AOQtd1TE" Received: from pps.filterd (m0279863.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 44GKN4lX017831; Thu, 16 May 2024 22:59:09 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h= from:date:subject:mime-version:content-type :content-transfer-encoding:message-id:references:in-reply-to:to :cc; s=qcppdkim1; bh=xXHsiv91PwjlPs1MvcU7cM3/qVstxKwE0iOAL5DZUek =; b=AOQtd1TEoccPpx3pzv3CNzvdR0U4M5myJRc3hLbi2J5bdkXwmoZiXGMqQOP SqiDXHdpljQYmrcaCrC3WFqidrNnGLBnpaCwiQa6/UiCjTKrguKG0t0eI2FbN0Yn 4zC8XFr+cQuyveGG4dbfyL1LCDMWPXDIFCgkTDC/xYmKDKpAyGYwTu2uJWxDzyJu 5G4O77CRvc2hBG9j4ATkxPWpGsgxBd4swEgTTzsEhg7IqBFbM3zcfWhkqYQX7igu JMGCVk4XULdTU0/DZbdHReZSkHSu4aSVaE/6pvUp34lgFnzlXDYv8ztp1cpwzD8u imxle0LPmXFFcU8fw5TEZywlmKw== Received: from nalasppmta01.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3y5c05t5dj-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 16 May 2024 22:59:09 +0000 (GMT) Received: from nalasex01a.na.qualcomm.com (nalasex01a.na.qualcomm.com [10.47.209.196]) by NALASPPMTA01.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 44GMx6K0012432 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 16 May 2024 22:59:06 GMT Received: from hu-clew-lv.qualcomm.com (10.49.16.6) by nalasex01a.na.qualcomm.com (10.47.209.196) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.9; Thu, 16 May 2024 15:59:05 -0700 From: Chris Lew Date: Thu, 16 May 2024 15:58:19 -0700 Subject: [PATCH 1/7] hwspinlock: Introduce refcount Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <20240516-hwspinlock-bust-v1-1-47a90a859238@quicinc.com> References: <20240516-hwspinlock-bust-v1-0-47a90a859238@quicinc.com> In-Reply-To: <20240516-hwspinlock-bust-v1-0-47a90a859238@quicinc.com> To: Bjorn Andersson , Baolin Wang , Peter Zijlstra , "Ingo Molnar" , Will Deacon , Waiman Long , Boqun Feng , Jonathan Corbet , Mathieu Poirier , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Manivannan Sadhasivam , Konrad Dybcio CC: , , , , , Chris Lew , "Richard Maina" X-Mailer: b4 0.12.4 X-Developer-Signature: v=1; a=ed25519-sha256; t=1715900345; l=2718; i=quic_clew@quicinc.com; s=20240508; h=from:subject:message-id; bh=hLiGXwK6/eMJFtwZ/h8OJhnWXPSq0ajjAK8+KrHxcRc=; b=XUGEroFrF2iuYIvReZr/iR+0SeLZ7IJdNaNVHw3QAwF6yauJa3LcNrBP+WETJgxZQTOm4UhxO 4SuRikBC0ZlDOWqM1zW7mA2HtY038BudSe5ERhOTdvfgbCnfbRr2/Xy X-Developer-Key: i=quic_clew@quicinc.com; a=ed25519; pk=lEYKFaL1H5dMC33BEeOULLcHAwjKyHkTLdLZQRDTKV4= X-ClientProxiedBy: nalasex01c.na.qualcomm.com (10.47.97.35) To nalasex01a.na.qualcomm.com (10.47.209.196) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-GUID: 6WbZUnFuNARMRCh1Ki0bUX_R5fX01YI6 X-Proofpoint-ORIG-GUID: 6WbZUnFuNARMRCh1Ki0bUX_R5fX01YI6 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.650,FMLib:17.11.176.26 definitions=2024-05-16_07,2024-05-15_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 malwarescore=0 mlxlogscore=999 mlxscore=0 suspectscore=0 adultscore=0 spamscore=0 lowpriorityscore=0 bulkscore=0 phishscore=0 priorityscore=1501 clxscore=1011 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2405010000 definitions=main-2405160168 From: Richard Maina Currently each device receives a dedicated hwspinlock that is not accesible to other device drivers. In order to allow multiple consumers access to the same hwspinlock, introduce a refcount to hwspinlock struct and implement refcounting infrastructure. Signed-off-by: Richard Maina Signed-off-by: Chris Lew --- drivers/hwspinlock/hwspinlock_core.c | 14 +++++++++----- drivers/hwspinlock/hwspinlock_internal.h | 2 ++ 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/drivers/hwspinlock/hwspinlock_core.c b/drivers/hwspinlock/hwspinlock_core.c index 0c0a932c00f3..29b33072ff57 100644 --- a/drivers/hwspinlock/hwspinlock_core.c +++ b/drivers/hwspinlock/hwspinlock_core.c @@ -428,6 +428,7 @@ static int hwspin_lock_register_single(struct hwspinlock *hwlock, int id) int ret; mutex_lock(&hwspinlock_tree_lock); + hwlock->refcnt = 0; ret = radix_tree_insert(&hwspinlock_tree, id, hwlock); if (ret) { @@ -671,6 +672,8 @@ static int __hwspin_lock_request(struct hwspinlock *hwlock) ret = 0; + hwlock->refcnt++; + /* mark hwspinlock as used, should not fail */ tmp = radix_tree_tag_clear(&hwspinlock_tree, hwlock_to_id(hwlock), HWSPINLOCK_UNUSED); @@ -829,12 +832,13 @@ int hwspin_lock_free(struct hwspinlock *hwlock) /* notify the underlying device that power is not needed */ pm_runtime_put(dev); - /* mark this hwspinlock as available */ - tmp = radix_tree_tag_set(&hwspinlock_tree, hwlock_to_id(hwlock), - HWSPINLOCK_UNUSED); + if (--hwlock->refcnt == 0) { + /* mark this hwspinlock as available */ + tmp = radix_tree_tag_set(&hwspinlock_tree, hwlock_to_id(hwlock), HWSPINLOCK_UNUSED); - /* sanity check (this shouldn't happen) */ - WARN_ON(tmp != hwlock); + /* sanity check (this shouldn't happen) */ + WARN_ON(tmp != hwlock); + } module_put(dev->driver->owner); diff --git a/drivers/hwspinlock/hwspinlock_internal.h b/drivers/hwspinlock/hwspinlock_internal.h index 29892767bb7a..12f230b40693 100644 --- a/drivers/hwspinlock/hwspinlock_internal.h +++ b/drivers/hwspinlock/hwspinlock_internal.h @@ -35,11 +35,13 @@ struct hwspinlock_ops { * struct hwspinlock - this struct represents a single hwspinlock instance * @bank: the hwspinlock_device structure which owns this lock * @lock: initialized and used by hwspinlock core + * @refcnt: counter for the number of existing references to the hwspinlock * @priv: private data, owned by the underlying platform-specific hwspinlock drv */ struct hwspinlock { struct hwspinlock_device *bank; spinlock_t lock; + unsigned int refcnt; void *priv; }; From patchwork Thu May 16 22:58:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Lew X-Patchwork-Id: 13666555 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C87C82C6BB; Thu, 16 May 2024 22:59:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.180.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715900387; cv=none; b=ui2D0keQIan/ygMUAygbLO76v5WupelnIaCqxA6PhL/bVmlqEU84pf/bIai9KYh3psLmWeVKyRYbR63/KRtfKURYtO6WKHM4upFcW0n9OkE3kRq5vDghcVdj0iJsRqCj1ezwdXRP37F4yCyDFHcrycWAunwyIZFP4wVU3BcrL4g= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715900387; c=relaxed/simple; bh=/FqNeVmzdV0RIu2YWl5Icsrpu4maCXiy8NsaAx0YDuo=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=ICUjFtfGjYVqz2mu6k4B6BDdc7SInA2ti6qsmY9dQ2n7sxgBo2VTNedIZRVDZ+LK/mOPzRUNonW3G0AM4Ep0ALAAv8mzZNeCQnI/mAsSNTXkllXSVQOWod6SaILlw8qR78QW1vg6POsC3oxw+fSktfJVlsTcT1ZXAPmSRjKB4/w= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com; spf=pass smtp.mailfrom=quicinc.com; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b=hslqRhYD; arc=none smtp.client-ip=205.220.180.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=quicinc.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="hslqRhYD" Received: from pps.filterd (m0279873.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 44GKMaMC007077; Thu, 16 May 2024 22:59:09 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h= from:date:subject:mime-version:content-type :content-transfer-encoding:message-id:references:in-reply-to:to :cc; s=qcppdkim1; bh=kHfQ6NXQ5kwelITGbExYSt4Ut+ZkVK98Wx3xRk/XbuA =; b=hslqRhYDHHAfjPFa8iKmqEroZfRdMH+Ltt+PE3n6i44jdmqyQYvhpZ8Q4K0 pVCc9X5p1G1eiTvv3diW74Djf6Ddwe1gLa2dRZ3hjJOywnSslxdG1mFLA9ZGv7SW S7jOGV534rOVce428uIbQtP84JLZBCF3F3YjgVePHHlY0v2kCl+o+MgjP+nxR/K/ Pu6ThdSe/Qv8r59JsQlkSpTlZ4tDFNukRSxEl/BkA3KkGL93Ubr/vK3hJ1FfiXZ0 +7Wgo5H/7/KrWQonLnMb/zaXLZSoGNoI518Cs0PI5w4IHfjy9W7LSqIJo8PmMp6i Z953IPo2NKvV3sSSWSnurpIE9UQ== Received: from nalasppmta01.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3y47egeu3a-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 16 May 2024 22:59:09 +0000 (GMT) Received: from nalasex01a.na.qualcomm.com (nalasex01a.na.qualcomm.com [10.47.209.196]) by NALASPPMTA01.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 44GMx6K1012432 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 16 May 2024 22:59:06 GMT Received: from hu-clew-lv.qualcomm.com (10.49.16.6) by nalasex01a.na.qualcomm.com (10.47.209.196) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.9; Thu, 16 May 2024 15:59:05 -0700 From: Chris Lew Date: Thu, 16 May 2024 15:58:20 -0700 Subject: [PATCH 2/7] hwspinlock: Enable hwspinlock sharing Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <20240516-hwspinlock-bust-v1-2-47a90a859238@quicinc.com> References: <20240516-hwspinlock-bust-v1-0-47a90a859238@quicinc.com> In-Reply-To: <20240516-hwspinlock-bust-v1-0-47a90a859238@quicinc.com> To: Bjorn Andersson , Baolin Wang , Peter Zijlstra , "Ingo Molnar" , Will Deacon , Waiman Long , Boqun Feng , Jonathan Corbet , Mathieu Poirier , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Manivannan Sadhasivam , Konrad Dybcio CC: , , , , , Chris Lew , "Richard Maina" X-Mailer: b4 0.12.4 X-Developer-Signature: v=1; a=ed25519-sha256; t=1715900345; l=2641; i=quic_clew@quicinc.com; s=20240508; h=from:subject:message-id; bh=bu2SwH1DNJyE9kUDSJOo/24lvfmmTJw6ZHzvOBd1Lqo=; b=obfsrT9HjbMTTIjfz55/lIHFyplEwmVhpEtvrrkIsUTc6OR02xAgbXUgiDg6yQZLmC5/0oQhR VHx+YYimGFoDel7o6IvQQKIfFp53cSpJ5gUkRAOATJapQO5F2eUpzSn X-Developer-Key: i=quic_clew@quicinc.com; a=ed25519; pk=lEYKFaL1H5dMC33BEeOULLcHAwjKyHkTLdLZQRDTKV4= X-ClientProxiedBy: nalasex01c.na.qualcomm.com (10.47.97.35) To nalasex01a.na.qualcomm.com (10.47.209.196) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-GUID: ZKfnza1QGKD6n4QfrXFlNS36Gfuq60Q6 X-Proofpoint-ORIG-GUID: ZKfnza1QGKD6n4QfrXFlNS36Gfuq60Q6 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.650,FMLib:17.11.176.26 definitions=2024-05-16_07,2024-05-15_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxscore=0 adultscore=0 malwarescore=0 phishscore=0 spamscore=0 mlxlogscore=999 lowpriorityscore=0 clxscore=1015 impostorscore=0 suspectscore=0 priorityscore=1501 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2405010000 definitions=main-2405160168 From: Richard Maina 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 Signed-off-by: Chris Lew --- 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) From patchwork Thu May 16 22:58:21 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Lew X-Patchwork-Id: 13666558 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1F57038FA6; Thu, 16 May 2024 22:59:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.168.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715900388; cv=none; b=hIEGiYbPKdT+1QpM0Y/9A0o9BV5nUni0WSagd13IB++XFYIMeodJvNh+jrlee+9Y+wJJAnearxqrQY43heFD3Hork7WSvtNPCdSBQs1HpN8WPC+mZ0dFlvkfRHFaA4GDeJvpBzPAibP5Kpexd+gIv4s7gW7FX4RQ+Q6sBxdEN0Q= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715900388; c=relaxed/simple; bh=PuP3rCcFrb95od+jXOlfqySFSEORz+MzdKmq2DrM7Io=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=Xo4edmLuZx1SZNEehoiyp+pZy6fF9MxxE0f4BdBf7ew/jqYz2xJc4EQO0ggqbAK5XKpO1Zxg8Jzm9ZApQX5/Rx1fUChqULn1VZqC0Bt4ak3wyyjEypFhma2vhCnAMaPWiR6UOqwzDyeKAaxHTUWAgsdLbM7ZL6Tf8xN3fejPFrU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com; spf=pass smtp.mailfrom=quicinc.com; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b=WNuUlF+W; arc=none smtp.client-ip=205.220.168.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=quicinc.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="WNuUlF+W" Received: from pps.filterd (m0279865.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 44GKMrO7008455; Thu, 16 May 2024 22:59:09 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h= from:date:subject:mime-version:content-type :content-transfer-encoding:message-id:references:in-reply-to:to :cc; s=qcppdkim1; bh=YiZm6RAtjJv5sclEXV9/7nXZIdJO10j8272UKQobI70 =; b=WNuUlF+WAnFYata1I/47Zbh6B0ajZnWCnH0+XUyeJ6t7wfOWUmOoSKJKXG1 Y/lSDIDYj0Y/DxV50PsvSzL01O7B+qtqyhWiwityvEx3vCEGvm9Jh84R6K9eZJEX hrHjFw0pcWzqxVBIoFlMCw75ZLlE3IhqOXpK9mYKw+ZnZTma1qcSDgBqXD6DhoTr 8gnqe0UksRWvs/MSWZEDKQfLJix6sdeEsyLFAssqwrwwcixKi0IoDmld7wHKYdh0 czciwE8Ugd2M22WODwcrPE7qFWi8FWW4s5Ht/k8hZfyh191SbB0OGh+7KpQ+w+OO JxmZ5KYI13wQWSxTj5Oua5YwOKw== Received: from nalasppmta01.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3y51tuk6bp-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 16 May 2024 22:59:09 +0000 (GMT) Received: from nalasex01a.na.qualcomm.com (nalasex01a.na.qualcomm.com [10.47.209.196]) by NALASPPMTA01.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 44GMx6K2012432 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 16 May 2024 22:59:06 GMT Received: from hu-clew-lv.qualcomm.com (10.49.16.6) by nalasex01a.na.qualcomm.com (10.47.209.196) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.9; Thu, 16 May 2024 15:59:05 -0700 From: Chris Lew Date: Thu, 16 May 2024 15:58:21 -0700 Subject: [PATCH 3/7] hwspinlock: Introduce hwspin_lock_bust() Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <20240516-hwspinlock-bust-v1-3-47a90a859238@quicinc.com> References: <20240516-hwspinlock-bust-v1-0-47a90a859238@quicinc.com> In-Reply-To: <20240516-hwspinlock-bust-v1-0-47a90a859238@quicinc.com> To: Bjorn Andersson , Baolin Wang , Peter Zijlstra , "Ingo Molnar" , Will Deacon , Waiman Long , Boqun Feng , Jonathan Corbet , Mathieu Poirier , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Manivannan Sadhasivam , Konrad Dybcio CC: , , , , , Chris Lew , "Richard Maina" X-Mailer: b4 0.12.4 X-Developer-Signature: v=1; a=ed25519-sha256; t=1715900345; l=5549; i=quic_clew@quicinc.com; s=20240508; h=from:subject:message-id; bh=r6T0Zp/81nd5V0dz4Vr79ona63c6Utz764HgHxRPvAQ=; b=DQOtMMsB6YfYb6ieVLpXbaK2ARStqPqBFkQrwerJT6Lfh3XX31xuKJzmMZiSp4MU0f6WNzkn1 hsG2FvAsAFSBO+6e2sWhnAfe317k6ogWTt4++PFNZ2Ri7ZNdO7qIMsk X-Developer-Key: i=quic_clew@quicinc.com; a=ed25519; pk=lEYKFaL1H5dMC33BEeOULLcHAwjKyHkTLdLZQRDTKV4= X-ClientProxiedBy: nalasex01c.na.qualcomm.com (10.47.97.35) To nalasex01a.na.qualcomm.com (10.47.209.196) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-ORIG-GUID: uz2yE_2PP5De56H-hTxKgdHjDlyI5iEE X-Proofpoint-GUID: uz2yE_2PP5De56H-hTxKgdHjDlyI5iEE X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.650,FMLib:17.11.176.26 definitions=2024-05-16_07,2024-05-15_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 adultscore=0 phishscore=0 spamscore=0 impostorscore=0 bulkscore=0 suspectscore=0 clxscore=1015 mlxscore=0 lowpriorityscore=0 mlxlogscore=999 malwarescore=0 priorityscore=1501 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2405010000 definitions=main-2405160168 From: Richard Maina 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 Signed-off-by: Chris Lew --- Documentation/locking/hwspinlock.rst | 11 +++++++++++ drivers/hwspinlock/hwspinlock_core.c | 30 +++++++++++++++++++++++++++++- drivers/hwspinlock/hwspinlock_internal.h | 3 +++ include/linux/hwspinlock.h | 6 ++++++ 4 files changed, 49 insertions(+), 1 deletion(-) diff --git a/Documentation/locking/hwspinlock.rst b/Documentation/locking/hwspinlock.rst index c1c2c827b575..6ee94cc6d3b7 100644 --- a/Documentation/locking/hwspinlock.rst +++ b/Documentation/locking/hwspinlock.rst @@ -85,6 +85,17 @@ is already free). Should be called from a process context (might sleep). +:: + + int hwspin_lock_bust(struct hwspinlock *hwlock, unsigned int id); + +After verifying the owner of the hwspinlock, release a previously acquired +hwspinlock; returns 0 on success, or an appropriate error code on failure +(e.g. -EOPNOTSUPP if the bust operation is not defined for the specific +hwspinlock). + +Should be called from a process context (might sleep). + :: int hwspin_lock_timeout(struct hwspinlock *hwlock, unsigned int timeout); diff --git a/drivers/hwspinlock/hwspinlock_core.c b/drivers/hwspinlock/hwspinlock_core.c index 73a6dff5cbac..a7851262f36f 100644 --- a/drivers/hwspinlock/hwspinlock_core.c +++ b/drivers/hwspinlock/hwspinlock_core.c @@ -305,6 +305,34 @@ void __hwspin_unlock(struct hwspinlock *hwlock, int mode, unsigned long *flags) } EXPORT_SYMBOL_GPL(__hwspin_unlock); +/** + * hwspin_lock_bust() - bust a specific hwspinlock + * @hwlock: a previously-acquired hwspinlock which we want to bust + * @id: identifier of the remote lock holder, if applicable + * + * This function will bust a hwspinlock that was previously acquired as + * long as the current owner of the lock matches the id given by the caller. + * + * Should be called from a process context (might sleep). + * + * Returns: 0 on success, or -EINVAL if the hwspinlock does not exist, or + * the bust operation fails, and -EOPNOTSUPP if the bust operation is not + * defined for the hwspinlock. + */ +int hwspin_lock_bust(struct hwspinlock *hwlock, unsigned int id) +{ + if (WARN_ON(!hwlock)) + return -EINVAL; + + if (!hwlock->bank->ops->bust) { + pr_err("bust operation not defined\n"); + return -EOPNOTSUPP; + } + + return hwlock->bank->ops->bust(hwlock, id); +} +EXPORT_SYMBOL_GPL(hwspin_lock_bust); + /** * of_hwspin_lock_simple_xlate - translate hwlock_spec to return a lock id * @hwlock_spec: hwlock specifier as found in the device tree @@ -610,7 +638,7 @@ EXPORT_SYMBOL_GPL(devm_hwspin_lock_unregister); * This function should be called from the underlying platform-specific * implementation, to register a new hwspinlock device instance. * - * Should be called from a process context (might sleep) + * Context: Process context. GFP_KERNEL allocation. * * Returns: %0 on success, or an appropriate error code on failure */ diff --git a/drivers/hwspinlock/hwspinlock_internal.h b/drivers/hwspinlock/hwspinlock_internal.h index 12f230b40693..2202f2c9a62e 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); }; diff --git a/include/linux/hwspinlock.h b/include/linux/hwspinlock.h index bfe7c1f1ac6d..f0231dbc4777 100644 --- a/include/linux/hwspinlock.h +++ b/include/linux/hwspinlock.h @@ -68,6 +68,7 @@ int __hwspin_lock_timeout(struct hwspinlock *, unsigned int, int, int __hwspin_trylock(struct hwspinlock *, int, unsigned long *); void __hwspin_unlock(struct hwspinlock *, int, unsigned long *); int of_hwspin_lock_get_id_byname(struct device_node *np, const char *name); +int hwspin_lock_bust(struct hwspinlock *hwlock, unsigned int id); int devm_hwspin_lock_free(struct device *dev, struct hwspinlock *hwlock); struct hwspinlock *devm_hwspin_lock_request(struct device *dev); struct hwspinlock *devm_hwspin_lock_request_specific(struct device *dev, @@ -127,6 +128,11 @@ void __hwspin_unlock(struct hwspinlock *hwlock, int mode, unsigned long *flags) { } +static inline int hwspin_lock_bust(struct hwspinlock *hwlock, unsigned int id) +{ + return 0; +} + static inline int of_hwspin_lock_get_id(struct device_node *np, int index) { return 0; From patchwork Thu May 16 22:58:22 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Lew X-Patchwork-Id: 13666557 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1F5A339851; Thu, 16 May 2024 22:59:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.168.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715900388; cv=none; b=dQy2P2Zym/O+kn6+0N+V/DZvZK4couuJK6Y0Txj3ltg1DzE+MGBRN1HsE5UDUe2qZyYLxBk8LpMh/b6+Jw8rz3QUcD2xX7/PV76FCLYO78ec0+9wcEIPeQffYxWKh0sBhxEMrVdCcqtPNoArluPiIj8nW2if2cYAAgl+fWW+QN8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715900388; c=relaxed/simple; bh=J6E0L17paEd5vpzM19w830w8zTXJU6s5lgFNGXm//VI=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=qmjp+ARVNeUpdwTQS6a+Hk5eeIxeKQWwFIh/qJvrPgYzSaMr0nJ7bnjZb0OTBgHoi8WFiypbwlzlpPjsJ78txiBY6RVw+4K3suA8qAowUVYCu2tW7NuNCV+xxNlbXTiA/7wiu/hgBPwrM/DnqkgEmuWZooF9u22siyy4232EUi0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com; spf=pass smtp.mailfrom=quicinc.com; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b=FSlGAyhS; arc=none smtp.client-ip=205.220.168.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=quicinc.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="FSlGAyhS" Received: from pps.filterd (m0279867.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 44GKMZdU032375; Thu, 16 May 2024 22:59:09 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h= from:date:subject:mime-version:content-type :content-transfer-encoding:message-id:references:in-reply-to:to :cc; s=qcppdkim1; bh=/zdoZNB4RTlTnGJPFMGMflVxQ51a9uAVHfE7re70Zco =; b=FSlGAyhS2m6GVr8I333HUNiFfSC9Tm3SktSqdPvW9kbwj7wXsy0BgL2/IM+ +GRLvFZTWLCSeCLBvdWvhgc5n/1K8HWpsJxLx2CI7cL/q2JyFLZi7p9ZCG4XD0dx CNr4hw6jKlzwF+Y6pTsIe5tz4fcKAeUxnmaZ1B3xwrFCWFuIQXUmVDW+GnVUEx1t 961oX2RlGZ3zZsbvphtjQiInyOvLBHDl9H6L7+ULWuZkhW4eiRl4oFvZhLMNusq7 a5Yk/a62Z1dyrTVxN0ZeCPw2tU3FcsHC6q9jd9OAwh2vjzCA3dGUy9H7eZJBX4Y5 bXRGVGWNtxTIOPe6oRU/tNTB46g== Received: from nalasppmta01.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3y3x51qwp6-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 16 May 2024 22:59:09 +0000 (GMT) Received: from nalasex01a.na.qualcomm.com (nalasex01a.na.qualcomm.com [10.47.209.196]) by NALASPPMTA01.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 44GMx6K3012432 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 16 May 2024 22:59:06 GMT Received: from hu-clew-lv.qualcomm.com (10.49.16.6) by nalasex01a.na.qualcomm.com (10.47.209.196) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.9; Thu, 16 May 2024 15:59:05 -0700 From: Chris Lew Date: Thu, 16 May 2024 15:58:22 -0700 Subject: [PATCH 4/7] hwspinlock: qcom: implement bust operation Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <20240516-hwspinlock-bust-v1-4-47a90a859238@quicinc.com> References: <20240516-hwspinlock-bust-v1-0-47a90a859238@quicinc.com> In-Reply-To: <20240516-hwspinlock-bust-v1-0-47a90a859238@quicinc.com> To: Bjorn Andersson , Baolin Wang , Peter Zijlstra , "Ingo Molnar" , Will Deacon , Waiman Long , Boqun Feng , Jonathan Corbet , Mathieu Poirier , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Manivannan Sadhasivam , Konrad Dybcio CC: , , , , , Chris Lew , "Richard Maina" X-Mailer: b4 0.12.4 X-Developer-Signature: v=1; a=ed25519-sha256; t=1715900345; l=1477; i=quic_clew@quicinc.com; s=20240508; h=from:subject:message-id; bh=wAIBLz79oU+HMe0nEvSY06pTxUYumh72NBIpfI/lgYU=; b=83cIDkF8UXNnS3E2bHOU4diNvXnLNe70xrXuI/bUnQZDxF4Kcfwnqp6l0vit6FpcwjwtBaV6c M/70kCm74UkAl35VQK49CgKdomcgxdc6ldo0zf1xbjSSKH/GirwW6+e X-Developer-Key: i=quic_clew@quicinc.com; a=ed25519; pk=lEYKFaL1H5dMC33BEeOULLcHAwjKyHkTLdLZQRDTKV4= X-ClientProxiedBy: nalasex01c.na.qualcomm.com (10.47.97.35) To nalasex01a.na.qualcomm.com (10.47.209.196) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-GUID: GCWT5pLJhjQEC5gxfU-6FehkVa4Er55I X-Proofpoint-ORIG-GUID: GCWT5pLJhjQEC5gxfU-6FehkVa4Er55I X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.650,FMLib:17.11.176.26 definitions=2024-05-16_07,2024-05-15_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 suspectscore=0 bulkscore=0 spamscore=0 lowpriorityscore=0 phishscore=0 mlxscore=0 impostorscore=0 adultscore=0 clxscore=1015 mlxlogscore=999 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2405010000 definitions=main-2405160168 From: Richard Maina Implement a new operation qcom_hwspinlock_bust() which can be invoked to free any locks that are in use when a remoteproc is stopped or crashed. Signed-off-by: Richard Maina Signed-off-by: Chris Lew --- drivers/hwspinlock/qcom_hwspinlock.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/drivers/hwspinlock/qcom_hwspinlock.c b/drivers/hwspinlock/qcom_hwspinlock.c index 814dfe8697bf..0390979fd765 100644 --- a/drivers/hwspinlock/qcom_hwspinlock.c +++ b/drivers/hwspinlock/qcom_hwspinlock.c @@ -64,9 +64,34 @@ static void qcom_hwspinlock_unlock(struct hwspinlock *lock) pr_err("%s: failed to unlock spinlock\n", __func__); } +static int qcom_hwspinlock_bust(struct hwspinlock *lock, unsigned int id) +{ + struct regmap_field *field = lock->priv; + u32 owner; + int ret; + + ret = regmap_field_read(field, &owner); + if (ret) { + dev_err(lock->bank->dev, "unable to query spinlock owner\n"); + return ret; + } + + if (owner != id) + return 0; + + ret = regmap_field_write(field, 0); + if (ret) { + dev_err(lock->bank->dev, "failed to bust spinlock\n"); + return ret; + } + + return 0; +} + static const struct hwspinlock_ops qcom_hwspinlock_ops = { .trylock = qcom_hwspinlock_trylock, .unlock = qcom_hwspinlock_unlock, + .bust = qcom_hwspinlock_bust, }; static const struct regmap_config sfpb_mutex_config = { From patchwork Thu May 16 22:58:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Lew X-Patchwork-Id: 13666551 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6E8501A2C01; Thu, 16 May 2024 22:59:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.180.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715900384; cv=none; b=ZCNwmmw2JxNYVgnw5njgKFc5k/rkie79nAtHarOzLx3PzQMc48bkbQ1a31m97iURXoTt/soLHyNFSsv2rULqTZlr12qKSH+8PEEcED0KptisjP5zroloRqgG69qdAuT092ELldGX4RhtBLG8/NFPxiugWtXl1Mbvpgcd/3s8oes= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715900384; c=relaxed/simple; bh=Jjc+GJYzicTjx6js4GerbYp99kWiJrFUOJeZVVAgHEA=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=PINZ8c5SXg/6yuSCszP0LbzXxjoOgToXG0ZJ+LJUDxW7MOEvJ3pJwg7cdpOiXIV2kSydejPeANSi3sVtLwVa+gbl3boquR7463v6FmYjHRRJXH/+di80gAyQChnQQOS//No406ynasDwaqPITo+KH/edPTL1RWWNviJZ6DQHiv0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com; spf=pass smtp.mailfrom=quicinc.com; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b=F6oNxWC+; arc=none smtp.client-ip=205.220.180.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=quicinc.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="F6oNxWC+" Received: from pps.filterd (m0279870.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 44GKNAhZ007332; Thu, 16 May 2024 22:59:09 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h= from:date:subject:mime-version:content-type :content-transfer-encoding:message-id:references:in-reply-to:to :cc; s=qcppdkim1; bh=Ema2+2A9vujXjn0yFcon4n+NzkviWKE52u8O3MUlHwE =; b=F6oNxWC+hp0VJ6CjvibKqboMLMJ7xBqwimqcbRdjK2MGS7FGVkBX9MnihdY MgEAZShB8RfjhWD649NsNTbwOxPeiJZ6eE10baGSAaiiKz/StNqnAgz8HdBWZcBv UiHWoUUAOT38qbP6F5z9PHXHNeK7foRH5En2RfC4v2OM+w/GHuxq7uOS3C2DW1xb klBsRlCemm9yrRcuDMizyqhf4RFfZkHG3xid7OtzvbeqIf+Eo6wRF+peK7+1BjXe JXjVYKaup2vkjSR2jxDzA7yEfIP80XY7daGuBN8y+toAv9aYQSjuZSS2cdwPooND T0SCaECA2TG/1wijbPu4Iq6wZWQ== Received: from nalasppmta01.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3y47f46tq1-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 16 May 2024 22:59:09 +0000 (GMT) Received: from nalasex01a.na.qualcomm.com (nalasex01a.na.qualcomm.com [10.47.209.196]) by NALASPPMTA01.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 44GMx6K4012432 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 16 May 2024 22:59:06 GMT Received: from hu-clew-lv.qualcomm.com (10.49.16.6) by nalasex01a.na.qualcomm.com (10.47.209.196) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.9; Thu, 16 May 2024 15:59:06 -0700 From: Chris Lew Date: Thu, 16 May 2024 15:58:23 -0700 Subject: [PATCH 5/7] dt-bindings: remoteproc: qcom,pas: Add hwlocks Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <20240516-hwspinlock-bust-v1-5-47a90a859238@quicinc.com> References: <20240516-hwspinlock-bust-v1-0-47a90a859238@quicinc.com> In-Reply-To: <20240516-hwspinlock-bust-v1-0-47a90a859238@quicinc.com> To: Bjorn Andersson , Baolin Wang , Peter Zijlstra , "Ingo Molnar" , Will Deacon , Waiman Long , Boqun Feng , Jonathan Corbet , Mathieu Poirier , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Manivannan Sadhasivam , Konrad Dybcio CC: , , , , , Chris Lew X-Mailer: b4 0.12.4 X-Developer-Signature: v=1; a=ed25519-sha256; t=1715900345; l=824; i=quic_clew@quicinc.com; s=20240508; h=from:subject:message-id; bh=Jjc+GJYzicTjx6js4GerbYp99kWiJrFUOJeZVVAgHEA=; b=xzKylqpOHoFsq+WH5F1VcT5ZBBSUftVR5DOi6x/eDdh53M9L28Z0uUCMfA2Kba58JK8k0g4LI KNlskJ2vMmQByp0hvzE3BSh7EY0SflJfnxW/rZ9PHo6ZwDgynCLOJiT X-Developer-Key: i=quic_clew@quicinc.com; a=ed25519; pk=lEYKFaL1H5dMC33BEeOULLcHAwjKyHkTLdLZQRDTKV4= X-ClientProxiedBy: nalasex01c.na.qualcomm.com (10.47.97.35) To nalasex01a.na.qualcomm.com (10.47.209.196) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-GUID: 1lqfqvuSgY5gUydpbDu7lFNE6Ah42Gts X-Proofpoint-ORIG-GUID: 1lqfqvuSgY5gUydpbDu7lFNE6Ah42Gts X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.650,FMLib:17.11.176.26 definitions=2024-05-16_07,2024-05-15_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 phishscore=0 bulkscore=0 clxscore=1015 malwarescore=0 adultscore=0 lowpriorityscore=0 impostorscore=0 suspectscore=0 mlxlogscore=897 mlxscore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2405010000 definitions=main-2405160168 Add hwlocks property to describe the hwspinlock that remoteproc can try to bust on behalf of the remoteproc's smem. Signed-off-by: Chris Lew --- Documentation/devicetree/bindings/remoteproc/qcom,pas-common.yaml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Documentation/devicetree/bindings/remoteproc/qcom,pas-common.yaml b/Documentation/devicetree/bindings/remoteproc/qcom,pas-common.yaml index 63a82e7a8bf8..483a8ff5f47e 100644 --- a/Documentation/devicetree/bindings/remoteproc/qcom,pas-common.yaml +++ b/Documentation/devicetree/bindings/remoteproc/qcom,pas-common.yaml @@ -77,6 +77,9 @@ properties: and devices related to the ADSP. unevaluatedProperties: false + hwlocks: + maxItems: 1 + required: - clocks - clock-names From patchwork Thu May 16 22:58:24 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Lew X-Patchwork-Id: 13666552 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6E884C8D1; Thu, 16 May 2024 22:59:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.180.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715900385; cv=none; b=tXBP7ILO1hmPSxVYFwUe0I0ODHpsEHpnng0cB8HA7cXxrYCkdLBqxSdUoGiOH/0t5hmiOyO2mZesDCwgBXVSWfubd7CR8+00mD08zAVKqBtr/1FG8JY+vuBPxjwKH+c3ebTb3rl0JwMVvr6ZcLRUoHk6E3BF4Mu+xSeiA2rcU6Q= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715900385; c=relaxed/simple; bh=UMQ33vmXjIMVoAouJoABlu/c79HijRXgfnTvWg20ShA=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=XobqDAHtuXr+lQDv7JaWGT7kNqwe0kWu1i0f4J85yi7au1mVti44yWEcZF6o9kLZfUh28mloHp2d5OUrM7pBgKjnYRPIkwfuLy6jr+tmi3jMGGMFWyA+Hl3TUwchqjVTufyntUyC52VtOn4S1qXgXNIdzYLd3wZSkWbBQb3uf/Y= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com; spf=pass smtp.mailfrom=quicinc.com; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b=A3UW7i4T; arc=none smtp.client-ip=205.220.180.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=quicinc.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="A3UW7i4T" Received: from pps.filterd (m0279872.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 44GKNDJp032690; Thu, 16 May 2024 22:59:09 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h= from:date:subject:mime-version:content-type :content-transfer-encoding:message-id:references:in-reply-to:to :cc; s=qcppdkim1; bh=E/63Sm+Bi5aqxDOepesdMg1nnCYC9lkcftzk5W6WgGs =; b=A3UW7i4Tj9HW3UumqUwwMzOBiwGq3oybEAv3BBwh+tCTHQbceFBR76JcnF7 ZpH+1BKRWWVZymuMdKfWZUvumd4YxDy0zCKjFl4f51lsNFmSyJKPR1hzEK5foRQy zP/FhAlJ/wsSidyfVRphbl3wH2W2b7uf7lkOZtx8PUJo6wJZIM3N9Dqjh1LeQl3u qT+38k1wJT5YtMLwOGR//B4zAg0PMrclXmtVwqM1ZAuPkrqtmf/f/RVFQHn98l5B kxzGPbTvC9uWtEvVqYzMQM1ai5TBQVn+WUvyzpxZ6tdbNXFAWQEuWfePeRR+ZM8w vCAx69e8pOi3CjYnJNHGSDff2+A== Received: from nalasppmta01.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3y2125mysu-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 16 May 2024 22:59:09 +0000 (GMT) Received: from nalasex01a.na.qualcomm.com (nalasex01a.na.qualcomm.com [10.47.209.196]) by NALASPPMTA01.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 44GMx6K5012432 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 16 May 2024 22:59:07 GMT Received: from hu-clew-lv.qualcomm.com (10.49.16.6) by nalasex01a.na.qualcomm.com (10.47.209.196) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.9; Thu, 16 May 2024 15:59:06 -0700 From: Chris Lew Date: Thu, 16 May 2024 15:58:24 -0700 Subject: [PATCH 6/7] remoteproc: qcom_q6v5_pas: Add hwspinlock bust on stop Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <20240516-hwspinlock-bust-v1-6-47a90a859238@quicinc.com> References: <20240516-hwspinlock-bust-v1-0-47a90a859238@quicinc.com> In-Reply-To: <20240516-hwspinlock-bust-v1-0-47a90a859238@quicinc.com> To: Bjorn Andersson , Baolin Wang , Peter Zijlstra , "Ingo Molnar" , Will Deacon , Waiman Long , Boqun Feng , Jonathan Corbet , Mathieu Poirier , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Manivannan Sadhasivam , Konrad Dybcio CC: , , , , , Chris Lew , "Richard Maina" X-Mailer: b4 0.12.4 X-Developer-Signature: v=1; a=ed25519-sha256; t=1715900345; l=4083; i=quic_clew@quicinc.com; s=20240508; h=from:subject:message-id; bh=FkvH3elkGao6or4V/MDCjMsiD3XkOU6SIJC7v+USEdM=; b=4WEx//Hw4anqI5f+HIotqEfGnzhI3Ck8MCmBfD3B89kiR3vmkPFuvW0nAGIbw1KTUNoyq4SZw wGcT2qPNlkUAZ9KqgONQ4CXBmkw5MRrwWZyHfUuLmeovomhIhS4vN25 X-Developer-Key: i=quic_clew@quicinc.com; a=ed25519; pk=lEYKFaL1H5dMC33BEeOULLcHAwjKyHkTLdLZQRDTKV4= X-ClientProxiedBy: nalasex01c.na.qualcomm.com (10.47.97.35) To nalasex01a.na.qualcomm.com (10.47.209.196) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-GUID: C60B6rHy56yAz3aOe7ijaxWzk9TykVxK X-Proofpoint-ORIG-GUID: C60B6rHy56yAz3aOe7ijaxWzk9TykVxK X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.650,FMLib:17.11.176.26 definitions=2024-05-16_07,2024-05-15_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 spamscore=0 lowpriorityscore=0 mlxlogscore=999 clxscore=1015 bulkscore=0 priorityscore=1501 impostorscore=0 phishscore=0 adultscore=0 suspectscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2405010000 definitions=main-2405160168 From: Richard Maina When remoteproc goes down unexpectedly this results in a state where any acquired hwspinlocks will remain locked possibly resulting in deadlock. In order to ensure all locks are freed we include a call to hwspin_lock_bust() during remoteproc shutdown. For qcom_q6v5_pas remoteprocs, each remoteproc has an assigned id that is used to take the hwspinlock. Remoteproc should use this id to try and bust the lock on remoteproc stop. This edge case only occurs with q6v5_pas watchdog crashes. The error fatal case has handling to clear the hwspinlock before the error fatal interrupt is triggered. Signed-off-by: Richard Maina Signed-off-by: Chris Lew --- drivers/remoteproc/qcom_q6v5_pas.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/drivers/remoteproc/qcom_q6v5_pas.c b/drivers/remoteproc/qcom_q6v5_pas.c index 54d8005d40a3..57178fcb9aa3 100644 --- a/drivers/remoteproc/qcom_q6v5_pas.c +++ b/drivers/remoteproc/qcom_q6v5_pas.c @@ -10,6 +10,7 @@ #include #include #include +#include #include #include #include @@ -52,6 +53,7 @@ struct adsp_data { const char *ssr_name; const char *sysmon_name; int ssctl_id; + int hwlock_id; int region_assign_idx; int region_assign_count; @@ -84,6 +86,9 @@ struct qcom_adsp { bool decrypt_shutdown; const char *info_name; + struct hwspinlock *hwlock; + int hwlock_id; + const struct firmware *firmware; const struct firmware *dtb_firmware; @@ -399,6 +404,12 @@ static int adsp_stop(struct rproc *rproc) if (handover) qcom_pas_handover(&adsp->q6v5); + if (adsp->hwlock) { + ret = hwspin_lock_bust(adsp->hwlock, adsp->hwlock_id); + if (ret) + dev_info(adsp->dev, "failed to bust hwspinlock\n"); + } + return ret; } @@ -684,6 +695,7 @@ static int adsp_probe(struct platform_device *pdev) struct rproc *rproc; const char *fw_name, *dtb_fw_name = NULL; const struct rproc_ops *ops = &adsp_ops; + int hwlock_idx; int ret; desc = of_device_get_match_data(&pdev->dev); @@ -736,6 +748,17 @@ static int adsp_probe(struct platform_device *pdev) adsp->dtb_firmware_name = dtb_fw_name; adsp->dtb_pas_id = desc->dtb_pas_id; } + + if (desc->hwlock_id) { + adsp->hwlock_id = desc->hwlock_id; + hwlock_idx = of_hwspin_lock_get_id(pdev->dev.of_node, 0); + if (hwlock_idx >= 0) { + adsp->hwlock = hwspin_lock_request_specific(hwlock_idx); + if (!adsp->hwlock) + dev_err(&pdev->dev, "failed to request hwspinlock\n"); + } + } + platform_set_drvdata(pdev, adsp); ret = device_init_wakeup(adsp->dev, true); @@ -1196,6 +1219,7 @@ static const struct adsp_data sm8550_adsp_resource = { .ssr_name = "lpass", .sysmon_name = "adsp", .ssctl_id = 0x14, + .hwlock_id = 3, }; static const struct adsp_data sm8550_cdsp_resource = { @@ -1216,6 +1240,7 @@ static const struct adsp_data sm8550_cdsp_resource = { .ssr_name = "cdsp", .sysmon_name = "cdsp", .ssctl_id = 0x17, + .hwlock_id = 6, }; static const struct adsp_data sm8550_mpss_resource = { @@ -1236,6 +1261,7 @@ static const struct adsp_data sm8550_mpss_resource = { .ssr_name = "mpss", .sysmon_name = "modem", .ssctl_id = 0x12, + .hwlock_id = 2, .region_assign_idx = 2, .region_assign_count = 1, .region_assign_vmid = QCOM_SCM_VMID_MSS_MSA, @@ -1275,6 +1301,7 @@ static const struct adsp_data sm8650_cdsp_resource = { .ssr_name = "cdsp", .sysmon_name = "cdsp", .ssctl_id = 0x17, + .hwlock_id = 6, .region_assign_idx = 2, .region_assign_count = 1, .region_assign_shared = true, @@ -1299,6 +1326,7 @@ static const struct adsp_data sm8650_mpss_resource = { .ssr_name = "mpss", .sysmon_name = "modem", .ssctl_id = 0x12, + .hwlock_id = 2, .region_assign_idx = 2, .region_assign_count = 3, .region_assign_vmid = QCOM_SCM_VMID_MSS_MSA, From patchwork Thu May 16 22:58:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Lew X-Patchwork-Id: 13666553 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C7D4B1799B; Thu, 16 May 2024 22:59:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.180.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715900386; cv=none; b=JoZtPK/SmzNjlXFnBP/N0YFSAWLVL44L7/vJ34bzs3ozF71XsNg75Ko6k++n1zGep4wh5vvn22DY5s0Wz8HbZxoZcobGbY6DwTcLiJt9VN1HBE2UEfQ5vdoj1SHvhAsRtpkJTPeiAHW6rC2UAEVaP2a3ZX15wOcX8BJYrQQjUM4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715900386; c=relaxed/simple; bh=hFxFX/P+1Xf0QbXT9siXfHWO9C1XUTE9mcYGKnLjrow=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=mvLMuJ4I5Pz3zSy3/87dHZomzmty1nWPb//qBX9h0KVuO3QIUllis0/v3+MF7AmqgZNZsqvKPBToX2KqyfjjARlKbYlo3NjA1tQU260tS++Ni2wu969ddU71zUqQ2DhtJ+BQ2ryqmwN3VNFe9xrNsy2SzV+eyPiCZSGE4mD8LV0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com; spf=pass smtp.mailfrom=quicinc.com; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b=SQ13+Kn8; arc=none smtp.client-ip=205.220.180.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=quicinc.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="SQ13+Kn8" Received: from pps.filterd (m0279873.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 44GKMaiE007096; Thu, 16 May 2024 22:59:10 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h= from:date:subject:mime-version:content-type :content-transfer-encoding:message-id:references:in-reply-to:to :cc; s=qcppdkim1; bh=LzjhrQmf8UA2KR/o3BaIC0rUEdGHcFyVo2lKB/hiOsI =; b=SQ13+Kn8WV+26fMyT9rbt8gi61YP2btR2GK02MCDemF8GUxuyBCUcH9UIA8 jqme0fAP6mdLunC6dWygoJTtOWwigI072jmTB/nx1wwuZIoO1o2kN4+CALq8rBtp oLngKNIykL9SmDbndWjHHZE6uM9v25shZ92wmDwrYw0hI6pwVe1SkzjtR5iKbKmn ujW2E2npNPtD5lheBoEVxnqbghHVV35UcYwS51agIv7IfAHt6JPDM7kKGd2TekCF F7nQt3lc1QY9gNVGbjViQtxHJLLJiT43kWRnw8JmI+db4j9SWZCvRSTKPC/hKxgR DXOMrmXlfJsjDhEYjlRwpMIwWeA== Received: from nalasppmta04.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3y47egeu3b-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 16 May 2024 22:59:10 +0000 (GMT) Received: from nalasex01a.na.qualcomm.com (nalasex01a.na.qualcomm.com [10.47.209.196]) by NALASPPMTA04.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 44GMx7P2030540 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 16 May 2024 22:59:07 GMT Received: from hu-clew-lv.qualcomm.com (10.49.16.6) by nalasex01a.na.qualcomm.com (10.47.209.196) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.9; Thu, 16 May 2024 15:59:06 -0700 From: Chris Lew Date: Thu, 16 May 2024 15:58:25 -0700 Subject: [PATCH 7/7] arm64: dts: qcom: sm8650: Add hwlock to remoteproc Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <20240516-hwspinlock-bust-v1-7-47a90a859238@quicinc.com> References: <20240516-hwspinlock-bust-v1-0-47a90a859238@quicinc.com> In-Reply-To: <20240516-hwspinlock-bust-v1-0-47a90a859238@quicinc.com> To: Bjorn Andersson , Baolin Wang , Peter Zijlstra , "Ingo Molnar" , Will Deacon , Waiman Long , Boqun Feng , Jonathan Corbet , Mathieu Poirier , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Manivannan Sadhasivam , Konrad Dybcio CC: , , , , , Chris Lew X-Mailer: b4 0.12.4 X-Developer-Signature: v=1; a=ed25519-sha256; t=1715900345; l=1173; i=quic_clew@quicinc.com; s=20240508; h=from:subject:message-id; bh=hFxFX/P+1Xf0QbXT9siXfHWO9C1XUTE9mcYGKnLjrow=; b=I5SYBz9Nf94hE3Yx5311CrGrep1WDH0WRJk28EKdr8iNad3/P2iDPKNEpI/kbASUgSW0xFHXv YWxYGqaKwsCA53CxRmI7KWxVFKiGfePdSAGNhY27YRp+9eapsUucDaG X-Developer-Key: i=quic_clew@quicinc.com; a=ed25519; pk=lEYKFaL1H5dMC33BEeOULLcHAwjKyHkTLdLZQRDTKV4= X-ClientProxiedBy: nalasex01c.na.qualcomm.com (10.47.97.35) To nalasex01a.na.qualcomm.com (10.47.209.196) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-GUID: 0p0uoeeB00LfWMHmsvG-8YWEQ7SxuDeY X-Proofpoint-ORIG-GUID: 0p0uoeeB00LfWMHmsvG-8YWEQ7SxuDeY X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.650,FMLib:17.11.176.26 definitions=2024-05-16_07,2024-05-15_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxscore=0 adultscore=0 malwarescore=0 phishscore=0 spamscore=0 mlxlogscore=766 lowpriorityscore=0 clxscore=1015 impostorscore=0 suspectscore=0 priorityscore=1501 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2405010000 definitions=main-2405160168 Add the hwlock property to remoteproc. This enables the remoteproc to try and bust the smem hwspinlock if the remoteproc has crashed while holding the hwspinlock. Signed-off-by: Chris Lew Nacked-by: Krzysztof Kozlowski --- arch/arm64/boot/dts/qcom/sm8650.dtsi | 3 +++ 1 file changed, 3 insertions(+) diff --git a/arch/arm64/boot/dts/qcom/sm8650.dtsi b/arch/arm64/boot/dts/qcom/sm8650.dtsi index 62a6e77730bc..a65a1679f003 100644 --- a/arch/arm64/boot/dts/qcom/sm8650.dtsi +++ b/arch/arm64/boot/dts/qcom/sm8650.dtsi @@ -2878,6 +2878,7 @@ remoteproc_mpss: remoteproc@4080000 { qcom,smem-states = <&smp2p_modem_out 0>; qcom,smem-state-names = "stop"; + hwlocks = <&tcsr_mutex 3>; status = "disabled"; @@ -5024,6 +5025,7 @@ remoteproc_adsp: remoteproc@30000000 { qcom,smem-states = <&smp2p_adsp_out 0>; qcom,smem-state-names = "stop"; + hwlocks = <&tcsr_mutex 3>; status = "disabled"; @@ -5183,6 +5185,7 @@ remoteproc_cdsp: remoteproc@32300000 { qcom,smem-states = <&smp2p_cdsp_out 0>; qcom,smem-state-names = "stop"; + hwlocks = <&tcsr_mutex 3>; status = "disabled";