Commit 948e7ce0 authored by Jingwen Chen's avatar Jingwen Chen Committed by Alex Deucher

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: default avatarJingwen Chen <Jingwen.Chen2@amd.com>
Reviewed-by: default avatarHorace Chen <horace.chen@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 85dfc1d6
...@@ -992,10 +992,14 @@ static int gmc_v10_0_gart_enable(struct amdgpu_device *adev) ...@@ -992,10 +992,14 @@ static int gmc_v10_0_gart_enable(struct amdgpu_device *adev)
return -EINVAL; return -EINVAL;
} }
if (amdgpu_sriov_vf(adev) && amdgpu_in_reset(adev))
goto skip_pin_bo;
r = amdgpu_gart_table_vram_pin(adev); r = amdgpu_gart_table_vram_pin(adev);
if (r) if (r)
return r; return r;
skip_pin_bo:
r = adev->gfxhub.funcs->gart_enable(adev); r = adev->gfxhub.funcs->gart_enable(adev);
if (r) if (r)
return r; return r;
......
...@@ -1717,10 +1717,14 @@ static int gmc_v9_0_gart_enable(struct amdgpu_device *adev) ...@@ -1717,10 +1717,14 @@ static int gmc_v9_0_gart_enable(struct amdgpu_device *adev)
return -EINVAL; return -EINVAL;
} }
if (amdgpu_sriov_vf(adev) && amdgpu_in_reset(adev))
goto skip_pin_bo;
r = amdgpu_gart_table_vram_pin(adev); r = amdgpu_gart_table_vram_pin(adev);
if (r) if (r)
return r; return r;
skip_pin_bo:
r = adev->gfxhub.funcs->gart_enable(adev); r = adev->gfxhub.funcs->gart_enable(adev);
if (r) if (r)
return r; return r;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment