lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Tue, 26 Jul 2022 17:07:44 +0530
From:   Sibi Sankar <quic_sibis@...cinc.com>
To:     Krzysztof Kozlowski <krzysztof.kozlowski@...aro.org>,
        Andy Gross <agross@...nel.org>,
        Bjorn Andersson <bjorn.andersson@...aro.org>,
        "Konrad Dybcio" <konrad.dybcio@...ainline.org>,
        Georgi Djakov <djakov@...nel.org>,
        Rob Herring <robh+dt@...nel.org>,
        <linux-arm-msm@...r.kernel.org>, <linux-pm@...r.kernel.org>,
        <devicetree@...r.kernel.org>, <linux-kernel@...r.kernel.org>
CC:     Rajendra Nayak <quic_rjendra@...cinc.com>
Subject: Re: [PATCH 06/10] soc: qcom: icc-bwmon: store count unit per variant



On 7/21/22 12:58 AM, Krzysztof Kozlowski wrote:
> Versions v4 and v5 of BWMON on SDM845 use different unit count, so allow
> easier variant customization by storing its value in struct
> icc_bwmon_data.
> 
> Cc: Rajendra Nayak <quic_rjendra@...cinc.com>
> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@...aro.org>

Reviewed-by: Sibi Sankar <quic_sibis@...cinc.com>

> ---
>   drivers/soc/qcom/icc-bwmon.c | 15 ++++++++-------
>   1 file changed, 8 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/soc/qcom/icc-bwmon.c b/drivers/soc/qcom/icc-bwmon.c
> index dcd445af6488..9a99e0fd1140 100644
> --- a/drivers/soc/qcom/icc-bwmon.c
> +++ b/drivers/soc/qcom/icc-bwmon.c
> @@ -104,12 +104,11 @@
>   #define BWMON_THRESHOLD_COUNT_ZONE0_DEFAULT	0xff
>   #define BWMON_THRESHOLD_COUNT_ZONE2_DEFAULT	0xff
>   
> -/* BWMONv4 count registers use count unit of 64 kB */
> -#define BWMON_COUNT_UNIT_KB			64
>   #define BWMON_ZONE_MAX(zone)			(0x2e0 + 4 * (zone))
>   
>   struct icc_bwmon_data {
>   	unsigned int sample_ms;
> +	unsigned int count_unit_kb; /* kbytes */
>   	unsigned int default_highbw_kbps;
>   	unsigned int default_medbw_kbps;
>   	unsigned int default_lowbw_kbps;
> @@ -193,9 +192,10 @@ static void bwmon_enable(struct icc_bwmon *bwmon, unsigned int irq_enable)
>   	writel(BWMON_ENABLE_ENABLE, bwmon->base + BWMON_ENABLE);
>   }
>   
> -static unsigned int bwmon_kbps_to_count(unsigned int kbps)
> +static unsigned int bwmon_kbps_to_count(struct icc_bwmon *bwmon,
> +					unsigned int kbps)
>   {
> -	return kbps / BWMON_COUNT_UNIT_KB;
> +	return kbps / bwmon->data->count_unit_kb;
>   }
>   
>   static void bwmon_set_threshold(struct icc_bwmon *bwmon, unsigned int reg,
> @@ -203,8 +203,8 @@ static void bwmon_set_threshold(struct icc_bwmon *bwmon, unsigned int reg,
>   {
>   	unsigned int thres;
>   
> -	thres = mult_frac(bwmon_kbps_to_count(kbps), bwmon->data->sample_ms,
> -			  MSEC_PER_SEC);
> +	thres = mult_frac(bwmon_kbps_to_count(bwmon, kbps),
> +			  bwmon->data->sample_ms, MSEC_PER_SEC);
>   	writel_relaxed(thres, bwmon->base + reg);
>   }
>   
> @@ -270,7 +270,7 @@ static irqreturn_t bwmon_intr(int irq, void *dev_id)
>   	 * downstream) always increments the max bytes count by one.
>   	 */
>   	max = readl(bwmon->base + BWMON_ZONE_MAX(zone)) + 1;
> -	max *= BWMON_COUNT_UNIT_KB;
> +	max *= bwmon->data->count_unit_kb;
>   	bwmon->target_kbps = mult_frac(max, MSEC_PER_SEC, bwmon->data->sample_ms);
>   
>   	return IRQ_WAKE_THREAD;
> @@ -394,6 +394,7 @@ static int bwmon_remove(struct platform_device *pdev)
>   /* BWMON v4 */
>   static const struct icc_bwmon_data msm8998_bwmon_data = {
>   	.sample_ms = 4,
> +	.count_unit_kb = 64,
>   	.default_highbw_kbps = 4800 * 1024, /* 4.8 GBps */
>   	.default_medbw_kbps = 512 * 1024, /* 512 MBps */
>   	.default_lowbw_kbps = 0,
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ