Received: by 2002:a05:6500:1b8f:b0:1fa:5c73:8e2d with SMTP id df15csp362092lqb; Tue, 28 May 2024 19:15:28 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXToh6MbHT2ZF15DUX3UJrdihGI7f/h3lauCYU4C495C62BsFHNlmb+jms1qfq43moVQ4ixASWVn/AVOK25vzeiRwpoeR4tdX7hGlvSvA== X-Google-Smtp-Source: AGHT+IH/CSpJ2YnYBzJ1U+p4kRu1ZFnH5+5fu/V2tascyFZZn3YhuHtJcujidHdDDnz8fBIAnoL+ X-Received: by 2002:a05:6870:2013:b0:24f:f282:241b with SMTP id 586e51a60fabf-24ff28237edmr8123699fac.33.1716948928477; Tue, 28 May 2024 19:15:28 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716948928; cv=pass; d=google.com; s=arc-20160816; b=fIzaIwfN8/Z3ZvCsrobCTG85Ylv+pzP4jIPE4pzT8+la8VjlHZPfRiZBi0nq2VbUtD BV1WlBxRGTPLV63mUgWFdDmWYYuXjr+T+aB21oslS7rclPGmfC0NL7bzxJDrDKHIq66o XvE5WKcqdbBXRVRzMCglXjixNAQRHSAQfiKfkuK4zMenL2WTxIddfuwb+RhHX00tuiKF 14QniVEAiadmAAZxBMGDdexwTAFv96WwNsd5yul1/F+4GP4v2IajHq8Hk2yCd5sqxi7D FH3nfer7/UHPLiQoRwDNUQ+lr0lwMHBlsLLJTvrNQJNruU/H0v7G/tJU6GWL37b4/M+S gx2Q== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=QAeUBMyvJ+On+Shxle4J5CUYCcNwuHoBtGUWyTwn6EM=; fh=hhBqTtuIqve4ZdDRjBHU1O72CWcIMyjr6vDafInQ9as=; b=tpHEIbeEmQvB7cEGja057mOTb00sfasjo8q15Vrs45vWAbtvbnUqvpNVVROnx/W9LV bkHypRDq6nl+sB4a8b154AIDdMXxkK2EvbqEf34rH6kHbf8P4ZXlyredp03d6TpNF3l8 J7CBBtctj1iFCLd6chB/op3AVZ01I7UUg2DaAqwuUBfAtbHRK6PF+/oxpkcO8pHyyLuT gpljCdynnQmsKP/biNMKj2el6iSv0ljTqoKqdwb7ALuICwR0kxmFV+gj/RtGu443pU0o WNpNtKBalubIwpNT6oH6YZhp8xNlGBuqiAlZMLQReUOR2ZNE2Z0Rqsn2mAgicu5xdEW9 rQbA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=qkkUTJpa; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-193344-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-193344-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id d2e1a72fcca58-6f8fc051153si9023309b3a.49.2024.05.28.19.15.27 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 May 2024 19:15:28 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-193344-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=qkkUTJpa; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-193344-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-193344-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org 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 E00E4B26AA4 for ; Wed, 29 May 2024 02:07:22 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3CF5715B57F; Wed, 29 May 2024 02:04:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="qkkUTJpa" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 5A04A15B103; Wed, 29 May 2024 02:04:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716948293; cv=none; b=jbOiFb68cRyDNJYEYxP6VCujWcU6GicgXboIoYDE/L6Uv9BOo6M2nt1i2K1Kw5Ph9qOCeCebxlw1TzjKWBAVHinhfZULNc9mXgNC35qemzGIeNXhw1t1wnEWYqvXPlRXE/ZOy4hRp5AocfldqVYJd/uLuFApePWJ3bK417SnDC0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716948293; c=relaxed/simple; bh=6G8j/Sv+MtbqrS9aW60pSqltpea9C3Q217H7ckx6jrY=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=rcquaKGPDiFpKa3hB6VS1CSwb7tMVp8XZYypw4e3paRIoLopTyRui7bJ04INXaTWGWvDpjjIu+ix9lmAAnCUWifMDLS9frD7CpakP35i7YEJzGrutq12gwrADGz5UTkX87xJ+WJf/m2uFPUHA8jRDDTB3HnVD+wAhjLXexTahV0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=qkkUTJpa; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8E954C3277B; Wed, 29 May 2024 02:04:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1716948293; bh=6G8j/Sv+MtbqrS9aW60pSqltpea9C3Q217H7ckx6jrY=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=qkkUTJpauF3WcRU+4Gxy0aKAGevlHW10RE4k7ylmBgPMrW8NB95+1VbhDNT4mFdZ4 PS5wdCIa1FCk79CQTZjnuxF+kxrZqxs9k+3AFsY9kThhGOZeXZYsSz6P+QATb4FlIk kU3dqX08/h7fjMzjZz1nMhZR+Qin/GU3PpV+KUvFAOxy/XzlR0rxrJt1+cQr4NJqkS vKFYXFPusjM0SUKVhrqpXYuQSTddxGoERcPCMHqxi6ZrvmR2E/K/51fHf+a2ToO+vr UinYDi5YwEsnrkuKG4SgP0EkuKJOUeybEfGyNC+0daCADFkzoj7/DCMwjOneWbtSIE OvVHG7ZmrW9Qg== Date: Tue, 28 May 2024 19:09:34 -0700 From: Bjorn Andersson To: Chris Lew Cc: 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 , linux-remoteproc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org, Richard Maina Subject: Re: [PATCH v2 2/4] hwspinlock: qcom: implement bust operation Message-ID: References: <20240524-hwspinlock-bust-v2-0-fb88fd17ca0b@quicinc.com> <20240524-hwspinlock-bust-v2-2-fb88fd17ca0b@quicinc.com> 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=us-ascii Content-Disposition: inline In-Reply-To: <20240524-hwspinlock-bust-v2-2-fb88fd17ca0b@quicinc.com> On Fri, May 24, 2024 at 06:26:41PM -0700, Chris Lew wrote: > 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 > Signed-off-by: Chris Lew Reviewed-by: Bjorn Andersson Regards, Bjorn > --- > 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 >