<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 id="divtagdefaultwrapper" style="font-size:12pt;color:#000000;font-family:Calibri,Helvetica,sans-serif;" dir="ltr">
<p style="margin-top:0;margin-bottom:0">Reviewed-by: Alex Deucher <alexander.deucher@amd.com><br>
</p>
</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 Emily Deng <Emily.Deng@amd.com><br>
<b>Sent:</b> Wednesday, January 2, 2019 10:58:37 PM<br>
<b>To:</b> amd-gfx@lists.freedesktop.org<br>
<b>Cc:</b> Deng, Emily<br>
<b>Subject:</b> [PATCH] drm/amdgpu/sriov: For finishing routine send rel event after init failed</font>
<div> </div>
</div>
<div class="BodyFragment"><font size="2"><span style="font-size:11pt;">
<div class="PlainText">When init fail, sendsend rel init, req_fini and rel_fini to host for the<br>
finishing routine.<br>
<br>
Signed-off-by: Emily Deng <Emily.Deng@amd.com><br>
---<br>
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 26 +++++++++++++++-----------<br>
 1 file changed, 15 insertions(+), 11 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 3c57ffc..ccd2e83 100644<br>
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c<br>
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c<br>
@@ -1652,7 +1652,7 @@ static int amdgpu_device_ip_init(struct amdgpu_device *adev)<br>
                 if (r) {<br>
                         DRM_ERROR("sw_init of IP block <%s> failed %d\n",<br>
                                   adev->ip_blocks[i].version->funcs->name, r);<br>
-                       return r;<br>
+                       goto init_failed;<br>
                 }<br>
                 adev->ip_blocks[i].status.sw = true;<br>
 <br>
@@ -1661,17 +1661,17 @@ static int amdgpu_device_ip_init(struct amdgpu_device *adev)<br>
                         r = amdgpu_device_vram_scratch_init(adev);<br>
                         if (r) {<br>
                                 DRM_ERROR("amdgpu_vram_scratch_init failed %d\n", r);<br>
-                               return r;<br>
+                               goto init_failed;<br>
                         }<br>
                         r = adev->ip_blocks[i].version->funcs->hw_init((void *)adev);<br>
                         if (r) {<br>
                                 DRM_ERROR("hw_init %d failed %d\n", i, r);<br>
-                               return r;<br>
+                               goto init_failed;<br>
                         }<br>
                         r = amdgpu_device_wb_init(adev);<br>
                         if (r) {<br>
                                 DRM_ERROR("amdgpu_device_wb_init failed %d\n", r);<br>
-                               return r;<br>
+                               goto init_failed;<br>
                         }<br>
                         adev->ip_blocks[i].status.hw = true;<br>
 <br>
@@ -1682,7 +1682,7 @@ static int amdgpu_device_ip_init(struct amdgpu_device *adev)<br>
                                                                 AMDGPU_CSA_SIZE);<br>
                                 if (r) {<br>
                                         DRM_ERROR("allocate CSA failed %d\n", r);<br>
-                                       return r;<br>
+                                       goto init_failed;<br>
                                 }<br>
                         }<br>
                 }<br>
@@ -1690,30 +1690,32 @@ static int amdgpu_device_ip_init(struct amdgpu_device *adev)<br>
 <br>
         r = amdgpu_ucode_create_bo(adev); /* create ucode bo when sw_init complete*/<br>
         if (r)<br>
-               return r;<br>
+               goto init_failed;<br>
 <br>
         r = amdgpu_device_ip_hw_init_phase1(adev);<br>
         if (r)<br>
-               return r;<br>
+               goto init_failed;<br>
 <br>
         r = amdgpu_device_fw_loading(adev);<br>
         if (r)<br>
-               return r;<br>
+               goto init_failed;<br>
 <br>
         r = amdgpu_device_ip_hw_init_phase2(adev);<br>
         if (r)<br>
-               return r;<br>
+               goto init_failed;<br>
 <br>
         if (adev->gmc.xgmi.num_physical_nodes > 1)<br>
                 amdgpu_xgmi_add_device(adev);<br>
         amdgpu_amdkfd_device_init(adev);<br>
 <br>
+init_failed:<br>
         if (amdgpu_sriov_vf(adev)) {<br>
-               amdgpu_virt_init_data_exchange(adev);<br>
+               if (!r)<br>
+                       amdgpu_virt_init_data_exchange(adev);<br>
                 amdgpu_virt_release_full_gpu(adev, true);<br>
         }<br>
 <br>
-       return 0;<br>
+       return r;<br>
 }<br>
 <br>
 /**<br>
@@ -2621,6 +2623,8 @@ int amdgpu_device_init(struct amdgpu_device *adev,<br>
                 }<br>
                 dev_err(adev->dev, "amdgpu_device_ip_init failed\n");<br>
                 amdgpu_vf_error_put(adev, AMDGIM_ERROR_VF_AMDGPU_INIT_FAIL, 0, 0);<br>
+               if (amdgpu_virt_request_full_gpu(adev, false))<br>
+                       amdgpu_virt_release_full_gpu(adev, false);<br>
                 goto failed;<br>
         }<br>
 <br>
-- <br>
2.7.4<br>
<br>
_______________________________________________<br>
amd-gfx mailing list<br>
amd-gfx@lists.freedesktop.org<br>
<a href="https://lists.freedesktop.org/mailman/listinfo/amd-gfx">https://lists.freedesktop.org/mailman/listinfo/amd-gfx</a><br>
</div>
</span></font></div>
</body>
</html>