<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<p style="font-family:Arial;font-size:10pt;color:#008000;margin:15pt;" align="Left">
[Public]<br>
</p>
<br>
<div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Series is:</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Reviewed-by: Alex Deucher <alexander.deucher@amd.com><br>
</div>
<div id="appendonsend"></div>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>From:</b> amd-gfx <amd-gfx-bounces@lists.freedesktop.org> on behalf of Yifan Zhang <yifan1.zhang@amd.com><br>
<b>Sent:</b> Thursday, March 3, 2022 3:05 AM<br>
<b>To:</b> amd-gfx@lists.freedesktop.org <amd-gfx@lists.freedesktop.org><br>
<b>Cc:</b> Zhang, Yifan <Yifan1.Zhang@amd.com>; Kuehling, Felix <Felix.Kuehling@amd.com><br>
<b>Subject:</b> [PATCH 2/2] drm/amdkfd: implement get_atc_vmid_pasid_mapping_info for gfx10.3</font>
<div> </div>
</div>
<div class="BodyFragment"><font size="2"><span style="font-size:11pt;">
<div class="PlainText">This patch implements get_atc_vmid_pasid_mapping_info for gfx10.3<br>
<br>
Signed-off-by: Yifan Zhang <yifan1.zhang@amd.com><br>
---<br>
 .../gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v10_3.c | 16 +++++++++++++++-<br>
 1 file changed, 15 insertions(+), 1 deletion(-)<br>
<br>
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v10_3.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v10_3.c<br>
index e9c80ce13f3e..ba21ec6b35e0 100644<br>
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v10_3.c<br>
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v10_3.c<br>
@@ -26,6 +26,8 @@<br>
 #include "gc/gc_10_3_0_sh_mask.h"<br>
 #include "oss/osssys_5_0_0_offset.h"<br>
 #include "oss/osssys_5_0_0_sh_mask.h"<br>
+#include "athub/athub_2_1_0_offset.h"<br>
+#include "athub/athub_2_1_0_sh_mask.h"<br>
 #include "soc15_common.h"<br>
 #include "v10_structs.h"<br>
 #include "nv.h"<br>
@@ -606,6 +608,18 @@ static int wave_control_execute_v10_3(struct amdgpu_device *adev,<br>
         return 0;<br>
 }<br>
 <br>
+static bool get_atc_vmid_pasid_mapping_info_v10_3(struct amdgpu_device *adev,<br>
+                                       uint8_t vmid, uint16_t *p_pasid)<br>
+{<br>
+       uint32_t value;<br>
+<br>
+       value = RREG32(SOC15_REG_OFFSET(ATHUB, 0, mmATC_VMID0_PASID_MAPPING)<br>
+                    + vmid);<br>
+       *p_pasid = value & ATC_VMID0_PASID_MAPPING__PASID_MASK;<br>
+<br>
+       return !!(value & ATC_VMID0_PASID_MAPPING__VALID_MASK);<br>
+}<br>
+<br>
 static void set_vm_context_page_table_base_v10_3(struct amdgpu_device *adev,<br>
                 uint32_t vmid, uint64_t page_table_base)<br>
 {<br>
@@ -788,7 +802,7 @@ const struct kfd2kgd_calls gfx_v10_3_kfd2kgd = {<br>
         .hqd_destroy = hqd_destroy_v10_3,<br>
         .hqd_sdma_destroy = hqd_sdma_destroy_v10_3,<br>
         .wave_control_execute = wave_control_execute_v10_3,<br>
-       .get_atc_vmid_pasid_mapping_info = NULL,<br>
+       .get_atc_vmid_pasid_mapping_info = get_atc_vmid_pasid_mapping_info_v10_3,<br>
         .set_vm_context_page_table_base = set_vm_context_page_table_base_v10_3,<br>
         .program_trap_handler_settings = program_trap_handler_settings_v10_3,<br>
 #if 0<br>
-- <br>
2.25.1<br>
<br>
</div>
</span></font></div>
</div>
</body>
</html>