All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stephan Gerhold <stephan@gerhold.net>
To: Konrad Dybcio <konrad.dybcio@linaro.org>
Cc: Andy Gross <agross@kernel.org>,
	Bjorn Andersson <andersson@kernel.org>,
	Georgi Djakov <djakov@kernel.org>,
	Michael Turquette <mturquette@baylibre.com>,
	Stephen Boyd <sboyd@kernel.org>,
	Marijn Suijten <marijn.suijten@somainline.org>,
	linux-arm-msm@vger.kernel.org, linux-pm@vger.kernel.org,
	linux-kernel@vger.kernel.org, linux-clk@vger.kernel.org
Subject: Re: [PATCH v3 04/10] interconnect: qcom: icc-rpm: Check for node-specific rate coefficients
Date: Thu, 10 Aug 2023 09:26:21 +0200	[thread overview]
Message-ID: <ZNSRHVC8Ay5YSLQi@gerhold.net> (raw)
In-Reply-To: <20230726-topic-icc_coeff-v3-4-dee684d6cdd2@linaro.org>

On Tue, Aug 08, 2023 at 01:43:35PM +0200, Konrad Dybcio wrote:
> 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 <konrad.dybcio@linaro.org>
> ---
>  drivers/interconnect/qcom/icc-rpm.c | 14 ++++++++++----
>  drivers/interconnect/qcom/icc-rpm.h |  5 +++++
>  2 files changed, 15 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 f9ef16f570be..4abf99ce2690 100644
> --- a/drivers/interconnect/qcom/icc-rpm.h
> +++ b/drivers/interconnect/qcom/icc-rpm.h
> @@ -103,6 +103,9 @@ 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

Nitpick: The doc comment needs to be moved to the earlier patch as well. :)

>   */
>  struct qcom_icc_node {
>  	unsigned char *name;
> @@ -117,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];
>  };
>  
> 
> -- 
> 2.41.0
> 

  reply	other threads:[~2023-08-10  7:26 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-08 11:43 [PATCH v3 00/10] Fix up icc clock rate calculation on some platforms Konrad Dybcio
2023-08-08 11:43 ` [PATCH v3 01/10] interconnect: qcom: icc-rpm: Add AB/IB calculations coefficients Konrad Dybcio
2023-08-08 11:43 ` [PATCH v3 02/10] interconnect: qcom: icc-rpm: Separate out clock rate calulcations Konrad Dybcio
2023-08-08 11:43 ` [PATCH v3 03/10] interconnect: qcom: icc-rpm: Let nodes drive their own bus clock Konrad Dybcio
2023-08-08 11:43 ` [PATCH v3 04/10] interconnect: qcom: icc-rpm: Check for node-specific rate coefficients Konrad Dybcio
2023-08-10  7:26   ` Stephan Gerhold [this message]
2023-08-10 13:28     ` Konrad Dybcio
2023-08-08 11:43 ` [PATCH v3 05/10] interconnect: qcom: qcm2290: Hook up MAS_APPS_PROC's bus clock Konrad Dybcio
2023-08-08 11:43 ` [PATCH v3 06/10] interconnect: qcom: qcm2290: Set AB coefficients Konrad Dybcio
2023-08-08 11:43 ` [PATCH v3 07/10] interconnect: qcom: qcm2290: Update EBI channel configuration Konrad Dybcio
2023-08-08 11:43 ` [PATCH v3 08/10] interconnect: qcom: sdm660: Set AB/IB coefficients Konrad Dybcio
2023-08-08 11:43 ` [PATCH v3 09/10] interconnect: qcom: msm8996: " Konrad Dybcio
2023-08-08 11:43 ` [PATCH v3 10/10] clk: qcom: smd-rpm: Move CPUSS_GNoC clock to interconnect Konrad Dybcio

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZNSRHVC8Ay5YSLQi@gerhold.net \
    --to=stephan@gerhold.net \
    --cc=agross@kernel.org \
    --cc=andersson@kernel.org \
    --cc=djakov@kernel.org \
    --cc=konrad.dybcio@linaro.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=marijn.suijten@somainline.org \
    --cc=mturquette@baylibre.com \
    --cc=sboyd@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.