[Why]
during idle optimizations we acquire the dc_lock, this lock is also
acquired during gpu_reset so we end up hanging the system due to a
deadlock
[How]
If we are in gpu reset:
 - disable idle optimizations and skip calls to the dc function
v2: skip idle optimizations calls
v3: add guard for DCN
Fixes: 71338cb4a7c2b51 ("drm/amd/display: enable idle optimizations for linux (MALL stutter)")
Signed-off-by: Bhawanpreet Lakha <Bhawanpreet.Lakha@amd.com>
Reviewed-by: Nicholas Kazlauskas <nicholas.kazlauskas@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
 
        if (amdgpu_in_reset(adev)) {
                mutex_lock(&dm->dc_lock);
+
+#if defined(CONFIG_DRM_AMD_DC_DCN)
+               dc_allow_idle_optimizations(adev->dm.dc, false);
+#endif
+
                dm->cached_dc_state = dc_copy_state(dm->dc->current_state);
 
                dm_gpureset_toggle_interrupts(adev, dm->cached_dc_state, false);
        if (!dc_interrupt_set(adev->dm.dc, irq_source, enable))
                return -EBUSY;
 
+#if defined(CONFIG_DRM_AMD_DC_DCN)
+       if (amdgpu_in_reset(adev))
+               return 0;
+
        mutex_lock(&dm->dc_lock);
 
        if (enable)
 
        mutex_unlock(&dm->dc_lock);
 
+#endif
        return 0;
 }