diff options
| author | Roger.He <[email protected]> | 2017-04-21 05:08:43 +0000 |
|---|---|---|
| committer | Alex Deucher <[email protected]> | 2017-04-28 21:33:08 +0000 |
| commit | 82521316395a37a2ec1d7e396c055f3c7de9d93b (patch) | |
| tree | 45fa90db68afefba7d11671ee969e13eea354cc8 /drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | |
| parent | drm/amdgpu: Fix use of interruptible waiting (diff) | |
| download | kernel-82521316395a37a2ec1d7e396c055f3c7de9d93b.tar.gz kernel-82521316395a37a2ec1d7e396c055f3c7de9d93b.zip | |
drm/amdgpu: validate shadow before restoring from it
Reviewed-by: Chunming Zhou <[email protected]>
Reviewed-by: Christian König <[email protected]>
Signed-off-by: Roger.He <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/amdgpu_object.c')
| -rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c index 60de77b153b7..365883d7948d 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c @@ -543,6 +543,27 @@ err: return r; } +int amdgpu_bo_validate(struct amdgpu_bo *bo) +{ + uint32_t domain; + int r; + + if (bo->pin_count) + return 0; + + domain = bo->prefered_domains; + +retry: + amdgpu_ttm_placement_from_domain(bo, domain); + r = ttm_bo_validate(&bo->tbo, &bo->placement, false, false); + if (unlikely(r == -ENOMEM) && domain != bo->allowed_domains) { + domain = bo->allowed_domains; + goto retry; + } + + return r; +} + int amdgpu_bo_restore_from_shadow(struct amdgpu_device *adev, struct amdgpu_ring *ring, struct amdgpu_bo *bo, |
