[1/2] interconnect: qcom: rpmh: add optional mask to send as vote

Message ID 20230619-topic-sm8550-upstream-interconnect-mask-vote-v1-1-66663c0aa592@linaro.org
State New
Headers
Series interconnect: qcom: rpmh: sm8550: mask to send as vote |

Commit Message

Neil Armstrong June 19, 2023, 8:24 a.m. UTC
  On the SM8550 SoC, some nodes requires a specific bit mark
instead of a bandwidth when voting.

Add an enable_mask variable to be used to vote when a node
is enabled in an aggregate loop.

Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org>
---
 drivers/interconnect/qcom/bcm-voter.c | 5 +++++
 drivers/interconnect/qcom/icc-rpmh.h  | 2 ++
 2 files changed, 7 insertions(+)
  

Comments

Konrad Dybcio June 19, 2023, 9:45 a.m. UTC | #1
On 19.06.2023 10:24, Neil Armstrong wrote:
> On the SM8550 SoC, some nodes requires a specific bit mark
> instead of a bandwidth when voting.
> 
> Add an enable_mask variable to be used to vote when a node
> is enabled in an aggregate loop.
> 
> Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org>
> ---
Would be nice to mention that it's literally this commit:

https://git.codelinaro.org/clo/la/kernel/msm-5.15/-/commit/2d1573e0206998151b342e6b52a4c0f7234d7e36

For the code:

Reviewed-by: Konrad Dybcio <konrad.dybcio@linaro.org>

Konrad
>  drivers/interconnect/qcom/bcm-voter.c | 5 +++++
>  drivers/interconnect/qcom/icc-rpmh.h  | 2 ++
>  2 files changed, 7 insertions(+)
> 
> diff --git a/drivers/interconnect/qcom/bcm-voter.c b/drivers/interconnect/qcom/bcm-voter.c
> index 8f385f9c2dd3..d5f2a6b5376b 100644
> --- a/drivers/interconnect/qcom/bcm-voter.c
> +++ b/drivers/interconnect/qcom/bcm-voter.c
> @@ -83,6 +83,11 @@ static void bcm_aggregate(struct qcom_icc_bcm *bcm)
>  
>  		temp = agg_peak[bucket] * bcm->vote_scale;
>  		bcm->vote_y[bucket] = bcm_div(temp, bcm->aux_data.unit);
> +
> +		if (bcm->enable_mask && (bcm->vote_x[bucket] || bcm->vote_y[bucket])) {
> +			bcm->vote_x[bucket] = 0;
> +			bcm->vote_y[bucket] = bcm->enable_mask;
> +		}
>  	}
>  
>  	if (bcm->keepalive && bcm->vote_x[QCOM_ICC_BUCKET_AMC] == 0 &&
> diff --git a/drivers/interconnect/qcom/icc-rpmh.h b/drivers/interconnect/qcom/icc-rpmh.h
> index 04391c1ba465..7843d8864d6b 100644
> --- a/drivers/interconnect/qcom/icc-rpmh.h
> +++ b/drivers/interconnect/qcom/icc-rpmh.h
> @@ -81,6 +81,7 @@ struct qcom_icc_node {
>   * @vote_x: aggregated threshold values, represents sum_bw when @type is bw bcm
>   * @vote_y: aggregated threshold values, represents peak_bw when @type is bw bcm
>   * @vote_scale: scaling factor for vote_x and vote_y
> + * @enable_mask: optional mask to send as vote instead of vote_x/vote_y
>   * @dirty: flag used to indicate whether the bcm needs to be committed
>   * @keepalive: flag used to indicate whether a keepalive is required
>   * @aux_data: auxiliary data used when calculating threshold values and
> @@ -97,6 +98,7 @@ struct qcom_icc_bcm {
>  	u64 vote_x[QCOM_ICC_NUM_BUCKETS];
>  	u64 vote_y[QCOM_ICC_NUM_BUCKETS];
>  	u64 vote_scale;
> +	u32 enable_mask;
>  	bool dirty;
>  	bool keepalive;
>  	struct bcm_db aux_data;
>
  
Neil Armstrong June 19, 2023, 9:47 a.m. UTC | #2
Hi,

On 19/06/2023 11:45, Konrad Dybcio wrote:
> On 19.06.2023 10:24, Neil Armstrong wrote:
>> On the SM8550 SoC, some nodes requires a specific bit mark
>> instead of a bandwidth when voting.
>>
>> Add an enable_mask variable to be used to vote when a node
>> is enabled in an aggregate loop.
>>
>> Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org>
>> ---
> Would be nice to mention that it's literally this commit:
> 
> https://git.codelinaro.org/clo/la/kernel/msm-5.15/-/commit/2d1573e0206998151b342e6b52a4c0f7234d7e36

Good catch, I just copied the bits but yeah in fine it's the same...

I'll refer to it in a v2.

> 
> For the code:
> 
> Reviewed-by: Konrad Dybcio <konrad.dybcio@linaro.org>

Thanks,
Neil

> 
> Konrad
>>   drivers/interconnect/qcom/bcm-voter.c | 5 +++++
>>   drivers/interconnect/qcom/icc-rpmh.h  | 2 ++
>>   2 files changed, 7 insertions(+)
>>
>> diff --git a/drivers/interconnect/qcom/bcm-voter.c b/drivers/interconnect/qcom/bcm-voter.c
>> index 8f385f9c2dd3..d5f2a6b5376b 100644
>> --- a/drivers/interconnect/qcom/bcm-voter.c
>> +++ b/drivers/interconnect/qcom/bcm-voter.c
>> @@ -83,6 +83,11 @@ static void bcm_aggregate(struct qcom_icc_bcm *bcm)
>>   
>>   		temp = agg_peak[bucket] * bcm->vote_scale;
>>   		bcm->vote_y[bucket] = bcm_div(temp, bcm->aux_data.unit);
>> +
>> +		if (bcm->enable_mask && (bcm->vote_x[bucket] || bcm->vote_y[bucket])) {
>> +			bcm->vote_x[bucket] = 0;
>> +			bcm->vote_y[bucket] = bcm->enable_mask;
>> +		}
>>   	}
>>   
>>   	if (bcm->keepalive && bcm->vote_x[QCOM_ICC_BUCKET_AMC] == 0 &&
>> diff --git a/drivers/interconnect/qcom/icc-rpmh.h b/drivers/interconnect/qcom/icc-rpmh.h
>> index 04391c1ba465..7843d8864d6b 100644
>> --- a/drivers/interconnect/qcom/icc-rpmh.h
>> +++ b/drivers/interconnect/qcom/icc-rpmh.h
>> @@ -81,6 +81,7 @@ struct qcom_icc_node {
>>    * @vote_x: aggregated threshold values, represents sum_bw when @type is bw bcm
>>    * @vote_y: aggregated threshold values, represents peak_bw when @type is bw bcm
>>    * @vote_scale: scaling factor for vote_x and vote_y
>> + * @enable_mask: optional mask to send as vote instead of vote_x/vote_y
>>    * @dirty: flag used to indicate whether the bcm needs to be committed
>>    * @keepalive: flag used to indicate whether a keepalive is required
>>    * @aux_data: auxiliary data used when calculating threshold values and
>> @@ -97,6 +98,7 @@ struct qcom_icc_bcm {
>>   	u64 vote_x[QCOM_ICC_NUM_BUCKETS];
>>   	u64 vote_y[QCOM_ICC_NUM_BUCKETS];
>>   	u64 vote_scale;
>> +	u32 enable_mask;
>>   	bool dirty;
>>   	bool keepalive;
>>   	struct bcm_db aux_data;
>>
  
Dmitry Baryshkov June 19, 2023, 12:59 p.m. UTC | #3
On Mon, 19 Jun 2023 at 12:47, Neil Armstrong <neil.armstrong@linaro.org> wrote:
>
> Hi,
>
> On 19/06/2023 11:45, Konrad Dybcio wrote:
> > On 19.06.2023 10:24, Neil Armstrong wrote:
> >> On the SM8550 SoC, some nodes requires a specific bit mark
> >> instead of a bandwidth when voting.
> >>
> >> Add an enable_mask variable to be used to vote when a node
> >> is enabled in an aggregate loop.
> >>
> >> Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org>
> >> ---
> > Would be nice to mention that it's literally this commit:
> >
> > https://git.codelinaro.org/clo/la/kernel/msm-5.15/-/commit/2d1573e0206998151b342e6b52a4c0f7234d7e36
>
> Good catch, I just copied the bits but yeah in fine it's the same...

And probably it also requires copying SoB (and Author?) from the
original commit.

>
> I'll refer to it in a v2.
>
> >
> > For the code:
> >
> > Reviewed-by: Konrad Dybcio <konrad.dybcio@linaro.org>
>
> Thanks,
> Neil
>
> >
> > Konrad
> >>   drivers/interconnect/qcom/bcm-voter.c | 5 +++++
> >>   drivers/interconnect/qcom/icc-rpmh.h  | 2 ++
> >>   2 files changed, 7 insertions(+)
> >>
> >> diff --git a/drivers/interconnect/qcom/bcm-voter.c b/drivers/interconnect/qcom/bcm-voter.c
> >> index 8f385f9c2dd3..d5f2a6b5376b 100644
> >> --- a/drivers/interconnect/qcom/bcm-voter.c
> >> +++ b/drivers/interconnect/qcom/bcm-voter.c
> >> @@ -83,6 +83,11 @@ static void bcm_aggregate(struct qcom_icc_bcm *bcm)
> >>
> >>              temp = agg_peak[bucket] * bcm->vote_scale;
> >>              bcm->vote_y[bucket] = bcm_div(temp, bcm->aux_data.unit);
> >> +
> >> +            if (bcm->enable_mask && (bcm->vote_x[bucket] || bcm->vote_y[bucket])) {
> >> +                    bcm->vote_x[bucket] = 0;
> >> +                    bcm->vote_y[bucket] = bcm->enable_mask;
> >> +            }
> >>      }
> >>
> >>      if (bcm->keepalive && bcm->vote_x[QCOM_ICC_BUCKET_AMC] == 0 &&
> >> diff --git a/drivers/interconnect/qcom/icc-rpmh.h b/drivers/interconnect/qcom/icc-rpmh.h
> >> index 04391c1ba465..7843d8864d6b 100644
> >> --- a/drivers/interconnect/qcom/icc-rpmh.h
> >> +++ b/drivers/interconnect/qcom/icc-rpmh.h
> >> @@ -81,6 +81,7 @@ struct qcom_icc_node {
> >>    * @vote_x: aggregated threshold values, represents sum_bw when @type is bw bcm
> >>    * @vote_y: aggregated threshold values, represents peak_bw when @type is bw bcm
> >>    * @vote_scale: scaling factor for vote_x and vote_y
> >> + * @enable_mask: optional mask to send as vote instead of vote_x/vote_y
> >>    * @dirty: flag used to indicate whether the bcm needs to be committed
> >>    * @keepalive: flag used to indicate whether a keepalive is required
> >>    * @aux_data: auxiliary data used when calculating threshold values and
> >> @@ -97,6 +98,7 @@ struct qcom_icc_bcm {
> >>      u64 vote_x[QCOM_ICC_NUM_BUCKETS];
> >>      u64 vote_y[QCOM_ICC_NUM_BUCKETS];
> >>      u64 vote_scale;
> >> +    u32 enable_mask;
> >>      bool dirty;
> >>      bool keepalive;
> >>      struct bcm_db aux_data;
> >>
>
  

Patch

diff --git a/drivers/interconnect/qcom/bcm-voter.c b/drivers/interconnect/qcom/bcm-voter.c
index 8f385f9c2dd3..d5f2a6b5376b 100644
--- a/drivers/interconnect/qcom/bcm-voter.c
+++ b/drivers/interconnect/qcom/bcm-voter.c
@@ -83,6 +83,11 @@  static void bcm_aggregate(struct qcom_icc_bcm *bcm)
 
 		temp = agg_peak[bucket] * bcm->vote_scale;
 		bcm->vote_y[bucket] = bcm_div(temp, bcm->aux_data.unit);
+
+		if (bcm->enable_mask && (bcm->vote_x[bucket] || bcm->vote_y[bucket])) {
+			bcm->vote_x[bucket] = 0;
+			bcm->vote_y[bucket] = bcm->enable_mask;
+		}
 	}
 
 	if (bcm->keepalive && bcm->vote_x[QCOM_ICC_BUCKET_AMC] == 0 &&
diff --git a/drivers/interconnect/qcom/icc-rpmh.h b/drivers/interconnect/qcom/icc-rpmh.h
index 04391c1ba465..7843d8864d6b 100644
--- a/drivers/interconnect/qcom/icc-rpmh.h
+++ b/drivers/interconnect/qcom/icc-rpmh.h
@@ -81,6 +81,7 @@  struct qcom_icc_node {
  * @vote_x: aggregated threshold values, represents sum_bw when @type is bw bcm
  * @vote_y: aggregated threshold values, represents peak_bw when @type is bw bcm
  * @vote_scale: scaling factor for vote_x and vote_y
+ * @enable_mask: optional mask to send as vote instead of vote_x/vote_y
  * @dirty: flag used to indicate whether the bcm needs to be committed
  * @keepalive: flag used to indicate whether a keepalive is required
  * @aux_data: auxiliary data used when calculating threshold values and
@@ -97,6 +98,7 @@  struct qcom_icc_bcm {
 	u64 vote_x[QCOM_ICC_NUM_BUCKETS];
 	u64 vote_y[QCOM_ICC_NUM_BUCKETS];
 	u64 vote_scale;
+	u32 enable_mask;
 	bool dirty;
 	bool keepalive;
 	struct bcm_db aux_data;