Skip to content

Commit 621ddff

Browse files
yuliashi-amdgregkh
authored andcommitted
drm/amdgpu: fix gart.bo pin_count leak
[ Upstream commit 6680576 ] gmc_v{9,10}_0_gart_disable() isn't called matched with correspoding gart_enbale function in SRIOV case. This will lead to gart.bo pin_count leak on driver unload. Cc: Hawking Zhang <Hawking.Zhang@amd.com> Signed-off-by: Leslie Shi <Yuliang.Shi@amd.com> Signed-off-by: Guchun Chen <guchun.chen@amd.com> Reviewed-by: Christian König <christian.koenig@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent a5ba615 commit 621ddff

2 files changed

Lines changed: 4 additions & 2 deletions

File tree

drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1018,6 +1018,8 @@ static int gmc_v10_0_hw_fini(void *handle)
10181018
{
10191019
struct amdgpu_device *adev = (struct amdgpu_device *)handle;
10201020

1021+
gmc_v10_0_gart_disable(adev);
1022+
10211023
if (amdgpu_sriov_vf(adev)) {
10221024
/* full access mode, so don't touch any GMC register */
10231025
DRM_DEBUG("For SRIOV client, shouldn't do anything.\n");
@@ -1026,7 +1028,6 @@ static int gmc_v10_0_hw_fini(void *handle)
10261028

10271029
amdgpu_irq_put(adev, &adev->gmc.ecc_irq, 0);
10281030
amdgpu_irq_put(adev, &adev->gmc.vm_fault, 0);
1029-
gmc_v10_0_gart_disable(adev);
10301031

10311032
return 0;
10321033
}

drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1677,6 +1677,8 @@ static int gmc_v9_0_hw_fini(void *handle)
16771677
{
16781678
struct amdgpu_device *adev = (struct amdgpu_device *)handle;
16791679

1680+
gmc_v9_0_gart_disable(adev);
1681+
16801682
if (amdgpu_sriov_vf(adev)) {
16811683
/* full access mode, so don't touch any GMC register */
16821684
DRM_DEBUG("For SRIOV client, shouldn't do anything.\n");
@@ -1685,7 +1687,6 @@ static int gmc_v9_0_hw_fini(void *handle)
16851687

16861688
amdgpu_irq_put(adev, &adev->gmc.ecc_irq, 0);
16871689
amdgpu_irq_put(adev, &adev->gmc.vm_fault, 0);
1688-
gmc_v9_0_gart_disable(adev);
16891690

16901691
return 0;
16911692
}

0 commit comments

Comments
 (0)