From: Shashank Sharma <shashank.sharma@amd.com>
To: "Christian König" <christian.koenig@amd.com>,
amd-gfx@lists.freedesktop.org
Cc: alexander.deucher@amd.com,
Shashank Sharma <contactshashanksharma@gmail.com>,
Arvind.Yadav@amd.com
Subject: Re: [PATCH v2 7/8] drm/amdgpu: create doorbell kernel object
Date: Tue, 14 Feb 2023 20:26:53 +0100 [thread overview]
Message-ID: <626ab9bd-9cd2-809b-1691-10ff31b4f52f@amd.com> (raw)
In-Reply-To: <4d5dee60-537d-745d-9bc9-1246f50427fe@amd.com>
On 14/02/2023 19:35, Christian König wrote:
> Am 14.02.23 um 17:15 schrieb Shashank Sharma:
>> From: Shashank Sharma <contactshashanksharma@gmail.com>
>>
>> This patch does the following:
>> - Initializes TTM range management for domain DOORBELL.
>> - Introduces a kernel bo for doorbell management in form of
>> mman.doorbell_kernel_bo.
>> This bo holds the kernel doorbell space now.
>> - Removes ioremapping of doorbell-kernel memory, as its not required
>> now.
>>
>> V2:
>> - Addressed review comments from Christian:
>> - do not use kernel_create_at(0), use kernel_create() instead.
>> - do not use ttm_resource_manager, use range_manager instead.
>> - do not ioremap doorbell, TTM will do that.
>> - Split one big patch into 2
>>
>> Cc: Alex Deucher <alexander.deucher@amd.com>
>> Cc: Christian Koenig <christian.koenig@amd.com>
>> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
>> Signed-off-by: Shashank Sharma <shashank.sharma@amd.com>
>> ---
>> drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 22 ++++++++++++++++++++++
>> drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h | 7 +++++++
>> 2 files changed, 29 insertions(+)
>>
>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
>> b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
>> index e9dc24191fc8..086e83c17c0f 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
>> @@ -1879,12 +1879,32 @@ int amdgpu_ttm_init(struct amdgpu_device *adev)
>> return r;
>> }
>> + r = amdgpu_ttm_init_on_chip(adev, AMDGPU_PL_DOORBELL,
>> adev->doorbell.doorbell_aper_size);
>> + if (r) {
>> + DRM_ERROR("Failed initializing oa heap.\n");
>> + return r;
>> + }
>> +
>> if (amdgpu_bo_create_kernel(adev, PAGE_SIZE, PAGE_SIZE,
>> AMDGPU_GEM_DOMAIN_GTT,
>> &adev->mman.sdma_access_bo, NULL,
>> &adev->mman.sdma_access_ptr))
>> DRM_WARN("Debug VRAM access will use slowpath MM access\n");
>> + /* Create a doorbell BO for kernel usages */
>> + r = amdgpu_bo_create_kernel(adev,
>> + adev->mman.doorbell_kernel_bo_size,
>> + PAGE_SIZE,
>> + AMDGPU_GEM_DOMAIN_DOORBELL,
>> + &adev->mman.doorbell_kernel_bo,
>> + &adev->mman.doorbell_gpu_addr,
>> + (void **)&adev->mman.doorbell_cpu_addr);
>> +
>> + if (r) {
>> + DRM_ERROR("Failed to create doorbell BO, err=%d\n", r);
>> + return r;
>> + }
>> +
>
> I would even move this before the SDMA VRAM buffer since the later is
> only nice to have while the doorbell is mandatory to have.
Agree,
>
>> return 0;
>> }
>> @@ -1908,6 +1928,8 @@ void amdgpu_ttm_fini(struct amdgpu_device *adev)
>> NULL, NULL);
>> amdgpu_bo_free_kernel(&adev->mman.sdma_access_bo, NULL,
>> &adev->mman.sdma_access_ptr);
>> + amdgpu_bo_free_kernel(&adev->mman.doorbell_kernel_bo,
>> + NULL, (void **)&adev->mman.doorbell_cpu_addr);
>> amdgpu_ttm_fw_reserve_vram_fini(adev);
>> amdgpu_ttm_drv_reserve_vram_fini(adev);
>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h
>> b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h
>> index 9cf5d8419965..50748ff1dd3c 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h
>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h
>> @@ -97,6 +97,13 @@ struct amdgpu_mman {
>> /* PAGE_SIZE'd BO for process memory r/w over SDMA. */
>> struct amdgpu_bo *sdma_access_bo;
>> void *sdma_access_ptr;
>> +
>> + /* doorbells reserved for the kernel driver */
>> + u32 num_kernel_doorbells; /* Number of doorbells
>> actually reserved for kernel */
>> + uint64_t doorbell_kernel_bo_size;
>
> That looks like duplicated information. We should only keep either the
> number of kernel doorbells or the kernel doorbell bo size around, not
> both.
Yeah, agree. I can remove one of these two.
>
> And BTW please no comment after structure members.
>
Noted,
- Shashank
> Christian.
>
>> + uint64_t doorbell_gpu_addr;
>> + struct amdgpu_bo *doorbell_kernel_bo;
>> + u32 *doorbell_cpu_addr;
>> };
>> struct amdgpu_copy_mem {
>
next prev parent reply other threads:[~2023-02-14 19:27 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-14 16:15 [PATCH v2 0/8] Re-design doorbell framework for usermode queues Shashank Sharma
2023-02-14 16:15 ` [PATCH v2 1/8] drm/amdgpu: add UAPI for allocating doorbell memory Shashank Sharma
2023-02-14 18:22 ` Christian König
2023-02-14 19:02 ` Shashank Sharma
2023-02-14 16:15 ` [PATCH v2 2/8] drm/amdgpu: replace aper_base_kaddr with vram_aper_base_kaddr Shashank Sharma
2023-02-14 18:24 ` Christian König
2023-02-14 19:03 ` Shashank Sharma
2023-02-14 16:15 ` [PATCH v2 3/8] drm/amdgpu: rename gmc.aper_base/size Shashank Sharma
2023-02-14 18:25 ` Christian König
2023-02-14 16:15 ` [PATCH v2 4/8] drm/amdgpu: rename doorbell variables Shashank Sharma
2023-02-14 18:27 ` Christian König
2023-02-14 19:16 ` Shashank Sharma
2023-02-14 16:15 ` [PATCH v2 5/8] drm/amdgpu: accommodate DOMAIN/PL_DOORBELL Shashank Sharma
2023-02-14 18:31 ` Christian König
2023-02-14 19:24 ` Shashank Sharma
2023-02-15 6:17 ` Christian König
2023-02-15 13:32 ` Shashank Sharma
2023-02-15 13:36 ` Christian König
2023-02-15 13:45 ` Shashank Sharma
2023-02-14 16:15 ` [PATCH v2 6/8] drm/amdgpu: get doorbell memory Shashank Sharma
2023-02-14 16:15 ` [PATCH v2 7/8] drm/amdgpu: create doorbell kernel object Shashank Sharma
2023-02-14 18:35 ` Christian König
2023-02-14 19:26 ` Shashank Sharma [this message]
2023-02-16 13:13 ` Shashank Sharma
2023-02-14 16:15 ` [PATCH v2 8/8] drm/amdgpu: start using kernel doorbell bo Shashank Sharma
2023-02-14 18:40 ` Christian König
2023-02-14 19:28 ` Shashank Sharma
2023-02-15 6:18 ` 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=626ab9bd-9cd2-809b-1691-10ff31b4f52f@amd.com \
--to=shashank.sharma@amd.com \
--cc=Arvind.Yadav@amd.com \
--cc=alexander.deucher@amd.com \
--cc=amd-gfx@lists.freedesktop.org \
--cc=christian.koenig@amd.com \
--cc=contactshashanksharma@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