<!DOCTYPE html><html><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  </head>
  <body>
    <p>Hello Alex, <br>
    </p>
    <div class="moz-cite-prefix">On 14/10/2024 22:29, Deucher, Alexander
      wrote:<br>
    </div>
    <blockquote type="cite" cite="mid:BL1PR12MB5144EC6671DD09A36B0BFD0CF7442@BL1PR12MB5144.namprd12.prod.outlook.com">
      <pre class="moz-quote-pre" wrap="">[AMD Official Use Only - AMD Internal Distribution Only]

</pre>
      <blockquote type="cite">
        <pre class="moz-quote-pre" wrap="">-----Original Message-----
From: Sharma, Shashank <a class="moz-txt-link-rfc2396E" href="mailto:Shashank.Sharma@amd.com"><Shashank.Sharma@amd.com></a>
Sent: Thursday, October 10, 2024 2:08 PM
To: <a class="moz-txt-link-abbreviated" href="mailto:amd-gfx@lists.freedesktop.org">amd-gfx@lists.freedesktop.org</a>
Cc: Somalapuram, Amaranath <a class="moz-txt-link-rfc2396E" href="mailto:Amaranath.Somalapuram@amd.com"><Amaranath.Somalapuram@amd.com></a>; Deucher,
Alexander <a class="moz-txt-link-rfc2396E" href="mailto:Alexander.Deucher@amd.com"><Alexander.Deucher@amd.com></a>; Koenig, Christian
<a class="moz-txt-link-rfc2396E" href="mailto:Christian.Koenig@amd.com"><Christian.Koenig@amd.com></a>; Yadav, Arvind <a class="moz-txt-link-rfc2396E" href="mailto:Arvind.Yadav@amd.com"><Arvind.Yadav@amd.com></a>; Sharma,
Shashank <a class="moz-txt-link-rfc2396E" href="mailto:Shashank.Sharma@amd.com"><Shashank.Sharma@amd.com></a>
Subject: [PATCH] drm/amdgpu: enable userqueue support for GFX12

From: Somalapuram Amaranath <a class="moz-txt-link-rfc2396E" href="mailto:Amaranath.Somalapuram@amd.com"><Amaranath.Somalapuram@amd.com></a>

This patch enables Usermode queue support across GFX, Compute and SDMA IPs
on GFX12/SDMA7. It typically reuses Navi3X userqueue IP functions to create and
destroy MQDs.
</pre>
      </blockquote>
      <pre class="moz-quote-pre" wrap="">
I would like to make this more explicit.  In mes_v11_0_userqueue.c, I would suggest splitting out any non-gfx11 specific code into some new helpers in mes_userqueue.c.  E.g.,

mes_v11_0_map_gtt_bo_to_gart() -> mes_userq_map_gtt_bo_to_gart()
mes_v11_0_create_wptr_mapping() -> mes_userq_create_wptr_mapping()
mes_v11_0_userq_map() -> mes_userq_map()
mes_v11_0_userq_unmap() -> mes_userq_unmap()
mes_v11_0_userq_mqd_destroy() -> mes_userq_mqd_destroy()</pre>
    </blockquote>
    <p>Initial patch sets had all these functions named similar to '<span style="white-space: pre-wrap">mes_userq_</span>* ' only, but later
      you recommended that we should have mention of _v11_0 to indicate
      the IP specific stuff, as there might be IP specific way of
      mapping/unmapping/creating and destroying the queues. So with this
      comment we might be going back to the same version. </p>
    <p>As of now, v12 UQ was tested using the the same methods as V11
      UQs, and found it functional. We might need more information
      before taking this step. <br>
    </p>
    <p>- Shashank<br>
    </p>
    <blockquote type="cite" cite="mid:BL1PR12MB5144EC6671DD09A36B0BFD0CF7442@BL1PR12MB5144.namprd12.prod.outlook.com">
      <pre class="moz-quote-pre" wrap="">

However, mes_v11_userq_create_ctx_space() uses the v11 mqd structures which may not match the v12 structures.  We should add a v12 implementation for any functions that use the v12 structures.
</pre>
    </blockquote>
    <blockquote type="cite" cite="mid:BL1PR12MB5144EC6671DD09A36B0BFD0CF7442@BL1PR12MB5144.namprd12.prod.outlook.com">
      <pre class="moz-quote-pre" wrap="">
Alex

</pre>
      <blockquote type="cite">
        <pre class="moz-quote-pre" wrap="">
Cc: Alex Deucher <a class="moz-txt-link-rfc2396E" href="mailto:alexander.deucher@amd.com"><alexander.deucher@amd.com></a>
Cc: Christian Koenig <a class="moz-txt-link-rfc2396E" href="mailto:christian.koenig@amd.com"><christian.koenig@amd.com></a>
Cc: Arvind Yadav <a class="moz-txt-link-rfc2396E" href="mailto:arvind.yadav@amd.com"><arvind.yadav@amd.com></a>
Signed-off-by: Somalapuram Amaranath <a class="moz-txt-link-rfc2396E" href="mailto:Amaranath.Somalapuram@amd.com"><Amaranath.Somalapuram@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>
---
 drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c | 5 +++++
drivers/gpu/drm/amd/amdgpu/sdma_v7_0.c | 6 ++++++
 2 files changed, 11 insertions(+)

diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c
b/drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c
index 9fec28d8a5fc..d511996c374d 100644
--- a/drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c
@@ -46,6 +46,7 @@
 #include "gfx_v12_0.h"
 #include "nbif_v6_3_1.h"
 #include "mes_v12_0.h"
+#include "mes_v11_0_userqueue.h"

 #define GFX12_NUM_GFX_RINGS  1
 #define GFX12_MEC_HPD_SIZE   2048
@@ -1335,6 +1336,10 @@ static int gfx_v12_0_sw_init(struct amdgpu_ip_block
*ip_block)
              adev->gfx.mec.num_mec = 2;
              adev->gfx.mec.num_pipe_per_mec = 2;
              adev->gfx.mec.num_queue_per_pipe = 4;
+#ifdef CONFIG_DRM_AMDGPU_NAVI3X_USERQ
+             adev->userq_funcs[AMDGPU_HW_IP_GFX] =
&userq_mes_v11_0_funcs;
+             adev->userq_funcs[AMDGPU_HW_IP_COMPUTE] =
&userq_mes_v11_0_funcs;
+#endif
              break;
      default:
              adev->gfx.me.num_me = 1;
diff --git a/drivers/gpu/drm/amd/amdgpu/sdma_v7_0.c
b/drivers/gpu/drm/amd/amdgpu/sdma_v7_0.c
index 24f24974ac1d..badcf38bb8b6 100644
--- a/drivers/gpu/drm/amd/amdgpu/sdma_v7_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/sdma_v7_0.c
@@ -42,6 +42,7 @@
 #include "sdma_common.h"
 #include "sdma_v7_0.h"
 #include "v12_structs.h"
+#include "mes_v11_0_userqueue.h"

 MODULE_FIRMWARE("amdgpu/sdma_7_0_0.bin");
 MODULE_FIRMWARE("amdgpu/sdma_7_0_1.bin");
@@ -1317,6 +1318,11 @@ static int sdma_v7_0_sw_init(struct amdgpu_ip_block
*ip_block)
      else
              DRM_ERROR("Failed to allocated memory for SDMA IP Dump\n");

+#ifdef CONFIG_DRM_AMDGPU_NAVI3X_USERQ
+     adev->userq_funcs[AMDGPU_HW_IP_DMA] = &userq_mes_v11_0_funcs;
#endif
+
+
      return r;
 }

--
2.46.2
</pre>
      </blockquote>
      <pre class="moz-quote-pre" wrap="">
</pre>
    </blockquote>
  </body>
</html>