diff options
| author | Steve Dunnagan <sdunnaga@redhat.com> | 2026-07-01 15:59:20 -0400 |
|---|---|---|
| committer | Sudeep Holla <sudeep.holla@arm.com> | 2026-07-09 14:34:41 +0100 |
| commit | bf1deecccf210d1dd84e85cd4a45070888583984 (patch) | |
| tree | 6ae71c40fa0df9aebf927fc57bed589d5ce39990 /Documentation/tty/git@git.tavy.me:linux.git | |
| parent | 05e5ffde9b666ee6d3ec225efeda9c038fa74ac8 (diff) | |
firmware: arm_scmi: Use 64-bit division for clock rate rounding
SCMI clock range descriptors report rates as 64-bit values. When handling
a range clock, scmi_clock_determine_rate() rounds the requested rate up to
the next supported step using the SCMI RATE_STEP value.
The current code uses div64_ul() for this calculation. Since div64_ul()
takes an unsigned long divisor, the 64-bit RATE_STEP value can be truncated
on 32-bit builds. In the worst case, a non-zero 64-bit step can be narrowed
to zero before the division.
Store RATE_STEP in a u64, reject a malformed zero step, and use
DIV64_U64_ROUND_UP() so the divisor is handled as a 64-bit value.
This does not change behavior for valid firmware reporting a non-zero step
that fits in unsigned long.
Tested on Xunlong Orange Pi 5 Plus / RK3588 with SCMI over SMC. SCMI
clocks probed successfully before and after the change. SCMI-backed CPU
clocks were exercised through cpufreq-dt by switching each CPU policy
between its lowest and highest available OPP.
Fixes: ecde921eb460 ("firmware: arm_scmi: Add clock determine_rate operation")
Signed-off-by: Steve Dunnagan <sdunnaga@redhat.com>
Link: https://patch.msgid.link/20260701195923.444270-1-sdunnaga@redhat.com
Signed-off-by: Sudeep Holla <sudeep.holla@kernel.org>
Diffstat (limited to 'Documentation/tty/git@git.tavy.me:linux.git')
0 files changed, 0 insertions, 0 deletions
