drm/radeon: Avoid overflows/divide-by-zero in latency_watermark calculations.
authorMario Kleiner <mario.kleiner.de@gmail.com>
Sun, 23 Apr 2017 23:33:08 +0000 (01:33 +0200)
committerAlex Deucher <alexander.deucher@amd.com>
Fri, 28 Apr 2017 21:33:03 +0000 (17:33 -0400)
commitae45bbc2ba8f92b5a773fece6f5792f497c89282
tree18464c5502b6fcca42218b81296436221c04a8a1
parenteffaf848b957fbf72a3b6a1ad87f5e031eda0b75
drm/radeon: Avoid overflows/divide-by-zero in latency_watermark calculations.

At dot clocks > approx. 250 Mhz, some of these calcs will overflow and
cause miscalculation of latency watermarks, and for some overflows also
divide-by-zero driver crash. Make calcs more overflow resistant.

This is a direct port of the corresponding patch from amdgpu-kms,
copy-paste for cik from dce-8 and si from dce-6, with a slightly
simpler variant for evergreen dce-4/5.

Only tested on DCE-4 evergreen with a Radeon HD-5770.

Signed-off-by: Mario Kleiner <mario.kleiner.de@gmail.com>
Cc: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/radeon/cik.c
drivers/gpu/drm/radeon/evergreen.c
drivers/gpu/drm/radeon/si.c