From: Shashank Sharma <shashank.sharma@amd.com>
To: Alex Deucher <alexdeucher@gmail.com>
Cc: Alex Deucher <alexander.deucher@amd.com>,
arvind.yadav@amd.com, Christian Koenig <christian.koenig@amd.com>,
amd-gfx@lists.freedesktop.org, arunpravin.paneerselvam@amd.com
Subject: Re: [RFC 4/7] drm/amdgpu: Allocate doorbell slot for user queue
Date: Tue, 3 Jan 2023 10:37:28 +0100 [thread overview]
Message-ID: <51dae816-a809-0b35-03de-c05498b1e696@amd.com> (raw)
In-Reply-To: <CADnq5_MLC5++t1GDsAXwKAXDuqTDk-RJHr5BCL0PKSfCOG4woQ@mail.gmail.com>
On 29/12/2022 18:50, Alex Deucher wrote:
> On Fri, Dec 23, 2022 at 2:37 PM Shashank Sharma <shashank.sharma@amd.com> wrote:
>> This patch allocates a doorbell slot in the bar, for the usermode queue.
>> We are using the unique queue-id to get this slot from MES.
> We should manage the doorbell BAR just like VRAM. I had a set of
> patches to convert doorbell memory to GEM objects. The user should be
> able to allocate doorbell memory via the GEM IOCTL just like VRAM or
> GTT. Then when the user calls the USERQ IOCTL, we can just look up
> the GEM object from the handle and then calculate the doorbell offset
> based on the offset of the GEM object from the start of the BAR.
>
> Alex
Noted,
- Shashank
>> Cc: Alex Deucher <alexander.deucher@amd.com>
>> Cc: Christian Koenig <christian.koenig@amd.com>
>> Signed-off-by: Shashank Sharma <shashank.sharma@amd.com>
>> ---
>> drivers/gpu/drm/amd/amdgpu/amdgpu_userqueue.c | 28 +++++++++++++++++++
>> 1 file changed, 28 insertions(+)
>>
>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_userqueue.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_userqueue.c
>> index a91cc304cb9e..b566ce4cb7f0 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_userqueue.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_userqueue.c
>> @@ -50,6 +50,25 @@ amdgpu_userqueue_remove_index(struct amdgpu_device *adev, struct amdgpu_usermode
>> ida_simple_remove(&uqg->ida, queue->queue_id);
>> }
>>
>> +static int
>> +amdgpu_userqueue_get_doorbell(struct amdgpu_device *adev,
>> + struct amdgpu_usermode_queue *queue)
>> +{
>> + int r;
>> + unsigned int doorbell_index;
>> +
>> + r = amdgpu_mes_alloc_process_doorbells(adev, &doorbell_index);
>> + if (r < 0) {
>> + DRM_ERROR("Failed to allocate doorbell for user queue\n");
>> + return r;
>> + }
>> +
>> + /* We are using qnique queue-id to get doorbell here */
>> + queue->doorbell_index = amdgpu_mes_get_doorbell_dw_offset_in_bar(adev,
>> + doorbell_index, queue->queue_id);
>> + return 0;
>> +}
>> +
>> static void
>> amdgpu_userqueue_setup_mqd(struct amdgpu_device *adev, struct amdgpu_usermode_queue *queue)
>> {
>> @@ -257,12 +276,21 @@ int amdgpu_userqueue_create(struct amdgpu_device *adev, struct drm_file *filp,
>> goto free_queue;
>> }
>>
>> + r = amdgpu_userqueue_get_doorbell(adev, queue);
>> + if (r) {
>> + DRM_ERROR("Failed to create doorbell for queue\n");
>> + goto free_mqd;
>> + }
>> +
>> ctx->userq = queue;
>> args->out.q_id = queue->queue_id;
>> args->out.flags = 0;
>> mutex_unlock(&adev->userq.userq_mutex);
>> return 0;
>>
>> +free_mqd:
>> + amdgpu_userqueue_destroy_mqd(queue);
>> +
>> free_queue:
>> amdgpu_userqueue_remove_index(adev, queue);
>> mutex_unlock(&adev->userq.userq_mutex);
>> --
>> 2.34.1
>>
next prev parent reply other threads:[~2023-01-03 9:37 UTC|newest]
Thread overview: 64+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-23 19:36 [RFC 0/7] RFC: Usermode queue for AMDGPU driver Shashank Sharma
2022-12-23 19:36 ` [RFC 1/7] drm/amdgpu: UAPI for user queue management Shashank Sharma
2022-12-24 20:20 ` Bas Nieuwenhuizen
2022-12-27 16:58 ` Alex Deucher
2023-01-02 11:27 ` Christian König
2023-01-03 19:51 ` Alex Deucher
2023-01-02 13:26 ` Christian König
2023-01-03 14:23 ` Alex Deucher
2023-01-03 18:29 ` Felix Kuehling
2023-01-03 19:17 ` Liu, Shaoyun
2023-01-03 19:22 ` Alex Deucher
2023-01-03 19:25 ` Liu, Shaoyun
2023-01-03 19:52 ` Alex Deucher
2023-01-03 20:05 ` Felix Kuehling
2023-01-03 19:18 ` Alex Deucher
2022-12-23 19:36 ` [RFC 2/7] drm/amdgpu: Add usermode queue for gfx work Shashank Sharma
2022-12-24 18:19 ` Oded Gabbay
2022-12-26 10:34 ` Shashank Sharma
2022-12-25 15:44 ` Christian König
2022-12-26 10:41 ` Shashank Sharma
2023-01-02 12:39 ` Christian König
2023-01-03 9:12 ` Shashank Sharma
2023-01-03 9:15 ` Christian König
2023-01-03 9:22 ` Shashank Sharma
2023-01-03 9:35 ` Christian König
2023-01-03 14:34 ` Alex Deucher
2023-01-03 14:50 ` Christian König
2022-12-29 17:41 ` Alex Deucher
2023-01-02 13:53 ` Christian König
2023-01-03 9:32 ` Shashank Sharma
2023-01-03 9:16 ` Shashank Sharma
2023-01-04 8:55 ` Zhu, Jiadong
2023-01-04 8:58 ` Shashank Sharma
2022-12-23 19:36 ` [RFC 3/7] drm/amdgpu: Create MQD for userspace queue Shashank Sharma
2022-12-29 17:47 ` Alex Deucher
2023-01-03 9:36 ` Shashank Sharma
2023-01-03 18:37 ` Felix Kuehling
2023-01-04 6:21 ` Yadav, Arvind
2023-01-04 9:10 ` Christian König
2023-01-04 9:13 ` Shashank Sharma
2023-01-04 9:17 ` Christian König
2023-01-04 9:23 ` Shashank Sharma
2023-01-04 14:35 ` Felix Kuehling
2023-01-04 14:38 ` Yadav, Arvind
2023-01-04 14:41 ` Shashank Sharma
2023-01-04 14:28 ` Alex Deucher
2022-12-23 19:36 ` [RFC 4/7] drm/amdgpu: Allocate doorbell slot for user queue Shashank Sharma
2022-12-29 17:50 ` Alex Deucher
2023-01-03 9:37 ` Shashank Sharma [this message]
2022-12-23 19:36 ` [RFC 5/7] drm/amdgpu: Create context for usermode queue Shashank Sharma
2022-12-29 17:54 ` Alex Deucher
2023-01-03 9:40 ` Shashank Sharma
2023-01-03 14:48 ` Alex Deucher
2022-12-23 19:36 ` [RFC 6/7] drm/amdgpu: Map userqueue into HW Shashank Sharma
2022-12-29 17:51 ` Alex Deucher
2023-01-03 9:38 ` Shashank Sharma
2022-12-23 19:36 ` [RFC 7/7] drm/amdgpu: Secure semaphore for usermode queue Shashank Sharma
2022-12-25 10:07 ` Zhang, Yifan
2022-12-27 9:32 ` Arunpravin Paneer Selvam
2022-12-29 18:02 ` [RFC 0/7] RFC: Usermode queue for AMDGPU driver Alex Deucher
2023-01-03 9:43 ` Shashank Sharma
2023-01-03 9:47 ` Christian König
2023-01-03 10:00 ` Shashank Sharma
2023-01-03 10:02 ` Christian König
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=51dae816-a809-0b35-03de-c05498b1e696@amd.com \
--to=shashank.sharma@amd.com \
--cc=alexander.deucher@amd.com \
--cc=alexdeucher@gmail.com \
--cc=amd-gfx@lists.freedesktop.org \
--cc=arunpravin.paneerselvam@amd.com \
--cc=arvind.yadav@amd.com \
--cc=christian.koenig@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox