All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/amdgpu: Mask out clear/wipe operation if buffer function is unavailable
@ 2025-06-16  8:21 Lang Yu
  2025-06-16  8:23 ` Christian König
  0 siblings, 1 reply; 2+ messages in thread
From: Lang Yu @ 2025-06-16  8:21 UTC (permalink / raw)
  To: amd-gfx, Alex Deucher, Christian Koenig; +Cc: Hawking Zhang, Lang Yu

It makes no sense to use clear/wipe operation if buffer function is
unavailable. It's useful in bring up phase when SDMA is not ready
and/or disabled intentionally by amdgpu_ip_block_mask. This avoids
manually masking out clear/wipe operation repeatedly.

Signed-off-by: Lang Yu <lang.yu@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
index 3ac52d9b9d30..467c8a1911bc 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
@@ -689,6 +689,10 @@ int amdgpu_bo_create(struct amdgpu_device *adev,
 	if (!amdgpu_bo_support_uswc(bo->flags))
 		bo->flags &= ~AMDGPU_GEM_CREATE_CPU_GTT_USWC;
 
+	if (!adev->mman.buffer_funcs_enabled)
+		bo->flags &= ~(AMDGPU_GEM_CREATE_VRAM_CLEARED |
+			       AMDGPU_GEM_CREATE_VRAM_WIPE_ON_RELEASE);
+
 	bo->tbo.bdev = &adev->mman.bdev;
 	if (bp->domain & (AMDGPU_GEM_DOMAIN_GWS | AMDGPU_GEM_DOMAIN_OA |
 			  AMDGPU_GEM_DOMAIN_GDS))
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] drm/amdgpu: Mask out clear/wipe operation if buffer function is unavailable
  2025-06-16  8:21 [PATCH] drm/amdgpu: Mask out clear/wipe operation if buffer function is unavailable Lang Yu
@ 2025-06-16  8:23 ` Christian König
  0 siblings, 0 replies; 2+ messages in thread
From: Christian König @ 2025-06-16  8:23 UTC (permalink / raw)
  To: Lang Yu, amd-gfx, Alex Deucher; +Cc: Hawking Zhang

On 6/16/25 10:21, Lang Yu wrote:
> It makes no sense to use clear/wipe operation if buffer function is
> unavailable. It's useful in bring up phase when SDMA is not ready
> and/or disabled intentionally by amdgpu_ip_block_mask. This avoids
> manually masking out clear/wipe operation repeatedly.

Clear NAK. SDMA can be temporary unavailable during suspend/resume, but that doesn't mean that we can skip that.

Especially ignoring AMDGPU_GEM_CREATE_VRAM_CLEARED will just crash userspace.

Regards,
Christian.

> 
> Signed-off-by: Lang Yu <lang.yu@amd.com>
> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
> index 3ac52d9b9d30..467c8a1911bc 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
> @@ -689,6 +689,10 @@ int amdgpu_bo_create(struct amdgpu_device *adev,
>  	if (!amdgpu_bo_support_uswc(bo->flags))
>  		bo->flags &= ~AMDGPU_GEM_CREATE_CPU_GTT_USWC;
>  
> +	if (!adev->mman.buffer_funcs_enabled)
> +		bo->flags &= ~(AMDGPU_GEM_CREATE_VRAM_CLEARED |
> +			       AMDGPU_GEM_CREATE_VRAM_WIPE_ON_RELEASE);
> +
>  	bo->tbo.bdev = &adev->mman.bdev;
>  	if (bp->domain & (AMDGPU_GEM_DOMAIN_GWS | AMDGPU_GEM_DOMAIN_OA |
>  			  AMDGPU_GEM_DOMAIN_GDS))


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-06-16  8:24 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-16  8:21 [PATCH] drm/amdgpu: Mask out clear/wipe operation if buffer function is unavailable Lang Yu
2025-06-16  8:23 ` Christian König

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.