Message ID | 20230330193303.612475-1-bhupesh.sharma@linaro.org |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp94515vqo; Thu, 30 Mar 2023 12:48:07 -0700 (PDT) X-Google-Smtp-Source: AKy350aWi1FJHOISYWOL8sdbWsTyggBaW53VI/KGRKB+VgXrDSSx21agZufjF+j/9eME9zsjlL4s X-Received: by 2002:a05:6402:181:b0:501:d6c2:7439 with SMTP id r1-20020a056402018100b00501d6c27439mr21410906edv.37.1680205686981; Thu, 30 Mar 2023 12:48:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680205686; cv=none; d=google.com; s=arc-20160816; b=GJTaM8mSwsPhcT5SKEF7ZiBQXdS6vGy059Kn3xSGKLen6OHUestVZXURNS3/T7l01Q bVHwCGzYBDZlLjtvwLLU6i6lhkXJrJ503FTIoN70xQL/FtWB7tdqvEgHl4PKbJCgfEOE MO/ZMQeTb2qJX7OLJ2J/A/xthhNra8E7gwa1Z2EFyccVZGiZvM1+oUdVjl2dwxQUnGce nrd81labt78ISL/0nAmkRsAWl8jPAvaNjSuSxcbMRix1TlhDrx5BL/k3OUFF2Cidq4Gg 9fll6jarrK99gQ72b7tDIlMa84AOe4+GMON8/BUiAlhH1+WhO+U8Ksed+PfbwMckrbBJ f8ug== 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=i6JuvYmYJCj0w3cmFeh/1DSQl/9BrhvO1sQcJl2DJ6s=; b=LfQRwf3t93hRiH37sVaLOiJgxJw8gUBAwe++XkOflKigkavqUeMmTROIMjSgPE7aK1 dYhE1EuEvkUdMLDHys7cL8LmPLsXxn60fAtxmnN/bC/f7eUqTYOtuSrDmo5fMoi968QA zpCDLUc0OIl3B9+fhvHLEJqIhUD+z1TQBKA1dtIKQ1uLM9kDAuWoC/bvSBhYXSrS3Fva VsIZi4hFcZCkiHKaj0JZshIFzyem5FyODd0y4HLBWeSjPx4AZct3LJX6mvgKsXx18QLV HzzNkGlQoVukwy7Gb0U97rXAjpHU5mI8gCWCGfP8TkvJjSiXsHPKbhUuB422XAybtDSJ /c4w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=rD6xqSmu; 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 v3-20020aa7d803000000b004fd26744fe9si413393edq.140.2023.03.30.12.47.43; Thu, 30 Mar 2023 12:48:06 -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=rD6xqSmu; 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 S232215AbjC3TdQ (ORCPT <rfc822;rua109.linux@gmail.com> + 99 others); Thu, 30 Mar 2023 15:33:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38356 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232216AbjC3TdP (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Thu, 30 Mar 2023 15:33:15 -0400 Received: from mail-pl1-x62b.google.com (mail-pl1-x62b.google.com [IPv6:2607:f8b0:4864:20::62b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 08081D31A for <linux-kernel@vger.kernel.org>; Thu, 30 Mar 2023 12:33:13 -0700 (PDT) Received: by mail-pl1-x62b.google.com with SMTP id o11so19133792ple.1 for <linux-kernel@vger.kernel.org>; Thu, 30 Mar 2023 12:33:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1680204792; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=i6JuvYmYJCj0w3cmFeh/1DSQl/9BrhvO1sQcJl2DJ6s=; b=rD6xqSmuN7f9T3bBAcfIeecEZ8zbF3WWnbD5MUeXkuHYRZ1Ot/MHFdY0+NMMDnxXVF nI7XP3eNwfIgLdGyisNIC84I/8r2vuxUwN13fcAxUTvBKIjCvU+Ozt34RI4ksIYxp/QW kcg4EGKgP+Md5xXYasUjAC9BYHjRJPfcGgeqYy5ipvUIG+KquXJg3TND+cm0Ci2WHqrU u/XKg+4vUDWVgfstcU2oGNjdFEPhBi0FZ5csQiMmZJSzIUY7cS51NisBo7zOOdDZXu6I xG+PgPJeIly6xYLRgab8GK2FaX1LFTrdjcKOJua9hI2B+mvxQbBIbq9WqBSuU7kQYAXY r+Ng== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680204792; 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=i6JuvYmYJCj0w3cmFeh/1DSQl/9BrhvO1sQcJl2DJ6s=; b=co1fM6FFlPC/xSp/yfYmwMD3ef83SQPaDToyW6kjP9EPn2PSmWaIvdBKMgF5LC4SMr d4KUAZiBStLduqIKQcQEgqhtvvxwIL5DNo87oClApLyAZpF0105ToCFx32W7pPb10uZg ZLPLEYQxiGlvH1TzubnsrPIgGv2t9uS1vEiyh4k+D8Woqs/qqtC0PIwzsB0xRfIlO6K3 VasvoW7SABCc8Fd6PRtfSaPyU/B1pBXYP4ggQivC3Dve0Ti6T3uAdO+JhTsA3boFBTTm wKHxayv8V+BZ2aCJXPTlXa/cRRW/u0AyZUPCJEM9JnFXZXtvtzMN7uisDXIztoH693r9 ++Pg== X-Gm-Message-State: AAQBX9fTfuXmwZnJ/Kc0hcJ1hc79MEZWtZFfJ2iJ32zIhKVdAWIJ9kfn YOyrOJrpuOUwZ/6s+pDqH5tsRA== X-Received: by 2002:a17:90b:1c8b:b0:234:d78:9b4c with SMTP id oo11-20020a17090b1c8b00b002340d789b4cmr26470010pjb.18.1680204792371; Thu, 30 Mar 2023 12:33:12 -0700 (PDT) Received: from localhost.localdomain ([2401:4900:1c5e:53ce:1f39:30a5:d20f:f205]) by smtp.gmail.com with ESMTPSA id g3-20020a170902934300b0019e8c3cd3f4sm84616plp.201.2023.03.30.12.33.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Mar 2023 12:33:12 -0700 (PDT) From: Bhupesh Sharma <bhupesh.sharma@linaro.org> To: linux-arm-msm@vger.kernel.org Cc: agross@kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, andersson@kernel.org, bhupesh.sharma@linaro.org, bhupesh.linux@gmail.com, krzysztof.kozlowski@linaro.org, robh+dt@kernel.org, konrad.dybcio@linaro.org Subject: [RESEND PATCH v2 1/1] arm64: dts: qcom: sm6115: Add CPU idle-states Date: Fri, 31 Mar 2023 01:03:03 +0530 Message-Id: <20230330193303.612475-1-bhupesh.sharma@linaro.org> X-Mailer: git-send-email 2.38.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.2 required=5.0 tests=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?1761810324953289946?= X-GMAIL-MSGID: =?utf-8?q?1761823358586846838?= |
Series |
[RESEND,v2,1/1] arm64: dts: qcom: sm6115: Add CPU idle-states
|
|
Commit Message
Bhupesh Sharma
March 30, 2023, 7:33 p.m. UTC
Add CPU idle-state nodes and power-domains in Qualcomm sm6115 SoC dtsi.
Signed-off-by: Bhupesh Sharma <bhupesh.sharma@linaro.org>
---
Changes since v1:
- v1 can be viewed here: https://lore.kernel.org/lkml/e5cda4cf-5c2a-a7ed-9e1d-1fe9f2cbef40@linaro.org
- Addressed Konrad's comments on v1 and added GDHS and Power Collapse
cluster power states.
arch/arm64/boot/dts/qcom/sm6115.dtsi | 136 +++++++++++++++++++++++++++
1 file changed, 136 insertions(+)
Comments
On 30.03.2023 21:33, Bhupesh Sharma wrote: > Add CPU idle-state nodes and power-domains in Qualcomm sm6115 SoC dtsi. > > Signed-off-by: Bhupesh Sharma <bhupesh.sharma@linaro.org> > --- > Changes since v1: > - v1 can be viewed here: https://lore.kernel.org/lkml/e5cda4cf-5c2a-a7ed-9e1d-1fe9f2cbef40@linaro.org > - Addressed Konrad's comments on v1 and added GDHS and Power Collapse > cluster power states. > > arch/arm64/boot/dts/qcom/sm6115.dtsi | 136 +++++++++++++++++++++++++++ > 1 file changed, 136 insertions(+) > > diff --git a/arch/arm64/boot/dts/qcom/sm6115.dtsi b/arch/arm64/boot/dts/qcom/sm6115.dtsi > index 2a51c938bbcb..b63395d476ed 100644 > --- a/arch/arm64/boot/dts/qcom/sm6115.dtsi > +++ b/arch/arm64/boot/dts/qcom/sm6115.dtsi > @@ -45,6 +45,8 @@ CPU0: cpu@0 { > enable-method = "psci"; > next-level-cache = <&L2_0>; > qcom,freq-domain = <&cpufreq_hw 0>; > + power-domains = <&CPU_PD0>; > + power-domain-names = "psci"; > L2_0: l2-cache { > compatible = "cache"; > cache-level = <2>; > @@ -61,6 +63,8 @@ CPU1: cpu@1 { > enable-method = "psci"; > next-level-cache = <&L2_0>; > qcom,freq-domain = <&cpufreq_hw 0>; > + power-domains = <&CPU_PD1>; > + power-domain-names = "psci"; > }; > > CPU2: cpu@2 { > @@ -73,6 +77,8 @@ CPU2: cpu@2 { > enable-method = "psci"; > next-level-cache = <&L2_0>; > qcom,freq-domain = <&cpufreq_hw 0>; > + power-domains = <&CPU_PD2>; > + power-domain-names = "psci"; > }; > > CPU3: cpu@3 { > @@ -85,6 +91,8 @@ CPU3: cpu@3 { > enable-method = "psci"; > next-level-cache = <&L2_0>; > qcom,freq-domain = <&cpufreq_hw 0>; > + power-domains = <&CPU_PD3>; > + power-domain-names = "psci"; > }; > > CPU4: cpu@100 { > @@ -97,6 +105,8 @@ CPU4: cpu@100 { > dynamic-power-coefficient = <282>; > next-level-cache = <&L2_1>; > qcom,freq-domain = <&cpufreq_hw 1>; > + power-domains = <&CPU_PD4>; > + power-domain-names = "psci"; > L2_1: l2-cache { > compatible = "cache"; > cache-level = <2>; > @@ -113,6 +123,8 @@ CPU5: cpu@101 { > enable-method = "psci"; > next-level-cache = <&L2_1>; > qcom,freq-domain = <&cpufreq_hw 1>; > + power-domains = <&CPU_PD5>; > + power-domain-names = "psci"; > }; > > CPU6: cpu@102 { > @@ -125,6 +137,8 @@ CPU6: cpu@102 { > enable-method = "psci"; > next-level-cache = <&L2_1>; > qcom,freq-domain = <&cpufreq_hw 1>; > + power-domains = <&CPU_PD6>; > + power-domain-names = "psci"; > }; > > CPU7: cpu@103 { > @@ -137,6 +151,8 @@ CPU7: cpu@103 { > enable-method = "psci"; > next-level-cache = <&L2_1>; > qcom,freq-domain = <&cpufreq_hw 1>; > + power-domains = <&CPU_PD7>; > + power-domain-names = "psci"; > }; > > cpu-map { > @@ -176,6 +192,68 @@ core3 { > }; > }; > }; > + > + idle-states { > + entry-method = "psci"; > + > + LITTLE_CPU_SLEEP_0: cpu-sleep-0-0 { > + compatible = "arm,idle-state"; > + idle-state-name = "silver-rail-power-collapse"; > + arm,psci-suspend-param = <0x40000003>; > + entry-latency-us = <290>; > + exit-latency-us = <376>; > + min-residency-us = <1182>; > + local-timer-stop; > + }; > + > + BIG_CPU_SLEEP_0: cpu-sleep-1-0 { > + compatible = "arm,idle-state"; > + idle-state-name = "gold-rail-power-collapse"; > + arm,psci-suspend-param = <0x40000003>; > + entry-latency-us = <297>; > + exit-latency-us = <324>; > + min-residency-us = <1110>; > + local-timer-stop; > + }; > + }; > + > + domain-idle-states { > + CLUSTER_0_SLEEP_0: cluster-sleep-0-0 { > + /* GDHS */ > + compatible = "domain-idle-state"; > + arm,psci-suspend-param = <0x40000022>; This 0x22 ending seems very sus. The last nibble represents the core-level power state and the penultimate one represents the same at cluster level. A value of 2 in that cluster nibble is actually undefined by the PSCI spec, whereas the value of 4 (as you have in all of the other idle states, including D3G for the perf cluster) corresponds to "Retention", so unless there's a very weird nuance in the TZ for this SoC, it should probably end in 0x42. Otherwise I think this LGTM now! Konrad > + entry-latency-us = <360>; > + exit-latency-us = <421>; > + min-residency-us = <782>; > + }; > + > + CLUSTER_0_SLEEP_1: cluster-sleep-0-1 { > + /* Power Collapse */ > + compatible = "domain-idle-state"; > + arm,psci-suspend-param = <0x41000044>; > + entry-latency-us = <800>; > + exit-latency-us = <2118>; > + min-residency-us = <7376>; > + }; > + > + CLUSTER_1_SLEEP_0: cluster-sleep-1-0 { > + /* GDHS */ > + compatible = "domain-idle-state"; > + arm,psci-suspend-param = <0x40000042>; > + entry-latency-us = <314>; > + exit-latency-us = <345>; > + min-residency-us = <660>; > + }; > + > + CLUSTER_1_SLEEP_1: cluster-sleep-1-1 { > + /* Power Collapse */ > + compatible = "domain-idle-state"; > + arm,psci-suspend-param = <0x41000044>; > + entry-latency-us = <640>; > + exit-latency-us = <1654>; > + min-residency-us = <8094>; > + }; > + }; > }; > > firmware { > @@ -199,6 +277,64 @@ pmu { > psci { > compatible = "arm,psci-1.0"; > method = "smc"; > + > + CPU_PD0: power-domain-cpu0 { > + #power-domain-cells = <0>; > + power-domains = <&CLUSTER_0_PD>; > + domain-idle-states = <&LITTLE_CPU_SLEEP_0>; > + }; > + > + CPU_PD1: power-domain-cpu1 { > + #power-domain-cells = <0>; > + power-domains = <&CLUSTER_0_PD>; > + domain-idle-states = <&LITTLE_CPU_SLEEP_0>; > + }; > + > + CPU_PD2: power-domain-cpu2 { > + #power-domain-cells = <0>; > + power-domains = <&CLUSTER_0_PD>; > + domain-idle-states = <&LITTLE_CPU_SLEEP_0>; > + }; > + > + CPU_PD3: power-domain-cpu3 { > + #power-domain-cells = <0>; > + power-domains = <&CLUSTER_0_PD>; > + domain-idle-states = <&LITTLE_CPU_SLEEP_0>; > + }; > + > + CPU_PD4: power-domain-cpu4 { > + #power-domain-cells = <0>; > + power-domains = <&CLUSTER_1_PD>; > + domain-idle-states = <&BIG_CPU_SLEEP_0>; > + }; > + > + CPU_PD5: power-domain-cpu5 { > + #power-domain-cells = <0>; > + power-domains = <&CLUSTER_1_PD>; > + domain-idle-states = <&BIG_CPU_SLEEP_0>; > + }; > + > + CPU_PD6: power-domain-cpu6 { > + #power-domain-cells = <0>; > + power-domains = <&CLUSTER_1_PD>; > + domain-idle-states = <&BIG_CPU_SLEEP_0>; > + }; > + > + CPU_PD7: power-domain-cpu7 { > + #power-domain-cells = <0>; > + power-domains = <&CLUSTER_1_PD>; > + domain-idle-states = <&BIG_CPU_SLEEP_0>; > + }; > + > + CLUSTER_0_PD: power-domain-cpu-cluster0 { > + #power-domain-cells = <0>; > + domain-idle-states = <&CLUSTER_0_SLEEP_0>, <&CLUSTER_0_SLEEP_1>; > + }; > + > + CLUSTER_1_PD: power-domain-cpu-cluster1 { > + #power-domain-cells = <0>; > + domain-idle-states = <&CLUSTER_1_SLEEP_0>, <&CLUSTER_1_SLEEP_1>; > + }; > }; > > reserved_memory: reserved-memory {
Hi Konrad, On Sat, 1 Apr 2023 at 17:51, Konrad Dybcio <konrad.dybcio@linaro.org> wrote: > > > > On 30.03.2023 21:33, Bhupesh Sharma wrote: > > Add CPU idle-state nodes and power-domains in Qualcomm sm6115 SoC dtsi. > > > > Signed-off-by: Bhupesh Sharma <bhupesh.sharma@linaro.org> > > --- > > Changes since v1: > > - v1 can be viewed here: https://lore.kernel.org/lkml/e5cda4cf-5c2a-a7ed-9e1d-1fe9f2cbef40@linaro.org > > - Addressed Konrad's comments on v1 and added GDHS and Power Collapse > > cluster power states. > > > > arch/arm64/boot/dts/qcom/sm6115.dtsi | 136 +++++++++++++++++++++++++++ > > 1 file changed, 136 insertions(+) > > > > diff --git a/arch/arm64/boot/dts/qcom/sm6115.dtsi b/arch/arm64/boot/dts/qcom/sm6115.dtsi > > index 2a51c938bbcb..b63395d476ed 100644 > > --- a/arch/arm64/boot/dts/qcom/sm6115.dtsi > > +++ b/arch/arm64/boot/dts/qcom/sm6115.dtsi > > @@ -45,6 +45,8 @@ CPU0: cpu@0 { > > enable-method = "psci"; > > next-level-cache = <&L2_0>; > > qcom,freq-domain = <&cpufreq_hw 0>; > > + power-domains = <&CPU_PD0>; > > + power-domain-names = "psci"; > > L2_0: l2-cache { > > compatible = "cache"; > > cache-level = <2>; > > @@ -61,6 +63,8 @@ CPU1: cpu@1 { > > enable-method = "psci"; > > next-level-cache = <&L2_0>; > > qcom,freq-domain = <&cpufreq_hw 0>; > > + power-domains = <&CPU_PD1>; > > + power-domain-names = "psci"; > > }; > > > > CPU2: cpu@2 { > > @@ -73,6 +77,8 @@ CPU2: cpu@2 { > > enable-method = "psci"; > > next-level-cache = <&L2_0>; > > qcom,freq-domain = <&cpufreq_hw 0>; > > + power-domains = <&CPU_PD2>; > > + power-domain-names = "psci"; > > }; > > > > CPU3: cpu@3 { > > @@ -85,6 +91,8 @@ CPU3: cpu@3 { > > enable-method = "psci"; > > next-level-cache = <&L2_0>; > > qcom,freq-domain = <&cpufreq_hw 0>; > > + power-domains = <&CPU_PD3>; > > + power-domain-names = "psci"; > > }; > > > > CPU4: cpu@100 { > > @@ -97,6 +105,8 @@ CPU4: cpu@100 { > > dynamic-power-coefficient = <282>; > > next-level-cache = <&L2_1>; > > qcom,freq-domain = <&cpufreq_hw 1>; > > + power-domains = <&CPU_PD4>; > > + power-domain-names = "psci"; > > L2_1: l2-cache { > > compatible = "cache"; > > cache-level = <2>; > > @@ -113,6 +123,8 @@ CPU5: cpu@101 { > > enable-method = "psci"; > > next-level-cache = <&L2_1>; > > qcom,freq-domain = <&cpufreq_hw 1>; > > + power-domains = <&CPU_PD5>; > > + power-domain-names = "psci"; > > }; > > > > CPU6: cpu@102 { > > @@ -125,6 +137,8 @@ CPU6: cpu@102 { > > enable-method = "psci"; > > next-level-cache = <&L2_1>; > > qcom,freq-domain = <&cpufreq_hw 1>; > > + power-domains = <&CPU_PD6>; > > + power-domain-names = "psci"; > > }; > > > > CPU7: cpu@103 { > > @@ -137,6 +151,8 @@ CPU7: cpu@103 { > > enable-method = "psci"; > > next-level-cache = <&L2_1>; > > qcom,freq-domain = <&cpufreq_hw 1>; > > + power-domains = <&CPU_PD7>; > > + power-domain-names = "psci"; > > }; > > > > cpu-map { > > @@ -176,6 +192,68 @@ core3 { > > }; > > }; > > }; > > + > > + idle-states { > > + entry-method = "psci"; > > + > > + LITTLE_CPU_SLEEP_0: cpu-sleep-0-0 { > > + compatible = "arm,idle-state"; > > + idle-state-name = "silver-rail-power-collapse"; > > + arm,psci-suspend-param = <0x40000003>; > > + entry-latency-us = <290>; > > + exit-latency-us = <376>; > > + min-residency-us = <1182>; > > + local-timer-stop; > > + }; > > + > > + BIG_CPU_SLEEP_0: cpu-sleep-1-0 { > > + compatible = "arm,idle-state"; > > + idle-state-name = "gold-rail-power-collapse"; > > + arm,psci-suspend-param = <0x40000003>; > > + entry-latency-us = <297>; > > + exit-latency-us = <324>; > > + min-residency-us = <1110>; > > + local-timer-stop; > > + }; > > + }; > > + > > + domain-idle-states { > > + CLUSTER_0_SLEEP_0: cluster-sleep-0-0 { > > + /* GDHS */ > > + compatible = "domain-idle-state"; > > + arm,psci-suspend-param = <0x40000022>; > This 0x22 ending seems very sus. > > The last nibble represents the core-level power state and the > penultimate one represents the same at cluster level. A value > of 2 in that cluster nibble is actually undefined by the PSCI spec, > whereas the value of 4 (as you have in all of the other idle > states, including D3G for the perf cluster) corresponds to > "Retention", so unless there's a very weird nuance in the > TZ for this SoC, it should probably end in 0x42. > > Otherwise I think this LGTM now! I am also learning by experiment about the exact values to use here, as the only ready reckoner of how these values are calculated, seems to be available via [1]. Also it seems the downstream code uses the following approach to calculate the LPM state suspend-param, which for example for CLUSTER_0_SLEEP_1 states turns out to be: state_id = get_cluster_id(cpu->parent, &affinity_level, from_idle); = 0x40 power_state = (is-reset << 30) = 0x40000000 affinity_level = (affinity level & 0x3) << 24 = 0x1000000 state_id += power_state + affinity_level + psci_id; = 0x40000000 + 0x1000000 + 0x40 + 0x4 = 0x41000044 For the D3G cases as well, I just used the 'qcom,psci-mode = <2>' value as provided in downstream code (see [2]), for the overall calculations. Also, the only usage of D3G state I could find upstream (in qcom dtsi files0 is for 'msm8916' (see [3]), which also uses the value with ending 0x2 -> 'arm,psci-suspend-param = <0x41000032>' [1]. https://patchwork.kernel.org/project/linux-arm-msm/patch/20201221002907.2870059-3-danny@kdrag0n.dev/#23857409 [2]. https://android.googlesource.com/kernel/msm-extra/devicetree/+/refs/tags/android-11.0.0_r0.56/qcom/bengal-pm.dtsi#127 [3]. https://github.com/torvalds/linux/blob/master/arch/arm64/boot/dts/qcom/msm8916.dtsi#L209 Thanks, Bhupesh > > + entry-latency-us = <360>; > > + exit-latency-us = <421>; > > + min-residency-us = <782>; > > + }; > > + > > + CLUSTER_0_SLEEP_1: cluster-sleep-0-1 { > > + /* Power Collapse */ > > + compatible = "domain-idle-state"; > > + arm,psci-suspend-param = <0x41000044>; > > + entry-latency-us = <800>; > > + exit-latency-us = <2118>; > > + min-residency-us = <7376>; > > + }; > > + > > + CLUSTER_1_SLEEP_0: cluster-sleep-1-0 { > > + /* GDHS */ > > + compatible = "domain-idle-state"; > > + arm,psci-suspend-param = <0x40000042>; > > + entry-latency-us = <314>; > > + exit-latency-us = <345>; > > + min-residency-us = <660>; > > + }; > > + > > + CLUSTER_1_SLEEP_1: cluster-sleep-1-1 { > > + /* Power Collapse */ > > + compatible = "domain-idle-state"; > > + arm,psci-suspend-param = <0x41000044>; > > + entry-latency-us = <640>; > > + exit-latency-us = <1654>; > > + min-residency-us = <8094>; > > + }; > > + }; > > }; > > > > firmware { > > @@ -199,6 +277,64 @@ pmu { > > psci { > > compatible = "arm,psci-1.0"; > > method = "smc"; > > + > > + CPU_PD0: power-domain-cpu0 { > > + #power-domain-cells = <0>; > > + power-domains = <&CLUSTER_0_PD>; > > + domain-idle-states = <&LITTLE_CPU_SLEEP_0>; > > + }; > > + > > + CPU_PD1: power-domain-cpu1 { > > + #power-domain-cells = <0>; > > + power-domains = <&CLUSTER_0_PD>; > > + domain-idle-states = <&LITTLE_CPU_SLEEP_0>; > > + }; > > + > > + CPU_PD2: power-domain-cpu2 { > > + #power-domain-cells = <0>; > > + power-domains = <&CLUSTER_0_PD>; > > + domain-idle-states = <&LITTLE_CPU_SLEEP_0>; > > + }; > > + > > + CPU_PD3: power-domain-cpu3 { > > + #power-domain-cells = <0>; > > + power-domains = <&CLUSTER_0_PD>; > > + domain-idle-states = <&LITTLE_CPU_SLEEP_0>; > > + }; > > + > > + CPU_PD4: power-domain-cpu4 { > > + #power-domain-cells = <0>; > > + power-domains = <&CLUSTER_1_PD>; > > + domain-idle-states = <&BIG_CPU_SLEEP_0>; > > + }; > > + > > + CPU_PD5: power-domain-cpu5 { > > + #power-domain-cells = <0>; > > + power-domains = <&CLUSTER_1_PD>; > > + domain-idle-states = <&BIG_CPU_SLEEP_0>; > > + }; > > + > > + CPU_PD6: power-domain-cpu6 { > > + #power-domain-cells = <0>; > > + power-domains = <&CLUSTER_1_PD>; > > + domain-idle-states = <&BIG_CPU_SLEEP_0>; > > + }; > > + > > + CPU_PD7: power-domain-cpu7 { > > + #power-domain-cells = <0>; > > + power-domains = <&CLUSTER_1_PD>; > > + domain-idle-states = <&BIG_CPU_SLEEP_0>; > > + }; > > + > > + CLUSTER_0_PD: power-domain-cpu-cluster0 { > > + #power-domain-cells = <0>; > > + domain-idle-states = <&CLUSTER_0_SLEEP_0>, <&CLUSTER_0_SLEEP_1>; > > + }; > > + > > + CLUSTER_1_PD: power-domain-cpu-cluster1 { > > + #power-domain-cells = <0>; > > + domain-idle-states = <&CLUSTER_1_SLEEP_0>, <&CLUSTER_1_SLEEP_1>; > > + }; > > }; > > > > reserved_memory: reserved-memory {
On 01/04/2023 21:26, Bhupesh Sharma wrote: > Hi Konrad, > > On Sat, 1 Apr 2023 at 17:51, Konrad Dybcio <konrad.dybcio@linaro.org> wrote: >> >> >> >> On 30.03.2023 21:33, Bhupesh Sharma wrote: >>> Add CPU idle-state nodes and power-domains in Qualcomm sm6115 SoC dtsi. >>> >>> Signed-off-by: Bhupesh Sharma <bhupesh.sharma@linaro.org> >>> --- >>> Changes since v1: >>> - v1 can be viewed here: https://lore.kernel.org/lkml/e5cda4cf-5c2a-a7ed-9e1d-1fe9f2cbef40@linaro.org >>> - Addressed Konrad's comments on v1 and added GDHS and Power Collapse >>> cluster power states. >>> >>> arch/arm64/boot/dts/qcom/sm6115.dtsi | 136 +++++++++++++++++++++++++++ >>> 1 file changed, 136 insertions(+) >>> >>> diff --git a/arch/arm64/boot/dts/qcom/sm6115.dtsi b/arch/arm64/boot/dts/qcom/sm6115.dtsi >>> index 2a51c938bbcb..b63395d476ed 100644 >>> --- a/arch/arm64/boot/dts/qcom/sm6115.dtsi >>> +++ b/arch/arm64/boot/dts/qcom/sm6115.dtsi >>> @@ -45,6 +45,8 @@ CPU0: cpu@0 { >>> enable-method = "psci"; >>> next-level-cache = <&L2_0>; >>> qcom,freq-domain = <&cpufreq_hw 0>; >>> + power-domains = <&CPU_PD0>; >>> + power-domain-names = "psci"; >>> L2_0: l2-cache { >>> compatible = "cache"; >>> cache-level = <2>; >>> @@ -61,6 +63,8 @@ CPU1: cpu@1 { >>> enable-method = "psci"; >>> next-level-cache = <&L2_0>; >>> qcom,freq-domain = <&cpufreq_hw 0>; >>> + power-domains = <&CPU_PD1>; >>> + power-domain-names = "psci"; >>> }; >>> >>> CPU2: cpu@2 { >>> @@ -73,6 +77,8 @@ CPU2: cpu@2 { >>> enable-method = "psci"; >>> next-level-cache = <&L2_0>; >>> qcom,freq-domain = <&cpufreq_hw 0>; >>> + power-domains = <&CPU_PD2>; >>> + power-domain-names = "psci"; >>> }; >>> >>> CPU3: cpu@3 { >>> @@ -85,6 +91,8 @@ CPU3: cpu@3 { >>> enable-method = "psci"; >>> next-level-cache = <&L2_0>; >>> qcom,freq-domain = <&cpufreq_hw 0>; >>> + power-domains = <&CPU_PD3>; >>> + power-domain-names = "psci"; >>> }; >>> >>> CPU4: cpu@100 { >>> @@ -97,6 +105,8 @@ CPU4: cpu@100 { >>> dynamic-power-coefficient = <282>; >>> next-level-cache = <&L2_1>; >>> qcom,freq-domain = <&cpufreq_hw 1>; >>> + power-domains = <&CPU_PD4>; >>> + power-domain-names = "psci"; >>> L2_1: l2-cache { >>> compatible = "cache"; >>> cache-level = <2>; >>> @@ -113,6 +123,8 @@ CPU5: cpu@101 { >>> enable-method = "psci"; >>> next-level-cache = <&L2_1>; >>> qcom,freq-domain = <&cpufreq_hw 1>; >>> + power-domains = <&CPU_PD5>; >>> + power-domain-names = "psci"; >>> }; >>> >>> CPU6: cpu@102 { >>> @@ -125,6 +137,8 @@ CPU6: cpu@102 { >>> enable-method = "psci"; >>> next-level-cache = <&L2_1>; >>> qcom,freq-domain = <&cpufreq_hw 1>; >>> + power-domains = <&CPU_PD6>; >>> + power-domain-names = "psci"; >>> }; >>> >>> CPU7: cpu@103 { >>> @@ -137,6 +151,8 @@ CPU7: cpu@103 { >>> enable-method = "psci"; >>> next-level-cache = <&L2_1>; >>> qcom,freq-domain = <&cpufreq_hw 1>; >>> + power-domains = <&CPU_PD7>; >>> + power-domain-names = "psci"; >>> }; >>> >>> cpu-map { >>> @@ -176,6 +192,68 @@ core3 { >>> }; >>> }; >>> }; >>> + >>> + idle-states { >>> + entry-method = "psci"; >>> + >>> + LITTLE_CPU_SLEEP_0: cpu-sleep-0-0 { >>> + compatible = "arm,idle-state"; >>> + idle-state-name = "silver-rail-power-collapse"; >>> + arm,psci-suspend-param = <0x40000003>; >>> + entry-latency-us = <290>; >>> + exit-latency-us = <376>; >>> + min-residency-us = <1182>; >>> + local-timer-stop; >>> + }; >>> + >>> + BIG_CPU_SLEEP_0: cpu-sleep-1-0 { >>> + compatible = "arm,idle-state"; >>> + idle-state-name = "gold-rail-power-collapse"; >>> + arm,psci-suspend-param = <0x40000003>; >>> + entry-latency-us = <297>; >>> + exit-latency-us = <324>; >>> + min-residency-us = <1110>; >>> + local-timer-stop; >>> + }; >>> + }; >>> + >>> + domain-idle-states { >>> + CLUSTER_0_SLEEP_0: cluster-sleep-0-0 { >>> + /* GDHS */ >>> + compatible = "domain-idle-state"; >>> + arm,psci-suspend-param = <0x40000022>; >> This 0x22 ending seems very sus. >> >> The last nibble represents the core-level power state and the >> penultimate one represents the same at cluster level. A value >> of 2 in that cluster nibble is actually undefined by the PSCI spec, >> whereas the value of 4 (as you have in all of the other idle >> states, including D3G for the perf cluster) corresponds to >> "Retention", so unless there's a very weird nuance in the >> TZ for this SoC, it should probably end in 0x42. >> >> Otherwise I think this LGTM now! > > I am also learning by experiment about the exact values to use here, > as the only ready reckoner of how these values are calculated, seems > to be available via [1]. > > Also it seems the downstream code uses the following approach to > calculate the LPM state suspend-param, which for example for > CLUSTER_0_SLEEP_1 states turns out to be: > > state_id = get_cluster_id(cpu->parent, &affinity_level, from_idle); = 0x40 > power_state = (is-reset << 30) = 0x40000000 > affinity_level = (affinity level & 0x3) << 24 = 0x1000000 > state_id += power_state + affinity_level + psci_id; > > = 0x40000000 + 0x1000000 + 0x40 + 0x4 = 0x41000044 > > For the D3G cases as well, I just used the 'qcom,psci-mode = <2>' > value as provided in downstream code (see [2]), for the overall > calculations. > > Also, the only usage of D3G state I could find upstream (in qcom dtsi > files0 is for 'msm8916' (see [3]), which also uses the value with > ending 0x2 -> 'arm,psci-suspend-param = <0x41000032>' D3G has min-child-idx = 1, so the end PSCI param should be 0x41000023 D3 is 0x41000043 > > [1]. https://patchwork.kernel.org/project/linux-arm-msm/patch/20201221002907.2870059-3-danny@kdrag0n.dev/#23857409 > [2]. https://android.googlesource.com/kernel/msm-extra/devicetree/+/refs/tags/android-11.0.0_r0.56/qcom/bengal-pm.dtsi#127 > [3]. https://github.com/torvalds/linux/blob/master/arch/arm64/boot/dts/qcom/msm8916.dtsi#L209 > > Thanks, > Bhupesh > >>> + entry-latency-us = <360>; >>> + exit-latency-us = <421>; >>> + min-residency-us = <782>; >>> + }; >>> + >>> + CLUSTER_0_SLEEP_1: cluster-sleep-0-1 { >>> + /* Power Collapse */ >>> + compatible = "domain-idle-state"; >>> + arm,psci-suspend-param = <0x41000044>; >>> + entry-latency-us = <800>; >>> + exit-latency-us = <2118>; >>> + min-residency-us = <7376>; >>> + }; >>> + >>> + CLUSTER_1_SLEEP_0: cluster-sleep-1-0 { >>> + /* GDHS */ >>> + compatible = "domain-idle-state"; >>> + arm,psci-suspend-param = <0x40000042>; >>> + entry-latency-us = <314>; >>> + exit-latency-us = <345>; >>> + min-residency-us = <660>; >>> + }; >>> + >>> + CLUSTER_1_SLEEP_1: cluster-sleep-1-1 { >>> + /* Power Collapse */ >>> + compatible = "domain-idle-state"; >>> + arm,psci-suspend-param = <0x41000044>; >>> + entry-latency-us = <640>; >>> + exit-latency-us = <1654>; >>> + min-residency-us = <8094>; >>> + }; >>> + }; >>> }; >>> >>> firmware { >>> @@ -199,6 +277,64 @@ pmu { >>> psci { >>> compatible = "arm,psci-1.0"; >>> method = "smc"; >>> + >>> + CPU_PD0: power-domain-cpu0 { >>> + #power-domain-cells = <0>; >>> + power-domains = <&CLUSTER_0_PD>; >>> + domain-idle-states = <&LITTLE_CPU_SLEEP_0>; >>> + }; >>> + >>> + CPU_PD1: power-domain-cpu1 { >>> + #power-domain-cells = <0>; >>> + power-domains = <&CLUSTER_0_PD>; >>> + domain-idle-states = <&LITTLE_CPU_SLEEP_0>; >>> + }; >>> + >>> + CPU_PD2: power-domain-cpu2 { >>> + #power-domain-cells = <0>; >>> + power-domains = <&CLUSTER_0_PD>; >>> + domain-idle-states = <&LITTLE_CPU_SLEEP_0>; >>> + }; >>> + >>> + CPU_PD3: power-domain-cpu3 { >>> + #power-domain-cells = <0>; >>> + power-domains = <&CLUSTER_0_PD>; >>> + domain-idle-states = <&LITTLE_CPU_SLEEP_0>; >>> + }; >>> + >>> + CPU_PD4: power-domain-cpu4 { >>> + #power-domain-cells = <0>; >>> + power-domains = <&CLUSTER_1_PD>; >>> + domain-idle-states = <&BIG_CPU_SLEEP_0>; >>> + }; >>> + >>> + CPU_PD5: power-domain-cpu5 { >>> + #power-domain-cells = <0>; >>> + power-domains = <&CLUSTER_1_PD>; >>> + domain-idle-states = <&BIG_CPU_SLEEP_0>; >>> + }; >>> + >>> + CPU_PD6: power-domain-cpu6 { >>> + #power-domain-cells = <0>; >>> + power-domains = <&CLUSTER_1_PD>; >>> + domain-idle-states = <&BIG_CPU_SLEEP_0>; >>> + }; >>> + >>> + CPU_PD7: power-domain-cpu7 { >>> + #power-domain-cells = <0>; >>> + power-domains = <&CLUSTER_1_PD>; >>> + domain-idle-states = <&BIG_CPU_SLEEP_0>; >>> + }; >>> + >>> + CLUSTER_0_PD: power-domain-cpu-cluster0 { >>> + #power-domain-cells = <0>; >>> + domain-idle-states = <&CLUSTER_0_SLEEP_0>, <&CLUSTER_0_SLEEP_1>; >>> + }; >>> + >>> + CLUSTER_1_PD: power-domain-cpu-cluster1 { >>> + #power-domain-cells = <0>; >>> + domain-idle-states = <&CLUSTER_1_SLEEP_0>, <&CLUSTER_1_SLEEP_1>; >>> + }; >>> }; >>> >>> reserved_memory: reserved-memory {
On Sun, 2 Apr 2023 at 01:28, Dmitry Baryshkov <dmitry.baryshkov@linaro.org> wrote: > > On 01/04/2023 21:26, Bhupesh Sharma wrote: > > Hi Konrad, > > > > On Sat, 1 Apr 2023 at 17:51, Konrad Dybcio <konrad.dybcio@linaro.org> wrote: > >> > >> > >> > >> On 30.03.2023 21:33, Bhupesh Sharma wrote: > >>> Add CPU idle-state nodes and power-domains in Qualcomm sm6115 SoC dtsi. > >>> > >>> Signed-off-by: Bhupesh Sharma <bhupesh.sharma@linaro.org> > >>> --- > >>> Changes since v1: > >>> - v1 can be viewed here: https://lore.kernel.org/lkml/e5cda4cf-5c2a-a7ed-9e1d-1fe9f2cbef40@linaro.org > >>> - Addressed Konrad's comments on v1 and added GDHS and Power Collapse > >>> cluster power states. > >>> > >>> arch/arm64/boot/dts/qcom/sm6115.dtsi | 136 +++++++++++++++++++++++++++ > >>> 1 file changed, 136 insertions(+) > >>> > >>> diff --git a/arch/arm64/boot/dts/qcom/sm6115.dtsi b/arch/arm64/boot/dts/qcom/sm6115.dtsi > >>> index 2a51c938bbcb..b63395d476ed 100644 > >>> --- a/arch/arm64/boot/dts/qcom/sm6115.dtsi > >>> +++ b/arch/arm64/boot/dts/qcom/sm6115.dtsi > >>> @@ -45,6 +45,8 @@ CPU0: cpu@0 { > >>> enable-method = "psci"; > >>> next-level-cache = <&L2_0>; > >>> qcom,freq-domain = <&cpufreq_hw 0>; > >>> + power-domains = <&CPU_PD0>; > >>> + power-domain-names = "psci"; > >>> L2_0: l2-cache { > >>> compatible = "cache"; > >>> cache-level = <2>; > >>> @@ -61,6 +63,8 @@ CPU1: cpu@1 { > >>> enable-method = "psci"; > >>> next-level-cache = <&L2_0>; > >>> qcom,freq-domain = <&cpufreq_hw 0>; > >>> + power-domains = <&CPU_PD1>; > >>> + power-domain-names = "psci"; > >>> }; > >>> > >>> CPU2: cpu@2 { > >>> @@ -73,6 +77,8 @@ CPU2: cpu@2 { > >>> enable-method = "psci"; > >>> next-level-cache = <&L2_0>; > >>> qcom,freq-domain = <&cpufreq_hw 0>; > >>> + power-domains = <&CPU_PD2>; > >>> + power-domain-names = "psci"; > >>> }; > >>> > >>> CPU3: cpu@3 { > >>> @@ -85,6 +91,8 @@ CPU3: cpu@3 { > >>> enable-method = "psci"; > >>> next-level-cache = <&L2_0>; > >>> qcom,freq-domain = <&cpufreq_hw 0>; > >>> + power-domains = <&CPU_PD3>; > >>> + power-domain-names = "psci"; > >>> }; > >>> > >>> CPU4: cpu@100 { > >>> @@ -97,6 +105,8 @@ CPU4: cpu@100 { > >>> dynamic-power-coefficient = <282>; > >>> next-level-cache = <&L2_1>; > >>> qcom,freq-domain = <&cpufreq_hw 1>; > >>> + power-domains = <&CPU_PD4>; > >>> + power-domain-names = "psci"; > >>> L2_1: l2-cache { > >>> compatible = "cache"; > >>> cache-level = <2>; > >>> @@ -113,6 +123,8 @@ CPU5: cpu@101 { > >>> enable-method = "psci"; > >>> next-level-cache = <&L2_1>; > >>> qcom,freq-domain = <&cpufreq_hw 1>; > >>> + power-domains = <&CPU_PD5>; > >>> + power-domain-names = "psci"; > >>> }; > >>> > >>> CPU6: cpu@102 { > >>> @@ -125,6 +137,8 @@ CPU6: cpu@102 { > >>> enable-method = "psci"; > >>> next-level-cache = <&L2_1>; > >>> qcom,freq-domain = <&cpufreq_hw 1>; > >>> + power-domains = <&CPU_PD6>; > >>> + power-domain-names = "psci"; > >>> }; > >>> > >>> CPU7: cpu@103 { > >>> @@ -137,6 +151,8 @@ CPU7: cpu@103 { > >>> enable-method = "psci"; > >>> next-level-cache = <&L2_1>; > >>> qcom,freq-domain = <&cpufreq_hw 1>; > >>> + power-domains = <&CPU_PD7>; > >>> + power-domain-names = "psci"; > >>> }; > >>> > >>> cpu-map { > >>> @@ -176,6 +192,68 @@ core3 { > >>> }; > >>> }; > >>> }; > >>> + > >>> + idle-states { > >>> + entry-method = "psci"; > >>> + > >>> + LITTLE_CPU_SLEEP_0: cpu-sleep-0-0 { > >>> + compatible = "arm,idle-state"; > >>> + idle-state-name = "silver-rail-power-collapse"; > >>> + arm,psci-suspend-param = <0x40000003>; > >>> + entry-latency-us = <290>; > >>> + exit-latency-us = <376>; > >>> + min-residency-us = <1182>; > >>> + local-timer-stop; > >>> + }; > >>> + > >>> + BIG_CPU_SLEEP_0: cpu-sleep-1-0 { > >>> + compatible = "arm,idle-state"; > >>> + idle-state-name = "gold-rail-power-collapse"; > >>> + arm,psci-suspend-param = <0x40000003>; > >>> + entry-latency-us = <297>; > >>> + exit-latency-us = <324>; > >>> + min-residency-us = <1110>; > >>> + local-timer-stop; > >>> + }; > >>> + }; > >>> + > >>> + domain-idle-states { > >>> + CLUSTER_0_SLEEP_0: cluster-sleep-0-0 { > >>> + /* GDHS */ > >>> + compatible = "domain-idle-state"; > >>> + arm,psci-suspend-param = <0x40000022>; > >> This 0x22 ending seems very sus. > >> > >> The last nibble represents the core-level power state and the > >> penultimate one represents the same at cluster level. A value > >> of 2 in that cluster nibble is actually undefined by the PSCI spec, > >> whereas the value of 4 (as you have in all of the other idle > >> states, including D3G for the perf cluster) corresponds to > >> "Retention", so unless there's a very weird nuance in the > >> TZ for this SoC, it should probably end in 0x42. > >> > >> Otherwise I think this LGTM now! > > > > I am also learning by experiment about the exact values to use here, > > as the only ready reckoner of how these values are calculated, seems > > to be available via [1]. > > > > Also it seems the downstream code uses the following approach to > > calculate the LPM state suspend-param, which for example for > > CLUSTER_0_SLEEP_1 states turns out to be: > > > > state_id = get_cluster_id(cpu->parent, &affinity_level, from_idle); = 0x40 > > power_state = (is-reset << 30) = 0x40000000 > > affinity_level = (affinity level & 0x3) << 24 = 0x1000000 > > state_id += power_state + affinity_level + psci_id; > > > > = 0x40000000 + 0x1000000 + 0x40 + 0x4 = 0x41000044 > > > > For the D3G cases as well, I just used the 'qcom,psci-mode = <2>' > > value as provided in downstream code (see [2]), for the overall > > calculations. > > > > Also, the only usage of D3G state I could find upstream (in qcom dtsi > > files0 is for 'msm8916' (see [3]), which also uses the value with > > ending 0x2 -> 'arm,psci-suspend-param = <0x41000032>' > > D3G has min-child-idx = 1, so the end PSCI param should be 0x41000023 > D3 is 0x41000043 Ok, let me recheck at my end as well. Thanks Bhupesh
On 2.04.2023 07:35, Bhupesh Sharma wrote: > On Sun, 2 Apr 2023 at 01:28, Dmitry Baryshkov > <dmitry.baryshkov@linaro.org> wrote: >> >> On 01/04/2023 21:26, Bhupesh Sharma wrote: >>> Hi Konrad, >>> >>> On Sat, 1 Apr 2023 at 17:51, Konrad Dybcio <konrad.dybcio@linaro.org> wrote: >>>> >>>> >>>> >>>> On 30.03.2023 21:33, Bhupesh Sharma wrote: >>>>> Add CPU idle-state nodes and power-domains in Qualcomm sm6115 SoC dtsi. >>>>> >>>>> Signed-off-by: Bhupesh Sharma <bhupesh.sharma@linaro.org> >>>>> --- >>>>> Changes since v1: >>>>> - v1 can be viewed here: https://lore.kernel.org/lkml/e5cda4cf-5c2a-a7ed-9e1d-1fe9f2cbef40@linaro.org >>>>> - Addressed Konrad's comments on v1 and added GDHS and Power Collapse >>>>> cluster power states. >>>>> >>>>> arch/arm64/boot/dts/qcom/sm6115.dtsi | 136 +++++++++++++++++++++++++++ >>>>> 1 file changed, 136 insertions(+) >>>>> >>>>> diff --git a/arch/arm64/boot/dts/qcom/sm6115.dtsi b/arch/arm64/boot/dts/qcom/sm6115.dtsi >>>>> index 2a51c938bbcb..b63395d476ed 100644 >>>>> --- a/arch/arm64/boot/dts/qcom/sm6115.dtsi >>>>> +++ b/arch/arm64/boot/dts/qcom/sm6115.dtsi >>>>> @@ -45,6 +45,8 @@ CPU0: cpu@0 { >>>>> enable-method = "psci"; >>>>> next-level-cache = <&L2_0>; >>>>> qcom,freq-domain = <&cpufreq_hw 0>; >>>>> + power-domains = <&CPU_PD0>; >>>>> + power-domain-names = "psci"; >>>>> L2_0: l2-cache { >>>>> compatible = "cache"; >>>>> cache-level = <2>; >>>>> @@ -61,6 +63,8 @@ CPU1: cpu@1 { >>>>> enable-method = "psci"; >>>>> next-level-cache = <&L2_0>; >>>>> qcom,freq-domain = <&cpufreq_hw 0>; >>>>> + power-domains = <&CPU_PD1>; >>>>> + power-domain-names = "psci"; >>>>> }; >>>>> >>>>> CPU2: cpu@2 { >>>>> @@ -73,6 +77,8 @@ CPU2: cpu@2 { >>>>> enable-method = "psci"; >>>>> next-level-cache = <&L2_0>; >>>>> qcom,freq-domain = <&cpufreq_hw 0>; >>>>> + power-domains = <&CPU_PD2>; >>>>> + power-domain-names = "psci"; >>>>> }; >>>>> >>>>> CPU3: cpu@3 { >>>>> @@ -85,6 +91,8 @@ CPU3: cpu@3 { >>>>> enable-method = "psci"; >>>>> next-level-cache = <&L2_0>; >>>>> qcom,freq-domain = <&cpufreq_hw 0>; >>>>> + power-domains = <&CPU_PD3>; >>>>> + power-domain-names = "psci"; >>>>> }; >>>>> >>>>> CPU4: cpu@100 { >>>>> @@ -97,6 +105,8 @@ CPU4: cpu@100 { >>>>> dynamic-power-coefficient = <282>; >>>>> next-level-cache = <&L2_1>; >>>>> qcom,freq-domain = <&cpufreq_hw 1>; >>>>> + power-domains = <&CPU_PD4>; >>>>> + power-domain-names = "psci"; >>>>> L2_1: l2-cache { >>>>> compatible = "cache"; >>>>> cache-level = <2>; >>>>> @@ -113,6 +123,8 @@ CPU5: cpu@101 { >>>>> enable-method = "psci"; >>>>> next-level-cache = <&L2_1>; >>>>> qcom,freq-domain = <&cpufreq_hw 1>; >>>>> + power-domains = <&CPU_PD5>; >>>>> + power-domain-names = "psci"; >>>>> }; >>>>> >>>>> CPU6: cpu@102 { >>>>> @@ -125,6 +137,8 @@ CPU6: cpu@102 { >>>>> enable-method = "psci"; >>>>> next-level-cache = <&L2_1>; >>>>> qcom,freq-domain = <&cpufreq_hw 1>; >>>>> + power-domains = <&CPU_PD6>; >>>>> + power-domain-names = "psci"; >>>>> }; >>>>> >>>>> CPU7: cpu@103 { >>>>> @@ -137,6 +151,8 @@ CPU7: cpu@103 { >>>>> enable-method = "psci"; >>>>> next-level-cache = <&L2_1>; >>>>> qcom,freq-domain = <&cpufreq_hw 1>; >>>>> + power-domains = <&CPU_PD7>; >>>>> + power-domain-names = "psci"; >>>>> }; >>>>> >>>>> cpu-map { >>>>> @@ -176,6 +192,68 @@ core3 { >>>>> }; >>>>> }; >>>>> }; >>>>> + >>>>> + idle-states { >>>>> + entry-method = "psci"; >>>>> + >>>>> + LITTLE_CPU_SLEEP_0: cpu-sleep-0-0 { >>>>> + compatible = "arm,idle-state"; >>>>> + idle-state-name = "silver-rail-power-collapse"; >>>>> + arm,psci-suspend-param = <0x40000003>; >>>>> + entry-latency-us = <290>; >>>>> + exit-latency-us = <376>; >>>>> + min-residency-us = <1182>; >>>>> + local-timer-stop; >>>>> + }; >>>>> + >>>>> + BIG_CPU_SLEEP_0: cpu-sleep-1-0 { >>>>> + compatible = "arm,idle-state"; >>>>> + idle-state-name = "gold-rail-power-collapse"; >>>>> + arm,psci-suspend-param = <0x40000003>; >>>>> + entry-latency-us = <297>; >>>>> + exit-latency-us = <324>; >>>>> + min-residency-us = <1110>; >>>>> + local-timer-stop; >>>>> + }; >>>>> + }; >>>>> + >>>>> + domain-idle-states { >>>>> + CLUSTER_0_SLEEP_0: cluster-sleep-0-0 { >>>>> + /* GDHS */ >>>>> + compatible = "domain-idle-state"; >>>>> + arm,psci-suspend-param = <0x40000022>; >>>> This 0x22 ending seems very sus. >>>> >>>> The last nibble represents the core-level power state and the >>>> penultimate one represents the same at cluster level. A value >>>> of 2 in that cluster nibble is actually undefined by the PSCI spec, >>>> whereas the value of 4 (as you have in all of the other idle >>>> states, including D3G for the perf cluster) corresponds to >>>> "Retention", so unless there's a very weird nuance in the >>>> TZ for this SoC, it should probably end in 0x42. >>>> >>>> Otherwise I think this LGTM now! >>> >>> I am also learning by experiment about the exact values to use here, >>> as the only ready reckoner of how these values are calculated, seems >>> to be available via [1]. >>> >>> Also it seems the downstream code uses the following approach to >>> calculate the LPM state suspend-param, which for example for >>> CLUSTER_0_SLEEP_1 states turns out to be: >>> >>> state_id = get_cluster_id(cpu->parent, &affinity_level, from_idle); = 0x40 >>> power_state = (is-reset << 30) = 0x40000000 >>> affinity_level = (affinity level & 0x3) << 24 = 0x1000000 >>> state_id += power_state + affinity_level + psci_id; >>> >>> = 0x40000000 + 0x1000000 + 0x40 + 0x4 = 0x41000044 >>> >>> For the D3G cases as well, I just used the 'qcom,psci-mode = <2>' >>> value as provided in downstream code (see [2]), for the overall >>> calculations.>>> >>> Also, the only usage of D3G state I could find upstream (in qcom dtsi >>> files0 is for 'msm8916' (see [3]), which also uses the value with >>> ending 0x2 -> 'arm,psci-suspend-param = <0x41000032>' Yes, the lowest '2' must be correct. I am concerned about the one above it (val & 0xf0). >> >> D3G has min-child-idx = 1, so the end PSCI param should be 0x41000023 >> D3 is 0x41000043 Not sure what that has to do with it. Looking at ancient kernel doc: qcom,min-child-idx: The minimum level that a child CPU should be in before this level can be chosen. This property is required for all non-default level. And it looks like the downstream code ensures that we don't just jump from "CPU running" to "CPU [some stage of] power collapse". So it looks like this patch may be good after all.. Can you verify with sysfs/debugfs that this idle state is being entered correctly? Konrad > > Ok, let me recheck at my end as well. > > Thanks > Bhupesh
diff --git a/arch/arm64/boot/dts/qcom/sm6115.dtsi b/arch/arm64/boot/dts/qcom/sm6115.dtsi index 2a51c938bbcb..b63395d476ed 100644 --- a/arch/arm64/boot/dts/qcom/sm6115.dtsi +++ b/arch/arm64/boot/dts/qcom/sm6115.dtsi @@ -45,6 +45,8 @@ CPU0: cpu@0 { enable-method = "psci"; next-level-cache = <&L2_0>; qcom,freq-domain = <&cpufreq_hw 0>; + power-domains = <&CPU_PD0>; + power-domain-names = "psci"; L2_0: l2-cache { compatible = "cache"; cache-level = <2>; @@ -61,6 +63,8 @@ CPU1: cpu@1 { enable-method = "psci"; next-level-cache = <&L2_0>; qcom,freq-domain = <&cpufreq_hw 0>; + power-domains = <&CPU_PD1>; + power-domain-names = "psci"; }; CPU2: cpu@2 { @@ -73,6 +77,8 @@ CPU2: cpu@2 { enable-method = "psci"; next-level-cache = <&L2_0>; qcom,freq-domain = <&cpufreq_hw 0>; + power-domains = <&CPU_PD2>; + power-domain-names = "psci"; }; CPU3: cpu@3 { @@ -85,6 +91,8 @@ CPU3: cpu@3 { enable-method = "psci"; next-level-cache = <&L2_0>; qcom,freq-domain = <&cpufreq_hw 0>; + power-domains = <&CPU_PD3>; + power-domain-names = "psci"; }; CPU4: cpu@100 { @@ -97,6 +105,8 @@ CPU4: cpu@100 { dynamic-power-coefficient = <282>; next-level-cache = <&L2_1>; qcom,freq-domain = <&cpufreq_hw 1>; + power-domains = <&CPU_PD4>; + power-domain-names = "psci"; L2_1: l2-cache { compatible = "cache"; cache-level = <2>; @@ -113,6 +123,8 @@ CPU5: cpu@101 { enable-method = "psci"; next-level-cache = <&L2_1>; qcom,freq-domain = <&cpufreq_hw 1>; + power-domains = <&CPU_PD5>; + power-domain-names = "psci"; }; CPU6: cpu@102 { @@ -125,6 +137,8 @@ CPU6: cpu@102 { enable-method = "psci"; next-level-cache = <&L2_1>; qcom,freq-domain = <&cpufreq_hw 1>; + power-domains = <&CPU_PD6>; + power-domain-names = "psci"; }; CPU7: cpu@103 { @@ -137,6 +151,8 @@ CPU7: cpu@103 { enable-method = "psci"; next-level-cache = <&L2_1>; qcom,freq-domain = <&cpufreq_hw 1>; + power-domains = <&CPU_PD7>; + power-domain-names = "psci"; }; cpu-map { @@ -176,6 +192,68 @@ core3 { }; }; }; + + idle-states { + entry-method = "psci"; + + LITTLE_CPU_SLEEP_0: cpu-sleep-0-0 { + compatible = "arm,idle-state"; + idle-state-name = "silver-rail-power-collapse"; + arm,psci-suspend-param = <0x40000003>; + entry-latency-us = <290>; + exit-latency-us = <376>; + min-residency-us = <1182>; + local-timer-stop; + }; + + BIG_CPU_SLEEP_0: cpu-sleep-1-0 { + compatible = "arm,idle-state"; + idle-state-name = "gold-rail-power-collapse"; + arm,psci-suspend-param = <0x40000003>; + entry-latency-us = <297>; + exit-latency-us = <324>; + min-residency-us = <1110>; + local-timer-stop; + }; + }; + + domain-idle-states { + CLUSTER_0_SLEEP_0: cluster-sleep-0-0 { + /* GDHS */ + compatible = "domain-idle-state"; + arm,psci-suspend-param = <0x40000022>; + entry-latency-us = <360>; + exit-latency-us = <421>; + min-residency-us = <782>; + }; + + CLUSTER_0_SLEEP_1: cluster-sleep-0-1 { + /* Power Collapse */ + compatible = "domain-idle-state"; + arm,psci-suspend-param = <0x41000044>; + entry-latency-us = <800>; + exit-latency-us = <2118>; + min-residency-us = <7376>; + }; + + CLUSTER_1_SLEEP_0: cluster-sleep-1-0 { + /* GDHS */ + compatible = "domain-idle-state"; + arm,psci-suspend-param = <0x40000042>; + entry-latency-us = <314>; + exit-latency-us = <345>; + min-residency-us = <660>; + }; + + CLUSTER_1_SLEEP_1: cluster-sleep-1-1 { + /* Power Collapse */ + compatible = "domain-idle-state"; + arm,psci-suspend-param = <0x41000044>; + entry-latency-us = <640>; + exit-latency-us = <1654>; + min-residency-us = <8094>; + }; + }; }; firmware { @@ -199,6 +277,64 @@ pmu { psci { compatible = "arm,psci-1.0"; method = "smc"; + + CPU_PD0: power-domain-cpu0 { + #power-domain-cells = <0>; + power-domains = <&CLUSTER_0_PD>; + domain-idle-states = <&LITTLE_CPU_SLEEP_0>; + }; + + CPU_PD1: power-domain-cpu1 { + #power-domain-cells = <0>; + power-domains = <&CLUSTER_0_PD>; + domain-idle-states = <&LITTLE_CPU_SLEEP_0>; + }; + + CPU_PD2: power-domain-cpu2 { + #power-domain-cells = <0>; + power-domains = <&CLUSTER_0_PD>; + domain-idle-states = <&LITTLE_CPU_SLEEP_0>; + }; + + CPU_PD3: power-domain-cpu3 { + #power-domain-cells = <0>; + power-domains = <&CLUSTER_0_PD>; + domain-idle-states = <&LITTLE_CPU_SLEEP_0>; + }; + + CPU_PD4: power-domain-cpu4 { + #power-domain-cells = <0>; + power-domains = <&CLUSTER_1_PD>; + domain-idle-states = <&BIG_CPU_SLEEP_0>; + }; + + CPU_PD5: power-domain-cpu5 { + #power-domain-cells = <0>; + power-domains = <&CLUSTER_1_PD>; + domain-idle-states = <&BIG_CPU_SLEEP_0>; + }; + + CPU_PD6: power-domain-cpu6 { + #power-domain-cells = <0>; + power-domains = <&CLUSTER_1_PD>; + domain-idle-states = <&BIG_CPU_SLEEP_0>; + }; + + CPU_PD7: power-domain-cpu7 { + #power-domain-cells = <0>; + power-domains = <&CLUSTER_1_PD>; + domain-idle-states = <&BIG_CPU_SLEEP_0>; + }; + + CLUSTER_0_PD: power-domain-cpu-cluster0 { + #power-domain-cells = <0>; + domain-idle-states = <&CLUSTER_0_SLEEP_0>, <&CLUSTER_0_SLEEP_1>; + }; + + CLUSTER_1_PD: power-domain-cpu-cluster1 { + #power-domain-cells = <0>; + domain-idle-states = <&CLUSTER_1_SLEEP_0>, <&CLUSTER_1_SLEEP_1>; + }; }; reserved_memory: reserved-memory {