]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commitdiff
drm/amdgpu: fix uvd crash on Polaris12 during driver unloading
authorEvan Quan <evan.quan@amd.com>
Sat, 9 Oct 2021 09:35:36 +0000 (17:35 +0800)
committerAndrea Righi <andrea.righi@canonical.com>
Tue, 7 Dec 2021 06:33:40 +0000 (07:33 +0100)
BugLink: https://bugs.launchpad.net/bugs/1951822
[ Upstream commit 4fc30ea780e0a5c1c019bc2e44f8523e1eed9051 ]

There was a change(below) target for such issue:
d82e2c249c8f ("drm/amdgpu: Fix crash on device remove/driver unload")
But the fix for VI ASICs was missing there. This is a supplement for
that.

Fixes: d82e2c249c8f ("drm/amdgpu: Fix crash on device remove/driver unload")
Signed-off-by: Evan Quan <evan.quan@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c

index bc571833632ea84538963852b9472ce0dfb77970..72f87629076810dcae82cd0240e34af8c939e51e 100644 (file)
@@ -543,6 +543,19 @@ static int uvd_v6_0_hw_fini(void *handle)
 {
        struct amdgpu_device *adev = (struct amdgpu_device *)handle;
 
+       cancel_delayed_work_sync(&adev->uvd.idle_work);
+
+       if (RREG32(mmUVD_STATUS) != 0)
+               uvd_v6_0_stop(adev);
+
+       return 0;
+}
+
+static int uvd_v6_0_suspend(void *handle)
+{
+       int r;
+       struct amdgpu_device *adev = (struct amdgpu_device *)handle;
+
        /*
         * Proper cleanups before halting the HW engine:
         *   - cancel the delayed idle work
@@ -567,17 +580,6 @@ static int uvd_v6_0_hw_fini(void *handle)
                                                       AMD_CG_STATE_GATE);
        }
 
-       if (RREG32(mmUVD_STATUS) != 0)
-               uvd_v6_0_stop(adev);
-
-       return 0;
-}
-
-static int uvd_v6_0_suspend(void *handle)
-{
-       int r;
-       struct amdgpu_device *adev = (struct amdgpu_device *)handle;
-
        r = uvd_v6_0_hw_fini(adev);
        if (r)
                return r;