[PATCH 2/2] drm/amd/amdgpu: fix gmc bo pin count leak in SRIOV

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



[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 for pin bo in gart_enable

Signed-off-by: Jingwen Chen <Jingwen.Chen2@xxxxxxx>
---
 drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c | 8 +++++---
 drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c  | 8 +++++---
 2 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c b/drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c
index d696c4754bea..b0f4d1ded977 100644
--- a/drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c
@@ -992,9 +992,11 @@ static int gmc_v10_0_gart_enable(struct amdgpu_device *adev)
 		return -EINVAL;
 	}
 
-	r = amdgpu_gart_table_vram_pin(adev);
-	if (r)
-		return r;
+	if (amdgpu_sriov_vf(adev) && !amdgpu_in_reset(adev)) {
+		r = amdgpu_gart_table_vram_pin(adev);
+		if (r)
+			return r;
+	}
 
 	r = adev->gfxhub.funcs->gart_enable(adev);
 	if (r)
diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c b/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c
index db2ec84f7237..c1adb212276d 100644
--- a/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c
@@ -1717,9 +1717,11 @@ static int gmc_v9_0_gart_enable(struct amdgpu_device *adev)
 		return -EINVAL;
 	}
 
-	r = amdgpu_gart_table_vram_pin(adev);
-	if (r)
-		return r;
+	if (amdgpu_sriov_vf(adev) && !amdgpu_in_reset(adev)) {
+		r = amdgpu_gart_table_vram_pin(adev);
+		if (r)
+			return r;
+	}
 
 	r = adev->gfxhub.funcs->gart_enable(adev);
 	if (r)
-- 
2.30.2




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux