Received: by 2002:ab2:7855:0:b0:1f9:5764:f03e with SMTP id m21csp796734lqp; Wed, 22 May 2024 23:16:15 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCX8s8N+06SGzqLJtHgPOvnwOJat1fr+p/y+efyr9vKur3Cl/zC6708hE/q+KMgAw+ibRobBzN7g5cHrVMxgQm4Ocf9iKDGJvk8AmP+M1Q== X-Google-Smtp-Source: AGHT+IEg6MuO70HbV9koGi7hTuyCbnIy5yQaGDh3f8ctNMtnLa2MEt4WXV2kXFR9O4RtZWa/QUMm X-Received: by 2002:a25:bfcc:0:b0:df4:df8c:a0c3 with SMTP id 3f1490d57ef6-df4e0c1b071mr4287259276.34.1716444975712; Wed, 22 May 2024 23:16:15 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716444975; cv=pass; d=google.com; s=arc-20160816; b=dyJAPYVcQhc+zqn+A+ZIF1THY0YlJIZMfO25/G5zaGDhtGcfQzKVwH0yX76a/g83VC Fr2NKtQv88bAGbw/hbK9OissL9RDEfIiuMoEHM46WwoWBMXs2G6T1VoWi6lnmJYSgIJH FW+TVs7wZtMdkraTT9LnI2rtoh+CVESoXA2vPMO1HfmyiqEwujnFRVRld4MiueujhPLo yVOIWvwuGPwmymo85F0lXX4ppUY/p0T/xY4pobrhU0HtQEeDlkN4BDdUzNDjnyJ4V8iQ crHzlDJEGE9RDE2Q/gK+XImena+EPbh51wB/6m2yHLHO96yiM+EXrqteZyR7o2QAjotx kwEg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:autocrypt:content-language :from:references:cc:to:subject:user-agent:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:date:message-id :dkim-signature; bh=PONr2pir0aA5894SUsxA0Po1Eclc4XLFlj9ZzAhJYVY=; fh=1pmxUqZOrLC+ET/vbT4HX7o4aqZ3hyssPJAZ1N/L1J4=; b=vlq9dtDDJwIvAY+li0slHTiLBZMe/JfC1UP6fM1Zd1JCcaQ1wN176ZamhmqpsOiegk QyRQtrQJjFr0DKRnCZL9xGZI26rLdxinK0/TdPIGebLD+3KlAYU7lQ5NfwsB/bn0bBxZ EoKyPMeT+0efA/P1RhAdfuwhBFaOGGOe8efbYA9A/fP+VqSzhEIWwfsGemmoiJ0V0cAB b+tNiIJLi+WqwMi21DE3abqIWoey4Hg3IzZlftW6u5NvafV47NZRwv8FqXfDUf+EMA/W cJTM+E+j33/6tz/60A+9Jmo4fZgV3fuK371lmQtHw7mgYJo7mRRsD0oIlz6ua70k6DSP 8DzQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=EkkYuERG; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-187034-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-187034-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id d75a77b69052e-43e3fcf93fdsi72133801cf.16.2024.05.22.23.16.15 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 May 2024 23:16:15 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-187034-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=EkkYuERG; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-187034-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-187034-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 5DAD81C21D1E for ; Thu, 23 May 2024 06:16:15 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D987513B58F; Thu, 23 May 2024 06:16:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="EkkYuERG" 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 C3D09187F; Thu, 23 May 2024 06:16:03 +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=1716444963; cv=none; b=owhac80B7bpq14N/EqXRAJ8UvhycGW1WWmUjw1x4BZfjIYUp4DxLSsoWLYYieun5+XXouLaPT0BZtjW2hDxLbXeBVJsRmMGQW75qzjH1XzO7XnuNj+mPZ5UwI51Vpf6udpba4oTJywOKbXA6X4qOfHZY33Ohe6CifLZal6PByPg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716444963; c=relaxed/simple; bh=2Gv4TYLp3WpuCGedr5MvVJZUKZFO/am8jSeOVS5dCaY=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=lYqJ4n73nHt+uFaRoxMAlHkecYPTS5SwgKN1YO71oBPW+g7jBiESsUkfmgq87/XpWMHb+1qv07exUjEP9/mibsGjVLYaGPPdPRytU8OR2QDGohYS9bM1KgxFZfwqVjWw2Cz+jedo3cP1p2Ibz6qd8oRM7H4NwtJfkFKvEVdaTHE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=EkkYuERG; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2AB7CC2BD10; Thu, 23 May 2024 06:15:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1716444963; bh=2Gv4TYLp3WpuCGedr5MvVJZUKZFO/am8jSeOVS5dCaY=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=EkkYuERGD3hG0qRPQMKgQ9beRgl8oSx/xtG2tWdgh/f6jSIQyw88RCniPhfpwRVnD g+yJH7bN9IBfyXWMQjvXCZjCNGr7AptjBWkw1j4g5MqS2hWdQSf12qNkPp+CKkWrcd ZWlGHttv3QPXDDr/uuQ1xHltUIycrp4v4j7YzevnJnvAdgAjkiAa/iDJA7bfCKB6bh +bCtj3771bxVW9f0vbSilJdP2jPonUje+3Mnwhbw3lQAr7+1UeTgt2KvmK5yDykd1w yRjU5+j/XY6l/gZr5DH9+jELIa+P3nyk7uUc8IDdU84tbvtFJ/mWjv3UTQYAtXViPF IPz4avuZqHTVg== Message-ID: Date: Thu, 23 May 2024 08:15:54 +0200 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 5/7] dt-bindings: remoteproc: qcom,pas: Add hwlocks To: Bjorn Andersson Cc: Chris Lew , 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 , 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 References: <20240516-hwspinlock-bust-v1-0-47a90a859238@quicinc.com> <20240516-hwspinlock-bust-v1-5-47a90a859238@quicinc.com> <3521519f-34b8-472d-be37-f0e64bba24fc@kernel.org> <92dcd555-69b1-4111-92dd-debe5107d526@kernel.org> From: Krzysztof Kozlowski Content-Language: en-US Autocrypt: addr=krzk@kernel.org; keydata= xsFNBFVDQq4BEAC6KeLOfFsAvFMBsrCrJ2bCalhPv5+KQF2PS2+iwZI8BpRZoV+Bd5kWvN79 cFgcqTTuNHjAvxtUG8pQgGTHAObYs6xeYJtjUH0ZX6ndJ33FJYf5V3yXqqjcZ30FgHzJCFUu JMp7PSyMPzpUXfU12yfcRYVEMQrmplNZssmYhiTeVicuOOypWugZKVLGNm0IweVCaZ/DJDIH gNbpvVwjcKYrx85m9cBVEBUGaQP6AT7qlVCkrf50v8bofSIyVa2xmubbAwwFA1oxoOusjPIE J3iadrwpFvsZjF5uHAKS+7wHLoW9hVzOnLbX6ajk5Hf8Pb1m+VH/E8bPBNNYKkfTtypTDUCj NYcd27tjnXfG+SDs/EXNUAIRefCyvaRG7oRYF3Ec+2RgQDRnmmjCjoQNbFrJvJkFHlPeHaeS BosGY+XWKydnmsfY7SSnjAzLUGAFhLd/XDVpb1Een2XucPpKvt9ORF+48gy12FA5GduRLhQU vK4tU7ojoem/G23PcowM1CwPurC8sAVsQb9KmwTGh7rVz3ks3w/zfGBy3+WmLg++C2Wct6nM Pd8/6CBVjEWqD06/RjI2AnjIq5fSEH/BIfXXfC68nMp9BZoy3So4ZsbOlBmtAPvMYX6U8VwD TNeBxJu5Ex0Izf1NV9CzC3nNaFUYOY8KfN01X5SExAoVTr09ewARAQABzSVLcnp5c3p0b2Yg S296bG93c2tpIDxrcnprQGtlcm5lbC5vcmc+wsGVBBMBCgA/AhsDBgsJCAcD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qYntmNKEicoHGU+x91Gcan8mCoqhJkbqrL7+nXG2 5Q/GS5M9RFWS+nYyJh+c3OcfKqVcZQNANItt7+ULzdNJuhvTRRdC3g9hmCEuNSr+CLMdnRBY fv0= In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit On 22/05/2024 19:50, Bjorn Andersson wrote: >>>>> >>>>> We did consider tying this to the SMEM instance, but the entitiy >>>>> relating to firmware is the remoteproc instance. >>>> >>>> I still do not understand why you have to add hwlock to remoteproc, even >>>> though it is not directly used. Your driver problem looks like lack of >>>> proper driver architecture - you want to control the locks not from the >>>> layer took the lock, but one layer up. Sorry, no, fix the driver >>>> architecture. >>>> >>> >>> No, it is the firmware's reference to the lock that is represented in >>> the remoteproc node, while SMEM deals with Linux's reference to the lock. >>> >>> This reference would be used to release the lock - on behalf of the >>> firmware - in the event that the firmware held it when it >>> stopped/crashed. >> >> I understood, but the remoteproc driver did not acquire the hardware >> lock. It was taken by smem, if I got it correctly, so you should poke >> smem to bust the spinlock. >> > > The remoteproc instance is the closest representation of the entity that > took the lock (i.e. the firmware). SMEM here is just another consumer of > the same lock. > >> The hwlock is not a property of remote proc, because remote proc does >> not care, right? Other device cares... and now for every smem user you >> will add new binding property? >> > > Right, the issue seen relates to SMEM, because the remote processor (not > the remoteproc driver) took the lock. > >> No, you are adding a binding based on your driver solution. > > Similar to how hwspinlocks are used in other platforms (e.g. TI) the > firmware could take multiple locks, e.g. to synchronize access to other > shared memory mechanism (i.e. not SMEM). While I am not aware of such > use case today, my expectation was that in such case we just list all > the hwlocks related to the firmware and bust those from the remoteproc > instance. > > Having to export APIs from each one of such drivers and make the > remoteproc identify the relevant instances and call those APIs does > indeed seem inconvenient. > SMEM is special here because it's singleton, but this would not > necessarily be true for other cases. I don't think that exporting such API is unreasonable, but quite opposite - expected. The remote processor crashed, so the remoteproc driver is supposed to call some sort of smem_cleanup() or smem_cleanup_on_crash() and call would bust/release the lock. That way lock handling is encapsulated entirely in one driver which already takes and releases the lock. Just like freeing any memory. remoteproc driver does not free other driver's memory only because processor crashed. Best regards, Krzysztof