From: Christian König Date: Tue, 19 Jan 2016 11:48:14 +0000 (+0100) Subject: drm/amdgpu: fix amdgpu_bo_pin_restricted VRAM placing v2 X-Git-Tag: firefly_0821_release~176^2~475^2~242 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=7c105b06bc6296ce215b4dc942204bdf82237323;p=firefly-linux-kernel-4.4.55.git drm/amdgpu: fix amdgpu_bo_pin_restricted VRAM placing v2 commit 78d0e182b6c1f5336f6e8cbb197f403276dabc7f upstream. We could pin BOs into invisible VRAM otherwise. v2: make logic more readable as suggested by Michel Signed-off-by: Christian König Reviewed-by: Alex Deucher (v1) Reviewed-by: Rex Zhu (v1) Reviewed-by: Michel Dänzer Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c index c3ce103b6a33..a2a16acee34d 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c @@ -399,7 +399,8 @@ int amdgpu_bo_pin_restricted(struct amdgpu_bo *bo, u32 domain, } if (fpfn > bo->placements[i].fpfn) bo->placements[i].fpfn = fpfn; - if (lpfn && lpfn < bo->placements[i].lpfn) + if (!bo->placements[i].lpfn || + (lpfn && lpfn < bo->placements[i].lpfn)) bo->placements[i].lpfn = lpfn; bo->placements[i].flags |= TTM_PL_FLAG_NO_EVICT; }