<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<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:#0078D7;margin:15pt;" align="Left">
[AMD Official Use Only - Internal Distribution Only]<br>
</p>
<br>
<div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Reviewed-by: Kevin Wang <kevin1.wang@amd.com></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);">
Best Regards,</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Kevin</div>
<div id="appendonsend"></div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
<hr tabindex="-1" style="display:inline-block; width:98%">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" color="#000000" style="font-size:11pt"><b>From:</b> Tianci Yin <tianci.yin@amd.com><br>
<b>Sent:</b> Wednesday, December 18, 2019 4:50 PM<br>
<b>To:</b> amd-gfx@lists.freedesktop.org <amd-gfx@lists.freedesktop.org><br>
<b>Cc:</b> Tuikov, Luben <Luben.Tuikov@amd.com>; Koenig, Christian <Christian.Koenig@amd.com>; Deucher, Alexander <Alexander.Deucher@amd.com>; Zhang, Hawking <Hawking.Zhang@amd.com>; Xu, Feifei <Feifei.Xu@amd.com>; Yuan, Xiaojie <Xiaojie.Yuan@amd.com>; Long,
 Gang <Gang.Long@amd.com>; Wang, Kevin(Yang) <Kevin1.Wang@amd.com>; Yin, Tianci (Rico) <Tianci.Yin@amd.com><br>
<b>Subject:</b> [PATCH 2/2] drm/amdgpu: remove memory training p2c buffer reservation(V2)</font>
<div> </div>
</div>
<div class="BodyFragment"><font size="2"><span style="font-size:11pt">
<div class="PlainText">From: "Tianci.Yin" <tianci.yin@amd.com><br>
<br>
IP discovery TMR(occupied the top VRAM with size DISCOVERY_TMR_SIZE)<br>
has been reserved, and the p2c buffer is in the range of this TMR, so<br>
the p2c buffer reservation is unnecessary.<br>
<br>
Change-Id: Ib1f2f2b4a1f3869c03ffe22e2836cdbee17ba99f<br>
Signed-off-by: Tianci.Yin <tianci.yin@amd.com><br>
---<br>
 drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h |  1 -<br>
 drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 21 ++-------------------<br>
 2 files changed, 2 insertions(+), 20 deletions(-)<br>
<br>
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h<br>
index 5f8fd3e3535b..3265487b859f 100644<br>
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h<br>
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h<br>
@@ -202,7 +202,6 @@ struct psp_memory_training_context {<br>
 <br>
         /*vram offset of the p2c training data*/<br>
         u64 p2c_train_data_offset;<br>
-       struct amdgpu_bo *p2c_bo;<br>
 <br>
         /*vram offset of the c2p training data*/<br>
         u64 c2p_train_data_offset;<br>
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c<br>
index ce5cb854bdb9..476ea4a4dc03 100644<br>
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c<br>
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c<br>
@@ -1681,9 +1681,6 @@ static int amdgpu_ttm_training_reserve_vram_fini(struct amdgpu_device *adev)<br>
         amdgpu_bo_free_kernel(&ctx->c2p_bo, NULL, NULL);<br>
         ctx->c2p_bo = NULL;<br>
 <br>
-       amdgpu_bo_free_kernel(&ctx->p2c_bo, NULL, NULL);<br>
-       ctx->p2c_bo = NULL;<br>
-<br>
         return 0;<br>
 }<br>
 <br>
@@ -1718,17 +1715,6 @@ static int amdgpu_ttm_training_reserve_vram_init(struct amdgpu_device *adev)<br>
                   ctx->p2c_train_data_offset,<br>
                   ctx->c2p_train_data_offset);<br>
 <br>
-       ret = amdgpu_bo_create_kernel_at(adev,<br>
-                                        ctx->p2c_train_data_offset,<br>
-                                        ctx->train_data_size,<br>
-                                        AMDGPU_GEM_DOMAIN_VRAM,<br>
-                                        &ctx->p2c_bo,<br>
-                                        NULL);<br>
-       if (ret) {<br>
-               DRM_ERROR("alloc p2c_bo failed(%d)!\n", ret);<br>
-               goto Err_out;<br>
-       }<br>
-<br>
         ret = amdgpu_bo_create_kernel_at(adev,<br>
                                          ctx->c2p_train_data_offset,<br>
                                          ctx->train_data_size,<br>
@@ -1737,15 +1723,12 @@ static int amdgpu_ttm_training_reserve_vram_init(struct amdgpu_device *adev)<br>
                                          NULL);<br>
         if (ret) {<br>
                 DRM_ERROR("alloc c2p_bo failed(%d)!\n", ret);<br>
-               goto Err_out;<br>
+               amdgpu_ttm_training_reserve_vram_fini(adev);<br>
+               return ret;<br>
         }<br>
 <br>
         ctx->init = PSP_MEM_TRAIN_RESERVE_SUCCESS;<br>
         return 0;<br>
-<br>
-Err_out:<br>
-       amdgpu_ttm_training_reserve_vram_fini(adev);<br>
-       return ret;<br>
 }<br>
 <br>
 /**<br>
-- <br>
2.17.1<br>
<br>
</div>
</span></font></div>
</div>
</body>
</html>