Skip to content

Commit 948e7ce

Browse files
Jingwen Chenalexdeucher
authored andcommitted
drm/amd/amdgpu: fix gmc bo pin count leak in SRIOV
[Why] gmc bo will be pinned during loading amdgpu and reset in SRIOV while only unpinned in unload amdgpu [How] add amdgpu_in_reset and sriov judgement to skip pin bo v2: fix wrong judgement Signed-off-by: Jingwen Chen <[email protected]> Reviewed-by: Horace Chen <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
1 parent 85dfc1d commit 948e7ce

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -992,10 +992,14 @@ static int gmc_v10_0_gart_enable(struct amdgpu_device *adev)
992992
return -EINVAL;
993993
}
994994

995+
if (amdgpu_sriov_vf(adev) && amdgpu_in_reset(adev))
996+
goto skip_pin_bo;
997+
995998
r = amdgpu_gart_table_vram_pin(adev);
996999
if (r)
9971000
return r;
9981001

1002+
skip_pin_bo:
9991003
r = adev->gfxhub.funcs->gart_enable(adev);
10001004
if (r)
10011005
return r;

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1717,10 +1717,14 @@ static int gmc_v9_0_gart_enable(struct amdgpu_device *adev)
17171717
return -EINVAL;
17181718
}
17191719

1720+
if (amdgpu_sriov_vf(adev) && amdgpu_in_reset(adev))
1721+
goto skip_pin_bo;
1722+
17201723
r = amdgpu_gart_table_vram_pin(adev);
17211724
if (r)
17221725
return r;
17231726

1727+
skip_pin_bo:
17241728
r = adev->gfxhub.funcs->gart_enable(adev);
17251729
if (r)
17261730
return r;

0 commit comments

Comments
 (0)