From patchwork Fri Aug 25 15:38:23 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Konrad Dybcio X-Patchwork-Id: 717879 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A13CFEE49BA for ; Fri, 25 Aug 2023 15:39:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239269AbjHYPjA (ORCPT ); Fri, 25 Aug 2023 11:39:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54470 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243699AbjHYPid (ORCPT ); Fri, 25 Aug 2023 11:38:33 -0400 Received: from mail-lj1-x22f.google.com (mail-lj1-x22f.google.com [IPv6:2a00:1450:4864:20::22f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9F3822691 for ; Fri, 25 Aug 2023 08:38:29 -0700 (PDT) Received: by mail-lj1-x22f.google.com with SMTP id 38308e7fff4ca-2bcda0aaf47so24550831fa.1 for ; Fri, 25 Aug 2023 08:38:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1692977908; x=1693582708; 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=ZFgErp58KfdfypCOT3vFx0dQzamUJWU6QtZ8tkYYvkM=; b=u5cpDQmXs6XpHGgASadsyLq5blZls/H8Qkkkdmw41/WtbDxHFFAsCPcwEuWLteML9B r1oIuKJZvqsqsRPUKiG8pzaB52ijvMM9Nh/9YlU6+2DtQvH1HYryJbV6IKguyw2NmtQV j6KOBCA1FHLmegxyllTc5f9Z0o3iXfXC4gVRFOnQk4DUgt0Mr/X+p2+zlHKsZKf+vQkF sEaswXdNdy9CLgUYu/Pvaizh8qqyyc9g1Qyw8n2XPWp1dzstbjvElbfGOBcEc4JRUHvN DWGhDkngRlbFcCrqQxtnrRvf+PaK1nMScgeHddYqLCHk2IAQvgo+6zJQeN5Teo2xju7M /T+Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692977908; x=1693582708; 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=ZFgErp58KfdfypCOT3vFx0dQzamUJWU6QtZ8tkYYvkM=; b=UdIfhEMNvZh/ZXDKezYCYmDXyg9YeAMdSMetqzYTDvXw0mfViXa89BNpgO+HtZUtyC 9aPJPWOPGm3GFF/ufliZzozoLIwNQONh6q+z4B3TlTeoc+jQ+mNcSXZ1PCxlSMFQfElH O9wqzsym4oSXyo64R6yquDQaT9pLIgCArRQKLjT9osLudeX1OFdeADhZCoWxHTo4wWC0 mFzE6BoT4ZV027jsXwUq1GAXE7/D9nv/dgwugqCY86ZDy3ypaO41pPJ9Td2hvAKnAs/C oDXSxEYRjm3yG+JjYz2P7fFK3/lR5FUpsXGWTy+fZ3OM9U6pzf861EmPLukla3EGVt7R wWQQ== X-Gm-Message-State: AOJu0YxdOBWbsvW4SAoa4FO7WygkhJzxwLl7vYEncv2LJO769S+zS0wd tIP5bOjVm3JNaalkN050RQwQrw== X-Google-Smtp-Source: AGHT+IFXxsO0inhPEywRrkMW3OYRkGh+GPhn9IzpDF0AeHHchYr9Zt524WleaK1kVijGAxg3TAvhgg== X-Received: by 2002:a05:6512:4026:b0:4fb:8938:48ab with SMTP id br38-20020a056512402600b004fb893848abmr7440673lfb.16.1692977907351; Fri, 25 Aug 2023 08:38:27 -0700 (PDT) Received: from [192.168.1.101] (abxh59.neoplus.adsl.tpnet.pl. [83.9.1.59]) by smtp.gmail.com with ESMTPSA id y17-20020a197511000000b004fe432108absm326002lfe.182.2023.08.25.08.38.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 25 Aug 2023 08:38:27 -0700 (PDT) From: Konrad Dybcio Date: Fri, 25 Aug 2023 17:38:23 +0200 Subject: [PATCH v4 01/10] interconnect: qcom: icc-rpm: Add AB/IB calculations coefficients MIME-Version: 1.0 Message-Id: <20230726-topic-icc_coeff-v4-1-c04b60caa467@linaro.org> References: <20230726-topic-icc_coeff-v4-0-c04b60caa467@linaro.org> In-Reply-To: <20230726-topic-icc_coeff-v4-0-c04b60caa467@linaro.org> To: Andy Gross , Bjorn Andersson , Georgi Djakov , Michael Turquette , Stephen Boyd Cc: Marijn Suijten , linux-arm-msm@vger.kernel.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-clk@vger.kernel.org, Konrad Dybcio X-Mailer: b4 0.12.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1692977904; l=3362; i=konrad.dybcio@linaro.org; s=20230215; h=from:subject:message-id; bh=VmCQkFG9XlEBLCy/UyzTZ9FZJie6xQcQFu/3Vn+/5S8=; b=z9JwFAn/1a+E13A31tID/phnvyfJsO+q7UKKiJGX9GEhcBpGwnLYXBsfoDCTjbTeyjo4U3TkP pPP2CARVWdkBuAbcAYGfYMwNKcCii28WqH4F41JYjuJ+HqVpszo+PQX X-Developer-Key: i=konrad.dybcio@linaro.org; a=ed25519; pk=iclgkYvtl2w05SSXO5EjjSYlhFKsJ+5OSZBjOkQuEms= Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Presumably due to the hardware being so complex, some nodes (or busses) have different (usually higher) requirements for bandwidth than what the usual calculations would suggest. Looking at the available downstream files, it seems like AB values are adjusted per-bus and IB values are adjusted per-node. With that in mind, introduce percentage-based coefficient struct members and use them in the calculations. One thing to note is that the IB coefficient is inverse (100/ib_percent) which feels a bit backwards, but it's necessary for precision.. Signed-off-by: Konrad Dybcio --- drivers/interconnect/qcom/icc-rpm.c | 18 +++++++++++++++--- drivers/interconnect/qcom/icc-rpm.h | 6 ++++++ 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/drivers/interconnect/qcom/icc-rpm.c b/drivers/interconnect/qcom/icc-rpm.c index 2c16917ba1fd..8b02aa8aa96a 100644 --- a/drivers/interconnect/qcom/icc-rpm.c +++ b/drivers/interconnect/qcom/icc-rpm.c @@ -298,7 +298,8 @@ static int qcom_icc_bw_aggregate(struct icc_node *node, u32 tag, u32 avg_bw, */ static void qcom_icc_bus_aggregate(struct icc_provider *provider, u64 *agg_clk_rate) { - u64 agg_avg_rate, agg_rate; + struct qcom_icc_provider *qp = to_qcom_provider(provider); + u64 agg_avg_rate, agg_peak_rate, agg_rate; struct qcom_icc_node *qn; struct icc_node *node; int i; @@ -315,8 +316,19 @@ static void qcom_icc_bus_aggregate(struct icc_provider *provider, u64 *agg_clk_r else agg_avg_rate = qn->sum_avg[i]; - agg_rate = max_t(u64, agg_avg_rate, qn->max_peak[i]); - do_div(agg_rate, qn->buswidth); + if (qp->ab_coeff) { + agg_avg_rate = agg_avg_rate * qp->ab_coeff; + agg_avg_rate = div_u64(agg_avg_rate, 100); + } + + if (qp->ib_coeff) { + agg_peak_rate = qn->max_peak[i] * 100; + agg_peak_rate = div_u64(qn->max_peak[i], qp->ib_coeff); + } else { + agg_peak_rate = qn->max_peak[i]; + } + + agg_rate = max_t(u64, agg_avg_rate, agg_peak_rate); agg_clk_rate[i] = max_t(u64, agg_clk_rate[i], agg_rate); } diff --git a/drivers/interconnect/qcom/icc-rpm.h b/drivers/interconnect/qcom/icc-rpm.h index eed3451af3e6..5e7d6a4fd2f3 100644 --- a/drivers/interconnect/qcom/icc-rpm.h +++ b/drivers/interconnect/qcom/icc-rpm.h @@ -44,6 +44,8 @@ struct rpm_clk_resource { * @type: the ICC provider type * @regmap: regmap for QoS registers read/write access * @qos_offset: offset to QoS registers + * @ab_coeff: a percentage-based coefficient for compensating the AB calculations + * @ib_coeff: an inverse-percentage-based coefficient for compensating the IB calculations * @bus_clk_rate: bus clock rate in Hz * @bus_clk_desc: a pointer to a rpm_clk_resource description of bus clocks * @bus_clk: a pointer to a HLOS-owned bus clock @@ -57,6 +59,8 @@ struct qcom_icc_provider { enum qcom_icc_type type; struct regmap *regmap; unsigned int qos_offset; + u16 ab_coeff; + u16 ib_coeff; u32 bus_clk_rate[QCOM_SMD_RPM_STATE_NUM]; const struct rpm_clk_resource *bus_clk_desc; struct clk *bus_clk; @@ -123,6 +127,8 @@ struct qcom_icc_desc { enum qcom_icc_type type; const struct regmap_config *regmap_cfg; unsigned int qos_offset; + u16 ab_coeff; + u16 ib_coeff; }; /* Valid for all bus types */ From patchwork Fri Aug 25 15:38:24 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Konrad Dybcio X-Patchwork-Id: 716923 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E4169C3DA66 for ; Fri, 25 Aug 2023 15:39:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244048AbjHYPjD (ORCPT ); Fri, 25 Aug 2023 11:39:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54468 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244036AbjHYPid (ORCPT ); Fri, 25 Aug 2023 11:38:33 -0400 Received: from mail-lf1-x12a.google.com (mail-lf1-x12a.google.com [IPv6:2a00:1450:4864:20::12a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7A3D726B6 for ; Fri, 25 Aug 2023 08:38:30 -0700 (PDT) Received: by mail-lf1-x12a.google.com with SMTP id 2adb3069b0e04-5007c8308c3so1657021e87.0 for ; Fri, 25 Aug 2023 08:38:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1692977909; x=1693582709; 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=FAra/D7JVrn+dMn4F76JoN+KI4BtnRIaq6Is5qXv98k=; b=CrBLRGndIExyI2+wK/Zo3clqzofvj6CRWaMTF71+IjcVAC4VJFIPXG5Q+U6V4Ee+M0 nkElt57mLTYkb/eSB3KfuGQoTF8nZ395kQtYYeeUiGIdGSGJD2ODWgETG0DtoKG/K2ed uLMQr3hDDs4wxnPd1YbaF3VNkx+hDJZHr8MpSengX+oY0jm810pmzgCrwL6G8uuE5gDY s9TmOjW9tfDnYAbNHSSIAjGz1LGX1XmS1DSIoGd4u/N86Z00ITqoZRoGx9GYfO6SVHXT 4L0wAu16vJTyR75HjtMvdWEIQx2MD12b4WcdzOIkSEDeAxyTVvCmq0MHAGKd4Q11hcw3 QAhQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692977909; x=1693582709; 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=FAra/D7JVrn+dMn4F76JoN+KI4BtnRIaq6Is5qXv98k=; b=flGkZgZnUx3RGC3yq2qGHHYfPaGsyLANuBpNKLEtcJEDseTGzBzHN0BZRVVRvIgrSI egpOjXw7rJSyfjqyR0xWojn0+VlIt4GwlkjPcU042c5Mskd+qmepIUyubMrwMCGkAOEe bxI/8eTZGOsU8Cs4+yOQRE+kigIvqbWKfwbuuiV2mad/e5x2cs/ucfIbltyq/utFkxQz m61XNLzagz4ueyFSl64146V6E86pvAJew98fc2R0xBu3qa2Hal0ZDgpkB0XX82yT5RWw Ciw3aGgdvDyNlkuA27gm2oi0bZOP2KykYpwq+tz4BlnFKo4c3pTEDsgZU1YVgKq/uCPw mBNQ== X-Gm-Message-State: AOJu0Yz9Wqma0TEQeAdXrjWWEXSesKgle261Y8lSJ+5ODnUmv/5cz1Bb xDT6LJ+cZCA/VDwWOVXvYYPR/g== X-Google-Smtp-Source: AGHT+IHI+8gip5772vltoC3vkbr47KloqwpeJEkOxu5dqyBC3IP3sNEjQLQo3a9bTBbUgFRSsv9fhA== X-Received: by 2002:a05:6512:36d2:b0:500:9524:f733 with SMTP id e18-20020a05651236d200b005009524f733mr5522146lfs.20.1692977908870; Fri, 25 Aug 2023 08:38:28 -0700 (PDT) Received: from [192.168.1.101] (abxh59.neoplus.adsl.tpnet.pl. [83.9.1.59]) by smtp.gmail.com with ESMTPSA id y17-20020a197511000000b004fe432108absm326002lfe.182.2023.08.25.08.38.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 25 Aug 2023 08:38:28 -0700 (PDT) From: Konrad Dybcio Date: Fri, 25 Aug 2023 17:38:24 +0200 Subject: [PATCH v4 02/10] interconnect: qcom: icc-rpm: Separate out clock rate calulcations MIME-Version: 1.0 Message-Id: <20230726-topic-icc_coeff-v4-2-c04b60caa467@linaro.org> References: <20230726-topic-icc_coeff-v4-0-c04b60caa467@linaro.org> In-Reply-To: <20230726-topic-icc_coeff-v4-0-c04b60caa467@linaro.org> To: Andy Gross , Bjorn Andersson , Georgi Djakov , Michael Turquette , Stephen Boyd Cc: Marijn Suijten , linux-arm-msm@vger.kernel.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-clk@vger.kernel.org, Konrad Dybcio X-Mailer: b4 0.12.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1692977904; l=2930; i=konrad.dybcio@linaro.org; s=20230215; h=from:subject:message-id; bh=VC812LO/ioFmOY5nAI+h4fNdcBO7BBenA1HKz6GQWTI=; b=Cc+hIEBSENUCytOdBLVU4wH09thDLSow/mlFKzyEfu4N4vNyEsQNwwwSIZrhuZ6kH7Z4Nov4j I8DUNAoq/XACHguOMYRKKGs1zB30ZkqQlD6p0GiF5zUKt+RqiLNo4Ye X-Developer-Key: i=konrad.dybcio@linaro.org; a=ed25519; pk=iclgkYvtl2w05SSXO5EjjSYlhFKsJ+5OSZBjOkQuEms= Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org In preparation for also setting per-node clock rates, separate out the logic that computes it. Signed-off-by: Konrad Dybcio --- drivers/interconnect/qcom/icc-rpm.c | 53 +++++++++++++++++++++---------------- 1 file changed, 30 insertions(+), 23 deletions(-) diff --git a/drivers/interconnect/qcom/icc-rpm.c b/drivers/interconnect/qcom/icc-rpm.c index 8b02aa8aa96a..8c1bfd65d774 100644 --- a/drivers/interconnect/qcom/icc-rpm.c +++ b/drivers/interconnect/qcom/icc-rpm.c @@ -291,6 +291,32 @@ static int qcom_icc_bw_aggregate(struct icc_node *node, u32 tag, u32 avg_bw, return 0; } +static u64 qcom_icc_calc_rate(struct qcom_icc_provider *qp, struct qcom_icc_node *qn, int ctx) +{ + u64 agg_avg_rate, agg_peak_rate, agg_rate; + + if (qn->channels) + agg_avg_rate = div_u64(qn->sum_avg[ctx], qn->channels); + else + agg_avg_rate = qn->sum_avg[ctx]; + + if (qp->ab_coeff) { + agg_avg_rate = agg_avg_rate * qp->ab_coeff; + agg_avg_rate = div_u64(agg_avg_rate, 100); + } + + if (qp->ib_coeff) { + agg_peak_rate = qn->max_peak[ctx] * 100; + agg_peak_rate = div_u64(qn->max_peak[ctx], qp->ib_coeff); + } else { + agg_peak_rate = qn->max_peak[ctx]; + } + + agg_rate = max_t(u64, agg_avg_rate, agg_peak_rate); + + return div_u64(agg_rate, qn->buswidth); +} + /** * qcom_icc_bus_aggregate - calculate bus clock rates by traversing all nodes * @provider: generic interconnect provider @@ -299,10 +325,9 @@ static int qcom_icc_bw_aggregate(struct icc_node *node, u32 tag, u32 avg_bw, static void qcom_icc_bus_aggregate(struct icc_provider *provider, u64 *agg_clk_rate) { struct qcom_icc_provider *qp = to_qcom_provider(provider); - u64 agg_avg_rate, agg_peak_rate, agg_rate; struct qcom_icc_node *qn; struct icc_node *node; - int i; + int ctx; /* * Iterate nodes on the provider, aggregate bandwidth requests for @@ -310,27 +335,9 @@ static void qcom_icc_bus_aggregate(struct icc_provider *provider, u64 *agg_clk_r */ list_for_each_entry(node, &provider->nodes, node_list) { qn = node->data; - for (i = 0; i < QCOM_SMD_RPM_STATE_NUM; i++) { - if (qn->channels) - agg_avg_rate = div_u64(qn->sum_avg[i], qn->channels); - else - agg_avg_rate = qn->sum_avg[i]; - - if (qp->ab_coeff) { - agg_avg_rate = agg_avg_rate * qp->ab_coeff; - agg_avg_rate = div_u64(agg_avg_rate, 100); - } - - if (qp->ib_coeff) { - agg_peak_rate = qn->max_peak[i] * 100; - agg_peak_rate = div_u64(qn->max_peak[i], qp->ib_coeff); - } else { - agg_peak_rate = qn->max_peak[i]; - } - - agg_rate = max_t(u64, agg_avg_rate, agg_peak_rate); - - agg_clk_rate[i] = max_t(u64, agg_clk_rate[i], agg_rate); + for (ctx = 0; ctx < QCOM_SMD_RPM_STATE_NUM; ctx++) { + agg_clk_rate[ctx] = max_t(u64, agg_clk_rate[ctx], + qcom_icc_calc_rate(qp, qn, ctx)); } } } From patchwork Fri Aug 25 15:38:25 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Konrad Dybcio X-Patchwork-Id: 717878 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 72DD7EE49BE for ; Fri, 25 Aug 2023 15:39:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343914AbjHYPjC (ORCPT ); Fri, 25 Aug 2023 11:39:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54628 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244082AbjHYPif (ORCPT ); Fri, 25 Aug 2023 11:38:35 -0400 Received: from mail-lf1-x130.google.com (mail-lf1-x130.google.com [IPv6:2a00:1450:4864:20::130]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C4E992139 for ; Fri, 25 Aug 2023 08:38:31 -0700 (PDT) Received: by mail-lf1-x130.google.com with SMTP id 2adb3069b0e04-500913779f5so1633538e87.2 for ; Fri, 25 Aug 2023 08:38:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1692977910; x=1693582710; 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=2Qs7DkXQesvmGRUTl+7tMvgVhMmlkAzzcuf9jrhvd4Y=; b=DIXvKrqhsgANPbvldoFMXQUyWVAzNJe3J2ltUM5E5JmFoFoMkLIh12L+QyuxxMmrgh gUJ4QjajuvpMmC3VxGb1Ne+DE1JT9kCNg4mpjd5ZyVcfmv+RKp4YBelTALsDrf88KoOy hUoaN8PAfRh3liybsj69YBwuvB2mixpZzJz/pJChfXp/lG0RjW/DuYiSFZLb1Ipr1oTV neMk/mlKxPOMzvpWzjHF/1boxVoWHiMF/PnFws5Tj4/njFyyxINr+pXDsPG0H9lmijI2 1AqqVp6MWOXBVAwEU4ut/l2xYd4VeD9Y2LM/qkEVrB6SI1Ga7JkklwNIdCs3H4obQb2H QyLQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692977910; x=1693582710; 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=2Qs7DkXQesvmGRUTl+7tMvgVhMmlkAzzcuf9jrhvd4Y=; b=b17ah5kJ5kkb9hvY82YzfsUb+4p6rfm1WPnsyFTA8rRmjOrVU0f3iHmGFM01wKWlFU TyHU45betWafl+HWQTjWHrYU5gS/cF663YEGl1gUPW8QjjLekO7teCuBVQ+PRvwV7M5/ Fg1ievfTsx3a6eeCz5d04YEsp1EkWbtgU9MG5C/2VWPUwSnAFD1DTgSCZ/B8zXV8EaCr XAv0/dqSToLIzF8lay/n/g13y2M7a/tGAol+qGYeBbgsn2FxPanjoQmJfybIL5w296gH wHmvVmHKh449uLo4fYG+juRK+8Ipi/spLU0/vlLC8Oduv1oHzNnm3kO/+f69Vl63KxL3 vGng== X-Gm-Message-State: AOJu0YxWw4OnkB4qJTQw9sE4Cv0pYcmEu3FtP6vGVV+iKBbzdpvbnU6M osQJUpOjQ+jjKxLSPSnyzypDDA== X-Google-Smtp-Source: AGHT+IG6CPeQKtNazpQeSnupGElm9heSeqRw3O+1Sbk7nDLDVg4dFBT94G9Z+AKuoCvIuGjCitRLHg== X-Received: by 2002:a05:6512:3ca9:b0:4fd:fadc:f1e with SMTP id h41-20020a0565123ca900b004fdfadc0f1emr17413695lfv.44.1692977909940; Fri, 25 Aug 2023 08:38:29 -0700 (PDT) Received: from [192.168.1.101] (abxh59.neoplus.adsl.tpnet.pl. [83.9.1.59]) by smtp.gmail.com with ESMTPSA id y17-20020a197511000000b004fe432108absm326002lfe.182.2023.08.25.08.38.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 25 Aug 2023 08:38:29 -0700 (PDT) From: Konrad Dybcio Date: Fri, 25 Aug 2023 17:38:25 +0200 Subject: [PATCH v4 03/10] interconnect: qcom: icc-rpm: Let nodes drive their own bus clock MIME-Version: 1.0 Message-Id: <20230726-topic-icc_coeff-v4-3-c04b60caa467@linaro.org> References: <20230726-topic-icc_coeff-v4-0-c04b60caa467@linaro.org> In-Reply-To: <20230726-topic-icc_coeff-v4-0-c04b60caa467@linaro.org> To: Andy Gross , Bjorn Andersson , Georgi Djakov , Michael Turquette , Stephen Boyd Cc: Marijn Suijten , linux-arm-msm@vger.kernel.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-clk@vger.kernel.org, Konrad Dybcio X-Mailer: b4 0.12.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1692977905; l=3339; i=konrad.dybcio@linaro.org; s=20230215; h=from:subject:message-id; bh=4w553Q1VyjmZbXhLcbPL02QrXrtQUKMzjob+n5kf8OI=; b=X30m0M4CuX9fVT307N4gHheamTK9uxJOwTbdsUU/aQx6NMV/7J4tTA+NGSFueEagqw7l7tP7B UcZGiZMAngCAwR43lQrTJZhuhVIejoHDN2tO5jC+FzUTSr4CMJWHXzP X-Developer-Key: i=konrad.dybcio@linaro.org; a=ed25519; pk=iclgkYvtl2w05SSXO5EjjSYlhFKsJ+5OSZBjOkQuEms= Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org If this hardware couldn't get messier, some nodes are supposed to drive their own bus clock.. Presumably to connect to some intermediate interface between the node itself and the bus it's (supposed to be) connected to. Expand the node struct with the necessary data and hook up the allocations & calculations. Note that the node-specific AB/IB coefficients contribute (by design) to both the node-level and the bus-level aggregation. Signed-off-by: Konrad Dybcio --- drivers/interconnect/qcom/icc-rpm.c | 27 +++++++++++++++++++++++++++ drivers/interconnect/qcom/icc-rpm.h | 4 ++++ 2 files changed, 31 insertions(+) diff --git a/drivers/interconnect/qcom/icc-rpm.c b/drivers/interconnect/qcom/icc-rpm.c index 8c1bfd65d774..1d3af4e9ead8 100644 --- a/drivers/interconnect/qcom/icc-rpm.c +++ b/drivers/interconnect/qcom/icc-rpm.c @@ -414,6 +414,33 @@ static int qcom_icc_set(struct icc_node *src, struct icc_node *dst) qp->bus_clk_rate[QCOM_SMD_RPM_SLEEP_STATE] = sleep_rate; } + /* Handle the node-specific clock */ + if (!src_qn->bus_clk_desc) + return 0; + + active_rate = qcom_icc_calc_rate(qp, src_qn, QCOM_SMD_RPM_ACTIVE_STATE); + sleep_rate = qcom_icc_calc_rate(qp, src_qn, QCOM_SMD_RPM_SLEEP_STATE); + + if (active_rate != src_qn->bus_clk_rate[QCOM_SMD_RPM_ACTIVE_STATE]) { + ret = qcom_icc_rpm_set_bus_rate(src_qn->bus_clk_desc, QCOM_SMD_RPM_ACTIVE_STATE, + active_rate); + if (ret) + return ret; + + /* Cache the rate after we've successfully committed it to RPM */ + src_qn->bus_clk_rate[QCOM_SMD_RPM_ACTIVE_STATE] = active_rate; + } + + if (sleep_rate != src_qn->bus_clk_rate[QCOM_SMD_RPM_SLEEP_STATE]) { + ret = qcom_icc_rpm_set_bus_rate(src_qn->bus_clk_desc, QCOM_SMD_RPM_SLEEP_STATE, + sleep_rate); + if (ret) + return ret; + + /* Cache the rate after we've successfully committed it to RPM */ + src_qn->bus_clk_rate[QCOM_SMD_RPM_SLEEP_STATE] = sleep_rate; + } + return 0; } diff --git a/drivers/interconnect/qcom/icc-rpm.h b/drivers/interconnect/qcom/icc-rpm.h index 5e7d6a4fd2f3..725e0d4840e4 100644 --- a/drivers/interconnect/qcom/icc-rpm.h +++ b/drivers/interconnect/qcom/icc-rpm.h @@ -97,11 +97,13 @@ struct qcom_icc_qos { * @num_links: the total number of @links * @channels: number of channels at this node (e.g. DDR channels) * @buswidth: width of the interconnect between a node and the bus (bytes) + * @bus_clk_desc: a pointer to a rpm_clk_resource description of bus clocks * @sum_avg: current sum aggregate value of all avg bw requests * @max_peak: current max aggregate value of all peak bw requests * @mas_rpm_id: RPM id for devices that are bus masters * @slv_rpm_id: RPM id for devices that are bus slaves * @qos: NoC QoS setting parameters + * @bus_clk_rate: a pointer to an array containing bus clock rates in Hz */ struct qcom_icc_node { unsigned char *name; @@ -110,11 +112,13 @@ struct qcom_icc_node { u16 num_links; u16 channels; u16 buswidth; + const struct rpm_clk_resource *bus_clk_desc; u64 sum_avg[QCOM_SMD_RPM_STATE_NUM]; u64 max_peak[QCOM_SMD_RPM_STATE_NUM]; int mas_rpm_id; int slv_rpm_id; struct qcom_icc_qos qos; + u32 bus_clk_rate[QCOM_SMD_RPM_STATE_NUM]; }; struct qcom_icc_desc { From patchwork Fri Aug 25 15:38:26 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Konrad Dybcio X-Patchwork-Id: 716926 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9BEC7C71133 for ; Fri, 25 Aug 2023 15:39:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243238AbjHYPi5 (ORCPT ); Fri, 25 Aug 2023 11:38:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54676 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245487AbjHYPih (ORCPT ); Fri, 25 Aug 2023 11:38:37 -0400 Received: from mail-lf1-x12c.google.com (mail-lf1-x12c.google.com [IPv6:2a00:1450:4864:20::12c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BC111268F for ; Fri, 25 Aug 2023 08:38:32 -0700 (PDT) Received: by mail-lf1-x12c.google.com with SMTP id 2adb3069b0e04-5007c8308c3so1657073e87.0 for ; Fri, 25 Aug 2023 08:38:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1692977911; x=1693582711; 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=dcjcwisDXlg84xv+ldq2FQJTTOumDjlAQbIhasmseG4=; b=wv+7VD7h2I9Bwxo458SiQOktW0QIFDltt4/vn/kw/WblRcP546HD1eUSnOPwYZvG32 XOFrvCIt4w/j2VcN06RNHJc2lSHRw+U+OoVQHzTR959o9GywnADT+Nq/bc2SHeBGRPvA +mXTIbVYQ++57pQ3bPAcQKuGMXZU2PH8MN+R1xdBAS2kldiQcz73OYsEdblj35OUZB5K MJzsN9Jr/gAOKxGXcrJOfrDQCjHaB0mDdlcV5sK/p6zCXlLdODfFWv1Qvgw6xsQl9GTF si7s0CV1doVUnrnRwgGworZenrskPpG+fVnVfSm/53HCL6bu1TbUUg1vk5nu5DnBz2Ko /iSA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692977911; x=1693582711; 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=dcjcwisDXlg84xv+ldq2FQJTTOumDjlAQbIhasmseG4=; b=dkD4s9rjDfKPMv7kEreTVzUzgaNqN4AZ1BSIzX7SsW0AXj768+mf3mzaTIEPL2LqDZ bELJliYo/dovi5VOAbUoj35wmrjtt+fYQFamez4WlfO72QY8RkVaMsmSDrpJrIsfI407 KR9X1RUg686h11M2Si4ucqhSxn6e18Kn1FWAF9TCYTsO6EOU5tS6Ca5lfzrNjNOKEATU BxS9ArBcIUTjvub6NelIAZWwVXXdev3IjmS/3OTjX59VusQWL6TLz6yupwdUtSpZ5URR KgO63MAf2LdcNHEt0tGDRnYaVxLtql6aQbrFD7rtSlBSxCKCNFrXPstNYsMIwJpqu4tf xB4Q== X-Gm-Message-State: AOJu0Yy+i7deYZwEKlvK6Atnv+CWkDipFXjiXILF7/jhYO53TtY/BPoL fJqnPMrTsjWzkOuyjpwusz0mxA== X-Google-Smtp-Source: AGHT+IE31/e3cnbPUm2oftzb5dIS9wX6shBNinidBB80qR9C1Lcug/NYghtA/1bMLAB+jx3HHMS9lA== X-Received: by 2002:ac2:4985:0:b0:4f9:51ac:41eb with SMTP id f5-20020ac24985000000b004f951ac41ebmr11172410lfl.16.1692977911150; Fri, 25 Aug 2023 08:38:31 -0700 (PDT) Received: from [192.168.1.101] (abxh59.neoplus.adsl.tpnet.pl. [83.9.1.59]) by smtp.gmail.com with ESMTPSA id y17-20020a197511000000b004fe432108absm326002lfe.182.2023.08.25.08.38.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 25 Aug 2023 08:38:30 -0700 (PDT) From: Konrad Dybcio Date: Fri, 25 Aug 2023 17:38:26 +0200 Subject: [PATCH v4 04/10] interconnect: qcom: icc-rpm: Check for node-specific rate coefficients MIME-Version: 1.0 Message-Id: <20230726-topic-icc_coeff-v4-4-c04b60caa467@linaro.org> References: <20230726-topic-icc_coeff-v4-0-c04b60caa467@linaro.org> In-Reply-To: <20230726-topic-icc_coeff-v4-0-c04b60caa467@linaro.org> To: Andy Gross , Bjorn Andersson , Georgi Djakov , Michael Turquette , Stephen Boyd Cc: Marijn Suijten , linux-arm-msm@vger.kernel.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-clk@vger.kernel.org, Konrad Dybcio X-Mailer: b4 0.12.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1692977905; l=2693; i=konrad.dybcio@linaro.org; s=20230215; h=from:subject:message-id; bh=mAeJwUiLt8a3mVMD19ZVYHlnPNRhvBX56pfF4nnsqeU=; b=fQY47HFD8x4as0tMazw1XA/kjiE7LYBWkxxqbTw7bad6rox/70IKKEhXY4I8h7i9KKBqlEIZm WQBNFTKpD3WA/tcJFgcfRNiBF4xrw+r0MvevMIO/WIhYXbDowBGEGAp X-Developer-Key: i=konrad.dybcio@linaro.org; a=ed25519; pk=iclgkYvtl2w05SSXO5EjjSYlhFKsJ+5OSZBjOkQuEms= Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Some nodes may have different coefficients than the general values for bus they're attached to. Check for that and use them if present. See [1], [2] for reference. [1] https://github.com/sonyxperiadev/kernel/commit/7456d9779af9ad6bb9c7ee6f33d5c5a8d3648e24 [2] https://github.com/artem/android_kernel_sony_msm8996/commit/bf7a8985dcaf0eab5bc2562d2d6775e7e29c0f30 Signed-off-by: Konrad Dybcio --- drivers/interconnect/qcom/icc-rpm.c | 14 ++++++++++---- drivers/interconnect/qcom/icc-rpm.h | 4 ++++ 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/drivers/interconnect/qcom/icc-rpm.c b/drivers/interconnect/qcom/icc-rpm.c index 1d3af4e9ead8..9c40314e03b5 100644 --- a/drivers/interconnect/qcom/icc-rpm.c +++ b/drivers/interconnect/qcom/icc-rpm.c @@ -300,14 +300,14 @@ static u64 qcom_icc_calc_rate(struct qcom_icc_provider *qp, struct qcom_icc_node else agg_avg_rate = qn->sum_avg[ctx]; - if (qp->ab_coeff) { - agg_avg_rate = agg_avg_rate * qp->ab_coeff; + if (qn->ab_coeff) { + agg_avg_rate = agg_avg_rate * qn->ab_coeff; agg_avg_rate = div_u64(agg_avg_rate, 100); } - if (qp->ib_coeff) { + if (qn->ib_coeff) { agg_peak_rate = qn->max_peak[ctx] * 100; - agg_peak_rate = div_u64(qn->max_peak[ctx], qp->ib_coeff); + agg_peak_rate = div_u64(qn->max_peak[ctx], qn->ib_coeff); } else { agg_peak_rate = qn->max_peak[ctx]; } @@ -563,6 +563,12 @@ int qnoc_probe(struct platform_device *pdev) for (i = 0; i < num_nodes; i++) { size_t j; + if (!qnodes[i]->ab_coeff) + qnodes[i]->ab_coeff = qp->ab_coeff; + + if (!qnodes[i]->ib_coeff) + qnodes[i]->ib_coeff = qp->ib_coeff; + node = icc_node_create(qnodes[i]->id); if (IS_ERR(node)) { ret = PTR_ERR(node); diff --git a/drivers/interconnect/qcom/icc-rpm.h b/drivers/interconnect/qcom/icc-rpm.h index 725e0d4840e4..4abf99ce2690 100644 --- a/drivers/interconnect/qcom/icc-rpm.h +++ b/drivers/interconnect/qcom/icc-rpm.h @@ -103,6 +103,8 @@ struct qcom_icc_qos { * @mas_rpm_id: RPM id for devices that are bus masters * @slv_rpm_id: RPM id for devices that are bus slaves * @qos: NoC QoS setting parameters + * @ab_coeff: a percentage-based coefficient for compensating the AB calculations + * @ib_coeff: an inverse-percentage-based coefficient for compensating the IB calculations * @bus_clk_rate: a pointer to an array containing bus clock rates in Hz */ struct qcom_icc_node { @@ -118,6 +120,8 @@ struct qcom_icc_node { int mas_rpm_id; int slv_rpm_id; struct qcom_icc_qos qos; + u16 ab_coeff; + u16 ib_coeff; u32 bus_clk_rate[QCOM_SMD_RPM_STATE_NUM]; }; From patchwork Fri Aug 25 15:38:27 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Konrad Dybcio X-Patchwork-Id: 717881 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BD35CEE49A3 for ; Fri, 25 Aug 2023 15:39:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243926AbjHYPi6 (ORCPT ); Fri, 25 Aug 2023 11:38:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54750 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343893AbjHYPik (ORCPT ); Fri, 25 Aug 2023 11:38:40 -0400 Received: from mail-lf1-x135.google.com (mail-lf1-x135.google.com [IPv6:2a00:1450:4864:20::135]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 39E5826AD for ; Fri, 25 Aug 2023 08:38:34 -0700 (PDT) Received: by mail-lf1-x135.google.com with SMTP id 2adb3069b0e04-4ffae5bdc9aso1663468e87.1 for ; Fri, 25 Aug 2023 08:38:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1692977912; x=1693582712; 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=UN2YRy5nVk/3pPVAynBwTOKMJ1RGnBnnrlQRo1bfz94=; b=Ag8oduepr8osxtNJfd1ArTVJIC0qYFDPObkAAoI+rKK6N8FWH4MVR/Vfp5gp92sxts ViJOvoXsekB/X6f3MAgrlCba5ZSpnybQAvNC60IHlx6PcWW15gFssjDnKp4Apdtis3Go h9RWzMyixvBPn+Yd2sd/wRJx2G/dVoRe4IzH+btnw+D8ETaXxn/w3sS2rZrA2zRczx35 O3HQefon9OeQt9BQ/FZ9ILJjpckOwrJkiGY2jaHq8DngLLqPtk+80JfGq14fAZwBS/wU +ONrcw46KGC4hzTeL9HXC6QKWDWFSJj5yFaTjy8wYVZrIZGpWeRyebdoGuSb9TeoZN3X vpVg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692977912; x=1693582712; 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=UN2YRy5nVk/3pPVAynBwTOKMJ1RGnBnnrlQRo1bfz94=; b=EFjZF+kXoxfSI/XMPmBHOnkS1GY4n7NRVKJ4ESJ9ts42dDcTam+uDoufoUp1jPgh2v nzmvVHmLAVXSZB0Grvm+tYO++L/zuPKbN8V6Y7yYMZfFxEWRwTccIxU1PHfONXtte5fr RrCYTGKeFBToryL6FuNXx2gg3UUDOr17YquotFdtb00DW7XfKW9RApgHDBvwg1twwKYR nZ9K3GzWLfc3eNoHz4WJvVfGO6bSOa0garllPYQjBDWNTFWX0p/Hr+ajJU1iEekgZ8V6 7AynPiUvyEzzL5PGoykycohin4wZqygmDeuh+h/FOeIMSNmwf27HMQyeiBQEKgYTtd3f FusQ== X-Gm-Message-State: AOJu0YxlXP3J16WeZStL5OkcdEiWgZulvfalq2gCJ+3kSussUnX94dDb Oc1xb00lc2jsHaQ/Qg+Zy+92gg== X-Google-Smtp-Source: AGHT+IGVMooC/n4ki8lW14Aik8eDks0F5p6RSUGvawcJIy/64vruyQQ5iSXb04VYvoNt4X0oYxY4tw== X-Received: by 2002:a05:6512:12c4:b0:4fb:9712:a717 with SMTP id p4-20020a05651212c400b004fb9712a717mr15074361lfg.13.1692977912522; Fri, 25 Aug 2023 08:38:32 -0700 (PDT) Received: from [192.168.1.101] (abxh59.neoplus.adsl.tpnet.pl. [83.9.1.59]) by smtp.gmail.com with ESMTPSA id y17-20020a197511000000b004fe432108absm326002lfe.182.2023.08.25.08.38.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 25 Aug 2023 08:38:31 -0700 (PDT) From: Konrad Dybcio Date: Fri, 25 Aug 2023 17:38:27 +0200 Subject: [PATCH v4 05/10] interconnect: qcom: qcm2290: Hook up MAS_APPS_PROC's bus clock MIME-Version: 1.0 Message-Id: <20230726-topic-icc_coeff-v4-5-c04b60caa467@linaro.org> References: <20230726-topic-icc_coeff-v4-0-c04b60caa467@linaro.org> In-Reply-To: <20230726-topic-icc_coeff-v4-0-c04b60caa467@linaro.org> To: Andy Gross , Bjorn Andersson , Georgi Djakov , Michael Turquette , Stephen Boyd Cc: Marijn Suijten , linux-arm-msm@vger.kernel.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-clk@vger.kernel.org, Konrad Dybcio X-Mailer: b4 0.12.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1692977905; l=2342; i=konrad.dybcio@linaro.org; s=20230215; h=from:subject:message-id; bh=GlL8hPLpxopE6Z6juWkr7yv0qDqrTnKLRNlPdw5/ARI=; b=nzOBRO0gupeVDvFwwhflJMN8ilm1Z/7ImveUexKVtqMrfY7vWa5H/LTxgGJtbOeV+/D8FwJFz G2IKVUTUZWnBX/zzhyP2pe9Zsk3/b5ZoIyjs+tSoSmYS0nSKlyD4Wi0 X-Developer-Key: i=konrad.dybcio@linaro.org; a=ed25519; pk=iclgkYvtl2w05SSXO5EjjSYlhFKsJ+5OSZBjOkQuEms= Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org This single node has its own clock which seems to be responsible for transactions between CPUSS (CPU + some stuff) and the GNOC. See [1] for reference. Define it and hook it up. [1] https://android.googlesource.com/kernel/msm-extra/devicetree/+/02f8c342b23c20a5cf967df649814be37a08227c%5E%21/#F0 Signed-off-by: Konrad Dybcio --- drivers/interconnect/qcom/icc-rpm-clocks.c | 6 ++++++ drivers/interconnect/qcom/icc-rpm.h | 1 + drivers/interconnect/qcom/qcm2290.c | 3 +++ 3 files changed, 10 insertions(+) diff --git a/drivers/interconnect/qcom/icc-rpm-clocks.c b/drivers/interconnect/qcom/icc-rpm-clocks.c index 63c82a91bbc7..ac1677de7dfd 100644 --- a/drivers/interconnect/qcom/icc-rpm-clocks.c +++ b/drivers/interconnect/qcom/icc-rpm-clocks.c @@ -25,6 +25,12 @@ const struct rpm_clk_resource bimc_clk = { }; EXPORT_SYMBOL_GPL(bimc_clk); +const struct rpm_clk_resource mem_1_clk = { + .resource_type = QCOM_SMD_RPM_MEM_CLK, + .clock_id = 1, +}; +EXPORT_SYMBOL_GPL(mem_1_clk); + const struct rpm_clk_resource bus_0_clk = { .resource_type = QCOM_SMD_RPM_BUS_CLK, .clock_id = 0, diff --git a/drivers/interconnect/qcom/icc-rpm.h b/drivers/interconnect/qcom/icc-rpm.h index 4abf99ce2690..a13768cfd231 100644 --- a/drivers/interconnect/qcom/icc-rpm.h +++ b/drivers/interconnect/qcom/icc-rpm.h @@ -152,6 +152,7 @@ extern const struct rpm_clk_resource bimc_clk; extern const struct rpm_clk_resource bus_0_clk; extern const struct rpm_clk_resource bus_1_clk; extern const struct rpm_clk_resource bus_2_clk; +extern const struct rpm_clk_resource mem_1_clk; extern const struct rpm_clk_resource mmaxi_0_clk; extern const struct rpm_clk_resource mmaxi_1_clk; extern const struct rpm_clk_resource qup_clk; diff --git a/drivers/interconnect/qcom/qcm2290.c b/drivers/interconnect/qcom/qcm2290.c index 5bc4b7516608..026e4c82d6d4 100644 --- a/drivers/interconnect/qcom/qcm2290.c +++ b/drivers/interconnect/qcom/qcm2290.c @@ -112,6 +112,9 @@ static struct qcom_icc_node mas_appss_proc = { .qos.qos_mode = NOC_QOS_MODE_FIXED, .qos.prio_level = 0, .qos.areq_prio = 0, + .bus_clk_desc = &mem_1_clk, + .ab_coeff = 159, + .ib_coeff = 96, .mas_rpm_id = 0, .slv_rpm_id = -1, .num_links = ARRAY_SIZE(mas_appss_proc_links), From patchwork Fri Aug 25 15:38:28 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Konrad Dybcio X-Patchwork-Id: 716925 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D4492EE49A6 for ; Fri, 25 Aug 2023 15:39:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244528AbjHYPjA (ORCPT ); Fri, 25 Aug 2023 11:39:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59280 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343898AbjHYPil (ORCPT ); Fri, 25 Aug 2023 11:38:41 -0400 Received: from mail-lf1-x12a.google.com (mail-lf1-x12a.google.com [IPv6:2a00:1450:4864:20::12a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 327E726BB for ; Fri, 25 Aug 2023 08:38:35 -0700 (PDT) Received: by mail-lf1-x12a.google.com with SMTP id 2adb3069b0e04-4fe61ae020bso1589381e87.2 for ; Fri, 25 Aug 2023 08:38:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1692977913; x=1693582713; 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=gMSCeQq+U/vd11NjyVrj4R2ylX9PoMYtwDoMYa3Rm8Y=; b=bGXhmKbu6qMXbPm775Q8scMcejoAdFvHX4YzW8UBOqXw/WSbgBpxw+gPZMpaITKW4+ u2ZSJWZvgIAOTsOOJ79Fbx//cpeTlyMAMAtma/mDQriRMhlPSZuhKqmqjUDHrDEHG68J rEgVBFlUA6YfRSlBRQxwS1t7gj/oNodWbnE3z2fHloRIMh8lKS/Eufcsha5+RzwqGwn5 uR5QDSYDEC5ZN6VjmyHRaheiPPBpLS5e/95pDrh0cXuSSXbuh0Ugvpd5EfzUF7xepQhF JAtPLUgwL1BMGMalzcdunWJo4ImZwt5iYtGdAOn1vu6bC3b8liuRIrSfZruNfz7CmxmQ MC+A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692977913; x=1693582713; 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=gMSCeQq+U/vd11NjyVrj4R2ylX9PoMYtwDoMYa3Rm8Y=; b=LuzC1/Cto5eNy07o+f3+Hp4Jtq0A5dzH5ZsOXvIkPpLzILebtlsSRmsngz2ZXcI2i0 C+1IE/qofgg1dXUsdz5PuIo3u6mek560uZxEGtwLXlFgrzwcTU7zwwTnxSKYNmbY/DXV 1l3kDNiC+ZrE9zZ7t3iCK1lDllPAsAm/XZSUTE2cZIksaz79qLHuyQmSz6cUuf+hxvei 5YCWT87XriaSDE6KfDFEPuUoSbZ8HjwFYmOLOJYIiTPV9U0+yLzeV2qM86P2vtfsoaGV Sop8ebVc4b7tpHd6ByUiqZNlNH+iq0IZ8C++SCJR8hKmXdLNQ/8kxAqTzPBFJhOitdYL 49Vw== X-Gm-Message-State: AOJu0YzyrcuWS+avCiqU80b/phjWEd0ZXq0p74kD7bVYZmOM+f4q9U1w 35smeuPQm0iaaetavhz0AEgrHQ== X-Google-Smtp-Source: AGHT+IH41lbtOTjRnPa3aqwfKiZCJa2eg2dWOOYiX3wbk60QmprMTvTj4pxcwmlMiRnKVg1gkS84Jg== X-Received: by 2002:a05:6512:3706:b0:4fb:820a:f87f with SMTP id z6-20020a056512370600b004fb820af87fmr12756547lfr.10.1692977913567; Fri, 25 Aug 2023 08:38:33 -0700 (PDT) Received: from [192.168.1.101] (abxh59.neoplus.adsl.tpnet.pl. [83.9.1.59]) by smtp.gmail.com with ESMTPSA id y17-20020a197511000000b004fe432108absm326002lfe.182.2023.08.25.08.38.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 25 Aug 2023 08:38:33 -0700 (PDT) From: Konrad Dybcio Date: Fri, 25 Aug 2023 17:38:28 +0200 Subject: [PATCH v4 06/10] interconnect: qcom: qcm2290: Set AB coefficients MIME-Version: 1.0 Message-Id: <20230726-topic-icc_coeff-v4-6-c04b60caa467@linaro.org> References: <20230726-topic-icc_coeff-v4-0-c04b60caa467@linaro.org> In-Reply-To: <20230726-topic-icc_coeff-v4-0-c04b60caa467@linaro.org> To: Andy Gross , Bjorn Andersson , Georgi Djakov , Michael Turquette , Stephen Boyd Cc: Marijn Suijten , linux-arm-msm@vger.kernel.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-clk@vger.kernel.org, Konrad Dybcio X-Mailer: b4 0.12.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1692977905; l=1293; i=konrad.dybcio@linaro.org; s=20230215; h=from:subject:message-id; bh=aFY/90aKNDx1nzjcFFL7/POIPB/o+2FqU9SnuM8+AC0=; b=l8uD5o/GnikDkg+xmGJbXq5fumoWL7jXS+VePD3K+ELdHkIxpkriVq0oYa1n1fwtbATyJpSWP YMPbWwl2u3JBX6Z4qC5SRDdeY9MkyqFgKpeN31HZezkaoADlkgvmQ3C X-Developer-Key: i=konrad.dybcio@linaro.org; a=ed25519; pk=iclgkYvtl2w05SSXO5EjjSYlhFKsJ+5OSZBjOkQuEms= Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Some buses need additional manual adjustments atop the usual calculations. Fill in the missing coefficients. Signed-off-by: Konrad Dybcio --- drivers/interconnect/qcom/qcm2290.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/interconnect/qcom/qcm2290.c b/drivers/interconnect/qcom/qcm2290.c index 026e4c82d6d4..7abc0c449220 100644 --- a/drivers/interconnect/qcom/qcm2290.c +++ b/drivers/interconnect/qcom/qcm2290.c @@ -1202,6 +1202,7 @@ static const struct qcom_icc_desc qcm2290_bimc = { .keep_alive = true, /* M_REG_BASE() in vendor msm_bus_bimc_adhoc driver */ .qos_offset = 0x8000, + .ab_coeff = 153, }; static struct qcom_icc_node * const qcm2290_cnoc_nodes[] = { @@ -1332,6 +1333,7 @@ static const struct qcom_icc_desc qcm2290_mmnrt_virt = { .regmap_cfg = &qcm2290_snoc_regmap_config, .keep_alive = true, .qos_offset = 0x15000, + .ab_coeff = 142, }; static struct qcom_icc_node * const qcm2290_mmrt_virt_nodes[] = { @@ -1348,6 +1350,7 @@ static const struct qcom_icc_desc qcm2290_mmrt_virt = { .regmap_cfg = &qcm2290_snoc_regmap_config, .keep_alive = true, .qos_offset = 0x15000, + .ab_coeff = 139, }; static const struct of_device_id qcm2290_noc_of_match[] = { From patchwork Fri Aug 25 15:38:29 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Konrad Dybcio X-Patchwork-Id: 716922 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C6ED0C7BC22 for ; Fri, 25 Aug 2023 15:39:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343923AbjHYPjD (ORCPT ); Fri, 25 Aug 2023 11:39:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59308 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343902AbjHYPin (ORCPT ); Fri, 25 Aug 2023 11:38:43 -0400 Received: from mail-lf1-x12a.google.com (mail-lf1-x12a.google.com [IPv6:2a00:1450:4864:20::12a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 547A22701 for ; Fri, 25 Aug 2023 08:38:36 -0700 (PDT) Received: by mail-lf1-x12a.google.com with SMTP id 2adb3069b0e04-500aed06ffcso51313e87.0 for ; Fri, 25 Aug 2023 08:38:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1692977914; x=1693582714; 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=azTsgBM86+GM9sSp42BUI1s8412oPMCgpH7RHDGWmLw=; b=i9hivS1oUlHEda/POH/lLTO9SB2ZhHbDNnbg9QGKhCuzidjynDn7kYqQQRBMaxOFFp 44uWmeDTl6fjdqvRQ9gsaWdTm8XNWalwNkS9r4rg05ZYYC/jv9bU6H9K2HzYQjQQtJgS afRJ+OnwYDKKMAB6L4Z92+/O4+GjJGdSQ40ch6PnofT0m06GKweUPvO1VO8IReYIbzsw 0tioSrBGuNjiiWIso/1D1wbkEtDRjD3l0rMBgt7mTGNZzUSMYi1mnpOIFsxMEyLTNYCG MIx526z7krjhugm6JNLDxJUWTrWLUFtuFnbAHEZR1imRge2DklUzNNPcfOKte0c1GuL0 1aiQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692977914; x=1693582714; 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=azTsgBM86+GM9sSp42BUI1s8412oPMCgpH7RHDGWmLw=; b=DN5k45s7shGBqwAtSAV+QS4+vYq4d0+ExHWJoC0T6xLJ64VKTzXnbCVntsLJl/l0tO b3O7C0zz2n07WcKodwLYielfQsQ2GlqLd4CISA6gYki/CQqXabn4YBKrkphVeiMSOik4 ArjQBVKgwFY/jr7ujoCl6DknDGlhxrKxWOtvFO6q/FSd6ApS8yXKNseQfkB8jNwSLP/z qzrZSo02ZKDhvPJUYL7JSBXSqBN4TNjPYdTUr5fhOQ2yfokFZorLio21firg4bwwz6sy 3IB4IklzEx6XywrMYFsKSkzJXeA4lWR7nU18RznOfeh/A5+guhKrx6hjBrlkZvBXUrOC QMUA== X-Gm-Message-State: AOJu0Ywf6drDuhkTnAGCZq0xJxhd87e6oEPoe4NtlqaBnk1F6Gs+5hWU YVFUYtZqsH2gXXHJ+f1a9aKhOA== X-Google-Smtp-Source: AGHT+IFpC7f2GKEeP17lWZafcyaLyk7hJMxrz3ESx1Rz4tEHInZrUawfmikVewSTSsESxFiozjT9kw== X-Received: by 2002:a19:6d1c:0:b0:4fd:c83b:a093 with SMTP id i28-20020a196d1c000000b004fdc83ba093mr11919849lfc.1.1692977914620; Fri, 25 Aug 2023 08:38:34 -0700 (PDT) Received: from [192.168.1.101] (abxh59.neoplus.adsl.tpnet.pl. [83.9.1.59]) by smtp.gmail.com with ESMTPSA id y17-20020a197511000000b004fe432108absm326002lfe.182.2023.08.25.08.38.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 25 Aug 2023 08:38:34 -0700 (PDT) From: Konrad Dybcio Date: Fri, 25 Aug 2023 17:38:29 +0200 Subject: [PATCH v4 07/10] interconnect: qcom: qcm2290: Update EBI channel configuration MIME-Version: 1.0 Message-Id: <20230726-topic-icc_coeff-v4-7-c04b60caa467@linaro.org> References: <20230726-topic-icc_coeff-v4-0-c04b60caa467@linaro.org> In-Reply-To: <20230726-topic-icc_coeff-v4-0-c04b60caa467@linaro.org> To: Andy Gross , Bjorn Andersson , Georgi Djakov , Michael Turquette , Stephen Boyd Cc: Marijn Suijten , linux-arm-msm@vger.kernel.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-clk@vger.kernel.org, Konrad Dybcio X-Mailer: b4 0.12.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1692977905; l=1320; i=konrad.dybcio@linaro.org; s=20230215; h=from:subject:message-id; bh=Y3uMer9xOocejP5QFGPjFGimfPx5QRm0vyhaJFgmIts=; b=J8kGgkMIcFdUnllOtWiO18kvfFZhO5gtE0bKmGCVA2lUur90VBvqeYmMaLqgPp1SMjC6rXJ11 XPwIZ5sMI2kDjabqVKuJ0Zql/RyizxHLEPqngv7zBQ1Mdg4FxI8tYEK X-Developer-Key: i=konrad.dybcio@linaro.org; a=ed25519; pk=iclgkYvtl2w05SSXO5EjjSYlhFKsJ+5OSZBjOkQuEms= Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org QCM2290 can support two memory configurations: single-channel, 32-bit wide LPDDR3 @ up to 933MHz (bus clock) or dual-channel, 16-bit wide LPDDR4X @ up to 1804 MHz. The interconnect driver in its current form seems to gravitate towards the first one, however there are no LPDDR3- equipped boards upstream and we still don't have a great way to discern the DDR generations on the kernel side. To make DDR scaling possible on the only currently-supported 2290 board, stick with the LPDDR4X config by default. The side effect on any potential LPDDR3 board would be that the requested bus clock rate is too high (but still capped to the firmware-configured FMAX). Signed-off-by: Konrad Dybcio --- drivers/interconnect/qcom/qcm2290.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/interconnect/qcom/qcm2290.c b/drivers/interconnect/qcom/qcm2290.c index 7abc0c449220..b88cf9a022e0 100644 --- a/drivers/interconnect/qcom/qcm2290.c +++ b/drivers/interconnect/qcom/qcm2290.c @@ -678,7 +678,8 @@ static struct qcom_icc_node mas_gfx3d = { static struct qcom_icc_node slv_ebi1 = { .name = "slv_ebi1", .id = QCM2290_SLAVE_EBI1, - .buswidth = 8, + .buswidth = 4, + .channels = 2, .mas_rpm_id = -1, .slv_rpm_id = 0, }; From patchwork Fri Aug 25 15:38:30 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Konrad Dybcio X-Patchwork-Id: 717877 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id F260CC7BC23 for ; Fri, 25 Aug 2023 15:39:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343919AbjHYPjD (ORCPT ); Fri, 25 Aug 2023 11:39:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59432 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343917AbjHYPiq (ORCPT ); Fri, 25 Aug 2023 11:38:46 -0400 Received: from mail-lf1-x12f.google.com (mail-lf1-x12f.google.com [IPv6:2a00:1450:4864:20::12f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5AEDC270D for ; Fri, 25 Aug 2023 08:38:37 -0700 (PDT) Received: by mail-lf1-x12f.google.com with SMTP id 2adb3069b0e04-4ff9abf18f9so1652478e87.2 for ; Fri, 25 Aug 2023 08:38:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1692977915; x=1693582715; 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=oTsJupvOxpa/fLz2jUo4zGYaUoVq8SU+eirkqgzntY0=; b=JxKRFQr5rwgjz3y2OlZPJDLs3znQsFi3JjJ2VGH2LRvqthq0oSB1fTuE/dWZvQnp45 3nvhJoqptG2xSfH92KEcvneRXMY2YmwShhJwW4zr3DEp8Tdkq0Q3chF1kPxxA2DkStrY lIXpQVf1ZjypJERrcU7plMnt6hlT6mtp9sdg2X2/O3DxMX756FShU1vRGSQKEVfCjyK8 2akYLrJJgfy1xFh2f15j7M2BLm/ueSPxiZicUUKU/fCOjsjxo221Fu04mK6ThLA3tuvM zqMFolHG4LlY/jQFPqwcg//sf5oR6ywR+soy1d34CA2sd1O+U0XioY5EDvitei6h4Iqw WZWQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692977915; x=1693582715; 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=oTsJupvOxpa/fLz2jUo4zGYaUoVq8SU+eirkqgzntY0=; b=f0ekmeB37fdmUA38oYdCqA/RVZRS3OwU6ePhq2/8GNeKWIMdErkk+tZ6JNlJO8SsnE n6ue5nk1VQQUvfOVXGuVWQ5GIK14X3dLsw9JnTRqGMAC/k0MP5m1UsGk6ZNL/1NvSDdt WdY2Ohy3orcRJ0RVWIn6I7CerKS6J8PjbX3E7TogaRnqlRgdGIg9zGPx1IHO5Sn5ECy5 hWk42YpwMHt/R+hwhSKm8It9wwPY3xVIgF5BTIKuav+NoxiQ4d4ZTlas0gJnWD90PwP/ T0GBSVpmNet4PpTb9bnoqnfW6ZtL3Y1nOJTsraxOwrkk6kUKiCV0gZbYcNj34bo5rbpV a92w== X-Gm-Message-State: AOJu0YzwOOBs+H8Rv4mzQG1Ql9/VsmnIYAtThyQ/xDiUr7WQrmNlIeGw 2285QkCP7M+AZa12uuM7miYLJw== X-Google-Smtp-Source: AGHT+IG+gm97orJLlW4xUxKCU9QvvOPMQ8WhucMASc4t7eCwYPa11tM1zcKrousEw5P/dQj6MXSLAw== X-Received: by 2002:ac2:4e95:0:b0:500:7dcc:621 with SMTP id o21-20020ac24e95000000b005007dcc0621mr9931027lfr.31.1692977915744; Fri, 25 Aug 2023 08:38:35 -0700 (PDT) Received: from [192.168.1.101] (abxh59.neoplus.adsl.tpnet.pl. [83.9.1.59]) by smtp.gmail.com with ESMTPSA id y17-20020a197511000000b004fe432108absm326002lfe.182.2023.08.25.08.38.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 25 Aug 2023 08:38:35 -0700 (PDT) From: Konrad Dybcio Date: Fri, 25 Aug 2023 17:38:30 +0200 Subject: [PATCH v4 08/10] interconnect: qcom: sdm660: Set AB/IB coefficients MIME-Version: 1.0 Message-Id: <20230726-topic-icc_coeff-v4-8-c04b60caa467@linaro.org> References: <20230726-topic-icc_coeff-v4-0-c04b60caa467@linaro.org> In-Reply-To: <20230726-topic-icc_coeff-v4-0-c04b60caa467@linaro.org> To: Andy Gross , Bjorn Andersson , Georgi Djakov , Michael Turquette , Stephen Boyd Cc: Marijn Suijten , linux-arm-msm@vger.kernel.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-clk@vger.kernel.org, Konrad Dybcio X-Mailer: b4 0.12.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1692977905; l=1519; i=konrad.dybcio@linaro.org; s=20230215; h=from:subject:message-id; bh=k/Cm9gmYXz5bp/vBXbZFWoKJc7XFdBGSN+LYtJyOew0=; b=Ii8HGcg6M0stWaaKslOhXJsc+X1cpC/nf/E53SdNuEDOoB50xUzQYYLhysV9fSLTzDrdo4eM+ 9uabXi/Xcp3D20BAK4H7hTV4T2mh8GCJJKnsQfy1kpQ9O8mryY+/16b X-Developer-Key: i=konrad.dybcio@linaro.org; a=ed25519; pk=iclgkYvtl2w05SSXO5EjjSYlhFKsJ+5OSZBjOkQuEms= Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Some buses and nodes need additional manual adjustments atop the usual calculations. Fill in the missing coefficients. Signed-off-by: Konrad Dybcio --- drivers/interconnect/qcom/sdm660.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/interconnect/qcom/sdm660.c b/drivers/interconnect/qcom/sdm660.c index 36962f7bd7bb..7392bebba334 100644 --- a/drivers/interconnect/qcom/sdm660.c +++ b/drivers/interconnect/qcom/sdm660.c @@ -602,6 +602,7 @@ static struct qcom_icc_node mas_mdp_p0 = { .name = "mas_mdp_p0", .id = SDM660_MASTER_MDP_P0, .buswidth = 16, + .ib_coeff = 50, .mas_rpm_id = 8, .slv_rpm_id = -1, .qos.ap_owned = true, @@ -621,6 +622,7 @@ static struct qcom_icc_node mas_mdp_p1 = { .name = "mas_mdp_p1", .id = SDM660_MASTER_MDP_P1, .buswidth = 16, + .ib_coeff = 50, .mas_rpm_id = 61, .slv_rpm_id = -1, .qos.ap_owned = true, @@ -1540,6 +1542,7 @@ static const struct qcom_icc_desc sdm660_bimc = { .num_nodes = ARRAY_SIZE(sdm660_bimc_nodes), .bus_clk_desc = &bimc_clk, .regmap_cfg = &sdm660_bimc_regmap_config, + .ab_coeff = 153, }; static struct qcom_icc_node * const sdm660_cnoc_nodes[] = { @@ -1659,6 +1662,7 @@ static const struct qcom_icc_desc sdm660_mnoc = { .intf_clocks = mm_intf_clocks, .num_intf_clocks = ARRAY_SIZE(mm_intf_clocks), .regmap_cfg = &sdm660_mnoc_regmap_config, + .ab_coeff = 153, }; static struct qcom_icc_node * const sdm660_snoc_nodes[] = { From patchwork Fri Aug 25 15:38:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Konrad Dybcio X-Patchwork-Id: 717882 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 75F03C3DA6F for ; Fri, 25 Aug 2023 15:39:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243344AbjHYPi5 (ORCPT ); Fri, 25 Aug 2023 11:38:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59472 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343928AbjHYPir (ORCPT ); Fri, 25 Aug 2023 11:38:47 -0400 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 958A926A1 for ; Fri, 25 Aug 2023 08:38:38 -0700 (PDT) Received: by mail-lf1-x132.google.com with SMTP id 2adb3069b0e04-4ff9abf18f9so1652511e87.2 for ; Fri, 25 Aug 2023 08:38:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1692977917; x=1693582717; 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=yiZENdL6t9VEM6eAL38ECOvrFwxXjTQK1S+ZGsAEBlQ=; b=Fp+8EHZfqbz8xMhsp71HyfyfrWrsLV6a4fh9+tgs4iQCS3qAMKzu3r/2Ulct5MJNuA +/dWnhDbwDk5tTA5dnStQP3n84O0fB/4vuW0XqT9H1Rq13MHNll/eM+k+MXn7qSC1nJG 53uB85uplDbtaT1W/Ojj3pyBa/Jr0Llq1gHIC4EV826trj1iYbHUBRjKHVTpqPReNDii FheD962F6m721rwOTrnmBbr38CirslprwQAsDZJTnfWfdL3gWVnRUEWCnlMoKbsnoIhl XDuFq//TZ2MNAdVGMej8u3uWDly5aaTbTqK1B5lS7Eqi06dURqXc3IUAdeIml0ZueXK5 oO2A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692977917; x=1693582717; 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=yiZENdL6t9VEM6eAL38ECOvrFwxXjTQK1S+ZGsAEBlQ=; b=caeDDkRfduaMlklCHHfH+/lk5W4QuUvRu/d4a9cToopGir0HE6lGvhV/mD3hDRkuHR rP8FvkJMMqb8OANvrArik8KlOzPmnFc7i4qICmFRvV5qefHFP7u6RYudtP+2RRZEPWOe h1V3D6hTiQYiBVFyumcR1wbcFDyF85u/vG40bpDvw6ldOWAI19vOooFj/i09NsNFC0ZP 8ua5foIi5WPdc1tfLtiSgHA+EB+6nowizuk7aP1fNx3n3OdmU+kiG1GD6HoG93+bs9+a XP0TX2CfRoZ+OBeP4rvMOCEL9Yhf814aJ/VjwhPCDID4aCuEpR/ovr/r3Ts+LV7HDe6h hOjw== X-Gm-Message-State: AOJu0YwO2r80X7VaUXlvKGdsy36L86UN9/yAL5b9ckntHf4K99N0Zse8 72xba3x/3QOEIw3ZgVnhuDKPyQ== X-Google-Smtp-Source: AGHT+IHgvbNgd/z7RmMgRHy4tYPVXlvxPZk9qUYWcaklbmHdT70adu20BDaNu8UMdLGsOqKXh70UBA== X-Received: by 2002:a05:6512:a94:b0:4fe:c4e:709f with SMTP id m20-20020a0565120a9400b004fe0c4e709fmr16313758lfu.20.1692977916991; Fri, 25 Aug 2023 08:38:36 -0700 (PDT) Received: from [192.168.1.101] (abxh59.neoplus.adsl.tpnet.pl. [83.9.1.59]) by smtp.gmail.com with ESMTPSA id y17-20020a197511000000b004fe432108absm326002lfe.182.2023.08.25.08.38.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 25 Aug 2023 08:38:36 -0700 (PDT) From: Konrad Dybcio Date: Fri, 25 Aug 2023 17:38:31 +0200 Subject: [PATCH v4 09/10] interconnect: qcom: msm8996: Set AB/IB coefficients MIME-Version: 1.0 Message-Id: <20230726-topic-icc_coeff-v4-9-c04b60caa467@linaro.org> References: <20230726-topic-icc_coeff-v4-0-c04b60caa467@linaro.org> In-Reply-To: <20230726-topic-icc_coeff-v4-0-c04b60caa467@linaro.org> To: Andy Gross , Bjorn Andersson , Georgi Djakov , Michael Turquette , Stephen Boyd Cc: Marijn Suijten , linux-arm-msm@vger.kernel.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-clk@vger.kernel.org, Konrad Dybcio X-Mailer: b4 0.12.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1692977905; l=1682; i=konrad.dybcio@linaro.org; s=20230215; h=from:subject:message-id; bh=SdQeJUatGaAH+ZYrspx7Qreq3n6DZHgEM2odYauRg7s=; b=bdk73CBuWAS1tNrDhRP36Vyq/v2nzE4DhHI2/O3H64qS1n5nYYTyfC3YEEG37P5XRKwQtT54M 0c1XxojsuJfArVRhD7dZaVj7joG1trZlxlHZzK1FIIdlImZ4kX18Q4+ X-Developer-Key: i=konrad.dybcio@linaro.org; a=ed25519; pk=iclgkYvtl2w05SSXO5EjjSYlhFKsJ+5OSZBjOkQuEms= Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Some buses and nodes need additional manual adjustments atop the usual calculations. Fill in the missing coefficients. Signed-off-by: Konrad Dybcio --- drivers/interconnect/qcom/msm8996.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/interconnect/qcom/msm8996.c b/drivers/interconnect/qcom/msm8996.c index 88683dfa468f..b73566c9b21f 100644 --- a/drivers/interconnect/qcom/msm8996.c +++ b/drivers/interconnect/qcom/msm8996.c @@ -448,6 +448,7 @@ static struct qcom_icc_node mas_mdp_p0 = { .name = "mas_mdp_p0", .id = MSM8996_MASTER_MDP_PORT0, .buswidth = 32, + .ib_coeff = 25, .mas_rpm_id = 8, .slv_rpm_id = -1, .qos.ap_owned = true, @@ -463,6 +464,7 @@ static struct qcom_icc_node mas_mdp_p1 = { .name = "mas_mdp_p1", .id = MSM8996_MASTER_MDP_PORT1, .buswidth = 32, + .ib_coeff = 25, .mas_rpm_id = 61, .slv_rpm_id = -1, .qos.ap_owned = true, @@ -1889,7 +1891,8 @@ static const struct qcom_icc_desc msm8996_bimc = { .nodes = bimc_nodes, .num_nodes = ARRAY_SIZE(bimc_nodes), .bus_clk_desc = &bimc_clk, - .regmap_cfg = &msm8996_bimc_regmap_config + .regmap_cfg = &msm8996_bimc_regmap_config, + .ab_coeff = 154, }; static struct qcom_icc_node * const cnoc_nodes[] = { @@ -2004,7 +2007,8 @@ static const struct qcom_icc_desc msm8996_mnoc = { .bus_clk_desc = &mmaxi_0_clk, .intf_clocks = mm_intf_clocks, .num_intf_clocks = ARRAY_SIZE(mm_intf_clocks), - .regmap_cfg = &msm8996_mnoc_regmap_config + .regmap_cfg = &msm8996_mnoc_regmap_config, + .ab_coeff = 154, }; static struct qcom_icc_node * const pnoc_nodes[] = { From patchwork Fri Aug 25 15:38:32 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Konrad Dybcio X-Patchwork-Id: 716924 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6FCEFEE49B7 for ; Fri, 25 Aug 2023 15:39:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343893AbjHYPjB (ORCPT ); Fri, 25 Aug 2023 11:39:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59546 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343936AbjHYPit (ORCPT ); Fri, 25 Aug 2023 11:38:49 -0400 Received: from mail-lf1-x131.google.com (mail-lf1-x131.google.com [IPv6:2a00:1450:4864:20::131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 06D4926A8 for ; Fri, 25 Aug 2023 08:38:40 -0700 (PDT) Received: by mail-lf1-x131.google.com with SMTP id 2adb3069b0e04-4fe61ae020bso1589519e87.2 for ; Fri, 25 Aug 2023 08:38:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1692977918; x=1693582718; 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=vJY9igvv29s/2ZAufEy7n6/wB5s/2TDnBd7ycBc9ECA=; b=M1fIp6tUYMwcgIdgVQ/9NtMrqbPki3FKGT66kq83HlqNZT7yDF4qvM5W/auZgzwrJq XMSw+k+eEny3oNGB53VUrp10iXIn8HqaNsRDrPlGM3mGiL/x92RRFQCQvf78MjuvIhOX 91tvzsuGTz+/oKe8gzs5PgGxWD+I6Sq29NZ+UIbTRObZwoOwHsoiQoa4D2GpkCwcZa3F W28Lju+8mOPdHfMOMI0CXGxILOEhCjZ/EG0bCghoMv3bZvDUG8O0QlF0O0UXkRg6Dq2y JrhkiWT0HGTFNkz0GINg80ppi2ME1p9B+Gi9Q8CEy1jilGfXHrGQroY6AkuwLY9MgTYc QjDg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692977918; x=1693582718; 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=vJY9igvv29s/2ZAufEy7n6/wB5s/2TDnBd7ycBc9ECA=; b=PoX0W28kCSViw6YboHQwvAf05/cz44v2Nd6TFdaRNywvH7FuMNYJfuZeCF6zIZNUhT FZv09q+XVtZV6cGU/tlb8WoXB8iumm8rE7xpjRFzCWi3DpACQQ2iTheToVUiq7M+4Vwg 1WdAp3zzXdlSAoDl538RzTPYYVEsMVTvKTXMQaEplsSbdV7wsmPz4GdOpIGiLghL0N6H UmKp7toZfD92xymfFTz6X/XYhEKKgRO2Ug59PaaQOhNspwJuGmuegYgMOvqgkObghL5k R4vYQ3z2Oe9gD5AMvSH9GuqQet6A/kdfdKffHsMhgtZyBlSjB9VRj7n/3o2hTxzPqgps IZow== X-Gm-Message-State: AOJu0YyBHKQiNoMZRc2AokKwxzBBzoi5pmsjF3bINxcMN08osiKTw5AQ 0alJOhltDdfE3woIGvo5CYXPBg== X-Google-Smtp-Source: AGHT+IHWFphSWAlFFuMyw/5UzF7Se2TZEW85zEnhmjsNx4dreiQuZ9JdDWT7CKvB/misba8Rh2T0Kw== X-Received: by 2002:a05:6512:532:b0:4f8:ff52:93b7 with SMTP id o18-20020a056512053200b004f8ff5293b7mr13864840lfc.30.1692977918323; Fri, 25 Aug 2023 08:38:38 -0700 (PDT) Received: from [192.168.1.101] (abxh59.neoplus.adsl.tpnet.pl. [83.9.1.59]) by smtp.gmail.com with ESMTPSA id y17-20020a197511000000b004fe432108absm326002lfe.182.2023.08.25.08.38.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 25 Aug 2023 08:38:38 -0700 (PDT) From: Konrad Dybcio Date: Fri, 25 Aug 2023 17:38:32 +0200 Subject: [PATCH v4 10/10] clk: qcom: smd-rpm: Move CPUSS_GNoC clock to interconnect MIME-Version: 1.0 Message-Id: <20230726-topic-icc_coeff-v4-10-c04b60caa467@linaro.org> References: <20230726-topic-icc_coeff-v4-0-c04b60caa467@linaro.org> In-Reply-To: <20230726-topic-icc_coeff-v4-0-c04b60caa467@linaro.org> To: Andy Gross , Bjorn Andersson , Georgi Djakov , Michael Turquette , Stephen Boyd Cc: Marijn Suijten , linux-arm-msm@vger.kernel.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-clk@vger.kernel.org, Konrad Dybcio X-Mailer: b4 0.12.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1692977905; l=1855; i=konrad.dybcio@linaro.org; s=20230215; h=from:subject:message-id; bh=1hMkhZWxur5L+rhPpwUgnrX9/5Tg532/CoJi6zLeNH8=; b=MB0amdZ8IojDpftW0N18+PFf6RGXezelKkXI5Q5AX1tFcS/pZP5a10Kr/yyb3xJzwMECMk/NT VYSL59tDDYVApm86CxFYG76N36i9tt8xTTFgK7mSlLUyjPe6Vrtkwh2 X-Developer-Key: i=konrad.dybcio@linaro.org; a=ed25519; pk=iclgkYvtl2w05SSXO5EjjSYlhFKsJ+5OSZBjOkQuEms= Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org As it turns out, it's yet another interconnect bus clock. Move it there. See [1] for reference. [1] https://android.googlesource.com/kernel/msm-extra/devicetree/+/02f8c342b23c20a5cf967df649814be37a08227c%5E%21/#F0 Signed-off-by: Konrad Dybcio --- drivers/clk/qcom/clk-smd-rpm.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/drivers/clk/qcom/clk-smd-rpm.c b/drivers/clk/qcom/clk-smd-rpm.c index 0191fc0dd7da..8602c02047d0 100644 --- a/drivers/clk/qcom/clk-smd-rpm.c +++ b/drivers/clk/qcom/clk-smd-rpm.c @@ -574,6 +574,16 @@ static const struct clk_smd_rpm *sm_qnoc_icc_clks[] = { &clk_smd_rpm_bus_2_snoc_clk, }; +static const struct clk_smd_rpm *qcm2290_icc_clks[] = { + &clk_smd_rpm_bimc_clk, + &clk_smd_rpm_bus_1_cnoc_clk, + &clk_smd_rpm_mmnrt_clk, + &clk_smd_rpm_mmrt_clk, + &clk_smd_rpm_qup_clk, + &clk_smd_rpm_bus_2_snoc_clk, + &clk_smd_rpm_cpuss_gnoc_clk, +}; + static struct clk_smd_rpm *msm8909_clks[] = { [RPM_SMD_QPIC_CLK] = &clk_smd_rpm_qpic_clk, [RPM_SMD_QPIC_CLK_A] = &clk_smd_rpm_qpic_a_clk, @@ -1189,15 +1199,13 @@ static struct clk_smd_rpm *qcm2290_clks[] = { [RPM_SMD_PKA_A_CLK] = &clk_smd_rpm_pka_a_clk, [RPM_SMD_BIMC_GPU_CLK] = &clk_smd_rpm_bimc_gpu_clk, [RPM_SMD_BIMC_GPU_A_CLK] = &clk_smd_rpm_bimc_gpu_a_clk, - [RPM_SMD_CPUSS_GNOC_CLK] = &clk_smd_rpm_cpuss_gnoc_clk, - [RPM_SMD_CPUSS_GNOC_A_CLK] = &clk_smd_rpm_cpuss_gnoc_a_clk, }; static const struct rpm_smd_clk_desc rpm_clk_qcm2290 = { .clks = qcm2290_clks, .num_clks = ARRAY_SIZE(qcm2290_clks), - .icc_clks = sm_qnoc_icc_clks, - .num_icc_clks = ARRAY_SIZE(sm_qnoc_icc_clks) + .icc_clks = qcm2290_icc_clks, + .num_icc_clks = ARRAY_SIZE(qcm2290_icc_clks) }; static const struct of_device_id rpm_smd_clk_match_table[] = {