Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/amd/display: Add FPU wrappers to dcn21_validate_bandwidth()

dcn21_validate_bandwidth() calls functions that use floating point math.
On my machine this sometimes results in simd exceptions when there are
other FPU users such as KVM virtual machines running. The screen freezes
completely in this case.

Wrapping the function with DC_FP_START()/DC_FP_END() seems to solve the
problem. This mirrors the approach used for dcn20_validate_bandwidth.

Tested on a AMD Ryzen 7 PRO 4750U (Renoir).

Bug: https://bugzilla.kernel.org/show_bug.cgi?id=206987
Signed-off-by: Jan Kokemüller <jan.kokemueller@gmail.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Cc: stable@vger.kernel.org

authored by

Jan Kokemüller and committed by
Alex Deucher
41401ac6 f2d51b20

+19 -3
+1 -1
drivers/gpu/drm/amd/display/dc/dcn20/dcn20_resource.c
··· 3247 3247 bool dcn20_validate_bandwidth(struct dc *dc, struct dc_state *context, 3248 3248 bool fast_validate) 3249 3249 { 3250 - bool voltage_supported = false; 3250 + bool voltage_supported; 3251 3251 DC_FP_START(); 3252 3252 voltage_supported = dcn20_validate_bandwidth_fp(dc, context, fast_validate); 3253 3253 DC_FP_END();
+18 -2
drivers/gpu/drm/amd/display/dc/dcn21/dcn21_resource.c
··· 1329 1329 return out; 1330 1330 } 1331 1331 1332 - bool dcn21_validate_bandwidth(struct dc *dc, struct dc_state *context, 1333 - bool fast_validate) 1332 + static noinline bool dcn21_validate_bandwidth_fp(struct dc *dc, 1333 + struct dc_state *context, bool fast_validate) 1334 1334 { 1335 1335 bool out = false; 1336 1336 ··· 1383 1383 1384 1384 return out; 1385 1385 } 1386 + 1387 + /* 1388 + * Some of the functions further below use the FPU, so we need to wrap this 1389 + * with DC_FP_START()/DC_FP_END(). Use the same approach as for 1390 + * dcn20_validate_bandwidth in dcn20_resource.c. 1391 + */ 1392 + bool dcn21_validate_bandwidth(struct dc *dc, struct dc_state *context, 1393 + bool fast_validate) 1394 + { 1395 + bool voltage_supported; 1396 + DC_FP_START(); 1397 + voltage_supported = dcn21_validate_bandwidth_fp(dc, context, fast_validate); 1398 + DC_FP_END(); 1399 + return voltage_supported; 1400 + } 1401 + 1386 1402 static void dcn21_destroy_resource_pool(struct resource_pool **pool) 1387 1403 { 1388 1404 struct dcn21_resource_pool *dcn21_pool = TO_DCN21_RES_POOL(*pool);