Received: by 2002:a05:6500:1b8f:b0:1fa:5c73:8e2d with SMTP id df15csp813077lqb; Wed, 29 May 2024 11:11:15 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXyTSBqw7SWjsdRNo1p5qSKdhfEne5PZuWMEEJ98pw2dFkHc6LegR98VSak8WnXDuPWi7zq4B1fJ/b8RV0SIJIdddT+b/QwCM9rC1pnyA== X-Google-Smtp-Source: AGHT+IFjyM4QgfhRCwGSrsyxK0Rq32OomjhjgoOgOKTIxwa9VEqrE7XdmMrtIed2BLkjyq31T12n X-Received: by 2002:a05:6214:398b:b0:6ad:650a:8551 with SMTP id 6a1803df08f44-6ad650a8b95mr150644956d6.56.1717006275272; Wed, 29 May 2024 11:11:15 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717006275; cv=pass; d=google.com; s=arc-20160816; b=L9h7UNONRbRJUxrvPCaBmYiFR6w/b2VMUHtpvoFPEeUUEpbbwJHIg7CTebIdey2KYd to1yBhSRlAEu54Tno91ZJF9zCYPZgTeYmcW1o7F/Cc9pkJjg2cbWz4co7wZr5jLbC5V8 3gKfe4tGfwlq+AKdbwLXsABhFAtxTrxtDHAtN6qCNUD/UknSm76CBpYUFJRFMZ3FBoA3 6w3U+dfLZlG7X3B01tiS9WWQMxXsptvkIR7ZBdQnhsxrF2zYe5M1qskW0j5lZz90zOY0 KSY7YJ+xEOYu4kJ3hArr9gEkuhbc4pOLKNk0ISf6TPOlW23WpTrTuPWDnu+tAR7eNi/r xVqA== 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=o++/LFsFJU7qKLCW6Zw9bAt7A393Bq5rYwa053ro+tc=; fh=yq+Ko9clF5UAYI8GmthOJiStA11CnBmYu7J0V0GpMDI=; b=g8sMLd94LL9A+gNaS2fEYvrRZcHOBsa22mfQGKPwqLH5RjtZ8675G2/hXkykNsV2Mu bPN8GQkWs7cihl8c1Wc99j9bPFt9HGeq2zljWp+jWzesjtb9b0tdsNHdwD5VUeKbSV6B 578w7uQCML5CqZad5+oHewGBAr1UVAXDEYaOdJdN2kh7Rkmoas11TcE/C1+5n6SfaJmv f+2azXr7yQqoh98Uh1xu7xTfVQEn9Zs+FIg36/K6OCU2lR09N5MkuZZVKX943OQkpuuo HMK2N2SHSMQvo3WIja+8IYKVmx4kbKwOM4F1rlKYtbgK17dbP2DL53Wmc+diKJd3KyGI g2+g==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=p0tWw72F; 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-194558-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-194558-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id 6a1803df08f44-6ad799618b7si91130706d6.86.2024.05.29.11.11.15 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 May 2024 11:11:15 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-194558-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=p0tWw72F; 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-194558-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-194558-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 05B531C2385B for ; Wed, 29 May 2024 18:11:15 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0D0601C688D; Wed, 29 May 2024 18:10:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="p0tWw72F" 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 A19551C0DCC; Wed, 29 May 2024 18:10:20 +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=1717006222; cv=none; b=hj010PddS3lcQBCtllsMDwJ4e7DXgF50ALihFr13yGA43+QEMuqGBBerH8HGuqVjYdFAkLX8cBtHAon/jau/z0CEAPw0+ys8Zg4NCP39dsJFgYb3Fwt9tFAAFoYIVet4uE407r0cW/x9o04m3osp3rqql/p4ceN3zmWOcyJGfoM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717006222; c=relaxed/simple; bh=U8zNeyBZ2/k85kcSrtkTjJBXpZlYLrDaA+wZkSc1Tk8=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=UjhyKBzFZOJwqzABirCXJGSYezQXMRAwkQDmgMrN/p2h2fxiqIza5qc5wrJ0vbFrAM1D4dVz17X0Ox3dqJDu+9pFuCipVGjBwkWs3hzsU6RoYB/7ziz5FQljLwqV4aS8l1eVuGAJ4fyvj7qhJ/NcT9saRdRevbXm6zQqKdoKiSA= 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=p0tWw72F; 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 Received: from pps.filterd (m0279868.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 44T9qucW012513; Wed, 29 May 2024 18:10:02 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= o++/LFsFJU7qKLCW6Zw9bAt7A393Bq5rYwa053ro+tc=; b=p0tWw72Fl32uUNhq s6Eq79YBe73M7lbenOzWVcCZYrPRuGTI1CnlUtCnB9Yc7x+XKPsWeErjBs5iqNo/ UC4O3/xTPAh3I53+4ysBpK+kiKv8uCmO+6e2ZfajGNjMr9EtGDj5YL9wt7nPEHB2 UMb7FvvEoRPRUeG77RwldynRsdnJ6RG00xBp/Tri0qQTY0hRAqpPUEuwt9CtzeQ+ zLBusNSq91zfdMqpVPOc6Bd107unfDdfEhq2Jm6f9HotNrdPiaqsBZ0o3GMnOXni COJPCmWJFNdGu25WRMgIr4+ecpNCjhGv2uc0048bKV25uCSpYRHRt/j7iU60RZxc tvXvEw== Received: from nalasppmta04.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3yba0qhurq-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 29 May 2024 18:10:01 +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 44TIA0Zw003974 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 29 May 2024 18:10:00 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; Wed, 29 May 2024 11:10:00 -0700 From: Chris Lew Date: Wed, 29 May 2024 11:09:56 -0700 Subject: [PATCH v3 2/4] 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: <20240529-hwspinlock-bust-v3-2-c8b924ffa5a2@quicinc.com> References: <20240529-hwspinlock-bust-v3-0-c8b924ffa5a2@quicinc.com> In-Reply-To: <20240529-hwspinlock-bust-v3-0-c8b924ffa5a2@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=1717006199; l=1530; i=quic_clew@quicinc.com; s=20240508; h=from:subject:message-id; bh=mmkPN43S9HCXd6+6jOFUT/6hMs9iDUCiyyz1fShSCPc=; b=ltIJvzIIjKUAYZzm1HLMnw4x+GwkDr0kod2QiaGQp8Tlh2KV0QNtAklJkGaP9yelpOx+JX4Tw qwLZaDHNz43DmZYmwhDIrij+pWqq+Nodr1glbSesLR0lwb+Wv2p5pGz 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: bgVoQ_XHxHuMiFm8ZUnjoiYulu5l_YMu X-Proofpoint-ORIG-GUID: bgVoQ_XHxHuMiFm8ZUnjoiYulu5l_YMu X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.650,FMLib:17.12.28.16 definitions=2024-05-29_14,2024-05-28_01,2024-05-17_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 suspectscore=0 lowpriorityscore=0 impostorscore=0 clxscore=1015 mlxscore=0 mlxlogscore=999 malwarescore=0 spamscore=0 adultscore=0 bulkscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2405170001 definitions=main-2405290127 From: Richard Maina Implement a new operation qcom_hwspinlock_bust() which can be invoked to bust any locks that are in use when a remoteproc is stopped or crashed. Signed-off-by: Richard Maina Reviewed-by: Bjorn Andersson 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