From: "Lazar, Lijo" <lijo.lazar@amd.com>
To: Alex Deucher <alexdeucher@gmail.com>
Cc: amd-gfx@lists.freedesktop.org, Hawking.Zhang@amd.com,
Alexander.Deucher@amd.com, Christian.Koenig@amd.com,
Jesse.Zhang@amd.com, "Yat Sin, David" <David.YatSin@amd.com>,
Lancelot.Six@amd.com
Subject: Re: [PATCH v4 09/11] drm/amdgpu: Add ioctl support for cwsr params
Date: Tue, 27 Jan 2026 11:14:06 +0530 [thread overview]
Message-ID: <283b02db-3038-4e6c-b577-a9fa02741b1b@amd.com> (raw)
In-Reply-To: <CADnq5_M6Mi5SJi_AYKhdmwacxumeTUrRHMrKazQxEM4v=utS7w@mail.gmail.com>
On 24-Jan-26 2:21 AM, Alex Deucher wrote:
> On Thu, Jan 22, 2026 at 5:52 AM Lijo Lazar <lijo.lazar@amd.com> wrote:
>>
>> Add cwsr parameters to userqueue ioctl. User should pass the GPU virtual
>> address for save/restore buffer, and size allocated. They are supported
>> only for user compute queues.
>>
>> Signed-off-by: Lijo Lazar <lijo.lazar@amd.com>
>> ---
>> drivers/gpu/drm/amd/amdgpu/mes_userqueue.c | 13 +++++++++----
>> include/uapi/drm/amdgpu_drm.h | 16 ++++++++++++++++
>> 2 files changed, 25 insertions(+), 4 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/amd/amdgpu/mes_userqueue.c b/drivers/gpu/drm/amd/amdgpu/mes_userqueue.c
>> index 7ad8297eb0d8..2765317f04df 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/mes_userqueue.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/mes_userqueue.c
>> @@ -343,16 +343,21 @@ static int mes_userq_mqd_create(struct amdgpu_usermode_queue *queue,
>>
>> if (amdgpu_cwsr_is_enabled(adev)) {
>> cwsr_params.ctx_save_area_address =
>> - userq_props->ctx_save_area_addr;
>> - cwsr_params.cwsr_sz = userq_props->ctx_save_area_size;
>> - cwsr_params.ctl_stack_sz = userq_props->ctl_stack_size;
>> -
>> + compute_mqd->ctx_save_area_va;
>> + cwsr_params.cwsr_sz = compute_mqd->ctx_save_area_size;
>> + cwsr_params.ctl_stack_sz = compute_mqd->ctl_stack_size;
>> r = amdgpu_userq_input_cwsr_params_validate(
>> queue, &cwsr_params);
>> if (r) {
>> kfree(compute_mqd);
>> goto free_mqd;
>> }
>> + userq_props->ctx_save_area_addr =
>> + compute_mqd->ctx_save_area_va;
>> + userq_props->ctx_save_area_size =
>> + compute_mqd->ctx_save_area_size;
>> + userq_props->ctl_stack_size =
>> + compute_mqd->ctl_stack_size;
>> }
>>
>> kfree(compute_mqd);
>> diff --git a/include/uapi/drm/amdgpu_drm.h b/include/uapi/drm/amdgpu_drm.h
>> index c178b8e0bd3f..b7a858365174 100644
>> --- a/include/uapi/drm/amdgpu_drm.h
>> +++ b/include/uapi/drm/amdgpu_drm.h
>> @@ -460,6 +460,22 @@ struct drm_amdgpu_userq_mqd_compute_gfx11 {
>> * to get the size.
>> */
>> __u64 eop_va;
>> + /**
>> + * @ctx_save_area_va: Virtual address of the GPU memory for save/restore buffer.
>> + * This must be from a separate GPU object, and use AMDGPU_INFO IOCTL
>> + * to get the size. This includes control stack, wave context and debugger memory.
>> + */
>> + __u64 ctx_save_area_va;
>> + /**
>> + * @ctx_save_area_size: Total size (in bytes) allocated for save/restore buffer.
>> + * Use AMDGPU_INFO IOCTL to get the size.
>> + */
>> + __u32 ctx_save_area_size;
>> + /**
>> + * @ctl_stack_size: Size (in bytes) of control stack region in the save/restore buffer.
>> + * Use AMDGPU_INFO IOCTL to get the size.
>> + */
>> + __u32 ctl_stack_size;
>
> Does it matter where the ctl_stack is within the save area?
>
This is the legacy way. Probably, this can be avoided. Adding David and
Lancelot.
Hi David/Lancelot,
Do you have the background of userspace passing back control stack size?
https://github.com/torvalds/linux/blob/master/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c#L260
Can driver assume that context save area takes care of everything and
assume that user allotted as per the right control stack size?
Thanks,
Lijo
> Alex
>
>> };
>>
>> /* userq signal/wait ioctl */
>> --
>> 2.49.0
>>
next prev parent reply other threads:[~2026-01-27 5:44 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-22 10:39 [PATCH v4 00/11] Add CWSR support to user queues Lijo Lazar
2026-01-22 10:39 ` [PATCH v4 01/11] drm/amdgpu: Add helper function to get xcc count Lijo Lazar
2026-01-22 10:39 ` [PATCH v4 02/11] drm/amdgpu: Add cwsr functions Lijo Lazar
2026-01-23 20:41 ` Alex Deucher
2026-01-22 10:39 ` [PATCH v4 03/11] drm/amdgpu: Fill cwsr save area details Lijo Lazar
2026-01-22 10:39 ` [PATCH v4 04/11] drm/amdgpu: Add user save area params validation Lijo Lazar
2026-01-23 20:44 ` Alex Deucher
2026-01-27 5:35 ` Lazar, Lijo
2026-01-27 5:55 ` Alex Deucher
2026-01-27 6:11 ` Lazar, Lijo
2026-01-28 12:30 ` Lancelot SIX
2026-01-28 16:06 ` Alex Deucher
2026-01-22 10:39 ` [PATCH v4 05/11] drm/amdgpu: Add cwsr to device init/fini sequence Lijo Lazar
2026-01-22 10:39 ` [PATCH v4 06/11] drm/amdgpu: Add first level cwsr handler to userq Lijo Lazar
2026-01-22 10:39 ` [PATCH v4 07/11] drm/amdgpu: Add user save area params to mqd input Lijo Lazar
2026-01-23 20:47 ` Alex Deucher
2026-01-22 10:39 ` [PATCH v4 08/11] drm/amdgpu: Add ioctl to get cwsr details Lijo Lazar
2026-01-23 20:48 ` Alex Deucher
2026-01-22 10:39 ` [PATCH v4 09/11] drm/amdgpu: Add ioctl support for cwsr params Lijo Lazar
2026-01-23 20:51 ` Alex Deucher
2026-01-27 5:44 ` Lazar, Lijo [this message]
2026-01-28 11:59 ` Lancelot SIX
2026-01-28 13:21 ` Lazar, Lijo
2026-01-22 10:39 ` [PATCH v4 10/11] drm/amdgpu: Add ioctl to set level2 handler Lijo Lazar
2026-01-23 20:52 ` Alex Deucher
2026-01-22 10:40 ` [PATCH v4 11/11] drm/amdgpu: Add interface to set debug trap flag Lijo Lazar
2026-01-23 20:53 ` Alex Deucher
2026-01-27 12:36 ` Lazar, Lijo
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=283b02db-3038-4e6c-b577-a9fa02741b1b@amd.com \
--to=lijo.lazar@amd.com \
--cc=Alexander.Deucher@amd.com \
--cc=Christian.Koenig@amd.com \
--cc=David.YatSin@amd.com \
--cc=Hawking.Zhang@amd.com \
--cc=Jesse.Zhang@amd.com \
--cc=Lancelot.Six@amd.com \
--cc=alexdeucher@gmail.com \
--cc=amd-gfx@lists.freedesktop.org \
/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