]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
drm/amdgpu: Add WARN_ON to the resource clear function
authorArunpravin Paneer Selvam <Arunpravin.PaneerSelvam@amd.com>
Wed, 16 Jul 2025 07:51:23 +0000 (13:21 +0530)
committerAlex Deucher <alexander.deucher@amd.com>
Thu, 17 Jul 2025 16:36:12 +0000 (12:36 -0400)
Set the dirty bit when the memory resource is not cleared
during BO release.

v2(Christian):
  - Drop the cleared flag set to false.
  - Improve the amdgpu_vram_mgr_set_clear_state() function.

v3:
  - Add back the resource clear flag set function call after
    being cleared during eviction (Christian).
  - Modified the patch subject name.

Signed-off-by: Arunpravin Paneer Selvam <Arunpravin.PaneerSelvam@amd.com>
Suggested-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.h

index b256cbc2bc27086c4f7ba2fa9bc675568734700a..2c88d5fd87da2ccff34e097011c546a6cc96fad4 100644 (file)
@@ -66,7 +66,10 @@ to_amdgpu_vram_mgr_resource(struct ttm_resource *res)
 
 static inline void amdgpu_vram_mgr_set_cleared(struct ttm_resource *res)
 {
-       to_amdgpu_vram_mgr_resource(res)->flags |= DRM_BUDDY_CLEARED;
+       struct amdgpu_vram_mgr_resource *ares = to_amdgpu_vram_mgr_resource(res);
+
+       WARN_ON(ares->flags & DRM_BUDDY_CLEARED);
+       ares->flags |= DRM_BUDDY_CLEARED;
 }
 
 #endif