[RFT,v2,01/14] dt-bindings: clock: qcom,rpmcc: Add a way to enable unused clock cleanup
Message ID | 20230303-topic-rpmcc_sleep-v2-1-ae80a325fe94@linaro.org |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp584556wrd; Wed, 8 Mar 2023 13:36:59 -0800 (PST) X-Google-Smtp-Source: AK7set8T961iFhpF1i8+M+fF0/n+2Txdg+ZyNUBqn6Mr26L1cIarlAHDOOE0ucKXZeoCxAxrnQmg X-Received: by 2002:a17:902:d2cb:b0:19c:be0a:83af with SMTP id n11-20020a170902d2cb00b0019cbe0a83afmr25639079plc.42.1678311419692; Wed, 08 Mar 2023 13:36:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678311419; cv=none; d=google.com; s=arc-20160816; b=gd9+OVB5z3e+JT0Xny0nki+HAoQqHLjSg7Vcs1hCGOsriHTTNRnQ9i2wDO429dYCxe J7klYSftZ0I+6De43kmpSGR5YhrgVCFRSupz5UgZKzeDCOqvufOA1DkN8dV7OVu69xxu isJtI03PAsZBRLwbaAj1GKaRs5hc7GURbAAocfVd9SkqPUgfE040L814coy2j6IcTV88 8UPyhzUArIiqiu0Mo3hIezljyQ0DeZ3qCkHtVL/+8xHFwXsPLAuIOIcEV1eIErQkL+He v0DFwizuS/SmGF1LbnLISsXzqYVTe9EhcgEbyotsVcbeVx7HjfHmmwDrFC/3yrrBBLq+ IgHA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:in-reply-to:references:message-id :content-transfer-encoding:mime-version:subject:date:from :dkim-signature; bh=QDlHCsdatk7h5R3zUsXpTRiwKW19DDuLF4HKqV/q1bg=; b=kKsIKR8PRb8/UnJ5goVCuKR8g8VCts7s5fOPQ6H/cByt87ebslPT9wRTRvjG7zIFHP sLiKNpxi2pK8CzGPkni9qqxl98VuNo60ae7RCLJ/HWcmWdh5iOZC84Tn+4XXxjQrxzl7 F9JSHwRvaRiBABfGc1NtPFNi7V4oDODlljj8i6CVDj9s7fPXoBa0voCujQai+nq8EJlL BLGJ++4yGgDyCQnWPPLFlrlVysJz70XkrL7/NaD8or+2/VUlaeN6fVJqo3ilmjya72Bz 4PYHGN+D6CVtBv5dZSgZCslLOfmHxSbzd3FOa0Rv4Bl81GYpUjpxMx1tocLdg2chLDgq kKjw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=osg1Gpfi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w13-20020a170902e88d00b0019e2fb0a5ffsi18438625plg.46.2023.03.08.13.36.44; Wed, 08 Mar 2023 13:36:59 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=osg1Gpfi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230015AbjCHVf5 (ORCPT <rfc822;toshivichauhan@gmail.com> + 99 others); Wed, 8 Mar 2023 16:35:57 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52394 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230011AbjCHVfr (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Wed, 8 Mar 2023 16:35:47 -0500 Received: from mail-lf1-x132.google.com (mail-lf1-x132.google.com [IPv6:2a00:1450:4864:20::132]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D7462CEF9B for <linux-kernel@vger.kernel.org>; Wed, 8 Mar 2023 13:35:39 -0800 (PST) Received: by mail-lf1-x132.google.com with SMTP id j11so23051380lfg.13 for <linux-kernel@vger.kernel.org>; Wed, 08 Mar 2023 13:35:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1678311338; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=QDlHCsdatk7h5R3zUsXpTRiwKW19DDuLF4HKqV/q1bg=; b=osg1GpfiQPSnkCrXraQM+3UriA4cjKvMkix3J0/xqRUCIIoUUX4nnNhIrBmtBQiKnD gePP3GBZ6QMmX5q4kilek17tUpgbO1ASRe776L8tUVxqk3TmpwlNJzqKPURdyyHE/WMU BT3pPYibiXQlN6feiN2B+AInyVpl/Y9yXdo+9vMUnspdaubHww4SRB/18DqQen3eVzHC 0R/KeD5QV4ZI4LWlIg13vyRz+4oGYnfF1Ft7AH4oyqClKnkCxy8OZpYDUBzSdZq9ZffP M36yfO0hKGomA91p8WSsOY/mwYDUjVFDlVVX1y5VPQYoTYtu4tpFVSIKTcJ10eENQ1qD tQHw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678311338; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=QDlHCsdatk7h5R3zUsXpTRiwKW19DDuLF4HKqV/q1bg=; b=7N1f/EA28mYtEYxM+VJhw782kqLiNMcjn47/7ckDHMtqiRalJhU6RFgOoRuRRknK4F g8uLgg4q/WNw86FucPl520khQ5XSYii66IrW58hmaeS50yZ+n9teJg4iZaqLX0k4/qBa D0xOCerZ76FymUkybC3tKW++dYl6CQcQJfS4lItkubPc8/Y5uZjHeXfLbwCeVcLoeIGt 0BTAuWxMzXYWZ+gtFWhyYBcGQ3wPQnCCR0UwuepDMkTHWYbW7zGcy5SRoeUcsLL2+8Dr 3LsRx8+w6opUBEt5VdvxL+zow1HTnaQ3xu0cClfQtSvGk2kGWZQQaQ/a0TOu1OdVPxm1 IZXg== X-Gm-Message-State: AO0yUKUPHwCAQUz+wyVZDo6Eds3IMYV2Omsv2vwrnJWCyMkSoDb+rw4N BZ6O5xGGUQs8PrHWL0hHbzW9rg== X-Received: by 2002:a05:6512:25b:b0:4dd:ab39:86e0 with SMTP id b27-20020a056512025b00b004ddab3986e0mr6214451lfo.27.1678311337931; Wed, 08 Mar 2023 13:35:37 -0800 (PST) Received: from [192.168.1.101] (abyj16.neoplus.adsl.tpnet.pl. [83.9.29.16]) by smtp.gmail.com with ESMTPSA id u7-20020ac243c7000000b004dc4d26c324sm2467479lfl.143.2023.03.08.13.35.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Mar 2023 13:35:37 -0800 (PST) From: Konrad Dybcio <konrad.dybcio@linaro.org> Date: Wed, 08 Mar 2023 22:35:17 +0100 Subject: [PATCH RFT v2 01/14] dt-bindings: clock: qcom,rpmcc: Add a way to enable unused clock cleanup MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20230303-topic-rpmcc_sleep-v2-1-ae80a325fe94@linaro.org> References: <20230303-topic-rpmcc_sleep-v2-0-ae80a325fe94@linaro.org> In-Reply-To: <20230303-topic-rpmcc_sleep-v2-0-ae80a325fe94@linaro.org> To: Andy Gross <agross@kernel.org>, Bjorn Andersson <andersson@kernel.org>, Michael Turquette <mturquette@baylibre.com>, Stephen Boyd <sboyd@kernel.org>, Rob Herring <robh+dt@kernel.org>, Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org> Cc: linux-arm-msm@vger.kernel.org, linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org, Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>, devicetree@vger.kernel.org, Konrad Dybcio <konrad.dybcio@linaro.org> X-Mailer: b4 0.12.1 X-Developer-Signature: v=1; a=ed25519-sha256; t=1678311334; l=2006; i=konrad.dybcio@linaro.org; s=20230215; h=from:subject:message-id; bh=kU+or0SIwjfCFe3CHtYMpTgzGECGUtYX8Fz74pRBjmw=; b=xakONkb1YLP0DXpf6jbByNh8PngvZtgp8nUR3XoamblbthS/l/94cTLlNZLqyAgOaLmx+zNacVua CppU+tiMDl4K7Y31exizgRwrFp/ZEBt95LxBUjQfHTTMDa5jS9yo X-Developer-Key: i=konrad.dybcio@linaro.org; a=ed25519; pk=iclgkYvtl2w05SSXO5EjjSYlhFKsJ+5OSZBjOkQuEms= X-Spam-Status: No, score=-0.2 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_SORBS_HTTP,RCVD_IN_SORBS_SOCKS,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1759837075251441617?= X-GMAIL-MSGID: =?utf-8?q?1759837075251441617?= |
Series |
SMD RPMCC sleep preparations
|
|
Commit Message
Konrad Dybcio
March 8, 2023, 9:35 p.m. UTC
Disabling RPMCC clocks can be a bit touchy. If we can't guarantee all
(or at least most) of the oneline peripherals ask the interconnect
framework to keep their buses online and guarantee enough bandwidth,
we're relying on bootloader defaults to keep the said buses alive through
RPM requests and rate setting on RPM clocks.
Without that in place, the RPM clocks are never enabled in the CCF, which
qualifies them to be cleaned up, since - as far as Linux is concerned -
nobody's using them and they're just wasting power. Doing so will end
tragically, as within miliseconds we'll get *some* access attempt on an
unlocked bus which will cause a platform crash.
On the other hand, if we want to save power and put well-supported
platforms to sleep, we should be shutting off at least some of these
clocks (this time with a clear distinction of which ones are *actually*
not in use, coming from the interconnect driver).
To differentiate between these two cases while not breaking older DTs,
introduce an opt-in property to correctly mark RPM clocks as enabled
after handoff (the initial max freq vote) and hence qualify them for the
common unused clock cleanup.
Signed-off-by: Konrad Dybcio <konrad.dybcio@linaro.org>
---
Documentation/devicetree/bindings/clock/qcom,rpmcc.yaml | 6 ++++++
1 file changed, 6 insertions(+)
Comments
On Wed, Mar 08, 2023 at 10:35:17PM +0100, Konrad Dybcio wrote: > Disabling RPMCC clocks can be a bit touchy. If we can't guarantee all > (or at least most) of the oneline peripherals ask the interconnect > framework to keep their buses online and guarantee enough bandwidth, > we're relying on bootloader defaults to keep the said buses alive through > RPM requests and rate setting on RPM clocks. > > Without that in place, the RPM clocks are never enabled in the CCF, which > qualifies them to be cleaned up, since - as far as Linux is concerned - > nobody's using them and they're just wasting power. Doing so will end > tragically, as within miliseconds we'll get *some* access attempt on an > unlocked bus which will cause a platform crash. > > On the other hand, if we want to save power and put well-supported > platforms to sleep, we should be shutting off at least some of these > clocks (this time with a clear distinction of which ones are *actually* > not in use, coming from the interconnect driver). > > To differentiate between these two cases while not breaking older DTs, > introduce an opt-in property to correctly mark RPM clocks as enabled > after handoff (the initial max freq vote) and hence qualify them for the > common unused clock cleanup. > > Signed-off-by: Konrad Dybcio <konrad.dybcio@linaro.org> > --- > Documentation/devicetree/bindings/clock/qcom,rpmcc.yaml | 6 ++++++ > 1 file changed, 6 insertions(+) > > diff --git a/Documentation/devicetree/bindings/clock/qcom,rpmcc.yaml b/Documentation/devicetree/bindings/clock/qcom,rpmcc.yaml > index 2a95bf8664f9..386153f61971 100644 > --- a/Documentation/devicetree/bindings/clock/qcom,rpmcc.yaml > +++ b/Documentation/devicetree/bindings/clock/qcom,rpmcc.yaml > @@ -58,6 +58,12 @@ properties: > minItems: 1 > maxItems: 2 > > + qcom,clk-disable-unused: > + type: boolean > + description: > + Indicates whether unused RPM clocks can be shut down with the common > + unused clock cleanup. Requires a functional interconnect driver. I don't think this should be QCom specific. Come up with something common (which will probably have some debate). Rob
On 16.03.2023 23:58, Rob Herring wrote: > On Wed, Mar 08, 2023 at 10:35:17PM +0100, Konrad Dybcio wrote: >> Disabling RPMCC clocks can be a bit touchy. If we can't guarantee all >> (or at least most) of the oneline peripherals ask the interconnect >> framework to keep their buses online and guarantee enough bandwidth, >> we're relying on bootloader defaults to keep the said buses alive through >> RPM requests and rate setting on RPM clocks. >> >> Without that in place, the RPM clocks are never enabled in the CCF, which >> qualifies them to be cleaned up, since - as far as Linux is concerned - >> nobody's using them and they're just wasting power. Doing so will end >> tragically, as within miliseconds we'll get *some* access attempt on an >> unlocked bus which will cause a platform crash. >> >> On the other hand, if we want to save power and put well-supported >> platforms to sleep, we should be shutting off at least some of these >> clocks (this time with a clear distinction of which ones are *actually* >> not in use, coming from the interconnect driver). >> >> To differentiate between these two cases while not breaking older DTs, >> introduce an opt-in property to correctly mark RPM clocks as enabled >> after handoff (the initial max freq vote) and hence qualify them for the >> common unused clock cleanup. >> >> Signed-off-by: Konrad Dybcio <konrad.dybcio@linaro.org> >> --- >> Documentation/devicetree/bindings/clock/qcom,rpmcc.yaml | 6 ++++++ >> 1 file changed, 6 insertions(+) >> >> diff --git a/Documentation/devicetree/bindings/clock/qcom,rpmcc.yaml b/Documentation/devicetree/bindings/clock/qcom,rpmcc.yaml >> index 2a95bf8664f9..386153f61971 100644 >> --- a/Documentation/devicetree/bindings/clock/qcom,rpmcc.yaml >> +++ b/Documentation/devicetree/bindings/clock/qcom,rpmcc.yaml >> @@ -58,6 +58,12 @@ properties: >> minItems: 1 >> maxItems: 2 >> >> + qcom,clk-disable-unused: >> + type: boolean >> + description: >> + Indicates whether unused RPM clocks can be shut down with the common >> + unused clock cleanup. Requires a functional interconnect driver. > > I don't think this should be QCom specific. Come up with something > common (which will probably have some debate). Generally the opposite (ignoring unused clocks during the cleanup) is the thing you need to opt into. I can however see how (especially with the focus on not breaking things for older DTs) somebody else may also decide to only allow them to be cleaned up conditionally (by marking the clocks that were enabled earlier as enabled in Linux OR not addding clk.flags |= CLK_IGNORE_UNUSED) as we do here. Stephen, Rob, would `clk-disable-unused` be a fitting generic property name for that? Should we also think about `clk-ignore-unused` as a clock-controller-specific alternative to the CCF-wide clk_ignore_unused cmdline? Konrad > > Rob
Quoting Konrad Dybcio (2023-03-16 17:31:34) > > On 16.03.2023 23:58, Rob Herring wrote: > > On Wed, Mar 08, 2023 at 10:35:17PM +0100, Konrad Dybcio wrote: > >> > >> + qcom,clk-disable-unused: > >> + type: boolean > >> + description: > >> + Indicates whether unused RPM clocks can be shut down with the common > >> + unused clock cleanup. Requires a functional interconnect driver. > > > > I don't think this should be QCom specific. Come up with something > > common (which will probably have some debate). > Generally the opposite (ignoring unused clocks during the cleanup) is > the thing you need to opt into. > > I can however see how (especially with the focus on not breaking things > for older DTs) somebody else may also decide to only allow them to be > cleaned up conditionally (by marking the clocks that were enabled earlier > as enabled in Linux OR not addding clk.flags |= CLK_IGNORE_UNUSED) as we > do here. > > Stephen, Rob, would `clk-disable-unused` be a fitting generic property > name for that? Should we also think about `clk-ignore-unused` as a > clock-controller-specific alternative to the CCF-wide clk_ignore_unused > cmdline? > There are multiple threads on the list about disabling unused clks. Moving the decision to disable unused clks to a DT property is yet another approach. I'd rather not do that, because it really isn't describing the hardware configuration. If anything, I'd expect the property to be describing which clks are enabled by the firmware and then leave the decision to disable them because they're unused up to the software.
On Wed, Mar 08, 2023 at 10:35:17PM +0100, Konrad Dybcio wrote: > Disabling RPMCC clocks can be a bit touchy. If we can't guarantee all > (or at least most) of the oneline peripherals ask the interconnect > framework to keep their buses online and guarantee enough bandwidth, > we're relying on bootloader defaults to keep the said buses alive through > RPM requests and rate setting on RPM clocks. > > Without that in place, the RPM clocks are never enabled in the CCF, which > qualifies them to be cleaned up, since - as far as Linux is concerned - > nobody's using them and they're just wasting power. Doing so will end > tragically, as within miliseconds we'll get *some* access attempt on an > unlocked bus which will cause a platform crash. > > On the other hand, if we want to save power and put well-supported > platforms to sleep, we should be shutting off at least some of these > clocks (this time with a clear distinction of which ones are *actually* > not in use, coming from the interconnect driver). > > To differentiate between these two cases while not breaking older DTs, > introduce an opt-in property to correctly mark RPM clocks as enabled > after handoff (the initial max freq vote) and hence qualify them for the > common unused clock cleanup. > > Signed-off-by: Konrad Dybcio <konrad.dybcio@linaro.org> > --- > Documentation/devicetree/bindings/clock/qcom,rpmcc.yaml | 6 ++++++ > 1 file changed, 6 insertions(+) > > diff --git a/Documentation/devicetree/bindings/clock/qcom,rpmcc.yaml b/Documentation/devicetree/bindings/clock/qcom,rpmcc.yaml > index 2a95bf8664f9..386153f61971 100644 > --- a/Documentation/devicetree/bindings/clock/qcom,rpmcc.yaml > +++ b/Documentation/devicetree/bindings/clock/qcom,rpmcc.yaml > @@ -58,6 +58,12 @@ properties: > minItems: 1 > maxItems: 2 > > + qcom,clk-disable-unused: This is a Linux implementation detail, not a description of the hardware. So it unfortunately doesn't belong here. > + type: boolean > + description: > + Indicates whether unused RPM clocks can be shut down with the common > + unused clock cleanup. Requires a functional interconnect driver. This is an interesting aspect though, there's a lot of things that will break if any one of these building blocks are missing, for any reason. Regards, Bjorn > + > required: > - compatible > - '#clock-cells' > > -- > 2.39.2 >
On 17.03.2023 19:20, Stephen Boyd wrote: > Quoting Konrad Dybcio (2023-03-16 17:31:34) >> >> On 16.03.2023 23:58, Rob Herring wrote: >>> On Wed, Mar 08, 2023 at 10:35:17PM +0100, Konrad Dybcio wrote: >>>> >>>> + qcom,clk-disable-unused: >>>> + type: boolean >>>> + description: >>>> + Indicates whether unused RPM clocks can be shut down with the common >>>> + unused clock cleanup. Requires a functional interconnect driver. >>> >>> I don't think this should be QCom specific. Come up with something >>> common (which will probably have some debate). >> Generally the opposite (ignoring unused clocks during the cleanup) is >> the thing you need to opt into. >> >> I can however see how (especially with the focus on not breaking things >> for older DTs) somebody else may also decide to only allow them to be >> cleaned up conditionally (by marking the clocks that were enabled earlier >> as enabled in Linux OR not addding clk.flags |= CLK_IGNORE_UNUSED) as we >> do here. >> >> Stephen, Rob, would `clk-disable-unused` be a fitting generic property >> name for that? Should we also think about `clk-ignore-unused` as a >> clock-controller-specific alternative to the CCF-wide clk_ignore_unused >> cmdline? >> > > There are multiple threads on the list about disabling unused clks. > Moving the decision to disable unused clks to a DT property is yet > another approach. I'd rather not do that, because it really isn't > describing the hardware configuration. If anything, I'd expect the > property to be describing which clks are enabled by the firmware and > then leave the decision to disable them because they're unused up to the > software. After some more thinking, I realized that this could be made opt-in simply with driver_data.. WDYT? Konrad
On 6.04.2023 16:44, Konrad Dybcio wrote: > > > On 17.03.2023 19:20, Stephen Boyd wrote: >> Quoting Konrad Dybcio (2023-03-16 17:31:34) >>> >>> On 16.03.2023 23:58, Rob Herring wrote: >>>> On Wed, Mar 08, 2023 at 10:35:17PM +0100, Konrad Dybcio wrote: >>>>> >>>>> + qcom,clk-disable-unused: >>>>> + type: boolean >>>>> + description: >>>>> + Indicates whether unused RPM clocks can be shut down with the common >>>>> + unused clock cleanup. Requires a functional interconnect driver. >>>> >>>> I don't think this should be QCom specific. Come up with something >>>> common (which will probably have some debate). >>> Generally the opposite (ignoring unused clocks during the cleanup) is >>> the thing you need to opt into. >>> >>> I can however see how (especially with the focus on not breaking things >>> for older DTs) somebody else may also decide to only allow them to be >>> cleaned up conditionally (by marking the clocks that were enabled earlier >>> as enabled in Linux OR not addding clk.flags |= CLK_IGNORE_UNUSED) as we >>> do here. >>> >>> Stephen, Rob, would `clk-disable-unused` be a fitting generic property >>> name for that? Should we also think about `clk-ignore-unused` as a >>> clock-controller-specific alternative to the CCF-wide clk_ignore_unused >>> cmdline? >>> >> >> There are multiple threads on the list about disabling unused clks. >> Moving the decision to disable unused clks to a DT property is yet >> another approach. I'd rather not do that, because it really isn't >> describing the hardware configuration. If anything, I'd expect the >> property to be describing which clks are enabled by the firmware and >> then leave the decision to disable them because they're unused up to the >> software. > After some more thinking, I realized that this could be made opt-in > simply with driver_data.. > > WDYT? ..on a re-evaluation, obviously not a great idea.. Old DTBs will not be happy about that. Konrad > > Konrad
On 7.04.2023 22:17, Konrad Dybcio wrote: > > > On 6.04.2023 16:44, Konrad Dybcio wrote: >> >> >> On 17.03.2023 19:20, Stephen Boyd wrote: >>> Quoting Konrad Dybcio (2023-03-16 17:31:34) >>>> >>>> On 16.03.2023 23:58, Rob Herring wrote: >>>>> On Wed, Mar 08, 2023 at 10:35:17PM +0100, Konrad Dybcio wrote: >>>>>> >>>>>> + qcom,clk-disable-unused: >>>>>> + type: boolean >>>>>> + description: >>>>>> + Indicates whether unused RPM clocks can be shut down with the common >>>>>> + unused clock cleanup. Requires a functional interconnect driver. >>>>> >>>>> I don't think this should be QCom specific. Come up with something >>>>> common (which will probably have some debate). >>>> Generally the opposite (ignoring unused clocks during the cleanup) is >>>> the thing you need to opt into. >>>> >>>> I can however see how (especially with the focus on not breaking things >>>> for older DTs) somebody else may also decide to only allow them to be >>>> cleaned up conditionally (by marking the clocks that were enabled earlier >>>> as enabled in Linux OR not addding clk.flags |= CLK_IGNORE_UNUSED) as we >>>> do here. >>>> >>>> Stephen, Rob, would `clk-disable-unused` be a fitting generic property >>>> name for that? Should we also think about `clk-ignore-unused` as a >>>> clock-controller-specific alternative to the CCF-wide clk_ignore_unused >>>> cmdline? >>>> >>> >>> There are multiple threads on the list about disabling unused clks. >>> Moving the decision to disable unused clks to a DT property is yet >>> another approach. I'd rather not do that, because it really isn't >>> describing the hardware configuration. If anything, I'd expect the >>> property to be describing which clks are enabled by the firmware and >>> then leave the decision to disable them because they're unused up to the >>> software. >> After some more thinking, I realized that this could be made opt-in >> simply with driver_data.. >> >> WDYT? > ..on a re-evaluation, obviously not a great idea.. Old DTBs will not > be happy about that. Another idea would be to yank out the not-very-useful "qcom,rpmcc" fallback compatible and present .is_enabled etc. when it's absent.. Directly checking for the interconnect handle to rpmcc is not possible, as interconnect requires rpmcc.. And then somebody's interconnect driver may not be "good enough" (like 8996 and pre-6.3 DTs). Konrad > > Konrad >> >> Konrad
On Wed, Mar 08, 2023 at 10:35:17PM +0100, Konrad Dybcio wrote: > Disabling RPMCC clocks can be a bit touchy. If we can't guarantee all > (or at least most) of the oneline peripherals ask the interconnect > framework to keep their buses online and guarantee enough bandwidth, > we're relying on bootloader defaults to keep the said buses alive through > RPM requests and rate setting on RPM clocks. > > Without that in place, the RPM clocks are never enabled in the CCF, which > qualifies them to be cleaned up, since - as far as Linux is concerned - > nobody's using them and they're just wasting power. Doing so will end > tragically, as within miliseconds we'll get *some* access attempt on an > unlocked bus which will cause a platform crash. > > On the other hand, if we want to save power and put well-supported > platforms to sleep, we should be shutting off at least some of these > clocks (this time with a clear distinction of which ones are *actually* > not in use, coming from the interconnect driver). > > To differentiate between these two cases while not breaking older DTs, > introduce an opt-in property to correctly mark RPM clocks as enabled > after handoff (the initial max freq vote) and hence qualify them for the > common unused clock cleanup. > > Signed-off-by: Konrad Dybcio <konrad.dybcio@linaro.org> > --- > Documentation/devicetree/bindings/clock/qcom,rpmcc.yaml | 6 ++++++ > 1 file changed, 6 insertions(+) > > diff --git a/Documentation/devicetree/bindings/clock/qcom,rpmcc.yaml b/Documentation/devicetree/bindings/clock/qcom,rpmcc.yaml > index 2a95bf8664f9..386153f61971 100644 > --- a/Documentation/devicetree/bindings/clock/qcom,rpmcc.yaml > +++ b/Documentation/devicetree/bindings/clock/qcom,rpmcc.yaml > @@ -58,6 +58,12 @@ properties: > minItems: 1 > maxItems: 2 > > + qcom,clk-disable-unused: > + type: boolean > + description: > + Indicates whether unused RPM clocks can be shut down with the common > + unused clock cleanup. Requires a functional interconnect driver. > + I'm surprised that Stephen Boyd did not bring up his usual "rant" here of moving the interconnect clock voting out of rpmcc into the interconnect drivers (see [1], [2]). :-) I was a bit "cautious" about it back then but at this point I think it kind of makes sense. Make sure to read Stephen's detailed explanation in https://lore.kernel.org/linux-arm-msm/159796605593.334488.8355244657387381953@swboyd.mtv.corp.google.com/ We keep looking for workarounds to prevent the CCF from "messing" with interconnect-related clocks. But the CCF cannot mess with "clocks" it does not manage. The RPM interconnect drivers already talk directly to the RPM in drivers/interconnect/qcom/smd-rpm.c. I think it should be quite easy to move the QCOM_SMD_RPM_BUS_CLK relates defines over there and just bypass the CCF entirely. For backwards compatibility (for platforms without interconnect drivers) one could either assume that the bootloader bandwidth votes will be sufficient and just leave those clocks completely alone. Or the "icc_smd_rpm" platform device could initially make max votes similar to the rpmcc device. By coincidence the "icc_smd_rpm" platform device is always created, no matter how the device tree looks or if the platform actually has an interconnect driver. Stephan [1]: https://lore.kernel.org/linux-arm-msm/159796605593.334488.8355244657387381953@swboyd.mtv.corp.google.com/ [2]: https://lore.kernel.org/linux-arm-msm/20211209091005.D3344C004DD@smtp.kernel.org/
Quoting Stephan Gerhold (2023-04-17 12:05:06) > On Wed, Mar 08, 2023 at 10:35:17PM +0100, Konrad Dybcio wrote: > > Disabling RPMCC clocks can be a bit touchy. If we can't guarantee all > > (or at least most) of the oneline peripherals ask the interconnect > > framework to keep their buses online and guarantee enough bandwidth, > > we're relying on bootloader defaults to keep the said buses alive through > > RPM requests and rate setting on RPM clocks. > > > > Without that in place, the RPM clocks are never enabled in the CCF, which > > qualifies them to be cleaned up, since - as far as Linux is concerned - > > nobody's using them and they're just wasting power. Doing so will end > > tragically, as within miliseconds we'll get *some* access attempt on an > > unlocked bus which will cause a platform crash. > > > > On the other hand, if we want to save power and put well-supported > > platforms to sleep, we should be shutting off at least some of these > > clocks (this time with a clear distinction of which ones are *actually* > > not in use, coming from the interconnect driver). > > > > To differentiate between these two cases while not breaking older DTs, > > introduce an opt-in property to correctly mark RPM clocks as enabled > > after handoff (the initial max freq vote) and hence qualify them for the > > common unused clock cleanup. > > > > Signed-off-by: Konrad Dybcio <konrad.dybcio@linaro.org> > > --- > > Documentation/devicetree/bindings/clock/qcom,rpmcc.yaml | 6 ++++++ > > 1 file changed, 6 insertions(+) > > > > diff --git a/Documentation/devicetree/bindings/clock/qcom,rpmcc.yaml b/Documentation/devicetree/bindings/clock/qcom,rpmcc.yaml > > index 2a95bf8664f9..386153f61971 100644 > > --- a/Documentation/devicetree/bindings/clock/qcom,rpmcc.yaml > > +++ b/Documentation/devicetree/bindings/clock/qcom,rpmcc.yaml > > @@ -58,6 +58,12 @@ properties: > > minItems: 1 > > maxItems: 2 > > > > + qcom,clk-disable-unused: > > + type: boolean > > + description: > > + Indicates whether unused RPM clocks can be shut down with the common > > + unused clock cleanup. Requires a functional interconnect driver. > > + > > I'm surprised that Stephen Boyd did not bring up his usual "rant" here > of moving the interconnect clock voting out of rpmcc into the > interconnect drivers (see [1], [2]). :-) :) I was hoping to get a fix for disabling unused clks during late init at the same time. Shucks! > > I was a bit "cautious" about it back then but at this point I think it > kind of makes sense. Make sure to read Stephen's detailed explanation in > https://lore.kernel.org/linux-arm-msm/159796605593.334488.8355244657387381953@swboyd.mtv.corp.google.com/ > > We keep looking for workarounds to prevent the CCF from "messing" with > interconnect-related clocks. But the CCF cannot mess with "clocks" it > does not manage. The RPM interconnect drivers already talk directly to > the RPM in drivers/interconnect/qcom/smd-rpm.c. I think it should be > quite easy to move the QCOM_SMD_RPM_BUS_CLK relates defines over there > and just bypass the CCF entirely. Please do it! > > For backwards compatibility (for platforms without interconnect drivers) > one could either assume that the bootloader bandwidth votes will be > sufficient and just leave those clocks completely alone. Or the > "icc_smd_rpm" platform device could initially make max votes similar to > the rpmcc device. By coincidence the "icc_smd_rpm" platform device is > always created, no matter how the device tree looks or if the platform > actually has an interconnect driver. > Yeah that's a good plan. Suspend will be broken or burn a lot of power, but presumably the new DTB will be used fairly quickly. Or you can implement something like clkdev for interconnects that lets you hack up an association between interconnects and consumers for existing DTs and then drop those lookups months later.
On 18.04.2023 02:19, Stephen Boyd wrote: > Quoting Stephan Gerhold (2023-04-17 12:05:06) >> On Wed, Mar 08, 2023 at 10:35:17PM +0100, Konrad Dybcio wrote: >>> Disabling RPMCC clocks can be a bit touchy. If we can't guarantee all >>> (or at least most) of the oneline peripherals ask the interconnect >>> framework to keep their buses online and guarantee enough bandwidth, >>> we're relying on bootloader defaults to keep the said buses alive through >>> RPM requests and rate setting on RPM clocks. >>> >>> Without that in place, the RPM clocks are never enabled in the CCF, which >>> qualifies them to be cleaned up, since - as far as Linux is concerned - >>> nobody's using them and they're just wasting power. Doing so will end >>> tragically, as within miliseconds we'll get *some* access attempt on an >>> unlocked bus which will cause a platform crash. >>> >>> On the other hand, if we want to save power and put well-supported >>> platforms to sleep, we should be shutting off at least some of these >>> clocks (this time with a clear distinction of which ones are *actually* >>> not in use, coming from the interconnect driver). >>> >>> To differentiate between these two cases while not breaking older DTs, >>> introduce an opt-in property to correctly mark RPM clocks as enabled >>> after handoff (the initial max freq vote) and hence qualify them for the >>> common unused clock cleanup. >>> >>> Signed-off-by: Konrad Dybcio <konrad.dybcio@linaro.org> >>> --- >>> Documentation/devicetree/bindings/clock/qcom,rpmcc.yaml | 6 ++++++ >>> 1 file changed, 6 insertions(+) >>> >>> diff --git a/Documentation/devicetree/bindings/clock/qcom,rpmcc.yaml b/Documentation/devicetree/bindings/clock/qcom,rpmcc.yaml >>> index 2a95bf8664f9..386153f61971 100644 >>> --- a/Documentation/devicetree/bindings/clock/qcom,rpmcc.yaml >>> +++ b/Documentation/devicetree/bindings/clock/qcom,rpmcc.yaml >>> @@ -58,6 +58,12 @@ properties: >>> minItems: 1 >>> maxItems: 2 >>> >>> + qcom,clk-disable-unused: >>> + type: boolean >>> + description: >>> + Indicates whether unused RPM clocks can be shut down with the common >>> + unused clock cleanup. Requires a functional interconnect driver. >>> + >> >> I'm surprised that Stephen Boyd did not bring up his usual "rant" here >> of moving the interconnect clock voting out of rpmcc into the >> interconnect drivers (see [1], [2]). :-) > > :) I was hoping to get a fix for disabling unused clks during late init > at the same time. Shucks! > >> >> I was a bit "cautious" about it back then but at this point I think it >> kind of makes sense. Make sure to read Stephen's detailed explanation in >> https://lore.kernel.org/linux-arm-msm/159796605593.334488.8355244657387381953@swboyd.mtv.corp.google.com/ >> >> We keep looking for workarounds to prevent the CCF from "messing" with >> interconnect-related clocks. But the CCF cannot mess with "clocks" it >> does not manage. The RPM interconnect drivers already talk directly to >> the RPM in drivers/interconnect/qcom/smd-rpm.c. I think it should be >> quite easy to move the QCOM_SMD_RPM_BUS_CLK relates defines over there >> and just bypass the CCF entirely. > > Please do it! Okay, that's a plan.. > >> >> For backwards compatibility (for platforms without interconnect drivers) >> one could either assume that the bootloader bandwidth votes will be >> sufficient and just leave those clocks completely alone. Or the >> "icc_smd_rpm" platform device could initially make max votes similar to >> the rpmcc device. By coincidence the "icc_smd_rpm" platform device is >> always created, no matter how the device tree looks or if the platform >> actually has an interconnect driver. >> > > Yeah that's a good plan. Suspend will be broken or burn a lot of power, (that's what happens as of today, so sgtm!) > but presumably the new DTB will be used fairly quickly. Or you can > implement something like clkdev for interconnects that lets you hack up > an association between interconnects and consumers for existing DTs and > then drop those lookups months later. Uh.. let's not.. Let's just contain it in the interconnect driver. The buses will be at bearable frequencies coming from the bootloader (as RPM, storage etc. are enabled) and boosting them at icc_rpm_smd probe sounds sane. Konrad
On 18.04.2023 12:33, Konrad Dybcio wrote: > > > On 18.04.2023 02:19, Stephen Boyd wrote: >> Quoting Stephan Gerhold (2023-04-17 12:05:06) >>> On Wed, Mar 08, 2023 at 10:35:17PM +0100, Konrad Dybcio wrote: >>>> Disabling RPMCC clocks can be a bit touchy. If we can't guarantee all >>>> (or at least most) of the oneline peripherals ask the interconnect >>>> framework to keep their buses online and guarantee enough bandwidth, >>>> we're relying on bootloader defaults to keep the said buses alive through >>>> RPM requests and rate setting on RPM clocks. >>>> >>>> Without that in place, the RPM clocks are never enabled in the CCF, which >>>> qualifies them to be cleaned up, since - as far as Linux is concerned - >>>> nobody's using them and they're just wasting power. Doing so will end >>>> tragically, as within miliseconds we'll get *some* access attempt on an >>>> unlocked bus which will cause a platform crash. >>>> >>>> On the other hand, if we want to save power and put well-supported >>>> platforms to sleep, we should be shutting off at least some of these >>>> clocks (this time with a clear distinction of which ones are *actually* >>>> not in use, coming from the interconnect driver). >>>> >>>> To differentiate between these two cases while not breaking older DTs, >>>> introduce an opt-in property to correctly mark RPM clocks as enabled >>>> after handoff (the initial max freq vote) and hence qualify them for the >>>> common unused clock cleanup. >>>> >>>> Signed-off-by: Konrad Dybcio <konrad.dybcio@linaro.org> >>>> --- >>>> Documentation/devicetree/bindings/clock/qcom,rpmcc.yaml | 6 ++++++ >>>> 1 file changed, 6 insertions(+) >>>> >>>> diff --git a/Documentation/devicetree/bindings/clock/qcom,rpmcc.yaml b/Documentation/devicetree/bindings/clock/qcom,rpmcc.yaml >>>> index 2a95bf8664f9..386153f61971 100644 >>>> --- a/Documentation/devicetree/bindings/clock/qcom,rpmcc.yaml >>>> +++ b/Documentation/devicetree/bindings/clock/qcom,rpmcc.yaml >>>> @@ -58,6 +58,12 @@ properties: >>>> minItems: 1 >>>> maxItems: 2 >>>> >>>> + qcom,clk-disable-unused: >>>> + type: boolean >>>> + description: >>>> + Indicates whether unused RPM clocks can be shut down with the common >>>> + unused clock cleanup. Requires a functional interconnect driver. >>>> + >>> >>> I'm surprised that Stephen Boyd did not bring up his usual "rant" here >>> of moving the interconnect clock voting out of rpmcc into the >>> interconnect drivers (see [1], [2]). :-) >> >> :) I was hoping to get a fix for disabling unused clks during late init >> at the same time. Shucks! >> >>> >>> I was a bit "cautious" about it back then but at this point I think it >>> kind of makes sense. Make sure to read Stephen's detailed explanation in >>> https://lore.kernel.org/linux-arm-msm/159796605593.334488.8355244657387381953@swboyd.mtv.corp.google.com/ >>> >>> We keep looking for workarounds to prevent the CCF from "messing" with >>> interconnect-related clocks. But the CCF cannot mess with "clocks" it >>> does not manage. The RPM interconnect drivers already talk directly to >>> the RPM in drivers/interconnect/qcom/smd-rpm.c. I think it should be >>> quite easy to move the QCOM_SMD_RPM_BUS_CLK relates defines over there >>> and just bypass the CCF entirely. >> >> Please do it! > Okay, that's a plan.. > >> >>> >>> For backwards compatibility (for platforms without interconnect drivers) >>> one could either assume that the bootloader bandwidth votes will be >>> sufficient and just leave those clocks completely alone. Or the >>> "icc_smd_rpm" platform device could initially make max votes similar to >>> the rpmcc device. By coincidence the "icc_smd_rpm" platform device is >>> always created, no matter how the device tree looks or if the platform >>> actually has an interconnect driver. >>> >> >> Yeah that's a good plan. Suspend will be broken or burn a lot of power, > (that's what happens as of today, so sgtm!) > >> but presumably the new DTB will be used fairly quickly. Or you can >> implement something like clkdev for interconnects that lets you hack up >> an association between interconnects and consumers for existing DTs and >> then drop those lookups months later. > Uh.. let's not.. Let's just contain it in the interconnect driver. > > The buses will be at bearable frequencies coming from the bootloader > (as RPM, storage etc. are enabled) and boosting them at icc_rpm_smd > probe sounds sane. What should we do about the non-bus RPM clocks though? I don't fancy IPA_CLK running 24/7.. And Stephan Gerhold was able to achieve VDD_MIN on msm8909 with these clocks shut down (albeit with a very basic dt setup)! Taking into account the old interconnect-enabled DTs, some of the clocks would need to be on so that the QoS writes can succeed (e.g. the MAS_IPA endpoint needs IPA_CLK), it gets complicated again.. I suppose something like this would work-ish: 0. remove clock handles as they're now contained within icc and use them as a "legacy marker" 1. add: if (qp->bus_clocks) // skip qos writes This will: - let us add is_enabled so that all RPM clocks bar XO_A will be cleaned up - save massively on code complexity at the cost of retroactively removing features (QoS settings) for people with old DTs and new kernels (don't tell Torvalds!) This DTB ABI stuff really gets in the way sometimes :/ We're only now fixing up U-Boot to be able to use upstream Linux DTs and other than that I think only OpenBSD uses it with 8280.. Wish we could get rid of all old junk once and then establish immutability but oh well.. Konrad > > Konrad
On Wed, Apr 19, 2023 at 01:31:01PM +0200, Konrad Dybcio wrote: > What should we do about the non-bus RPM clocks though? I don't fancy > IPA_CLK running 24/7.. And Stephan Gerhold was able to achieve VDD_MIN > on msm8909 with these clocks shut down (albeit with a very basic dt setup)! > > Taking into account the old interconnect-enabled DTs, some of the > clocks would need to be on so that the QoS writes can succeed > (e.g. the MAS_IPA endpoint needs IPA_CLK), it gets complicated again.. > I guess MSM8996 is the only platform affected by this? sdm630.dtsi seems to list the clock already in the a2noc and all others don't seem to have an interconnect driver yet. This will be subjective and someone will surely disagree but... IMO forcing all RPM clocks on during boot and keeping them enabled is not part of the DT ABI. If you don't describe the hardware correctly and are missing necessary clocks in the description (like the IPA_CLK on the interconnect node) then your DT is wrong and should be fixed. I would see this a bit like typical optimizing C compilers nowadays. If you write correct code it can optimize, e.g. drop unnecessary function calls. But if you write incorrect code with undefined behavior it's not the fault of the compiler if you run into trouble. The code must be fixed. The DT bindings don't specify that unused resources (clocks, ...) stay "magically" active. They specify that that the resources you reference are available. As such, I would say the OS is free to optimize here and turn off unused resources. The more important point IMO is not breaking all platforms without interconnect drivers. This goes beyond just adding a missing clock to the DT, you need to write the driver first. But having the max vote in icc_smd_rpm (somehow) should hopefully take care of that. > I suppose something like this would work-ish: > > 0. remove clock handles as they're now contained within icc and > use them as a "legacy marker" > 1. add: > if (qp->bus_clocks) > // skip qos writes Maybe you can just check if all necessary clocks for QOS are there or not? I don't think it's a problem to skip it on broken DTs. I think it would be even fine to refuse loading the interconnect driver completely and just have the standard max vote (as long as that results in a booting system). > > This will: > - let us add is_enabled so that all RPM clocks bar XO_A will be cleaned up > - save massively on code complexity > +1 > at the cost of retroactively removing features (QoS settings) for people > with old DTs and new kernels (don't tell Torvalds!) > I doubt anyone will notice :p > This DTB ABI stuff really gets in the way sometimes :/ We're only now > fixing up U-Boot to be able to use upstream Linux DTs and other than > that I think only OpenBSD uses it with 8280.. Wish we could get rid of > all old junk once and then establish immutability but oh well.. Nice, thanks a lot for working on addressing the Qualcomm DT mess in U-Boot. I've been meaning to work this myself for a long time but never found the time to start... :') Thanks, Stephan
On 19.04.2023 16:00, Stephan Gerhold wrote: > On Wed, Apr 19, 2023 at 01:31:01PM +0200, Konrad Dybcio wrote: >> What should we do about the non-bus RPM clocks though? I don't fancy >> IPA_CLK running 24/7.. And Stephan Gerhold was able to achieve VDD_MIN >> on msm8909 with these clocks shut down (albeit with a very basic dt setup)! >> >> Taking into account the old interconnect-enabled DTs, some of the >> clocks would need to be on so that the QoS writes can succeed >> (e.g. the MAS_IPA endpoint needs IPA_CLK), it gets complicated again.. >> > > I guess MSM8996 is the only platform affected by this? sdm630.dtsi seems > to list the clock already in the a2noc and all others don't seem to have > an interconnect driver yet. > > This will be subjective and someone will surely disagree but... > > IMO forcing all RPM clocks on during boot and keeping them enabled is > not part of the DT ABI. If you don't describe the hardware correctly and > are missing necessary clocks in the description (like the IPA_CLK on the > interconnect node) then your DT is wrong and should be fixed. > > I would see this a bit like typical optimizing C compilers nowadays. If > you write correct code it can optimize, e.g. drop unnecessary function > calls. But if you write incorrect code with undefined behavior it's not > the fault of the compiler if you run into trouble. The code must be > fixed. > > The DT bindings don't specify that unused resources (clocks, ...) stay > "magically" active. They specify that that the resources you reference > are available. As such, I would say the OS is free to optimize here and > turn off unused resources. > > The more important point IMO is not breaking all platforms without > interconnect drivers. This goes beyond just adding a missing clock to > the DT, you need to write the driver first. But having the max vote in > icc_smd_rpm (somehow) should hopefully take care of that. Hm, interesting argument. Krzysztof, Bjorn, what's your stance on this? We *need* to add unused cleanup to rpmcc for feature completion and there's no good way of discerning whether it's safe to do so.. Doing so will make clk_ignore_unused necessary to boot with legacy DTs. Stephan argues the DTs were incomplete from the start and the breakage is only a result of us previously abusing what's essentially undefined behavior.. I think I second this, but it is *a* breakage so I want to know your opinion. FWIW the same happens when we have simple-framebuffer enabled and then introduce dispcc on a given platform without adding the clocks under the simplefb node and we've not been frowning upon that too much, so I'd be willing to give it a pass if you're okay with it.. Not caring about this would make things far, far easier really.. Konrad > >> I suppose something like this would work-ish: >> >> 0. remove clock handles as they're now contained within icc and >> use them as a "legacy marker" >> 1. add: >> if (qp->bus_clocks) >> // skip qos writes > > Maybe you can just check if all necessary clocks for QOS are there or > not? I don't think it's a problem to skip it on broken DTs. I think it > would be even fine to refuse loading the interconnect driver completely > and just have the standard max vote (as long as that results in a > booting system). > >> >> This will: >> - let us add is_enabled so that all RPM clocks bar XO_A will be cleaned up >> - save massively on code complexity >> > > +1 > >> at the cost of retroactively removing features (QoS settings) for people >> with old DTs and new kernels (don't tell Torvalds!) >> > > I doubt anyone will notice :p > >> This DTB ABI stuff really gets in the way sometimes :/ We're only now >> fixing up U-Boot to be able to use upstream Linux DTs and other than >> that I think only OpenBSD uses it with 8280.. Wish we could get rid of >> all old junk once and then establish immutability but oh well.. > > Nice, thanks a lot for working on addressing the Qualcomm DT mess in > U-Boot. I've been meaning to work this myself for a long time but never > found the time to start... :') > > Thanks, > Stephan
On Wed, Mar 08, 2023 at 10:35:17PM +0100, Konrad Dybcio wrote: > Disabling RPMCC clocks can be a bit touchy. If we can't guarantee all > (or at least most) of the oneline peripherals ask the interconnect > framework to keep their buses online and guarantee enough bandwidth, > we're relying on bootloader defaults to keep the said buses alive through > RPM requests and rate setting on RPM clocks. > > Without that in place, the RPM clocks are never enabled in the CCF, which > qualifies them to be cleaned up, since - as far as Linux is concerned - > nobody's using them and they're just wasting power. Doing so will end > tragically, as within miliseconds we'll get *some* access attempt on an > unlocked bus which will cause a platform crash. > > On the other hand, if we want to save power and put well-supported > platforms to sleep, we should be shutting off at least some of these > clocks (this time with a clear distinction of which ones are *actually* > not in use, coming from the interconnect driver). > > To differentiate between these two cases while not breaking older DTs, > introduce an opt-in property to correctly mark RPM clocks as enabled > after handoff (the initial max freq vote) and hence qualify them for the > common unused clock cleanup. > My 2 cents here... First, this property doesn't belong in DT at all as it is OS specific handling. This leaves us with the option of using a cmdline or module params for rmpcc. But we already have one (clk_ignore_unused), so the platforms making use of old DTB's should use that instead. And that get's rid of the debate that when you start disabling rpmcc clocks, old platforms will break. I don't see a valid point to keep the old platforms alive since their DTB (firmware) is broken already. So either they have to fix the DTB or use a cmdline option. - Mani > Signed-off-by: Konrad Dybcio <konrad.dybcio@linaro.org> > --- > Documentation/devicetree/bindings/clock/qcom,rpmcc.yaml | 6 ++++++ > 1 file changed, 6 insertions(+) > > diff --git a/Documentation/devicetree/bindings/clock/qcom,rpmcc.yaml b/Documentation/devicetree/bindings/clock/qcom,rpmcc.yaml > index 2a95bf8664f9..386153f61971 100644 > --- a/Documentation/devicetree/bindings/clock/qcom,rpmcc.yaml > +++ b/Documentation/devicetree/bindings/clock/qcom,rpmcc.yaml > @@ -58,6 +58,12 @@ properties: > minItems: 1 > maxItems: 2 > > + qcom,clk-disable-unused: > + type: boolean > + description: > + Indicates whether unused RPM clocks can be shut down with the common > + unused clock cleanup. Requires a functional interconnect driver. > + > required: > - compatible > - '#clock-cells' > > -- > 2.39.2 >
diff --git a/Documentation/devicetree/bindings/clock/qcom,rpmcc.yaml b/Documentation/devicetree/bindings/clock/qcom,rpmcc.yaml index 2a95bf8664f9..386153f61971 100644 --- a/Documentation/devicetree/bindings/clock/qcom,rpmcc.yaml +++ b/Documentation/devicetree/bindings/clock/qcom,rpmcc.yaml @@ -58,6 +58,12 @@ properties: minItems: 1 maxItems: 2 + qcom,clk-disable-unused: + type: boolean + description: + Indicates whether unused RPM clocks can be shut down with the common + unused clock cleanup. Requires a functional interconnect driver. + required: - compatible - '#clock-cells'