drm/amdgpu: remove partition attributes sys file for gfx_v9_4_3
authorShiwu Zhang <shiwu.zhang@amd.com>
Mon, 14 Nov 2022 07:52:19 +0000 (15:52 +0800)
committerAlex Deucher <alexander.deucher@amd.com>
Fri, 9 Jun 2023 13:48:59 +0000 (09:48 -0400)
For driver de-init like rmmod operations those partition specific
attributes need to be removed accordingly.

Signed-off-by: Shiwu Zhang <shiwu.zhang@amd.com>
Reviewed-by: Rajneesh Bhardwaj <rajneesh.bhardwaj@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.h
drivers/gpu/drm/amd/amdgpu/gfx_v9_4_3.c

index 8aea9e02327559edfa9589c6f6e203eeec3ec13f..5ff49737d7c601023d23768141929445c83cc5d1 100644 (file)
@@ -1345,3 +1345,10 @@ int amdgpu_gfx_sysfs_init(struct amdgpu_device *adev)
 
        return 0;
 }
+
+void amdgpu_gfx_sysfs_fini(struct amdgpu_device *adev)
+{
+       device_remove_file(adev->dev, &dev_attr_current_compute_partition);
+       device_remove_file(adev->dev, &dev_attr_available_compute_partition);
+       device_remove_file(adev->dev, &dev_attr_current_memory_partition);
+}
index e37501685fa9443316d87de8dfd6b3cb0b7eb26c..023c5b08929ffad255bf660eb071c0c8ff4bd9e1 100644 (file)
@@ -502,4 +502,5 @@ int amdgpu_gfx_poison_consumption_handler(struct amdgpu_device *adev,
 
 bool amdgpu_gfx_is_master_xcc(struct amdgpu_device *adev, int xcc_id);
 int amdgpu_gfx_sysfs_init(struct amdgpu_device *adev);
+void amdgpu_gfx_sysfs_fini(struct amdgpu_device *adev);
 #endif
index 9d7852ffd708474c23a95177a29cc42abed769b3..75ad5176e99eaddd6d49da06167b498cbd40600d 100644 (file)
@@ -895,6 +895,7 @@ static int gfx_v9_4_3_sw_fini(void *handle)
        gfx_v9_4_3_mec_fini(adev);
        amdgpu_bo_unref(&adev->gfx.rlc.clear_state_obj);
        gfx_v9_4_3_free_microcode(adev);
+       amdgpu_gfx_sysfs_fini(adev);
 
        return 0;
 }