diff options
author | Jonathan Gray <jsg@cvs.openbsd.org> | 2022-01-27 23:07:52 +0000 |
---|---|---|
committer | Jonathan Gray <jsg@cvs.openbsd.org> | 2022-01-27 23:07:52 +0000 |
commit | af80ffc5c2bee429a20d45bd42b935a1c07c4809 (patch) | |
tree | 8b86d24f3a1556fc01e1a583b1f35a1b5fa130e3 /sys/dev/pci | |
parent | 9447cef630188fc20e1210d0a0958441289d1ca4 (diff) |
drm/amd/amdgpu: fix gmc bo pin count leak in SRIOV
From Jingwen Chen
305f07b93d34d292432251e9963bf232db38d67a in linux 5.15.y/5.15.17
948e7ce01413b71395723aaf846015062aea3a43 in mainline linux
Diffstat (limited to 'sys/dev/pci')
-rw-r--r-- | sys/dev/pci/drm/amd/amdgpu/gmc_v10_0.c | 4 | ||||
-rw-r--r-- | sys/dev/pci/drm/amd/amdgpu/gmc_v9_0.c | 4 |
2 files changed, 8 insertions, 0 deletions
diff --git a/sys/dev/pci/drm/amd/amdgpu/gmc_v10_0.c b/sys/dev/pci/drm/amd/amdgpu/gmc_v10_0.c index d37205f0076..61b14fa2aa6 100644 --- a/sys/dev/pci/drm/amd/amdgpu/gmc_v10_0.c +++ b/sys/dev/pci/drm/amd/amdgpu/gmc_v10_0.c @@ -1021,10 +1021,14 @@ static int gmc_v10_0_gart_enable(struct amdgpu_device *adev) return -EINVAL; } + if (amdgpu_sriov_vf(adev) && amdgpu_in_reset(adev)) + goto skip_pin_bo; + r = amdgpu_gart_table_vram_pin(adev); if (r) return r; +skip_pin_bo: r = adev->gfxhub.funcs->gart_enable(adev); if (r) return r; diff --git a/sys/dev/pci/drm/amd/amdgpu/gmc_v9_0.c b/sys/dev/pci/drm/amd/amdgpu/gmc_v9_0.c index ce416e17737..9c1d45e5380 100644 --- a/sys/dev/pci/drm/amd/amdgpu/gmc_v9_0.c +++ b/sys/dev/pci/drm/amd/amdgpu/gmc_v9_0.c @@ -1708,10 +1708,14 @@ static int gmc_v9_0_gart_enable(struct amdgpu_device *adev) return -EINVAL; } + if (amdgpu_sriov_vf(adev) && amdgpu_in_reset(adev)) + goto skip_pin_bo; + r = amdgpu_gart_table_vram_pin(adev); if (r) return r; +skip_pin_bo: r = adev->gfxhub.funcs->gart_enable(adev); if (r) return r; |