Received: by 2002:ab2:6816:0:b0:1f9:5764:f03e with SMTP id t22csp596312lqo; Thu, 16 May 2024 16:02:08 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVd8M9oXs1PH/RgMnESxs1XTUwYqxXi9ZfWGkkIOj6hR4fss5kjMUE7ybF/vtxnv6HPV30+JaGzkvqiNkGdu9NNAAA5xCEdRpPLOtVz+Q== X-Google-Smtp-Source: AGHT+IGnhA1aka86F+NETOcu5TpAPJwgN8rLFciQ9XtyH6BOcHGs0SKC89WJQddTmaKmnkq1vVYS X-Received: by 2002:a05:6a00:17a6:b0:6f3:e9bc:7ed3 with SMTP id d2e1a72fcca58-6f4e02d3863mr23472275b3a.17.1715900528292; Thu, 16 May 2024 16:02:08 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715900528; cv=pass; d=google.com; s=arc-20160816; b=Jdql8F79CMpZCMuso8dgSBR0OHywxubb9uLRj6sq7q3s4SPQqFcbZ9bfjsAr27gmOx 7QWxvffwWGUIiZZwGgPeoGgudc+yBr5Ad5exHrIiIC/HzGXbdGZU7oRrJkwmY5TAd+hF 1cFkSt6AH5CgO5YLgASYs2YvFewyuN9HZ8L4sSZrXD/YUTm6RNyryswp+F0eCBOPxVUz TtiNFHMFXTRkqpRG+XpvDrfkeCDvB/bhU2NO8l1+XysLpaHCyEtjWtFfnDjoMuON6QAW Axj2cwJWsvoPKIq8G1tzTo7QXVB2dwBp5F2f375U+s1zim3tMZmGvTeREKR+BEkrDVXc zwMg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :subject:date:from:dkim-signature; bh=/zdoZNB4RTlTnGJPFMGMflVxQ51a9uAVHfE7re70Zco=; fh=yq+Ko9clF5UAYI8GmthOJiStA11CnBmYu7J0V0GpMDI=; b=XubbfI5C8Wj2uEK1PQcaH4NRhNfhdt3H/Z1GTsxUCNIsSDWKnA4q5+F3uQ/lNzXQBf B8eFnb47RFuC9ghkeIdoZTJYlEsjKcOGp2jmORsYyK4+3ziRvQf6oNglAsiFEsVK8/Fh wdYU1lUFAyS7lut5kA6B/gCkkC1dUKVs55Tz0DirIJDw7L49UHU3m8/4SHGylC+ukZTa i3j4Wg4VtpVkgmyuGUwX+gKkH0U7y1AdYeoEvp+Ak3EtiatkUMx2cgu6TYAB9ivXo19a pQFQQOiUpg8PscXhAixze7ii0BTocIuRKr6lAjSlfgA24gTvc4k4h4J77/hsB/iDCHzK n1Zg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=FSlGAyhS; arc=pass (i=1 spf=pass spfdomain=quicinc.com dkim=pass dkdomain=quicinc.com dmarc=pass fromdomain=quicinc.com); spf=pass (google.com: domain of linux-kernel+bounces-181621-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-181621-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id 41be03b00d2f7-64b96c0a9cesi3419959a12.167.2024.05.16.16.02.07 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 May 2024 16:02:08 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-181621-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=FSlGAyhS; arc=pass (i=1 spf=pass spfdomain=quicinc.com dkim=pass dkdomain=quicinc.com dmarc=pass fromdomain=quicinc.com); spf=pass (google.com: domain of linux-kernel+bounces-181621-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-181621-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id D30B3B21FDD for ; Thu, 16 May 2024 23:01:31 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A28CD50251; Thu, 16 May 2024 22:59:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="FSlGAyhS" 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 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-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit 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 = { -- 2.25.1