Commit 030bb4ad authored by Nirmoy Das's avatar Nirmoy Das Committed by Alex Deucher

drm/amdgpu: make BO type check less restrictive

BO with ttm_bo_type_sg type can also have tiling_flag and metadata.
So so BO type check for only ttm_bo_type_kernel.
Reviewed-by: default avatarChristian König <christian.koenig@amd.com>
Signed-off-by: default avatarNirmoy Das <nirmoy.das@amd.com>
Reported-by: default avatarTom StDenis <Tom.StDenis@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent cc1bcf85
......@@ -1164,7 +1164,7 @@ int amdgpu_bo_set_tiling_flags(struct amdgpu_bo *bo, u64 tiling_flags)
struct amdgpu_device *adev = amdgpu_ttm_adev(bo->tbo.bdev);
struct amdgpu_bo_user *ubo;
BUG_ON(bo->tbo.type != ttm_bo_type_device);
BUG_ON(bo->tbo.type == ttm_bo_type_kernel);
if (adev->family <= AMDGPU_FAMILY_CZ &&
AMDGPU_TILING_GET(tiling_flags, TILE_SPLIT) > 6)
return -EINVAL;
......@@ -1186,7 +1186,7 @@ void amdgpu_bo_get_tiling_flags(struct amdgpu_bo *bo, u64 *tiling_flags)
{
struct amdgpu_bo_user *ubo;
BUG_ON(bo->tbo.type != ttm_bo_type_device);
BUG_ON(bo->tbo.type == ttm_bo_type_kernel);
dma_resv_assert_held(bo->tbo.base.resv);
ubo = to_amdgpu_bo_user(bo);
......@@ -1213,7 +1213,7 @@ int amdgpu_bo_set_metadata (struct amdgpu_bo *bo, void *metadata,
struct amdgpu_bo_user *ubo;
void *buffer;
BUG_ON(bo->tbo.type != ttm_bo_type_device);
BUG_ON(bo->tbo.type == ttm_bo_type_kernel);
ubo = to_amdgpu_bo_user(bo);
if (!metadata_size) {
if (ubo->metadata_size) {
......@@ -1263,7 +1263,7 @@ int amdgpu_bo_get_metadata(struct amdgpu_bo *bo, void *buffer,
if (!buffer && !metadata_size)
return -EINVAL;
BUG_ON(bo->tbo.type != ttm_bo_type_device);
BUG_ON(bo->tbo.type == ttm_bo_type_kernel);
ubo = to_amdgpu_bo_user(bo);
if (buffer) {
if (buffer_size < ubo->metadata_size)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment