diff options
author | Chunming Zhou <david1.zhou@amd.com> | 2018-04-17 06:34:40 -0400 |
---|---|---|
committer | Alex Deucher <alexander.deucher@amd.com> | 2018-05-15 14:43:32 -0400 |
commit | 3f188453faf7ba5b59e8064df4afffbc946e25ec (patch) | |
tree | 64c028c4dee60d1b0c9b37692234ffae98056cf0 /drivers/gpu/drm/amd/amdgpu | |
parent | aa2b2e2822831d78a283edb12cf8b7da21bdd0ed (diff) |
drm/amdgpu: handle domain mask checking v2
if domain is illegal, we should return error.
v2:
remove duplicated domain checking.
Signed-off-by: Chunming Zhou <david1.zhou@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu')
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c | 7 | ||||
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 9 |
2 files changed, 2 insertions, 14 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c index ff606ce88837..c62c3dd4dcc6 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c | |||
@@ -229,12 +229,7 @@ int amdgpu_gem_create_ioctl(struct drm_device *dev, void *data, | |||
229 | return -EINVAL; | 229 | return -EINVAL; |
230 | 230 | ||
231 | /* reject invalid gem domains */ | 231 | /* reject invalid gem domains */ |
232 | if (args->in.domains & ~(AMDGPU_GEM_DOMAIN_CPU | | 232 | if (args->in.domains & ~AMDGPU_GEM_DOMAIN_MASK) |
233 | AMDGPU_GEM_DOMAIN_GTT | | ||
234 | AMDGPU_GEM_DOMAIN_VRAM | | ||
235 | AMDGPU_GEM_DOMAIN_GDS | | ||
236 | AMDGPU_GEM_DOMAIN_GWS | | ||
237 | AMDGPU_GEM_DOMAIN_OA)) | ||
238 | return -EINVAL; | 233 | return -EINVAL; |
239 | 234 | ||
240 | /* create a gem object to contain this object in */ | 235 | /* create a gem object to contain this object in */ |
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c index 9258f0694922..feece0a491a3 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | |||
@@ -360,7 +360,6 @@ static int amdgpu_bo_do_create(struct amdgpu_device *adev, | |||
360 | }; | 360 | }; |
361 | struct amdgpu_bo *bo; | 361 | struct amdgpu_bo *bo; |
362 | unsigned long page_align, size = bp->size; | 362 | unsigned long page_align, size = bp->size; |
363 | u32 preferred_domains; | ||
364 | size_t acc_size; | 363 | size_t acc_size; |
365 | int r; | 364 | int r; |
366 | 365 | ||
@@ -381,14 +380,8 @@ static int amdgpu_bo_do_create(struct amdgpu_device *adev, | |||
381 | drm_gem_private_object_init(adev->ddev, &bo->gem_base, size); | 380 | drm_gem_private_object_init(adev->ddev, &bo->gem_base, size); |
382 | INIT_LIST_HEAD(&bo->shadow_list); | 381 | INIT_LIST_HEAD(&bo->shadow_list); |
383 | INIT_LIST_HEAD(&bo->va); | 382 | INIT_LIST_HEAD(&bo->va); |
384 | preferred_domains = bp->preferred_domain ? bp->preferred_domain : | 383 | bo->preferred_domains = bp->preferred_domain ? bp->preferred_domain : |
385 | bp->domain; | 384 | bp->domain; |
386 | bo->preferred_domains = preferred_domains & (AMDGPU_GEM_DOMAIN_VRAM | | ||
387 | AMDGPU_GEM_DOMAIN_GTT | | ||
388 | AMDGPU_GEM_DOMAIN_CPU | | ||
389 | AMDGPU_GEM_DOMAIN_GDS | | ||
390 | AMDGPU_GEM_DOMAIN_GWS | | ||
391 | AMDGPU_GEM_DOMAIN_OA); | ||
392 | bo->allowed_domains = bo->preferred_domains; | 385 | bo->allowed_domains = bo->preferred_domains; |
393 | if (bp->type != ttm_bo_type_kernel && | 386 | if (bp->type != ttm_bo_type_kernel && |
394 | bo->allowed_domains == AMDGPU_GEM_DOMAIN_VRAM) | 387 | bo->allowed_domains == AMDGPU_GEM_DOMAIN_VRAM) |