<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">
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Hi Jon,</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Does that mean we can simply use this instead?</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<span style="font-family: "Segoe UI", "Segoe UI Web (West European)", "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, "Helvetica Neue", sans-serif; font-size: 14.6667px; background-color: rgb(255, 255, 255); display: inline !important">+
if (mgpu_info.num_dgpu == adev->gmc.xgmi.num_physical_nodes<b> - 1</b>) {</span><br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="color: rgb(0, 0, 0);"><span style="font-size: 14.6667px;">Thanks,</span></div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Michael</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> Kim, Jonathan <Jonathan.Kim@amd.com><br>
<b>Sent:</b> 05 November 2019 11:32 AM<br>
<b>To:</b> Quan, Evan <Evan.Quan@amd.com>; amd-gfx@lists.freedesktop.org <amd-gfx@lists.freedesktop.org><br>
<b>Cc:</b> Strawbridge, Michael <Michael.Strawbridge@amd.com><br>
<b>Subject:</b> RE: [PATCH 2/2] drm/amdgpu: perform p-state switch after the whole hive initialized</font>
<div> </div>
</div>
<div class="BodyFragment"><font size="2"><span style="font-size:11pt;">
<div class="PlainText">Please see inline.<br>
<br>
Jon<br>
<br>
-----Original Message-----<br>
From: Quan, Evan <Evan.Quan@amd.com> <br>
Sent: Tuesday, November 5, 2019 5:24 AM<br>
To: amd-gfx@lists.freedesktop.org<br>
Cc: Kim, Jonathan <Jonathan.Kim@amd.com>; Strawbridge, Michael <Michael.Strawbridge@amd.com>; Quan, Evan <Evan.Quan@amd.com><br>
Subject: [PATCH 2/2] drm/amdgpu: perform p-state switch after the whole hive initialized<br>
<br>
P-state switch should be performed after all devices from the hive get initialized.<br>
<br>
Change-Id: Ifc7cac9ef0cf250447d2a412da35d601e2ac79ec<br>
Signed-off-by: Evan Quan <evan.quan@amd.com><br>
---<br>
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 47 ++++++++++++++++------<br>
1 file changed, 35 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 e6ce949670e5..2d72d206cead 100644<br>
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c<br>
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c<br>
@@ -2090,6 +2090,7 @@ static int amdgpu_device_enable_mgpu_fan_boost(void)<br>
*/<br>
static int amdgpu_device_ip_late_init(struct amdgpu_device *adev) {<br>
+ struct amdgpu_gpu_instance *gpu_instance;<br>
int i = 0, r;<br>
<br>
for (i = 0; i < adev->num_ip_blocks; i++) { @@ -2115,6 +2116,40 @@ static int amdgpu_device_ip_late_init(struct amdgpu_device *adev)<br>
if (r)<br>
DRM_ERROR("enable mgpu fan boost failed (%d).\n", r);<br>
<br>
+<br>
+ if (adev->gmc.xgmi.num_physical_nodes > 1) {<br>
+ mutex_lock(&mgpu_info.mutex);<br>
+<br>
+ /*<br>
+ * Reset device p-state to low as this was booted with high.<br>
+ *<br>
+ * This should be performed only after all devices from the same<br>
+ * hive get initialized.<br>
+ *<br>
+ * However, it's unknown how many device in the hive in advance.<br>
+ * As this is counted one by one during devices initializations.<br>
+ *<br>
+ * So, we wait for all XGMI interlinked devices initialized.<br>
+ * This may bring some delays as those devices may come from<br>
+ * different hives. But that should be OK.<br>
+ */<br>
+ if (mgpu_info.num_dgpu == adev->gmc.xgmi.num_physical_nodes) {<br>
[JK] This condition will never succeed. mgpu_info.num_dgpu is 0-indexed while num_physical_nodes give total nodes.<br>
<br>
+ for (i = 0; i < mgpu_info.num_gpu; i++) {<br>
+ gpu_instance = &(mgpu_info.gpu_ins[i]);<br>
+ if (gpu_instance->adev->flags & AMD_IS_APU)<br>
+ continue;<br>
+<br>
+ r = amdgpu_xgmi_set_pstate(gpu_instance->adev, 0);<br>
+ if (r) {<br>
+ DRM_ERROR("pstate setting failed (%d).\n", r);<br>
+ break;<br>
+ }<br>
+ }<br>
+ }<br>
+<br>
+ mutex_unlock(&mgpu_info.mutex);<br>
+ }<br>
+<br>
return 0;<br>
}<br>
<br>
@@ -2227,18 +2262,6 @@ static void amdgpu_device_delayed_init_work_handler(struct work_struct *work)<br>
r = amdgpu_ib_ring_tests(adev);<br>
if (r)<br>
DRM_ERROR("ib ring test failed (%d).\n", r);<br>
-<br>
- /*<br>
- * set to low pstate by default<br>
- * This should be performed after all devices from<br>
- * XGMI finish their initializations. Thus it's moved<br>
- * to here.<br>
- * The time delay is 2S. TODO: confirm whether that<br>
- * is enough for all possible XGMI setups.<br>
- */<br>
- r = amdgpu_xgmi_set_pstate(adev, 0);<br>
- if (r)<br>
- DRM_ERROR("pstate setting failed (%d).\n", r);<br>
}<br>
<br>
static void amdgpu_device_delay_enable_gfx_off(struct work_struct *work)<br>
--<br>
2.23.0<br>
<br>
</div>
</span></font></div>
</body>
</html>