<!DOCTYPE html><html><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  </head>
  <body>
    <p><br>
    </p>
    <div class="moz-cite-prefix">On 06/01/2025 17:45, Saleemkhan Jamadar
      wrote:<br>
    </div>
    <blockquote type="cite" cite="mid:20250106164530.763188-4-saleemkhan.jamadar@amd.com">
      <pre wrap="" class="moz-quote-pre">VCN and VPE have different offset range, update the doorbell
offset range repsectively.
Doorbell size for VCN and VPE is 32bit.

Signed-off-by: Saleemkhan Jamadar <a class="moz-txt-link-rfc2396E" href="mailto:saleemkhan.jamadar@amd.com"><saleemkhan.jamadar@amd.com></a>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_userqueue.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_userqueue.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_userqueue.c
index 769154223e2d..8c9a2f42116c 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_userqueue.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_userqueue.c
@@ -222,6 +222,21 @@ amdgpu_userqueue_get_doorbell_index(struct amdgpu_userq_mgr *uq_mgr,
        }
 
        db_size = sizeof(u64);
+       switch (db_info->queue_type) {
+               case AMDGPU_HW_IP_VCN_ENC:
+                       db_size = sizeof(u32);
+                       db_info->doorbell_offset += AMDGPU_NAVI10_DOORBELL64_VCN0_1 << 1;
+               break;</pre>
    </blockquote>
    Please check on alignment with switch(case), checkpatch will get
    this one as well. <br>
    <blockquote type="cite" cite="mid:20250106164530.763188-4-saleemkhan.jamadar@amd.com">
      <pre wrap="" class="moz-quote-pre">
+
+               case AMDGPU_HW_IP_VPE:
+                       db_size = sizeof(u32);
+                       db_info->doorbell_offset += AMDGPU_NAVI10_DOORBELL64_VPE << 1;
+               break;
+
+               default:
+                       /* FixMe : handle this after userqs are enabled for suported IPs */</pre>
    </blockquote>
    <p>Now I think you can add cases for GFX and SDMA IPs as well, set
      size to U64 and then return -<span style="white-space: pre-wrap">EINVAL in case of IP not recognized</span>
      (default).</p>
    <p>- Shashank<br>
    </p>
    <blockquote type="cite" cite="mid:20250106164530.763188-4-saleemkhan.jamadar@amd.com">
      <pre wrap="" class="moz-quote-pre">
+       }
+
        index = amdgpu_doorbell_index_on_bar(uq_mgr->adev, db_obj->obj,
                                             db_info->doorbell_offset, db_size);
        DRM_DEBUG_DRIVER("[Usermode queues] doorbell index=%lld\n", index);
</pre>
    </blockquote>
  </body>
</html>