Message ID | 20230726-topic-icc_coeff-v2-0-8c91c6c76076@linaro.org |
---|---|
Headers | show |
Series | Fix up icc clock rate calculation on some platforms | expand |
On Mon, Jul 31, 2023 at 12:52:20PM +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. > > Signed-off-by: Konrad Dybcio <konrad.dybcio@linaro.org> > --- > drivers/interconnect/qcom/icc-rpm.c | 10 +++++++--- > drivers/interconnect/qcom/icc-rpm.h | 6 ++++++ > 2 files changed, 13 insertions(+), 3 deletions(-) > > diff --git a/drivers/interconnect/qcom/icc-rpm.c b/drivers/interconnect/qcom/icc-rpm.c > index f0e575c95b49..91eb428385f6 100644 > --- a/drivers/interconnect/qcom/icc-rpm.c > +++ b/drivers/interconnect/qcom/icc-rpm.c > @@ -300,11 +300,15 @@ static u64 qcom_icc_calc_rate(struct qcom_icc_provider *qp, struct qcom_icc_node > else > agg_avg_rate = qn->sum_avg[ctx]; > > - /* Check if the node has a specific coefficient first*/ > - if (qp->ab_coeff) > + /* Check if the node has a specific coefficient first */ > + if (qn->ab_coeff) > + agg_avg_rate = mult_frac(qn->ab_coeff, agg_avg_rate, 100); > + else if (qp->ab_coeff) > agg_avg_rate = mult_frac(qp->ab_coeff, agg_avg_rate, 100); > > - if (qp->ib_coeff) > + if (qn->ab_coeff) > + agg_peak_rate = mult_frac(100, qn->max_peak[ctx], qn->ib_coeff); > + else if (qp->ib_coeff) > agg_peak_rate = mult_frac(100, qn->max_peak[ctx], qp->ib_coeff); > else > agg_peak_rate = qn->max_peak[ctx]; Code/data size and likely performance would be slightly better if you only add ab_coeff/ib_coeff to the node and not the provider. This is slightly inconvenient because you need to duplicate the same value on a lot of nodes, but the per-node memory is reserved anyway. You might as well use I would say. > diff --git a/drivers/interconnect/qcom/icc-rpm.h b/drivers/interconnect/qcom/icc-rpm.h > index 835b83cfb548..1a26a7b82166 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 > */ > struct qcom_icc_node { > unsigned char *name; > @@ -117,6 +120,9 @@ 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; bus_clk_rate should be in previous patch :) Thanks, Stephan
Hi Konrad, On 31.07.23 13:52, Konrad Dybcio wrote: > Certain platforms require that some buses (or individual nodes) make > some additional changes to the clock rate formula, throwing in some > magic, Qualcomm-defined coefficients, to account for "inefficiencies". Maybe some links to the downstream code would help to better check and understand this. Adding also Odelu in case he has any comments on the patches. Thanks, Georgi > Add the framework for it and utilize it on a couple SoCs. > > Signed-off-by: Konrad Dybcio <konrad.dybcio@linaro.org> > --- > Changes in v2: > - Use the (arguably less favourable but necessary for precission) 100/x > instead of x/100 for ib coefficient, update values in consequent > patches to reflect that > - Rename "_percent" to "_coeff" because of /\ > - Add the necessary code to support per-node clocks > - Add the necessary code to support per-node coefficients > - Hook up the CPUSS<->GNoC clock on QCM2290 > - Update EBI node on QCM2290 > - Link to v1: https://lore.kernel.org/r/20230726-topic-icc_coeff-v1-0-31616960818c@linaro.org > > --- > Konrad Dybcio (10): > interconnect: qcom: icc-rpm: Add AB/IB calculations coefficients > interconnect: qcom: icc-rpm: Separate out clock rate calulcations > interconnect: qcom: icc-rpm: Let nodes drive their own bus clock > interconnect: qcom: icc-rpm: Check for node-specific rate coefficients > interconnect: qcom: qcm2290: Hook up MAS_APPS_PROC's bus clock > interconnect: qcom: qcm2290: Set AB coefficients > interconnect: qcom: qcm2290: Update EBI channel configuration > interconnect: qcom: sdm660: Set AB/IB coefficients > interconnect: qcom: msm8996: Set AB/IB coefficients > clk: qcom: smd-rpm: Move CPUSS_GNoC clock to interconnect > > drivers/clk/qcom/clk-smd-rpm.c | 16 ++++-- > drivers/interconnect/qcom/icc-rpm-clocks.c | 6 ++ > drivers/interconnect/qcom/icc-rpm.c | 92 ++++++++++++++++++++++++------ > drivers/interconnect/qcom/icc-rpm.h | 15 +++++ > drivers/interconnect/qcom/msm8996.c | 8 ++- > drivers/interconnect/qcom/qcm2290.c | 9 ++- > drivers/interconnect/qcom/sdm660.c | 4 ++ > 7 files changed, 124 insertions(+), 26 deletions(-) > --- > base-commit: ec89391563792edd11d138a853901bce76d11f44 > change-id: 20230726-topic-icc_coeff-b053d5409b9f > > Best regards,
Certain platforms require that some buses (or individual nodes) make some additional changes to the clock rate formula, throwing in some magic, Qualcomm-defined coefficients, to account for "inefficiencies". Add the framework for it and utilize it on a couple SoCs. Signed-off-by: Konrad Dybcio <konrad.dybcio@linaro.org> --- Changes in v2: - Use the (arguably less favourable but necessary for precission) 100/x instead of x/100 for ib coefficient, update values in consequent patches to reflect that - Rename "_percent" to "_coeff" because of /\ - Add the necessary code to support per-node clocks - Add the necessary code to support per-node coefficients - Hook up the CPUSS<->GNoC clock on QCM2290 - Update EBI node on QCM2290 - Link to v1: https://lore.kernel.org/r/20230726-topic-icc_coeff-v1-0-31616960818c@linaro.org --- Konrad Dybcio (10): interconnect: qcom: icc-rpm: Add AB/IB calculations coefficients interconnect: qcom: icc-rpm: Separate out clock rate calulcations interconnect: qcom: icc-rpm: Let nodes drive their own bus clock interconnect: qcom: icc-rpm: Check for node-specific rate coefficients interconnect: qcom: qcm2290: Hook up MAS_APPS_PROC's bus clock interconnect: qcom: qcm2290: Set AB coefficients interconnect: qcom: qcm2290: Update EBI channel configuration interconnect: qcom: sdm660: Set AB/IB coefficients interconnect: qcom: msm8996: Set AB/IB coefficients clk: qcom: smd-rpm: Move CPUSS_GNoC clock to interconnect drivers/clk/qcom/clk-smd-rpm.c | 16 ++++-- drivers/interconnect/qcom/icc-rpm-clocks.c | 6 ++ drivers/interconnect/qcom/icc-rpm.c | 92 ++++++++++++++++++++++++------ drivers/interconnect/qcom/icc-rpm.h | 15 +++++ drivers/interconnect/qcom/msm8996.c | 8 ++- drivers/interconnect/qcom/qcm2290.c | 9 ++- drivers/interconnect/qcom/sdm660.c | 4 ++ 7 files changed, 124 insertions(+), 26 deletions(-) --- base-commit: ec89391563792edd11d138a853901bce76d11f44 change-id: 20230726-topic-icc_coeff-b053d5409b9f Best regards,