All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/nouveau: fix 64-bit divisor truncation in DP SST calculation
@ 2026-11-27 23:41 Luděk Habarta
  2026-12-05 23:00   ` Danilo Krummrich
  0 siblings, 1 reply; 3+ messages in thread
From: Luděk Habarta @ 2026-11-27 23:41 UTC (permalink / raw)
  To: lyude, dakr; +Cc: airlied, nouveau, dri-devel, stable, Luděk Habarta

The DP SST watermark calculation uses div_u64() to divide ratioF
by the total link bandwidth. However, div_u64() takes a 32-bit
divisor, while the calculated bandwidth can exceed U32_MAX.

For a four-lane HBR3 link, the divisor is 25920000000, which
is truncated to 150196224. This results in ratioF exceeding
PrecisionFactor and causes nv50_sor_dp_watermark_sst() to
return prematurely without configuring the DP SST stream.

This was observed on an NVIDIA GA102 (GeForce RTX 3080) with
GSP firmware 570.144 and a Dell AW5520QF connected via
DisplayPort. Video output worked, but audio remained silent
despite valid ELD data and successful ALSA playback.

Use div64_u64() to preserve the full 64-bit divisor, restoring
the original arithmetic semantics before the conversion to
kernel division helpers.

Tested on GA102 with Linux 7.3.6. DisplayPort audio works
after the fix at 3840x2160 and 120 Hz.

Fixes: 7e6bd6409b66 ("nouveau/disp: fix post-gsp build on 32-bit arm.")
Cc: stable@vger.kernel.org
Signed-off-by: Luděk Habarta <habarta.ludek@gmail.com>
---
 drivers/gpu/drm/nouveau/dispnv50/disp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/nouveau/dispnv50/disp.c b/drivers/gpu/drm/nouveau/dispnv50/disp.c
index e91130f93db6..7634147c01ac 100644
--- a/drivers/gpu/drm/nouveau/dispnv50/disp.c
+++ b/drivers/gpu/drm/nouveau/dispnv50/disp.c
@@ -1661,7 +1661,7 @@ nv50_sor_dp_watermark_sst(struct nouveau_encoder *outp,
 	//
 	ratioF = div_u64((u64)pixelClockHz * depth * PrecisionFactor, DSC_FACTOR);
 
-	ratioF = div_u64(ratioF, 8 * (u64) minRate * outp->dp.link_nr);
+	ratioF = div64_u64(ratioF, 8 * minRate * outp->dp.link_nr);
 
 	if (PrecisionFactor < ratioF) // Assert if we will end up with a negative number in below
 		return false;
-- 
2.56.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-12-05 23:01 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-27 23:41 [PATCH] drm/nouveau: fix 64-bit divisor truncation in DP SST calculation Luděk Habarta
2026-12-05 23:00 ` Danilo Krummrich
2026-12-05 23:00   ` Danilo Krummrich

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.