<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:#0000FF;margin:5pt;" align="Left">
[AMD Official Use Only]<br>
</p>
<br>
<div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);">
<span style="color: rgb(0, 0, 0); background-color: rgb(255, 255, 255); display: inline !important;">Reviewed-by: David Nieto <david.nieto@amd.com></span><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> Skvortsov, Victor <Victor.Skvortsov@amd.com><br>
<b>Sent:</b> Thursday, December 16, 2021 11:42 AM<br>
<b>To:</b> amd-gfx@lists.freedesktop.org <amd-gfx@lists.freedesktop.org>; Deng, Emily <Emily.Deng@amd.com>; Liu, Monk <Monk.Liu@amd.com>; Ming, Davis <Davis.Ming@amd.com>; Liu, Shaoyun <Shaoyun.Liu@amd.com>; Zhou, Peng Ju <PengJu.Zhou@amd.com>; Chen, JingWen
 <JingWen.Chen2@amd.com>; Chen, Horace <Horace.Chen@amd.com>; Nieto, David M <David.Nieto@amd.com><br>
<b>Cc:</b> Skvortsov, Victor <Victor.Skvortsov@amd.com><br>
<b>Subject:</b> [PATCH v3 4/5] drm/amdgpu: get xgmi info before ip_init</font>
<div> </div>
</div>
<div class="BodyFragment"><font size="2"><span style="font-size:11pt;">
<div class="PlainText">Driver needs to call get_xgmi_info() before ip_init<br>
to determine whether it needs to handle a pending hive reset.<br>
<br>
Signed-off-by: Victor Skvortsov <victor.skvortsov@amd.com><br>
---<br>
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 7 +++++++<br>
 drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c     | 6 ------<br>
 drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c      | 6 ------<br>
 3 files changed, 7 insertions(+), 12 deletions(-)<br>
<br>
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c<br>
index 5bd785cfc5ca..4fd370016834 100644<br>
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c<br>
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c<br>
@@ -3576,6 +3576,13 @@ int amdgpu_device_init(struct amdgpu_device *adev,<br>
         if (r)<br>
                 return r;<br>
 <br>
+       /* Need to get xgmi info early to decide the reset behavior*/<br>
+       if (adev->gmc.xgmi.supported) {<br>
+               r = adev->gfxhub.funcs->get_xgmi_info(adev);<br>
+       if (r)<br>
+                       return r;<br>
+       }<br>
+<br>
         /* enable PCIE atomic ops */<br>
         if (amdgpu_sriov_vf(adev))<br>
                 adev->have_atomics_support = ((struct amd_sriov_msg_pf2vf_info *)<br>
diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c b/drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c<br>
index ae46eb35b3d7..3d5d47a799e3 100644<br>
--- a/drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c<br>
+++ b/drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c<br>
@@ -914,12 +914,6 @@ static int gmc_v10_0_sw_init(void *handle)<br>
                 return r;<br>
         }<br>
 <br>
-       if (adev->gmc.xgmi.supported) {<br>
-               r = adev->gfxhub.funcs->get_xgmi_info(adev);<br>
-               if (r)<br>
-                       return r;<br>
-       }<br>
-<br>
         r = gmc_v10_0_mc_init(adev);<br>
         if (r)<br>
                 return r;<br>
diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c b/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c<br>
index 2b86c63b032a..57f2729a7bd0 100644<br>
--- a/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c<br>
+++ b/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c<br>
@@ -1628,12 +1628,6 @@ static int gmc_v9_0_sw_init(void *handle)<br>
         }<br>
         adev->need_swiotlb = drm_need_swiotlb(44);<br>
 <br>
-       if (adev->gmc.xgmi.supported) {<br>
-               r = adev->gfxhub.funcs->get_xgmi_info(adev);<br>
-               if (r)<br>
-                       return r;<br>
-       }<br>
-<br>
         r = gmc_v9_0_mc_init(adev);<br>
         if (r)<br>
                 return r;<br>
-- <br>
2.25.1<br>
<br>
</div>
</span></font></div>
</div>
</body>
</html>