* [PATCH] drm/amd/display: Fix 64-bit division error on 32-bit platforms in mod_freesync_build_vrr_params
@ 2020-03-30 22:16 Nathan Chancellor
2020-03-31 14:37 ` Alex Deucher
0 siblings, 1 reply; 2+ messages in thread
From: Nathan Chancellor @ 2020-03-30 22:16 UTC (permalink / raw)
To: Harry Wentland, Leo Li, Alex Deucher, Christian König,
David (ChunMing) Zhou
Cc: Rodrigo Siqueira, amd-gfx, dri-devel, linux-kernel, Nathan Chancellor
When building arm32 allyesconfig,
ld.lld: error: undefined symbol: __aeabi_uldivmod
>>> referenced by freesync.c
>>> gpu/drm/amd/display/modules/freesync/freesync.o:(mod_freesync_build_vrr_params) in archive drivers/built-in.a
>>> did you mean: __aeabi_uidivmod
>>> defined in: arch/arm/lib/lib.a(lib1funcs.o)
Use div_u64 in the two locations that do 64-bit divisior, which both
have a u64 dividend and u32 divisor.
Fixes: 349a370781de ("drm/amd/display: LFC not working on 2.0x range monitors")
Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
---
drivers/gpu/drm/amd/display/modules/freesync/freesync.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/amd/display/modules/freesync/freesync.c b/drivers/gpu/drm/amd/display/modules/freesync/freesync.c
index 8911f01671aa..c33454a9e0b4 100644
--- a/drivers/gpu/drm/amd/display/modules/freesync/freesync.c
+++ b/drivers/gpu/drm/amd/display/modules/freesync/freesync.c
@@ -761,10 +761,10 @@ void mod_freesync_build_vrr_params(struct mod_freesync *mod_freesync,
// If a monitor reports exactly max refresh of 2x of min, enforce it on nominal
rounded_nominal_in_uhz =
- ((nominal_field_rate_in_uhz + 50000) / 100000) * 100000;
+ div_u64(nominal_field_rate_in_uhz + 50000, 100000) * 100000;
if (in_config->max_refresh_in_uhz == (2 * in_config->min_refresh_in_uhz) &&
in_config->max_refresh_in_uhz == rounded_nominal_in_uhz)
- min_refresh_in_uhz = nominal_field_rate_in_uhz / 2;
+ min_refresh_in_uhz = div_u64(nominal_field_rate_in_uhz, 2);
if (!vrr_settings_require_update(core_freesync,
in_config, (unsigned int)min_refresh_in_uhz, (unsigned int)max_refresh_in_uhz,
--
2.26.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] drm/amd/display: Fix 64-bit division error on 32-bit platforms in mod_freesync_build_vrr_params
2020-03-30 22:16 [PATCH] drm/amd/display: Fix 64-bit division error on 32-bit platforms in mod_freesync_build_vrr_params Nathan Chancellor
@ 2020-03-31 14:37 ` Alex Deucher
0 siblings, 0 replies; 2+ messages in thread
From: Alex Deucher @ 2020-03-31 14:37 UTC (permalink / raw)
To: Nathan Chancellor
Cc: Harry Wentland, Leo Li, Alex Deucher, Christian König,
David (ChunMing) Zhou, Rodrigo Siqueira,
Maling list - DRI developers, amd-gfx list, LKML
On Tue, Mar 31, 2020 at 3:38 AM Nathan Chancellor
<natechancellor@gmail.com> wrote:
>
> When building arm32 allyesconfig,
>
> ld.lld: error: undefined symbol: __aeabi_uldivmod
> >>> referenced by freesync.c
> >>> gpu/drm/amd/display/modules/freesync/freesync.o:(mod_freesync_build_vrr_params) in archive drivers/built-in.a
> >>> did you mean: __aeabi_uidivmod
> >>> defined in: arch/arm/lib/lib.a(lib1funcs.o)
>
> Use div_u64 in the two locations that do 64-bit divisior, which both
> have a u64 dividend and u32 divisor.
>
> Fixes: 349a370781de ("drm/amd/display: LFC not working on 2.0x range monitors")
> Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
Applied. Thanks!
Alex
> ---
> drivers/gpu/drm/amd/display/modules/freesync/freesync.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/display/modules/freesync/freesync.c b/drivers/gpu/drm/amd/display/modules/freesync/freesync.c
> index 8911f01671aa..c33454a9e0b4 100644
> --- a/drivers/gpu/drm/amd/display/modules/freesync/freesync.c
> +++ b/drivers/gpu/drm/amd/display/modules/freesync/freesync.c
> @@ -761,10 +761,10 @@ void mod_freesync_build_vrr_params(struct mod_freesync *mod_freesync,
>
> // If a monitor reports exactly max refresh of 2x of min, enforce it on nominal
> rounded_nominal_in_uhz =
> - ((nominal_field_rate_in_uhz + 50000) / 100000) * 100000;
> + div_u64(nominal_field_rate_in_uhz + 50000, 100000) * 100000;
> if (in_config->max_refresh_in_uhz == (2 * in_config->min_refresh_in_uhz) &&
> in_config->max_refresh_in_uhz == rounded_nominal_in_uhz)
> - min_refresh_in_uhz = nominal_field_rate_in_uhz / 2;
> + min_refresh_in_uhz = div_u64(nominal_field_rate_in_uhz, 2);
>
> if (!vrr_settings_require_update(core_freesync,
> in_config, (unsigned int)min_refresh_in_uhz, (unsigned int)max_refresh_in_uhz,
> --
> 2.26.0
>
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-03-31 14:38 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-30 22:16 [PATCH] drm/amd/display: Fix 64-bit division error on 32-bit platforms in mod_freesync_build_vrr_params Nathan Chancellor
2020-03-31 14:37 ` Alex Deucher
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).