From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 15630C04A94 for ; Wed, 9 Aug 2023 16:52:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231455AbjHIQwg (ORCPT ); Wed, 9 Aug 2023 12:52:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38674 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231368AbjHIQwf (ORCPT ); Wed, 9 Aug 2023 12:52:35 -0400 Received: from mail-lj1-x232.google.com (mail-lj1-x232.google.com [IPv6:2a00:1450:4864:20::232]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9EE022691 for ; Wed, 9 Aug 2023 09:52:23 -0700 (PDT) Received: by mail-lj1-x232.google.com with SMTP id 38308e7fff4ca-2b9b904bb04so481681fa.1 for ; Wed, 09 Aug 2023 09:52:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1691599939; x=1692204739; h=content-transfer-encoding:in-reply-to:autocrypt:from:references:cc :to:content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=TQJEv5Vw7ZJZLzL74/YFszGSXRtz97IWL9b+9KOEYBk=; b=ZO9GM7kMXDoegIZvjBMStvrp6k0mAqPeeKnZVncyjI7+NV+JiqCs4v1oWOzjGWf5i3 jWjFOuQ9uQTMZCKyW4vhy1nIipCY47B5mMkYGIEbldjoVUEFPleKpQEuJK1DlGg2mA9G +oX5pZ4MY+Q7IwuV3YHqwG38AGslp4Xfs0rYVMITikLmthAjz+17AHdkyiYBk1F5Sr32 wnS9cOcy0IRxja9nUUeFC31S9eb800X6nntcGCReQQS27uzpd+Mjk9s/e56lWTsfp3nL QSX/GXd7MrzDvYzDji+t/p/ChlJy04GchzD9M3hRWqz8DmP8+kgqElQYr1Smv8rEQ/aB Uksw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691599939; x=1692204739; h=content-transfer-encoding:in-reply-to:autocrypt:from:references:cc :to:content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=TQJEv5Vw7ZJZLzL74/YFszGSXRtz97IWL9b+9KOEYBk=; b=bv+Lo8iGzfvYgJ55I7n+RZEFkhjKc4ilf98if9laDyxFCmeol5rBACoaIyZilIin6T S1PzYMzxrhxlqfGdPW+LxhD9JQjM1wflSjnRxRo+WkHLlnDifFj6dMGbadWXmWsngYnp 8IT22KlcyVMzWY/qqVU5gTm+RH2+UcaulgCNEXvoINP5RUb1y9L5BRAyTg+hBnLMGng1 HxhT1vS2vUh47GdlGYX1qxe1RqgpdH1xSnsSYTng8HXOOOdqh94x1nKsMGABlL12etxs vtVIufUCUTynyYXasGuJBINJyerZXgqtBrp1n/crK/4/TszD5IL7Gqzpju8RdbzdM26S J/cw== X-Gm-Message-State: AOJu0YwJqQaOJEyXA/TiXh1WQtYPbpUgNtZnByb7st9aNcKHxrwKGc6M rYdkvbFJxsjCg2RD9vyhLk6JLQ== X-Google-Smtp-Source: AGHT+IHKrr6dngxD5jbf0lI7E9pc6JW/R62gAP8zLLoHL2aQJmFdV+8JZpgmrPwhkyIEldKOTgVLyQ== X-Received: by 2002:a2e:b0fc:0:b0:2b9:ee3e:240c with SMTP id h28-20020a2eb0fc000000b002b9ee3e240cmr2392361ljl.24.1691599939431; Wed, 09 Aug 2023 09:52:19 -0700 (PDT) Received: from [192.168.1.101] (abxi185.neoplus.adsl.tpnet.pl. [83.9.2.185]) by smtp.gmail.com with ESMTPSA id x10-20020a2e880a000000b002b9f03729e2sm2787141ljh.36.2023.08.09.09.52.17 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 09 Aug 2023 09:52:18 -0700 (PDT) Message-ID: Date: Wed, 9 Aug 2023 18:52:17 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 03/15] clk: qcom: gcc-sm6375: Unregister critical clocks Content-Language: en-US To: Johan Hovold , Bjorn Andersson Cc: Andy Gross , Michael Turquette , Stephen Boyd , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Marijn Suijten , linux-arm-msm@vger.kernel.org, linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org References: <20230717-topic-branch_aon_cleanup-v1-0-27784d27a4f4@linaro.org> <20230717-topic-branch_aon_cleanup-v1-3-27784d27a4f4@linaro.org> <33a26241-026a-9466-5dd6-e3202b29f57c@linaro.org> From: Konrad Dybcio Autocrypt: addr=konrad.dybcio@linaro.org; keydata= xsFNBF9ALYUBEADWAhxdTBWrwAgDQQzc1O/bJ5O7b6cXYxwbBd9xKP7MICh5YA0DcCjJSOum BB/OmIWU6X+LZW6P88ZmHe+KeyABLMP5s1tJNK1j4ntT7mECcWZDzafPWF4F6m4WJOG27kTJ HGWdmtO+RvadOVi6CoUDqALsmfS3MUG5Pj2Ne9+0jRg4hEnB92AyF9rW2G3qisFcwPgvatt7 TXD5E38mLyOPOUyXNj9XpDbt1hNwKQfiidmPh5e7VNAWRnW1iCMMoKqzM1Anzq7e5Afyeifz zRcQPLaqrPjnKqZGL2BKQSZDh6NkI5ZLRhhHQf61fkWcUpTp1oDC6jWVfT7hwRVIQLrrNj9G MpPzrlN4YuAqKeIer1FMt8cq64ifgTzxHzXsMcUdclzq2LTk2RXaPl6Jg/IXWqUClJHbamSk t1bfif3SnmhA6TiNvEpDKPiT3IDs42THU6ygslrBxyROQPWLI9IL1y8S6RtEh8H+NZQWZNzm UQ3imZirlPjxZtvz1BtnnBWS06e7x/UEAguj7VHCuymVgpl2Za17d1jj81YN5Rp5L9GXxkV1 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VR4cBcg5dfFgFAmQ5bvICGwwACgkQR4cBcg5dfFju1Q//Xta1ShwL0MLSC1KL1lXGXeRM 8arzfyiB5wJ9tb9U/nZvhhdfilEDLe0jKJY0RJErbdRHsalwQCrtq/1ewQpMpsRxXzAjgfRN jc4tgxRWmI+aVTzSRpywNahzZBT695hMz81cVZJoZzaV0KaMTlSnBkrviPz1nIGHYCHJxF9r cIu0GSIyUjZ/7xslxdvjpLth16H27JCWDzDqIQMtg61063gNyEyWgt1qRSaK14JIH/DoYRfn jfFQSC8bffFjat7BQGFz4ZpRavkMUFuDirn5Tf28oc5ebe2cIHp4/kajTx/7JOxWZ80U70mA cBgEeYSrYYnX+UJsSxpzLc/0sT1eRJDEhI4XIQM4ClIzpsCIN5HnVF76UQXh3a9zpwh3dk8i bhN/URmCOTH+LHNJYN/MxY8wuukq877DWB7k86pBs5IDLAXmW8v3gIDWyIcgYqb2v8QO2Mqx YMqL7UZxVLul4/JbllsQB8F/fNI8AfttmAQL9cwo6C8yDTXKdho920W4WUR9k8NT/OBqWSyk bGqMHex48FVZhexNPYOd58EY9/7mL5u0sJmo+jTeb4JBgIbFPJCFyng4HwbniWgQJZ1WqaUC nas9J77uICis2WH7N8Bs9jy0wQYezNzqS+FxoNXmDQg2jetX8en4bO2Di7Pmx0jXA4TOb9TM izWDgYvmBE8= In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org On 19.07.2023 10:43, Johan Hovold wrote: > On Tue, Jul 18, 2023 at 09:23:52AM -0700, Bjorn Andersson wrote: >> On Tue, Jul 18, 2023 at 03:26:51PM +0200, Konrad Dybcio wrote: >>> On 18.07.2023 15:20, Johan Hovold wrote: >>>> On Mon, Jul 17, 2023 at 05:19:10PM +0200, Konrad Dybcio wrote: >>>>> Some clocks need to be always-on, but we don't really do anything >>>>> with them, other than calling enable() once and telling Linux they're >>>>> enabled. >>>>> >>>>> Unregister them to save a couple of bytes and, perhaps more >>>>> importantly, allow for runtime suspend of the clock controller device, >>>>> as CLK_IS_CRITICAL prevents the latter. >>>> >>>> But this doesn't sound right. How can you disable a controller which >>>> still has clocks enabled? >>>> >>>> Shouldn't instead these clocks be modelled properly so that they are >>>> only enabled when actually needed? >>> Hm.. We do have clk_branch2_aon_ops, but something still needs to >>> toggle these clocks. >>> >> >> Before we started replacing these clocks with static votes, I handled >> exactly this problem in the turingcc-qcs404 driver by registering the >> ahb clock with a pm_clk_add(). The clock framework will then >> automagically keep the clock enabled around operations, but it will also >> keep the runtime state active as long as the clock is prepared. >> >> As mentioned in an earlier reply today, there's no similarity to this in >> the reset or gdsc code, so we'd need to add that in order to rely on >> such mechanism. > > This reminds me of: > > 4cc47e8add63 ("clk: qcom: gdsc: Remove direct runtime PM calls") > > which recently removed a broken attempt to implement this for gdscs. > > Just stumbled over GENPD_FLAG_PM_CLK which may provide a way forward at > least for genpd (but see below). > >>> I *think* we could leave a permanent vote in probe() without breaking >>> runtime pm! I'll give it a spin bit later.. >>> >> >> Modelling the AHB clock in DT and putting a devm_clk_get_enabled() would >> properly connect the two, and thereby handle probe order between the two >> clock controllers. > > Yeah, this dependency really should be described eventually. > >> But it would prevent the power-domain of the parent provider to ever >> suspending. Using pm_clk_add() this would at least depend on client >> votes. > > IIUC using pm_clk_add() would also prevent the parent from suspending > due to that resume call in clk_prepare(). > > And this mechanism is also used for GENPD_FLAG_PM_CLK... So.. how do we go about solving the issue that this patch tried to address? Konrad