Received: by 2002:a05:6358:53a8:b0:117:f937:c515 with SMTP id z40csp4692998rwe; Mon, 17 Apr 2023 17:25:58 -0700 (PDT) X-Google-Smtp-Source: AKy350aPsJsdKn7oCbXNg7IAveurazd16fYFzewJ+OfyUH6SxZUNCc0s75hX9Z2FTmDyEaq0nhP5 X-Received: by 2002:a05:6a20:1454:b0:ec:414f:8f9f with SMTP id a20-20020a056a20145400b000ec414f8f9fmr21683709pzi.25.1681777558673; Mon, 17 Apr 2023 17:25:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681777558; cv=none; d=google.com; s=arc-20160816; b=ixhKD+MYAz6H3o2FCqrJxgf7SyHRDnk/l41ERQrNYLSP2SCiXO9wBBsIfHnvyOOo4b ueBkxjKd2xKqcsCx7TA+orFmVjD6Nzq6+3rj85IRcv45x9HVYoZr5k7rIxW5bOTgODNo PeTtoD5JubbbPTyuM/3bjoXx+yChsmLlosFlaIQuCzhY2+6U8tKk70Bj8ynl6XYsZZG0 aRG5Q2P93sRmRSbPp7s9GSnYFCC2sfw1SofW8OS08AeJKTqJ4o1I28kJIpBgnW3JR2y1 ygWLJjapo6zmyB0OJ7X5E+HB7p1LpiuY2JENLaQ57WWgHfC5NkdrLt6uh5ctedV9VsV/ K/rw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:date:to:cc:from:subject:references :in-reply-to:content-transfer-encoding:mime-version:message-id :dkim-signature; bh=JyaTFkdW4YISDV/DcZLWbeaVzMjKryWfSTo0LjkrgIg=; b=yGCp9H6F1WuLtla+lvBw9FyN7EP6QoYBiPmAo9bBlhAY7Aph28aK5oMmuO94vMfxho mfOqyr24PI/z2TIVGK3Szo4fP4eIbXzCIn1BvC9rikyZvhmWUM8usxaSrpoPFoezqQoZ gFfWo7GS1oyxGvK/ebpLIGfdS3Lrx6IPAL5BlycOp2ucjzB+j+wUII0O9Qg9vrp5G8bk rL0/WccSwf1xbYc5nCjtUXROOtYbQCdjgfDn1dzCLG5J3GiUgDr8wABpVJ8VSUHfOPJf 7isPA+J177+hYHAMDb8Nx/ZxnxbJTZXFtCmNnvkx/eBFaHuHHDp3i2mVJU8I+1uEnsKU 6FWg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="L/tBgBfY"; 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=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y4-20020a634944000000b0051916fa6d91si12220101pgk.328.2023.04.17.17.25.45; Mon, 17 Apr 2023 17:25:58 -0700 (PDT) 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=@kernel.org header.s=k20201202 header.b="L/tBgBfY"; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229762AbjDRATu (ORCPT + 99 others); Mon, 17 Apr 2023 20:19:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47222 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229479AbjDRATs (ORCPT ); Mon, 17 Apr 2023 20:19:48 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9506540EF; Mon, 17 Apr 2023 17:19:47 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 27CAE628AE; Tue, 18 Apr 2023 00:19:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 76E78C4339B; Tue, 18 Apr 2023 00:19:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1681777186; bh=g3qUdn2hQ1WPJG2BIFK2kXAqmBIPi6cDwAOdAsYPGEs=; h=In-Reply-To:References:Subject:From:Cc:To:Date:From; b=L/tBgBfYevEU4sS8/mfX++M/A48vtv4mC8MZbJTMQsuwYTkkiRyta/l7iGLBGIMAD WXvmv3rKcIBjklrqVSSm22BE7Lhla9GGLo2F1M3OzgWiBmVcGzmsW0XUNAmsrA9tjO FJpaoPyScjeZ1req7eXVuF4mQDM1U+Pgf/uOwtYU2xH94Ur2UTNIugZS3EQOrdC99m YUmnulPpCTE29qUEyWVLpOgjzjiJGc8s8YLwm47piGAiQpO8Ul/YTN84nb890sTIrl /tCNTBkOUhjNSbOpB1jYuXdanLkVJdjv3iFzPaRvh1A4c2oN34Sw8cJZUJdByBLFM6 8kCZOAut0DpEw== Message-ID: Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable In-Reply-To: References: <20230303-topic-rpmcc_sleep-v2-0-ae80a325fe94@linaro.org> <20230303-topic-rpmcc_sleep-v2-1-ae80a325fe94@linaro.org> Subject: Re: [PATCH RFT v2 01/14] dt-bindings: clock: qcom,rpmcc: Add a way to enable unused clock cleanup From: Stephen Boyd Cc: Andy Gross , Bjorn Andersson , Michael Turquette , Rob Herring , Krzysztof Kozlowski , linux-arm-msm@vger.kernel.org, linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org, Krzysztof Kozlowski , devicetree@vger.kernel.org To: Konrad Dybcio , Stephan Gerhold Date: Mon, 17 Apr 2023 17:19:44 -0700 User-Agent: alot/0.10 X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham 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: X-Mailing-List: linux-kernel@vger.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 throu= gh > > RPM requests and rate setting on RPM clocks. > >=20 > > Without that in place, the RPM clocks are never enabled in the CCF, whi= ch > > 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. > >=20 > > 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). > >=20 > > 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. > >=20 > > Signed-off-by: Konrad Dybcio > > --- > > Documentation/devicetree/bindings/clock/qcom,rpmcc.yaml | 6 ++++++ > > 1 file changed, 6 insertions(+) > >=20 > > 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 > > =20 > > + qcom,clk-disable-unused: > > + type: boolean > > + description: > > + Indicates whether unused RPM clocks can be shut down with the co= mmon > > + unused clock cleanup. Requires a functional interconnect driver. > > + >=20 > 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! >=20 > 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.835524465738738= 1953@swboyd.mtv.corp.google.com/ >=20 > 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! >=20 > 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. >=20 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.