Skip to contentSkip to conversation

drm/amdgpu: finalizing mem_partitions at the end of GMC v9 sw_fini

PATCH In review Le Ma 2 participants 2 messages Nov 13, 2023

Subsystems (2)
lore
Share & tools
lore

Le Ma

author
#0 lore raw

PATCH 1/1 drm/amdgpu: finalizing mem_partitions at the end of GMC v9 sw_fini

The valid num_mem_partitions is required during ttm pool fini, thus move the cleanup at the end of the function.

---
 drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c +3 -2
index bde25eb4ed8e..c1f2f166f064 100644
@@ -2170,8 +2170,6 @@ static int gmc_v9_0_sw_fini(void *handle)
 
 	if (amdgpu_ip_version(adev, GC_HWIP, 0) == IP_VERSION(9, 4, 3))
 		amdgpu_gmc_sysfs_fini(adev);
-	adev->gmc.num_mem_partitions = 0;
-	kfree(adev->gmc.mem_partitions);
 
 	amdgpu_gmc_ras_fini(adev);
 	amdgpu_gem_force_release(adev);
@@ -2185,6 +2183,9 @@ static int gmc_v9_0_sw_fini(void *handle)
 	amdgpu_bo_free_kernel(&adev->gmc.pdb0_bo, NULL, &adev->gmc.ptr_pdb0);
 	amdgpu_bo_fini(adev);
 
+	adev->gmc.num_mem_partitions = 0;
+	kfree(adev->gmc.mem_partitions);
+
 	return 0;
 }
 
Signature · 1 line
2.38.1
Reviewed-by on v1 1/1
#1 lore raw

[AMD Official Use Only - General]

Regards,
Hawking
-----Original Message-----
From: Ma, Le <[email protected]>
Sent: Monday, November 13, 2023 18:36
To: [email protected]
Cc: Zhang, Hawking <[email protected]>
Subject: [PATCH 1/1] drm/amdgpu: finalizing mem_partitions at the end of GMC v9 sw_fini

The valid num_mem_partitions is required during ttm pool fini, thus move the cleanup at the end of the function.

---
 drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c +3 -2
index bde25eb4ed8e..c1f2f166f064 100644
@@ -2170,8 +2170,6 @@ static int gmc_v9_0_sw_fini(void *handle)
 
        if (amdgpu_ip_version(adev, GC_HWIP, 0) == IP_VERSION(9, 4, 3))
                amdgpu_gmc_sysfs_fini(adev);
-       adev->gmc.num_mem_partitions = 0;
-       kfree(adev->gmc.mem_partitions);
 
        amdgpu_gmc_ras_fini(adev);
        amdgpu_gem_force_release(adev);
@@ -2185,6 +2183,9 @@ static int gmc_v9_0_sw_fini(void *handle)
        amdgpu_bo_free_kernel(&adev->gmc.pdb0_bo, NULL, &adev->gmc.ptr_pdb0);
        amdgpu_bo_fini(adev);
 
+       adev->gmc.num_mem_partitions = 0;
+       kfree(adev->gmc.mem_partitions);
+
        return 0;
 }
 

--
2.38.1