Message ID | 20221019135925.366162-1-manivannan.sadhasivam@linaro.org |
---|---|
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp354243wrs; Wed, 19 Oct 2022 07:20:13 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4Il35V8zMUkEk0mpjdPr5Yft5lBNwqauQlM8/KBYdGB99HOPc+MehfnItDqDil4llbT6fS X-Received: by 2002:a17:90a:bb94:b0:209:618f:46ac with SMTP id v20-20020a17090abb9400b00209618f46acmr46686634pjr.240.1666189212892; Wed, 19 Oct 2022 07:20:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666189212; cv=none; d=google.com; s=arc-20160816; b=bhhG/GwuX849gKIW6G/4Ta5KMHVEuGIMfJL6I9iSfgnKwcoge++Pko+1nx+UaJsV02 YVwZK399ad505hSkVTJ93anlbjNfT4A7Lc52C1A3Rl29/Q4L8O11QOF4z7ct/K9OrhiC XElhIpvL9yw0JQgbaqTnY9HbeFjK1+BKl/SaVQ5idE9+ubnqXzjE+SEjo2/x4j6uMtcr 9tjJ/Y/qDF8ettGWQ72U/09GT8rW7E+/8SEe7aeS/4EbKDeXw4qJpcsDgNrQoU4oq1Jo 5Yo5Y2jYXkAmhhjX9MkX1r7lt9TM4Ro5kxazgkh8a68SzhSbZT9m5aplwAL/gHo6jMR0 UjEw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=OzAmFJUitT522Y1pMwEljBD9yHh+MrS0Tv4SZYF/11U=; b=T42x+v4sPv76ODNmhERG2RYKXdm0QoRqWqJsgtRN4fZdlK31nZmguHlRvL7pRaxCth 6cyOZiieMPyQ2Jt2mWlFfoGoB4mF6DEmru0WLdjfF9vPulmPRBkf3CElTXSJAB4sA5iT 64xg2eAU+XCoBC0JwdVVHsbVUHqtq8aT0B77bITLvauHWKhxpa6yitr2J5WSl+1ShWJo +EhvW8tNLeEEo7ETIjp67efe5Iv0J36DssiF9qIjQgn1LepK31j5sjSo2kH2Hj6Ya69A SZ7HV4IcYneA+LfeN4DdLFzdGVRkqsidANcXqe8U74h9T+NA/69nCmO/sFP7dy0WBuz8 rBmw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=a8Xhd+Ar; 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 bk13-20020a056a02028d00b0046b2752dcbcsi18170470pgb.590.2022.10.19.07.19.55; Wed, 19 Oct 2022 07:20:12 -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=@linaro.org header.s=google header.b=a8Xhd+Ar; 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 S231526AbiJSOSR (ORCPT <rfc822;samuel.l.nystrom@gmail.com> + 99 others); Wed, 19 Oct 2022 10:18:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41262 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229535AbiJSOR6 (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Wed, 19 Oct 2022 10:17:58 -0400 Received: from mail-pg1-x541.google.com (mail-pg1-x541.google.com [IPv6:2607:f8b0:4864:20::541]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 06BE9F5CF6 for <linux-kernel@vger.kernel.org>; Wed, 19 Oct 2022 07:00:57 -0700 (PDT) Received: by mail-pg1-x541.google.com with SMTP id 129so16327902pgc.5 for <linux-kernel@vger.kernel.org>; Wed, 19 Oct 2022 07:00:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=OzAmFJUitT522Y1pMwEljBD9yHh+MrS0Tv4SZYF/11U=; b=a8Xhd+ArGyjvYWY5frIWpbb/ecNGCYPd7mpbXRTTZA6scDoaNxbKEd8qrby48Z8uJu Er5AvA2IBoGO9b2gZI+6rL5Tt4AeIJDtp9Xdupu+8O1HcjLlXirCgIuPuUuqCJ5P5QGQ L6S8UTL0sQ6i3OdxzomruA0s8QUU5YGDJJUbGPy0K2zgc3pWQqf9WP2ZfBWzDmSC+4jW gjH8TWVchZS1zNi+js3ax0z+FdOOhRREqA37n/oqA6nyEU/V/bMl6NPXnljJt7oUIjMy q25JDpfjhPfgZfafX5i1QUFAaYoMSCHU19vzxc5zWQ7n//J9grmDSRe6VlDxHpEns4fj +LLw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=OzAmFJUitT522Y1pMwEljBD9yHh+MrS0Tv4SZYF/11U=; b=fG1brjpUflknXS7dMguZ9RB7mHZHLkaFS6G26Ab7r2FVWjWNfWkuDO0KGhfcHBVicU G/sw6LDeFnk1CPfmaaCVZ8QhtLs8Gx78yDqSsZRqgF+v/SO2PHSDfbUfvkdUD2viHIsA 7iWZOo/M0mKueqsTPwFqo6Ud3hxBVnw2iO7LTwn4PjWr0B1P4A0l6AWqwti+Gpgx+S3T Wc29pBchp7aNNCZRTwGcpgHcgyZ1BYFO2xdOAumF3QGzPdWCbj9VW612+kEEao6fmJir uzb5Bj3bho+OH1aNULgRSTEG3n9wqifK4ipxr587nl7LG2Xqz3rcyger0fx3bmBBOZvE 6UNA== X-Gm-Message-State: ACrzQf0Xku/kkknTIVDXjvLlgiz7BxLVmbdIiVrSJe2nTKjy8zdQ2gRb npM+AsQGv1t2XFbWyXWKSZB8 X-Received: by 2002:aa7:810d:0:b0:563:1fa6:fecc with SMTP id b13-20020aa7810d000000b005631fa6feccmr8916163pfi.24.1666187977124; Wed, 19 Oct 2022 06:59:37 -0700 (PDT) Received: from localhost.localdomain ([117.193.210.93]) by smtp.gmail.com with ESMTPSA id 194-20020a6216cb000000b0053e199aa99bsm11240322pfw.220.2022.10.19.06.59.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 19 Oct 2022 06:59:35 -0700 (PDT) From: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org> To: andersson@kernel.org, viresh.kumar@linaro.org, krzysztof.kozlowski+dt@linaro.org, rafael@kernel.org, robh+dt@kernel.org Cc: johan@kernel.org, devicetree@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org> Subject: [PATCH 0/4] qcom-cpufreq-hw: Add CPU clock provider support Date: Wed, 19 Oct 2022 19:29:21 +0530 Message-Id: <20221019135925.366162-1-manivannan.sadhasivam@linaro.org> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=unavailable 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?1747126020022093218?= X-GMAIL-MSGID: =?utf-8?q?1747126020022093218?= |
Series |
qcom-cpufreq-hw: Add CPU clock provider support
|
|
Message
Manivannan Sadhasivam
Oct. 19, 2022, 1:59 p.m. UTC
Hello, This series adds clock provider support to the Qcom CPUFreq driver for supplying the clocks to the CPU cores in Qcom SoCs. The Qualcomm platforms making use of CPUFreq HW Engine (EPSS/OSM) supply clocks to the CPU cores. But this is not represented clearly in devicetree. There is no clock coming out of the CPUFreq HW node to the CPU. This created an issue [1] with the OPP core when a recent enhancement series was submitted. Eventhough the issue got fixed in the OPP framework in the meantime, that's not a proper solution and this series aims to fix it properly. There was also an attempt made by Viresh [2] to fix the issue by moving the clocks supplied to the CPUFreq HW node to the CPU. But that was not accepted since those clocks belong to the CPUFreq HW node only. The proposal here is to add clock provider support to the Qcom CPUFreq HW driver to supply clocks to the CPUs that comes out of the EPSS/OSM block. This correctly reflects the hardware implementation. The clock provider is a simple one that just provides the frequency of the clocks supplied to each frequency domain in the SoC using .recalc_rate() callback. The frequency supplied by the driver will be the actual frequency that comes out of the EPSS/OSM block after the DCVS operation. This frequency is not same as what the CPUFreq framework has set but it is the one that gets supplied to the CPUs after throttling by LMh. This series has been tested on SM8450 based dev board and hence there is a DTS change only for that platform. Once this series gets accepted, rest of the platform DTS can also be modified and finally the hack on the OPP core can be dropped. Thanks, Mani [1] https://lore.kernel.org/lkml/YsxSkswzsqgMOc0l@hovoldconsulting.com/ [2] https://lore.kernel.org/lkml/20220801054255.GA12039@thinkpad/t/ Manivannan Sadhasivam (4): cpufreq: qcom-hw: Remove un-necessary cpumask_empty() check dt-bindings: cpufreq: cpufreq-qcom-hw: Add cpufreq clock provider cpufreq: qcom-hw: Add CPU clock provider support arm64: dts: qcom: sm8450: Supply clock from cpufreq node to CPUs .../bindings/cpufreq/cpufreq-qcom-hw.yaml | 12 ++++ arch/arm64/boot/dts/qcom/sm8450.dtsi | 9 +++ drivers/cpufreq/qcom-cpufreq-hw.c | 72 ++++++++++++++++--- 3 files changed, 84 insertions(+), 9 deletions(-)
Comments
+ Johan, On 19-10-22, 19:29, Manivannan Sadhasivam wrote: > Hello, > > This series adds clock provider support to the Qcom CPUFreq driver for > supplying the clocks to the CPU cores in Qcom SoCs. > > The Qualcomm platforms making use of CPUFreq HW Engine (EPSS/OSM) supply > clocks to the CPU cores. But this is not represented clearly in devicetree. > There is no clock coming out of the CPUFreq HW node to the CPU. This created > an issue [1] with the OPP core when a recent enhancement series was submitted. > Eventhough the issue got fixed in the OPP framework in the meantime, that's > not a proper solution and this series aims to fix it properly. > > There was also an attempt made by Viresh [2] to fix the issue by moving the > clocks supplied to the CPUFreq HW node to the CPU. But that was not accepted > since those clocks belong to the CPUFreq HW node only. > > The proposal here is to add clock provider support to the Qcom CPUFreq HW > driver to supply clocks to the CPUs that comes out of the EPSS/OSM block. > This correctly reflects the hardware implementation. > > The clock provider is a simple one that just provides the frequency of the > clocks supplied to each frequency domain in the SoC using .recalc_rate() > callback. The frequency supplied by the driver will be the actual frequency > that comes out of the EPSS/OSM block after the DCVS operation. This frequency > is not same as what the CPUFreq framework has set but it is the one that gets > supplied to the CPUs after throttling by LMh. > > This series has been tested on SM8450 based dev board and hence there is a DTS > change only for that platform. Once this series gets accepted, rest of the > platform DTS can also be modified and finally the hack on the OPP core can be > dropped. Thanks for working on this Mani. Can you also test the below code over your series ? This shouldn't result in issues that Johan reported earlier [1][2]. Below is the hack I am carrying in the OPP core for Qcom SoCs at the moment. diff --git a/drivers/opp/core.c b/drivers/opp/core.c index e87567dbe99f..b7158d33c13d 100644 --- a/drivers/opp/core.c +++ b/drivers/opp/core.c @@ -1384,20 +1384,6 @@ static struct opp_table *_update_opp_table_clk(struct device *dev, } if (ret == -ENOENT) { - /* - * There are few platforms which don't want the OPP core to - * manage device's clock settings. In such cases neither the - * platform provides the clks explicitly to us, nor the DT - * contains a valid clk entry. The OPP nodes in DT may still - * contain "opp-hz" property though, which we need to parse and - * allow the platform to find an OPP based on freq later on. - * - * This is a simple solution to take care of such corner cases, - * i.e. make the clk_count 1, which lets us allocate space for - * frequency in opp->rates and also parse the entries in DT. - */ - opp_table->clk_count = 1; - dev_dbg(dev, "%s: Couldn't find clock: %d\n", __func__, ret); return opp_table; } diff --git a/drivers/opp/debugfs.c b/drivers/opp/debugfs.c index 96a30a032c5f..402c507edac7 100644 --- a/drivers/opp/debugfs.c +++ b/drivers/opp/debugfs.c @@ -138,7 +138,7 @@ void opp_debug_create_one(struct dev_pm_opp *opp, struct opp_table *opp_table) * - For some devices rate isn't available or there are multiple, use * index instead for them. */ - if (likely(opp_table->clk_count == 1 && opp->rates[0])) + if (likely(opp_table->clk_count == 1)) id = opp->rates[0]; else id = _get_opp_count(opp_table);
On Thu, Oct 20, 2022 at 10:52:30AM +0530, Viresh Kumar wrote: > + Johan, > > On 19-10-22, 19:29, Manivannan Sadhasivam wrote: > > Hello, > > > > This series adds clock provider support to the Qcom CPUFreq driver for > > supplying the clocks to the CPU cores in Qcom SoCs. > > > > The Qualcomm platforms making use of CPUFreq HW Engine (EPSS/OSM) supply > > clocks to the CPU cores. But this is not represented clearly in devicetree. > > There is no clock coming out of the CPUFreq HW node to the CPU. This created > > an issue [1] with the OPP core when a recent enhancement series was submitted. > > Eventhough the issue got fixed in the OPP framework in the meantime, that's > > not a proper solution and this series aims to fix it properly. > > > > There was also an attempt made by Viresh [2] to fix the issue by moving the > > clocks supplied to the CPUFreq HW node to the CPU. But that was not accepted > > since those clocks belong to the CPUFreq HW node only. > > > > The proposal here is to add clock provider support to the Qcom CPUFreq HW > > driver to supply clocks to the CPUs that comes out of the EPSS/OSM block. > > This correctly reflects the hardware implementation. > > > > The clock provider is a simple one that just provides the frequency of the > > clocks supplied to each frequency domain in the SoC using .recalc_rate() > > callback. The frequency supplied by the driver will be the actual frequency > > that comes out of the EPSS/OSM block after the DCVS operation. This frequency > > is not same as what the CPUFreq framework has set but it is the one that gets > > supplied to the CPUs after throttling by LMh. > > > > This series has been tested on SM8450 based dev board and hence there is a DTS > > change only for that platform. Once this series gets accepted, rest of the > > platform DTS can also be modified and finally the hack on the OPP core can be > > dropped. > > Thanks for working on this Mani. > > Can you also test the below code over your series ? This shouldn't > result in issues that Johan reported earlier [1][2]. Below is the hack I > am carrying in the OPP core for Qcom SoCs at the moment. > > diff --git a/drivers/opp/core.c b/drivers/opp/core.c > index e87567dbe99f..b7158d33c13d 100644 > --- a/drivers/opp/core.c > +++ b/drivers/opp/core.c > @@ -1384,20 +1384,6 @@ static struct opp_table *_update_opp_table_clk(struct device *dev, > } > > if (ret == -ENOENT) { > - /* > - * There are few platforms which don't want the OPP core to > - * manage device's clock settings. In such cases neither the > - * platform provides the clks explicitly to us, nor the DT > - * contains a valid clk entry. The OPP nodes in DT may still > - * contain "opp-hz" property though, which we need to parse and > - * allow the platform to find an OPP based on freq later on. > - * > - * This is a simple solution to take care of such corner cases, > - * i.e. make the clk_count 1, which lets us allocate space for > - * frequency in opp->rates and also parse the entries in DT. > - */ > - opp_table->clk_count = 1; > - > dev_dbg(dev, "%s: Couldn't find clock: %d\n", __func__, ret); > return opp_table; > } > diff --git a/drivers/opp/debugfs.c b/drivers/opp/debugfs.c > index 96a30a032c5f..402c507edac7 100644 > --- a/drivers/opp/debugfs.c > +++ b/drivers/opp/debugfs.c > @@ -138,7 +138,7 @@ void opp_debug_create_one(struct dev_pm_opp *opp, struct opp_table *opp_table) > * - For some devices rate isn't available or there are multiple, use > * index instead for them. > */ > - if (likely(opp_table->clk_count == 1 && opp->rates[0])) > + if (likely(opp_table->clk_count == 1)) > id = opp->rates[0]; > else > id = _get_opp_count(opp_table); > With the above diffs applied, I no longer see the issues reported by Johan on SM8450 dev board. Thanks, Mani > -- > viresh > > [1] https://lore.kernel.org/all/YsxSkswzsqgMOc0l@hovoldconsulting.com/ > [2] https://lore.kernel.org/all/Ys2FZa6YDwt7d%2FZc@hovoldconsulting.com/