<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);">
Thanks Xiaojie!<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> Yuan, Xiaojie <Xiaojie.Yuan@amd.com><br>
<b>Sent:</b> Thursday, December 19, 2019 11:02<br>
<b>To:</b> Yin, Tianci (Rico) <Tianci.Yin@amd.com>; 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>; Long, Gang <Gang.Long@amd.com>; Wang, Kevin(Yang)
 <Kevin1.Wang@amd.com><br>
<b>Subject:</b> Re: [PATCH 2/2] drm/amdgpu: remove memory training p2c buffer reservation(V2)</font>
<div> </div>
</div>
<div class="BodyFragment"><font face="Times New Roman" size="3"><span style="font-size:12pt;"><a name="BM_BEGIN"></a>
<div><font size="2"><span style="font-size:11pt;">[AMD Official Use Only - Internal Distribution Only]<br>
<br>
Reviewed-by: Xiaojie Yuan <xiaojie.yuan@amd.com><br>
<br>
BR,<br>
Xiaojie<br>
<br>
________________________________________<br>
From: Tianci Yin <tianci.yin@amd.com><br>
Sent: Thursday, December 19, 2019 10:44 AM<br>
To: amd-gfx@lists.freedesktop.org<br>
Cc: Tuikov, Luben; Koenig, Christian; Deucher, Alexander; Zhang, Hawking; Xu, Feifei; Yuan, Xiaojie; Long, Gang; Wang, Kevin(Yang); Yin, Tianci (Rico)<br>
Subject: [PATCH 2/2] drm/amdgpu: remove memory training p2c buffer reservation(V2)<br>
<br>
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>
Reviewed-by: Kevin Wang <kevin1.wang@amd.com><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 ec84acdd43a2..60f17e989014 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>
@@ -1725,17 +1722,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>
@@ -1744,15 +1730,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>
</span></font></div>
</span></font></div>
</body>
</html>