From: "Christian König" <ckoenig.leichtzumerken@gmail.com>
To: Shashank Sharma <shashank.sharma@amd.com>, amd-gfx@lists.freedesktop.org
Cc: Alex Deucher <alexander.deucher@amd.com>,
mukul.joshi@amd.com, contactshashanksharma@gmail.com,
Christian Koenig <christian.koenig@amd.com>,
arvind.yadav@amd.com
Subject: Re: [PATCH v2 07/12] get absolute offset from doorbell index
Date: Thu, 13 Apr 2023 12:59:12 +0200 [thread overview]
Message-ID: <8d3b24e5-cef5-608a-3110-456bc2967360@gmail.com> (raw)
In-Reply-To: <20230412162537.1357-8-shashank.sharma@amd.com>
Am 12.04.23 um 18:25 schrieb Shashank Sharma:
> This patch adds a helper function which converts a doorbell's
> relative index in a BO to an absolute doorbell offset in the
> doorbell BAR.
>
> V2: No space between the variable name doc (Luben)
>
> Cc: Alex Deucher <alexander.deucher@amd.com>
> Cc: Christian Koenig <christian.koenig@amd.com>
> Signed-off-by: Shashank Sharma <shashank.sharma@amd.com>
Acked-by: Christian König <christian.koenig@amd.com>
> ---
> drivers/gpu/drm/amd/amdgpu/amdgpu_doorbell.h | 3 +++
> .../gpu/drm/amd/amdgpu/amdgpu_doorbell_mgr.c | 21 +++++++++++++++++++
> 2 files changed, 24 insertions(+)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_doorbell.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_doorbell.h
> index fbbff12a14cd..b110e002bad2 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_doorbell.h
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_doorbell.h
> @@ -317,6 +317,9 @@ void amdgpu_mm_wdoorbell64(struct amdgpu_device *adev, u32 index, u64 v);
> int amdgpu_doorbell_init(struct amdgpu_device *adev);
> void amdgpu_doorbell_fini(struct amdgpu_device *adev);
> int amdgpu_doorbell_create_kernel_doorbells(struct amdgpu_device *adev);
> +uint32_t amdgpu_doorbell_index_on_bar(struct amdgpu_device *adev,
> + struct amdgpu_bo *db_bo,
> + uint32_t doorbell_index);
>
> #define RDOORBELL32(index) amdgpu_mm_rdoorbell(adev, (index))
> #define WDOORBELL32(index, v) amdgpu_mm_wdoorbell(adev, (index), (v))
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_doorbell_mgr.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_doorbell_mgr.c
> index 8be2dfa8fa74..a99cd56e8bf4 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_doorbell_mgr.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_doorbell_mgr.c
> @@ -108,6 +108,27 @@ void amdgpu_mm_wdoorbell64(struct amdgpu_device *adev, u32 index, u64 v)
> DRM_ERROR("writing beyond doorbell aperture: 0x%08x!\n", index);
> }
>
> +/**
> + * amdgpu_doorbell_index_on_bar - Find doorbell's absolute offset in BAR
> + *
> + * @adev: amdgpu_device pointer
> + * @db_bo: doorbell object's bo
> + * @db_index: doorbell relative index in this doorbell object
> + *
> + * returns doorbell's absolute index in BAR
> + */
> +uint32_t amdgpu_doorbell_index_on_bar(struct amdgpu_device *adev,
> + struct amdgpu_bo *db_bo,
> + uint32_t doorbell_index)
> +{
> + int db_bo_offset;
> +
> + db_bo_offset = amdgpu_bo_gpu_offset_no_check(db_bo);
> +
> + /* doorbell index is 32 bit but doorbell's size is 64-bit, so *2 */
> + return db_bo_offset / sizeof(u32) + doorbell_index * 2;
> +}
> +
> /**
> * amdgpu_doorbell_create_kernel_doorbells - Create kernel doorbells for graphics
> *
next prev parent reply other threads:[~2023-04-13 10:59 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-12 16:25 [PATCH v2 00/12] AMDGPU doorbell manager Shashank Sharma
2023-04-12 16:25 ` [PATCH v2 01/12] drm/amdgpu: create a new file for " Shashank Sharma
2023-04-13 10:48 ` Christian König
2023-04-13 10:51 ` Christian König
2023-04-12 16:25 ` [PATCH v2 02/12] drm/amdgpu: don't modify num_doorbells for mes Shashank Sharma
2023-04-12 16:25 ` [PATCH v2 03/12] drm/amdgpu: add UAPI for allocating doorbell memory Shashank Sharma
2023-04-12 16:25 ` [PATCH v2 04/12] drm/amdgpu: accommodate DOMAIN/PL_DOORBELL Shashank Sharma
2023-04-12 16:25 ` [PATCH v2 05/12] drm/amdgpu: initialize ttm for doorbells Shashank Sharma
2023-04-12 16:25 ` [PATCH v2 06/12] drm/amdgpu: create kernel doorbell pages Shashank Sharma
2023-04-12 16:25 ` [PATCH v2 07/12] get absolute offset from doorbell index Shashank Sharma
2023-04-13 10:59 ` Christian König [this message]
2023-04-12 16:25 ` [PATCH v2 08/12] drm/amdgpu: use doorbell manager for kfd kernel doorbells Shashank Sharma
2023-04-13 11:02 ` Christian König
2023-04-13 13:08 ` Shashank Sharma
2023-04-21 19:58 ` Felix Kuehling
2023-04-22 6:39 ` Shashank Sharma
2023-04-24 19:56 ` Felix Kuehling
2023-04-25 19:59 ` Shashank Sharma
2023-06-09 19:33 ` Felix Kuehling
2023-04-12 16:25 ` [PATCH v2 09/12] drm/amdgpu: use doorbell manager for kfd process doorbells Shashank Sharma
2023-04-13 11:07 ` Christian König
2023-04-21 20:11 ` Felix Kuehling
2023-04-22 6:45 ` Shashank Sharma
2023-04-12 16:25 ` [PATCH v2 10/12] drm/amdgpu: remove unused functions and variables Shashank Sharma
2023-06-09 19:34 ` Felix Kuehling
2023-04-12 16:25 ` [PATCH v2 11/12] drm/amdgpu: use doorbell mgr for MES kernel doorbells Shashank Sharma
2023-04-12 16:25 ` [PATCH v2 12/12] drm/amdgpu: cleanup MES process level doorbells Shashank Sharma
2023-04-13 11:19 ` 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=8d3b24e5-cef5-608a-3110-456bc2967360@gmail.com \
--to=ckoenig.leichtzumerken@gmail.com \
--cc=alexander.deucher@amd.com \
--cc=amd-gfx@lists.freedesktop.org \
--cc=arvind.yadav@amd.com \
--cc=christian.koenig@amd.com \
--cc=contactshashanksharma@gmail.com \
--cc=mukul.joshi@amd.com \
--cc=shashank.sharma@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