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]
Message-ID: <57529d24-8b46-4eed-95ed-463ad3f4190e@collabora.com>
Date: Mon, 29 Apr 2024 10:08:20 +0200
From: AngeloGioacchino Del Regno <angelogioacchino.delregno@...labora.com>
To: Nathan Chancellor <nathan@...nel.org>
Cc: djakov@...nel.org, robh@...nel.org, krzysztof.kozlowski+dt@...aro.org,
 conor+dt@...nel.org, matthias.bgg@...il.com, lgirdwood@...il.com,
 broonie@...nel.org, keescook@...omium.org, gustavoars@...nel.org,
 henryc.chen@...iatek.com, linux-pm@...r.kernel.org,
 devicetree@...r.kernel.org, linux-kernel@...r.kernel.org,
 linux-arm-kernel@...ts.infradead.org, linux-mediatek@...ts.infradead.org,
 kernel@...labora.com, wenst@...omium.org, amergnat@...libre.com,
 Dawei Chien <dawei.chien@...iatek.com>
Subject: Re: [PATCH v5 4/7] soc: mediatek: Add MediaTek DVFS Resource
 Collector (DVFSRC) driver

Il 24/04/24 21:04, Nathan Chancellor ha scritto:
> Hi Angelo,
> 
> On Wed, Apr 24, 2024 at 11:54:13AM +0200, AngeloGioacchino Del Regno wrote:
>> The Dynamic Voltage and Frequency Scaling Resource Collector (DVFSRC) is a
>> Hardware module used to collect all the requests from both software and the
>> various remote processors embedded into the SoC and decide about a minimum
>> operating voltage and a minimum DRAM frequency to fulfill those requests in
>> an effort to provide the best achievable performance per watt.
>>
>> This hardware IP is capable of transparently performing direct register R/W
>> on all of the DVFSRC-controlled regulators and SoC bandwidth knobs.
>>
>> This driver includes support for MT8183, MT8192 and MT8195.
>>
>> Co-Developed-by: Dawei Chien <dawei.chien@...iatek.com>
>> [Angelo: Partial refactoring and cleanups]
>> Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@...labora.com>
> ...
>>   drivers/soc/mediatek/mtk-dvfsrc.c        | 551 +++++++++++++++++++++++
> ...
>> +#define KBPS_TO_MBPS(x)			((x) / 1000)
> ...
>> +static void __dvfsrc_set_dram_bw_v1(struct mtk_dvfsrc *dvfsrc, u32 reg,
>> +				    u16 max_bw, u16 min_bw, u64 bw)
>> +{
>> +	u32 new_bw = (u32)div_u64(KBPS_TO_MBPS(bw), 100);
>> +
>> +	/* If bw constraints (in mbps) are defined make sure to respect them */
>> +	if (max_bw)
>> +		new_bw = min(new_bw, max_bw);
>> +	if (min_bw && new_bw > 0)
>> +		new_bw = max(new_bw, min_bw);
>> +
>> +	dvfsrc_writel(dvfsrc, reg, new_bw);
>> +}
> 
> Using KBPS_TO_MBPS here results in
> 
>    ERROR: modpost: "__aeabi_uldivmod" [drivers/soc/mediatek/mtk-dvfsrc.ko] undefined!
> 
> when building ARCH=arm allmodconfig with clang. I did not check to see
> if this is visible with GCC but if it is not, it is only because GCC
> implements certain transformations for constant division that clang may
> or may not have implemented (there was some work on getting all
> transformations that GCC has supported in clang as well but I do not
> think was ever completed). Perhaps KBPS_TO_MBPS() should be dropped and
> the new_bw assignement turned into
> 
>    u32 new_bw = (u32)div_u64(bw, 100 * 1000); /* Multiply divisor by 1000 to convert bw from Kbps to Mbps */

Thanks, I honestly didn't check clang.

Your suggestion looks good, I'll do exactly that.

Cheers!
Angelo

> 
> or something like that.
> 
> Cheers,
> Nathan


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ