]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
drm/amdgpu: fix JPEG v5.3.0 queue reset failure in DPG mode
authorJesse Zhang <Jesse.Zhang@amd.com>
Wed, 29 Jul 2026 08:57:08 +0000 (16:57 +0800)
committerAlex Deucher <alexander.deucher@amd.com>
Thu, 6 Aug 2026 18:31:34 +0000 (14:31 -0400)
Like jpeg_v5_0_0, in DPG mode the ring reset path only clears the
JPEG_PG_MODE bit and never resets a hung JRBC, so the post-reset ring test
times out and the driver falls back to a full MODE1 reset.

Temporarily force the static power-gating path during the reset so the
stop/start sequence power-cycles the JPEG block (JMI soft reset + power
off/on), matching the jpeg_v4_0 reset.

Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Jesse Zhang <Jesse.Zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
(cherry picked from commit e93659cab11c48255dcac58af60203c99815586b)
Cc: stable@vger.kernel.org
drivers/gpu/drm/amd/amdgpu/jpeg_v5_3_0.c

index 2c3e6d9f52a6550181f0cccafc0268b2d36b8dd2..33c2626abc80f1c92886c088be634263b36a6204 100644 (file)
@@ -655,15 +655,28 @@ static int jpeg_v5_3_0_ring_reset(struct amdgpu_ring *ring,
                                  unsigned int vmid,
                                  struct amdgpu_fence *timedout_fence)
 {
+       struct amdgpu_device *adev = ring->adev;
+       u32 pg_flags = adev->pg_flags;
        int r;
 
        amdgpu_ring_reset_helper_begin(ring, timedout_fence);
-       r = jpeg_v5_3_0_stop(ring->adev);
-       if (r)
-               return r;
-       r = jpeg_v5_3_0_start(ring->adev);
+
+       /*
+        * The DPG stop path only clears the JPEG_PG_MODE bit and never resets a
+        * hung JRBC, so the post-reset ring test times out and the driver falls
+        * back to a full MODE1 reset. Temporarily force the static power-gating
+        * path so the stop/start sequence actually power-cycles the JPEG block
+        * (JMI soft reset + static power off/on), matching the working jpeg_v4_0
+        * reset.
+        */
+       adev->pg_flags &= ~AMD_PG_SUPPORT_JPEG_DPG;
+       r = jpeg_v5_3_0_stop(adev);
+       if (!r)
+               r = jpeg_v5_3_0_start(adev);
+       adev->pg_flags = pg_flags;
        if (r)
                return r;
+
        return amdgpu_ring_reset_helper_end(ring, timedout_fence);
 }