From: "Christian König" <christian.koenig@amd.com>
To: Saleemkhan Jamadar <saleemkhan083@gmail.com>,
alexander.deucher@amd.com, amd-gfx@lists.freedesktop.org
Subject: Re: [PATCH v2] drm/amdgpu: do not use amdgpu_bo_gpu_offset_no_check individually
Date: Mon, 10 Nov 2025 10:15:58 +0100 [thread overview]
Message-ID: <013ea777-fb59-45d0-a83d-68919f68785d@amd.com> (raw)
In-Reply-To: <20251108190317.13240-1-saleemkhan083@gmail.com>
On 11/8/25 20:02, Saleemkhan Jamadar wrote:
> This should not be used indiviually, use amdgpu_bo_gpu_offset
> with bo reserved.
>
> v2 - pin bo so that offset returned won't change after unresv/unlock (Christian)
Each pin must have a matching unpin or otherwise you run into warnings on destruction.
Regards,
Christian.
>
> Signed-off-by: Saleemkhan Jamadar <saleemkhan083@gmail.com>
> Suggested-by: Christian König <christian.koenig@amd.com>
> ---
> .../gpu/drm/amd/amdgpu/amdgpu_doorbell_mgr.c | 2 +-
> drivers/gpu/drm/amd/amdgpu/mes_userqueue.c | 21 ++++++++++++++++++-
> 2 files changed, 21 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_doorbell_mgr.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_doorbell_mgr.c
> index 3040437d99c2..bc7858567321 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_doorbell_mgr.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_doorbell_mgr.c
> @@ -129,7 +129,7 @@ uint32_t amdgpu_doorbell_index_on_bar(struct amdgpu_device *adev,
> {
> int db_bo_offset;
>
> - db_bo_offset = amdgpu_bo_gpu_offset_no_check(db_bo);
> + db_bo_offset = amdgpu_bo_gpu_offset(db_bo);
>
> /* doorbell index is 32 bit but doorbell's size can be 32 bit
> * or 64 bit, so *db_size(in byte)/4 for alignment.
> diff --git a/drivers/gpu/drm/amd/amdgpu/mes_userqueue.c b/drivers/gpu/drm/amd/amdgpu/mes_userqueue.c
> index b1ee9473d628..f0ad3edbdef2 100644
> --- a/drivers/gpu/drm/amd/amdgpu/mes_userqueue.c
> +++ b/drivers/gpu/drm/amd/amdgpu/mes_userqueue.c
> @@ -93,8 +93,27 @@ mes_userq_create_wptr_mapping(struct amdgpu_userq_mgr *uq_mgr,
> return ret;
> }
>
> - queue->wptr_obj.gpu_addr = amdgpu_bo_gpu_offset_no_check(wptr_obj->obj);
> + ret = amdgpu_bo_reserve(wptr_obj->obj, true);
> + if (ret) {
> + DRM_ERROR("Failed to reserve wptr bo\n");
> + return ret;
> + }
> +
> + ret = amdgpu_bo_pin(wptr_obj->obj, AMDGPU_GEM_DOMAIN_GTT);
> + if (ret) {
> + drm_file_err(uq_mgr->file, "[Usermode queues] Failed to pin wptr bo\n");
> + goto unresv_bo;
> + }
> +
> + queue->wptr_obj.gpu_addr = amdgpu_bo_gpu_offset(wptr_obj->obj);
> + amdgpu_bo_unreserve(wptr_obj->obj);
> +
> return 0;
> +
> +unresv_bo:
> + amdgpu_bo_unreserve(wptr_obj->obj);
> + return ret;
> +
> }
>
> static int convert_to_mes_priority(int priority)
prev parent reply other threads:[~2025-11-10 9:16 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-08 19:02 [PATCH v2] drm/amdgpu: do not use amdgpu_bo_gpu_offset_no_check individually Saleemkhan Jamadar
2025-11-10 9:15 ` Christian König [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=013ea777-fb59-45d0-a83d-68919f68785d@amd.com \
--to=christian.koenig@amd.com \
--cc=alexander.deucher@amd.com \
--cc=amd-gfx@lists.freedesktop.org \
--cc=saleemkhan083@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox