<!DOCTYPE html><html><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<p>[+Mukul]</p>
<div class="moz-cite-prefix">On 2023-09-27 12:16, Arvind Yadav
wrote:<br>
</div>
<blockquote type="cite" cite="mid:20230927161616.3335-2-Arvind.Yadav@amd.com">
<pre class="moz-quote-pre" wrap="">This patch is to adjust the absolute doorbell offset
against the doorbell id considering the doorbell
size of 32/64 bit.
Cc: Christian Koenig <a class="moz-txt-link-rfc2396E" href="mailto:christian.koenig@amd.com"><christian.koenig@amd.com></a>
Cc: Alex Deucher <a class="moz-txt-link-rfc2396E" href="mailto:alexander.deucher@amd.com"><alexander.deucher@amd.com></a>
Signed-off-by: Shashank Sharma <a class="moz-txt-link-rfc2396E" href="mailto:shashank.sharma@amd.com"><shashank.sharma@amd.com></a>
Signed-off-by: Arvind Yadav <a class="moz-txt-link-rfc2396E" href="mailto:Arvind.Yadav@amd.com"><Arvind.Yadav@amd.com></a>
---
drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c b/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c
index 0d3d538b64eb..c327f7f604d7 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c
@@ -407,7 +407,16 @@ static int allocate_doorbell(struct qcm_process_device *qpd,
q->properties.doorbell_off = amdgpu_doorbell_index_on_bar(dev->adev,
qpd->proc_doorbells,
- q->doorbell_id);
+ 0);</pre>
</blockquote>
<p>Looks like we're now always calling amdgpu_doorbell_index_on_bar
with the third parameter = 0. So we could remove that parameter.
It doesn't do us any good and only causes bugs if we use any non-0
value.<br>
</p>
<p><br>
</p>
<blockquote type="cite" cite="mid:20230927161616.3335-2-Arvind.Yadav@amd.com">
<pre class="moz-quote-pre" wrap="">
+
+ /* Adjust the absolute doorbell offset against the doorbell id considering
+ * the doorbell size of 32/64 bit.
+ */
+ if (!KFD_IS_SOC15(dev))
+ q->properties.doorbell_off += q->doorbell_id;
+ else
+ q->properties.doorbell_off += q->doorbell_id * 2;</pre>
</blockquote>
<p>This could be simplified and generalized as</p>
<pre> q->properties.doorbell_off += q->doorbell_id * dev->kfd->device_info.doorbell_size / 4;
</pre>
<p>Regards,<br>
Felix</p>
<p><br>
</p>
<blockquote type="cite" cite="mid:20230927161616.3335-2-Arvind.Yadav@amd.com">
<pre class="moz-quote-pre" wrap="">
+
return 0;
}
</pre>
</blockquote>
</body>
</html>