From: Shashank Sharma <shashank.sharma@amd.com>
To: Luben Tuikov <luben.tuikov@amd.com>, amd-gfx@lists.freedesktop.org
Cc: Alex Deucher <alexander.deucher@amd.com>,
Felix Kuehling <felix.kuehling@amd.com>,
Shashank Sharma <contactshashanksharma@gmail.com>,
Christian Koenig <christian.koenig@amd.com>
Subject: Re: [PATCH v3 7/9] drm/amdgpu: map usermode queue into MES
Date: Tue, 4 Apr 2023 18:36:05 +0200 [thread overview]
Message-ID: <5127600a-09ed-ac76-e841-f975e4d5ec7c@amd.com> (raw)
In-Reply-To: <9e2c2b90-f1b6-8ecf-fcc8-166b038d1993@amd.com>
On 04/04/2023 18:30, Luben Tuikov wrote:
> On 2023-03-29 12:04, Shashank Sharma wrote:
>> From: Shashank Sharma <contactshashanksharma@gmail.com>
>>
>> This patch adds new functions to map/unmap a usermode queue into
>> the FW, using the MES ring. As soon as this mapping is done, the
>> queue would be considered ready to accept the workload.
>>
>> V1: Addressed review comments from Alex on the RFC patch series
>> - Map/Unmap should be IP specific.
>> V2:
>> Addressed review comments from Christian:
>> - Fix the wptr_mc_addr calculation (moved into another patch)
>> Addressed review comments from Alex:
>> - Do not add fptrs for map/unmap
>>
>> V3: Integration with doorbell manager
>>
>> Cc: Alex Deucher <alexander.deucher@amd.com>
>> Cc: Christian Koenig <christian.koenig@amd.com>
>> Signed-off-by: Shashank Sharma <shashank.sharma@amd.com>
>> ---
> Just add all your Cc right here, and let git-send-email figure it out.
> Between the Cc tags and the SMTP CC list, Felix is the only one missing.
No, that's not how it is.
You keep people cc'ed in the cover letter so that they get informed
every time this patch is pushed/used on any opensource branch.
People who are added manually in cc are required for this code review
session.
- Shashank
> Regards,
> Luben
>
>> .../drm/amd/amdgpu/amdgpu_userqueue_gfx_v11.c | 70 +++++++++++++++++++
>> 1 file changed, 70 insertions(+)
>>
>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_userqueue_gfx_v11.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_userqueue_gfx_v11.c
>> index 39e90ea32fcb..1627641a4a4e 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_userqueue_gfx_v11.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_userqueue_gfx_v11.c
>> @@ -23,12 +23,73 @@
>> #include "amdgpu.h"
>> #include "amdgpu_userqueue.h"
>> #include "v11_structs.h"
>> +#include "amdgpu_mes.h"
>>
>> #define AMDGPU_USERQ_PROC_CTX_SZ PAGE_SIZE
>> #define AMDGPU_USERQ_GANG_CTX_SZ PAGE_SIZE
>> #define AMDGPU_USERQ_FW_CTX_SZ PAGE_SIZE
>> #define AMDGPU_USERQ_GDS_CTX_SZ PAGE_SIZE
>>
>> +static int
>> +amdgpu_userq_gfx_v11_map(struct amdgpu_userq_mgr *uq_mgr,
>> + struct amdgpu_usermode_queue *queue)
>> +{
>> + struct amdgpu_device *adev = uq_mgr->adev;
>> + struct mes_add_queue_input queue_input;
>> + int r;
>> +
>> + memset(&queue_input, 0x0, sizeof(struct mes_add_queue_input));
>> +
>> + queue_input.process_va_start = 0;
>> + queue_input.process_va_end = (adev->vm_manager.max_pfn - 1) << AMDGPU_GPU_PAGE_SHIFT;
>> + queue_input.process_quantum = 100000; /* 10ms */
>> + queue_input.gang_quantum = 10000; /* 1ms */
>> + queue_input.paging = false;
>> +
>> + queue_input.gang_context_addr = queue->gang_ctx_gpu_addr;
>> + queue_input.process_context_addr = queue->proc_ctx_gpu_addr;
>> + queue_input.inprocess_gang_priority = AMDGPU_MES_PRIORITY_LEVEL_NORMAL;
>> + queue_input.gang_global_priority_level = AMDGPU_MES_PRIORITY_LEVEL_NORMAL;
>> +
>> + queue_input.process_id = queue->vm->pasid;
>> + queue_input.queue_type = queue->queue_type;
>> + queue_input.mqd_addr = queue->mqd.gpu_addr;
>> + queue_input.wptr_addr = queue->userq_prop.wptr_gpu_addr;
>> + queue_input.queue_size = queue->userq_prop.queue_size >> 2;
>> + queue_input.doorbell_offset = queue->userq_prop.doorbell_index;
>> + queue_input.page_table_base_addr = amdgpu_gmc_pd_addr(queue->vm->root.bo);
>> +
>> + amdgpu_mes_lock(&adev->mes);
>> + r = adev->mes.funcs->add_hw_queue(&adev->mes, &queue_input);
>> + amdgpu_mes_unlock(&adev->mes);
>> + if (r) {
>> + DRM_ERROR("Failed to map queue in HW, err (%d)\n", r);
>> + return r;
>> + }
>> +
>> + DRM_DEBUG_DRIVER("Queue %d mapped successfully\n", queue->queue_id);
>> + return 0;
>> +}
>> +
>> +static void
>> +amdgpu_userq_gfx_v11_unmap(struct amdgpu_userq_mgr *uq_mgr,
>> + struct amdgpu_usermode_queue *queue)
>> +{
>> + struct amdgpu_device *adev = uq_mgr->adev;
>> + struct mes_remove_queue_input queue_input;
>> + int r;
>> +
>> + memset(&queue_input, 0x0, sizeof(struct mes_remove_queue_input));
>> + queue_input.doorbell_offset = queue->userq_prop.doorbell_index;
>> + queue_input.gang_context_addr = queue->gang_ctx_gpu_addr;
>> +
>> + amdgpu_mes_lock(&adev->mes);
>> + r = adev->mes.funcs->remove_hw_queue(&adev->mes, &queue_input);
>> + amdgpu_mes_unlock(&adev->mes);
>> + if (r)
>> + DRM_ERROR("Failed to unmap queue in HW, err (%d)\n", r);
>> +}
>> +
>> static int amdgpu_userq_gfx_v11_create_ctx_space(struct amdgpu_userq_mgr *uq_mgr,
>> struct amdgpu_usermode_queue *queue)
>> {
>> @@ -129,6 +190,14 @@ amdgpu_userq_gfx_v11_mqd_create(struct amdgpu_userq_mgr *uq_mgr, struct amdgpu_u
>>
>> amdgpu_userq_set_ctx_space(uq_mgr, queue);
>> amdgpu_bo_unreserve(mqd->obj);
>> +
>> + /* Map the queue in HW using MES ring */
>> + r = amdgpu_userq_gfx_v11_map(uq_mgr, queue);
>> + if (r) {
>> + DRM_ERROR("Failed to map userqueue (%d)\n", r);
>> + goto free_ctx;
>> + }
>> +
>> DRM_DEBUG_DRIVER("MQD for queue %d created\n", queue->queue_id);
>> return 0;
>>
>> @@ -147,6 +216,7 @@ amdgpu_userq_gfx_v11_mqd_destroy(struct amdgpu_userq_mgr *uq_mgr, struct amdgpu_
>> {
>> struct amdgpu_userq_ctx_space *mqd = &queue->mqd;
>>
>> + amdgpu_userq_gfx_v11_unmap(uq_mgr, queue);
>> amdgpu_userq_gfx_v11_destroy_ctx_space(uq_mgr, queue);
>> amdgpu_bo_free_kernel(&mqd->obj,
>> &mqd->gpu_addr,
next prev parent reply other threads:[~2023-04-04 16:36 UTC|newest]
Thread overview: 56+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-29 16:04 [PATCH v3 0/9] AMDGPU Usermode queues Shashank Sharma
2023-03-29 16:04 ` [PATCH v3 1/9] drm/amdgpu: UAPI for user queue management Shashank Sharma
2023-03-29 17:25 ` Christian König
2023-03-29 17:57 ` Alex Deucher
2023-03-29 19:21 ` Shashank Sharma
2023-03-29 19:46 ` Alex Deucher
2023-03-30 6:13 ` Shashank Sharma
[not found] ` <71fc098c-c0cb-3097-4e11-c2d9bd9b4783@damsy.net>
2023-03-30 8:15 ` Shashank Sharma
2023-03-30 10:40 ` Christian König
2023-03-30 15:08 ` Alex Deucher
2023-03-29 16:04 ` [PATCH v3 2/9] drm/amdgpu: add usermode queue base code Shashank Sharma
2023-03-30 21:15 ` Alex Deucher
2023-03-31 8:52 ` Shashank Sharma
2023-04-04 16:05 ` Luben Tuikov
2023-03-29 16:04 ` [PATCH v3 3/9] drm/amdgpu: add new IOCTL for usermode queue Shashank Sharma
2023-04-10 0:02 ` Bas Nieuwenhuizen
2023-04-10 14:28 ` Shashank Sharma
2023-03-29 16:04 ` [PATCH v3 4/9] drm/amdgpu: create GFX-gen11 MQD for userqueue Shashank Sharma
2023-03-30 21:18 ` Alex Deucher
2023-03-31 8:49 ` Shashank Sharma
2023-04-04 16:21 ` Luben Tuikov
2023-03-29 16:04 ` [PATCH v3 5/9] drm/amdgpu: create context space for usermode queue Shashank Sharma
2023-03-30 21:23 ` Alex Deucher
2023-03-31 8:42 ` Shashank Sharma
2023-04-04 16:24 ` Luben Tuikov
2023-04-04 16:37 ` Shashank Sharma
2023-03-29 16:04 ` [PATCH v3 6/9] drm/amdgpu: add new parameters in v11_struct Shashank Sharma
2023-03-30 21:25 ` Alex Deucher
2023-03-31 6:39 ` Yadav, Arvind
2023-03-31 8:30 ` Shashank Sharma
2023-03-29 16:04 ` [PATCH v3 7/9] drm/amdgpu: map usermode queue into MES Shashank Sharma
2023-04-04 16:30 ` Luben Tuikov
2023-04-04 16:36 ` Shashank Sharma [this message]
2023-04-04 20:58 ` Luben Tuikov
2023-04-05 10:06 ` Shashank Sharma
2023-04-05 21:18 ` Luben Tuikov
2023-04-06 7:45 ` Shashank Sharma
2023-04-06 15:16 ` Felix Kuehling
2023-04-07 6:41 ` Shashank Sharma
2023-03-29 16:04 ` [PATCH v3 8/9] drm/amdgpu: map wptr BO into GART Shashank Sharma
2023-04-10 0:00 ` Bas Nieuwenhuizen
2023-04-11 9:29 ` Christian König
2023-04-11 16:02 ` Shashank Sharma
2023-03-29 16:04 ` [PATCH v3 9/9] drm/amdgpu: generate doorbell index for userqueue Shashank Sharma
2023-04-10 0:36 ` [PATCH v3 0/9] AMDGPU Usermode queues Bas Nieuwenhuizen
2023-04-10 7:32 ` Sharma, Shashank
2023-04-10 9:25 ` Bas Nieuwenhuizen
2023-04-10 13:40 ` Sharma, Shashank
2023-04-10 13:46 ` Bas Nieuwenhuizen
2023-04-10 14:01 ` Shashank Sharma
2023-04-10 14:04 ` Bas Nieuwenhuizen
2023-04-10 14:26 ` Shashank Sharma
2023-04-11 9:37 ` Christian König
2023-04-11 9:48 ` Shashank Sharma
2023-04-11 10:00 ` Bas Nieuwenhuizen
2023-04-11 10:55 ` Shashank Sharma
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=5127600a-09ed-ac76-e841-f975e4d5ec7c@amd.com \
--to=shashank.sharma@amd.com \
--cc=alexander.deucher@amd.com \
--cc=amd-gfx@lists.freedesktop.org \
--cc=christian.koenig@amd.com \
--cc=contactshashanksharma@gmail.com \
--cc=felix.kuehling@amd.com \
--cc=luben.tuikov@amd.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 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.