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

commit 41401ac67791810dd880345962339aa1bedd3c0d upstream.

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
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Jan Kokemüller 2021-02-11 19:28:43 +01:00 committed by Greg Kroah-Hartman
parent 49b1b5b100
commit 9d0da9afeb
2 changed files with 19 additions and 3 deletions

View File

@ -3248,7 +3248,7 @@ static noinline bool dcn20_validate_bandwidth_fp(struct dc *dc,
bool dcn20_validate_bandwidth(struct dc *dc, struct dc_state *context,
bool fast_validate)
{
bool voltage_supported = false;
bool voltage_supported;
DC_FP_START();
voltage_supported = dcn20_validate_bandwidth_fp(dc, context, fast_validate);
DC_FP_END();

View File

@ -1173,8 +1173,8 @@ void dcn21_calculate_wm(
}
bool dcn21_validate_bandwidth(struct dc *dc, struct dc_state *context,
bool fast_validate)
static noinline bool dcn21_validate_bandwidth_fp(struct dc *dc,
struct dc_state *context, bool fast_validate)
{
bool out = false;
@ -1227,6 +1227,22 @@ bool dcn21_validate_bandwidth(struct dc *dc, struct dc_state *context,
return out;
}
/*
* Some of the functions further below use the FPU, so we need to wrap this
* with DC_FP_START()/DC_FP_END(). Use the same approach as for
* dcn20_validate_bandwidth in dcn20_resource.c.
*/
bool dcn21_validate_bandwidth(struct dc *dc, struct dc_state *context,
bool fast_validate)
{
bool voltage_supported;
DC_FP_START();
voltage_supported = dcn21_validate_bandwidth_fp(dc, context, fast_validate);
DC_FP_END();
return voltage_supported;
}
static void dcn21_destroy_resource_pool(struct resource_pool **pool)
{
struct dcn21_resource_pool *dcn21_pool = TO_DCN21_RES_POOL(*pool);