drm/amdgpu: make BO type check less restrictive
Subsystems (2)
PATCH 1/1 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.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +4 -4
@@ -1167,7 +1167,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 ;
@@ -1189,7 +1189,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);
@@ -1216,7 +1216,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) {
@@ -1266,7 +1266,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)
Signature · 6 lines
2.30.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Am 15.03.21 um 16:14 schrieb Nirmoy Das:
Quoted 5 lines
BO with
ttm_bo_type_sgtype can also havetiling_flagand metadata. So so BO type check for onlyttm_bo_type_kernel.Signed-off-by Nirmoy Das <[email protected]>Reported-by Tom StDenis <[email protected]>
At some point we should probably add a amdgpu_bo_is_user() helper function, but for now that should work.
Quoted 36 lines
--- drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +3
-3@@ -1167,7 +1167,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 ;@@ -1189,7 +1189,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);@@ -1216,7 +1216,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) {
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c int amdgpu_bo_get_metadata(struct amdgpu_bo *bo, void *buffer, · line 1272
Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +1
-1@@ -1266,7 +1266,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)
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
StDenis, Tom
Reviewed-by Christian König[AMD Official Use Only - Internal Distribution Only]
FWIW the patch seems to fix the issue I was seeing :-)
Tom
________________________________________
From: Koenig, Christian <[email protected]>
Sent: Monday, March 15, 2021 11:22
To: Das, Nirmoy
Cc: [email protected]; StDenis, Tom
Subject: Re: [PATCH 1/1] drm/amdgpu: make BO type check less restrictive
Am 15.03.21 um 16:14 schrieb Nirmoy Das:
Quoted 5 lines
BO with
ttm_bo_type_sgtype can also havetiling_flagand metadata. So so BO type check for onlyttm_bo_type_kernel.Signed-off-by Nirmoy Das <[email protected]>Reported-by Tom StDenis <[email protected]>
At some point we should probably add a amdgpu_bo_is_user() helper function, but for now that should work.
Quoted 36 lines
--- drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +3
-3@@ -1167,7 +1167,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 ;@@ -1189,7 +1189,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);@@ -1216,7 +1216,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) {
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c int amdgpu_bo_get_metadata(struct amdgpu_bo *bo, void *buffer, · line 1272
Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +1
-1@@ -1266,7 +1266,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)
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx