drm/amdgpu: remove memory training p2c buffer reservation(V2)
authorTianci.Yin <tianci.yin@amd.com>
Tue, 17 Dec 2019 06:34:45 +0000 (14:34 +0800)
committerAlex Deucher <alexander.deucher@amd.com>
Mon, 23 Dec 2019 19:59:28 +0000 (14:59 -0500)
IP discovery TMR(occupied the top VRAM with size DISCOVERY_TMR_SIZE)
has been reserved, and the p2c buffer is in the range of this TMR, so
the p2c buffer reservation is unnecessary.

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Kevin Wang <kevin1.wang@amd.com>
Reviewed-by: Xiaojie Yuan <xiaojie.yuan@amd.com>
Signed-off-by: Tianci.Yin <tianci.yin@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c

index 5f8fd3e3535bcf6481cf7cc12fac1645e5eb10b8..3265487b859f0463adec250b342d26b6142b8b3f 100644 (file)
@@ -202,7 +202,6 @@ struct psp_memory_training_context {
 
        /*vram offset of the p2c training data*/
        u64 p2c_train_data_offset;
-       struct amdgpu_bo *p2c_bo;
 
        /*vram offset of the c2p training data*/
        u64 c2p_train_data_offset;
index 37b027fb0916bdeca0c4078aa6ac771a4063cec0..b2f8ba9e1f774b553ab7c3597fc88f2b4c54845d 100644 (file)
@@ -1714,9 +1714,6 @@ static int amdgpu_ttm_training_reserve_vram_fini(struct amdgpu_device *adev)
        amdgpu_bo_free_kernel(&ctx->c2p_bo, NULL, NULL);
        ctx->c2p_bo = NULL;
 
-       amdgpu_bo_free_kernel(&ctx->p2c_bo, NULL, NULL);
-       ctx->p2c_bo = NULL;
-
        return 0;
 }
 
@@ -1755,17 +1752,6 @@ static int amdgpu_ttm_training_reserve_vram_init(struct amdgpu_device *adev)
                  ctx->p2c_train_data_offset,
                  ctx->c2p_train_data_offset);
 
-       ret = amdgpu_bo_create_kernel_at(adev,
-                                        ctx->p2c_train_data_offset,
-                                        ctx->train_data_size,
-                                        AMDGPU_GEM_DOMAIN_VRAM,
-                                        &ctx->p2c_bo,
-                                        NULL);
-       if (ret) {
-               DRM_ERROR("alloc p2c_bo failed(%d)!\n", ret);
-               goto Err_out;
-       }
-
        ret = amdgpu_bo_create_kernel_at(adev,
                                         ctx->c2p_train_data_offset,
                                         ctx->train_data_size,
@@ -1774,15 +1760,12 @@ static int amdgpu_ttm_training_reserve_vram_init(struct amdgpu_device *adev)
                                         NULL);
        if (ret) {
                DRM_ERROR("alloc c2p_bo failed(%d)!\n", ret);
-               goto Err_out;
+               amdgpu_ttm_training_reserve_vram_fini(adev);
+               return ret;
        }
 
        ctx->init = PSP_MEM_TRAIN_RESERVE_SUCCESS;
        return 0;
-
-Err_out:
-       amdgpu_ttm_training_reserve_vram_fini(adev);
-       return ret;
 }
 
 /**