[PATCH 2/2] drm/amdgpu: remove memory training p2c buffer reservation(V2)

2019-12-19 Thread Tianci Yin
From: "Tianci.Yin" 

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.

Change-Id: Ib1f2f2b4a1f3869c03ffe22e2836cdbee17ba99f
Reviewed-by: Kevin Wang 
Reviewed-by: Xiaojie Yuan 
Signed-off-by: Tianci.Yin 
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h |  1 -
 drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 21 ++---
 2 files changed, 2 insertions(+), 20 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h
index 5f8fd3e3535b..3265487b859f 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h
@@ -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;
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
index 1515413fd356..1aab4e349bc8 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
@@ -1681,9 +1681,6 @@ static int amdgpu_ttm_training_reserve_vram_fini(struct 
amdgpu_device *adev)
amdgpu_bo_free_kernel(>c2p_bo, NULL, NULL);
ctx->c2p_bo = NULL;
 
-   amdgpu_bo_free_kernel(>p2c_bo, NULL, NULL);
-   ctx->p2c_bo = NULL;
-
return 0;
 }
 
@@ -1722,17 +1719,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,
->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,
@@ -1741,15 +1727,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;
 }
 
 /**
-- 
2.17.1

___
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx


Re: [PATCH 2/2] drm/amdgpu: remove memory training p2c buffer reservation(V2)

2019-12-18 Thread Yin, Tianci (Rico)
Thanks Xiaojie!

From: Yuan, Xiaojie 
Sent: Thursday, December 19, 2019 11:02
To: Yin, Tianci (Rico) ; amd-gfx@lists.freedesktop.org 

Cc: Tuikov, Luben ; Koenig, Christian 
; Deucher, Alexander ; 
Zhang, Hawking ; Xu, Feifei ; Long, 
Gang ; Wang, Kevin(Yang) 
Subject: Re: [PATCH 2/2] drm/amdgpu: remove memory training p2c buffer 
reservation(V2)

[AMD Official Use Only - Internal Distribution Only]

Reviewed-by: Xiaojie Yuan 

BR,
Xiaojie


From: Tianci Yin 
Sent: Thursday, December 19, 2019 10:44 AM
To: amd-gfx@lists.freedesktop.org
Cc: Tuikov, Luben; Koenig, Christian; Deucher, Alexander; Zhang, Hawking; Xu, 
Feifei; Yuan, Xiaojie; Long, Gang; Wang, Kevin(Yang); Yin, Tianci (Rico)
Subject: [PATCH 2/2] drm/amdgpu: remove memory training p2c buffer 
reservation(V2)

From: "Tianci.Yin" 

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.

Change-Id: Ib1f2f2b4a1f3869c03ffe22e2836cdbee17ba99f
Reviewed-by: Kevin Wang 
Signed-off-by: Tianci.Yin 
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h |  1 -
 drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 21 ++---
 2 files changed, 2 insertions(+), 20 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h
index 5f8fd3e3535b..3265487b859f 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h
@@ -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;
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
index ec84acdd43a2..60f17e989014 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
@@ -1681,9 +1681,6 @@ static int amdgpu_ttm_training_reserve_vram_fini(struct 
amdgpu_device *adev)
amdgpu_bo_free_kernel(>c2p_bo, NULL, NULL);
ctx->c2p_bo = NULL;

-   amdgpu_bo_free_kernel(>p2c_bo, NULL, NULL);
-   ctx->p2c_bo = NULL;
-
return 0;
 }

@@ -1725,17 +1722,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,
->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,
@@ -1744,15 +1730,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;
 }

 /**
--
2.17.1

___
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx


Re: [PATCH 2/2] drm/amdgpu: remove memory training p2c buffer reservation(V2)

2019-12-18 Thread Yuan, Xiaojie
[AMD Official Use Only - Internal Distribution Only]

Reviewed-by: Xiaojie Yuan 

BR,
Xiaojie


From: Tianci Yin 
Sent: Thursday, December 19, 2019 10:44 AM
To: amd-gfx@lists.freedesktop.org
Cc: Tuikov, Luben; Koenig, Christian; Deucher, Alexander; Zhang, Hawking; Xu, 
Feifei; Yuan, Xiaojie; Long, Gang; Wang, Kevin(Yang); Yin, Tianci (Rico)
Subject: [PATCH 2/2] drm/amdgpu: remove memory training p2c buffer 
reservation(V2)

From: "Tianci.Yin" 

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.

Change-Id: Ib1f2f2b4a1f3869c03ffe22e2836cdbee17ba99f
Reviewed-by: Kevin Wang 
Signed-off-by: Tianci.Yin 
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h |  1 -
 drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 21 ++---
 2 files changed, 2 insertions(+), 20 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h
index 5f8fd3e3535b..3265487b859f 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h
@@ -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;
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
index ec84acdd43a2..60f17e989014 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
@@ -1681,9 +1681,6 @@ static int amdgpu_ttm_training_reserve_vram_fini(struct 
amdgpu_device *adev)
amdgpu_bo_free_kernel(>c2p_bo, NULL, NULL);
ctx->c2p_bo = NULL;

-   amdgpu_bo_free_kernel(>p2c_bo, NULL, NULL);
-   ctx->p2c_bo = NULL;
-
return 0;
 }

@@ -1725,17 +1722,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,
->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,
@@ -1744,15 +1730,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;
 }

 /**
--
2.17.1

___
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx


[PATCH 2/2] drm/amdgpu: remove memory training p2c buffer reservation(V2)

2019-12-18 Thread Tianci Yin
From: "Tianci.Yin" 

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.

Change-Id: Ib1f2f2b4a1f3869c03ffe22e2836cdbee17ba99f
Reviewed-by: Kevin Wang 
Signed-off-by: Tianci.Yin 
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h |  1 -
 drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 21 ++---
 2 files changed, 2 insertions(+), 20 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h
index 5f8fd3e3535b..3265487b859f 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h
@@ -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;
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
index ec84acdd43a2..60f17e989014 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
@@ -1681,9 +1681,6 @@ static int amdgpu_ttm_training_reserve_vram_fini(struct 
amdgpu_device *adev)
amdgpu_bo_free_kernel(>c2p_bo, NULL, NULL);
ctx->c2p_bo = NULL;
 
-   amdgpu_bo_free_kernel(>p2c_bo, NULL, NULL);
-   ctx->p2c_bo = NULL;
-
return 0;
 }
 
@@ -1725,17 +1722,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,
->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,
@@ -1744,15 +1730,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;
 }
 
 /**
-- 
2.17.1

___
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx


Re: [PATCH 2/2] drm/amdgpu: remove memory training p2c buffer reservation(V2)

2019-12-18 Thread Yin, Tianci (Rico)
Thanks Kevin!

From: Wang, Kevin(Yang) 
Sent: Wednesday, December 18, 2019 16:53
To: Yin, Tianci (Rico) ; amd-gfx@lists.freedesktop.org 

Cc: Tuikov, Luben ; Koenig, Christian 
; Deucher, Alexander ; 
Zhang, Hawking ; Xu, Feifei ; Yuan, 
Xiaojie ; Long, Gang 
Subject: Re: [PATCH 2/2] drm/amdgpu: remove memory training p2c buffer 
reservation(V2)


[AMD Official Use Only - Internal Distribution Only]

Reviewed-by: Kevin Wang 

Best Regards,
Kevin


From: Tianci Yin 
Sent: Wednesday, December 18, 2019 4:50 PM
To: amd-gfx@lists.freedesktop.org 
Cc: Tuikov, Luben ; Koenig, Christian 
; Deucher, Alexander ; 
Zhang, Hawking ; Xu, Feifei ; Yuan, 
Xiaojie ; Long, Gang ; Wang, 
Kevin(Yang) ; Yin, Tianci (Rico) 
Subject: [PATCH 2/2] drm/amdgpu: remove memory training p2c buffer 
reservation(V2)

From: "Tianci.Yin" 

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.

Change-Id: Ib1f2f2b4a1f3869c03ffe22e2836cdbee17ba99f
Signed-off-by: Tianci.Yin 
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h |  1 -
 drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 21 ++---
 2 files changed, 2 insertions(+), 20 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h
index 5f8fd3e3535b..3265487b859f 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h
@@ -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;
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
index ce5cb854bdb9..476ea4a4dc03 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
@@ -1681,9 +1681,6 @@ static int amdgpu_ttm_training_reserve_vram_fini(struct 
amdgpu_device *adev)
 amdgpu_bo_free_kernel(>c2p_bo, NULL, NULL);
 ctx->c2p_bo = NULL;

-   amdgpu_bo_free_kernel(>p2c_bo, NULL, NULL);
-   ctx->p2c_bo = NULL;
-
 return 0;
 }

@@ -1718,17 +1715,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,
->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,
@@ -1737,15 +1723,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;
 }

 /**
--
2.17.1

___
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx


Re: [PATCH 2/2] drm/amdgpu: remove memory training p2c buffer reservation(V2)

2019-12-18 Thread Wang, Kevin(Yang)
[AMD Official Use Only - Internal Distribution Only]

Reviewed-by: Kevin Wang 

Best Regards,
Kevin


From: Tianci Yin 
Sent: Wednesday, December 18, 2019 4:50 PM
To: amd-gfx@lists.freedesktop.org 
Cc: Tuikov, Luben ; Koenig, Christian 
; Deucher, Alexander ; 
Zhang, Hawking ; Xu, Feifei ; Yuan, 
Xiaojie ; Long, Gang ; Wang, 
Kevin(Yang) ; Yin, Tianci (Rico) 
Subject: [PATCH 2/2] drm/amdgpu: remove memory training p2c buffer 
reservation(V2)

From: "Tianci.Yin" 

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.

Change-Id: Ib1f2f2b4a1f3869c03ffe22e2836cdbee17ba99f
Signed-off-by: Tianci.Yin 
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h |  1 -
 drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 21 ++---
 2 files changed, 2 insertions(+), 20 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h
index 5f8fd3e3535b..3265487b859f 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h
@@ -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;
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
index ce5cb854bdb9..476ea4a4dc03 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
@@ -1681,9 +1681,6 @@ static int amdgpu_ttm_training_reserve_vram_fini(struct 
amdgpu_device *adev)
 amdgpu_bo_free_kernel(>c2p_bo, NULL, NULL);
 ctx->c2p_bo = NULL;

-   amdgpu_bo_free_kernel(>p2c_bo, NULL, NULL);
-   ctx->p2c_bo = NULL;
-
 return 0;
 }

@@ -1718,17 +1715,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,
->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,
@@ -1737,15 +1723,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;
 }

 /**
--
2.17.1

___
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx


[PATCH 2/2] drm/amdgpu: remove memory training p2c buffer reservation(V2)

2019-12-18 Thread Tianci Yin
From: "Tianci.Yin" 

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.

Change-Id: Ib1f2f2b4a1f3869c03ffe22e2836cdbee17ba99f
Signed-off-by: Tianci.Yin 
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h |  1 -
 drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 21 ++---
 2 files changed, 2 insertions(+), 20 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h
index 5f8fd3e3535b..3265487b859f 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h
@@ -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;
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
index ce5cb854bdb9..476ea4a4dc03 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
@@ -1681,9 +1681,6 @@ static int amdgpu_ttm_training_reserve_vram_fini(struct 
amdgpu_device *adev)
amdgpu_bo_free_kernel(>c2p_bo, NULL, NULL);
ctx->c2p_bo = NULL;
 
-   amdgpu_bo_free_kernel(>p2c_bo, NULL, NULL);
-   ctx->p2c_bo = NULL;
-
return 0;
 }
 
@@ -1718,17 +1715,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,
->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,
@@ -1737,15 +1723,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;
 }
 
 /**
-- 
2.17.1

___
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx


[PATCH 2/2] drm/amdgpu: remove memory training p2c buffer reservation(V2)

2019-12-17 Thread Tianci Yin
From: "Tianci.Yin" 

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.

Change-Id: Ib1f2f2b4a1f3869c03ffe22e2836cdbee17ba99f
Signed-off-by: Tianci.Yin 
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h |  1 -
 drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 21 ++---
 2 files changed, 2 insertions(+), 20 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h
index 5f8fd3e3535b..3265487b859f 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h
@@ -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;
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
index ce5cb854bdb9..476ea4a4dc03 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
@@ -1681,9 +1681,6 @@ static int amdgpu_ttm_training_reserve_vram_fini(struct 
amdgpu_device *adev)
amdgpu_bo_free_kernel(>c2p_bo, NULL, NULL);
ctx->c2p_bo = NULL;
 
-   amdgpu_bo_free_kernel(>p2c_bo, NULL, NULL);
-   ctx->p2c_bo = NULL;
-
return 0;
 }
 
@@ -1718,17 +1715,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,
->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,
@@ -1737,15 +1723,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;
 }
 
 /**
-- 
2.17.1

___
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx


Re: [PATCH 2/2] drm/amdgpu: remove memory training p2c buffer reservation

2019-12-17 Thread Yin, Tianci (Rico)
Hi Guchun,

Thanks very much for your suggestion.
I will refine it and send it out later.

Rico

From: Chen, Guchun 
Sent: Tuesday, December 17, 2019 22:11
To: Yin, Tianci (Rico) ; amd-gfx@lists.freedesktop.org 

Cc: Long, Gang ; Yin, Tianci (Rico) ; 
Xu, Feifei ; Wang, Kevin(Yang) ; 
Tuikov, Luben ; Deucher, Alexander 
; Zhang, Hawking ; Koenig, 
Christian ; Yuan, Xiaojie 
Subject: RE: [PATCH 2/2] drm/amdgpu: remove memory training p2c buffer 
reservation

[AMD Official Use Only - Internal Distribution Only]




-Original Message-
From: amd-gfx  On Behalf Of Tianci Yin
Sent: Tuesday, December 17, 2019 7:23 PM
To: amd-gfx@lists.freedesktop.org
Cc: Long, Gang ; Yin, Tianci (Rico) ; 
Xu, Feifei ; Wang, Kevin(Yang) ; 
Tuikov, Luben ; Deucher, Alexander 
; Zhang, Hawking ; Koenig, 
Christian ; Yuan, Xiaojie 
Subject: [PATCH 2/2] drm/amdgpu: remove memory training p2c buffer reservation

From: "Tianci.Yin" 

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.

Change-Id: Ib1f2f2b4a1f3869c03ffe22e2836cdbee17ba99f
Signed-off-by: Tianci.Yin 
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h |  1 -  
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 14 --
 2 files changed, 15 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h
index 5f8fd3e3535b..3265487b859f 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h
@@ -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;
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
index ce5cb854bdb9..6f0ad1d1d4d7 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
@@ -1681,9 +1681,6 @@ static int amdgpu_ttm_training_reserve_vram_fini(struct 
amdgpu_device *adev)
 amdgpu_bo_free_kernel(>c2p_bo, NULL, NULL);
 ctx->c2p_bo = NULL;

-   amdgpu_bo_free_kernel(>p2c_bo, NULL, NULL);
-   ctx->p2c_bo = NULL;
-
 return 0;
 }

@@ -1718,17 +1715,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,
->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,
[Guchun] If we have to remove such buffer reservation, from coding style's 
perspective, I suggest removing error handler code by "goto" too in 
amdgpu_ttm_training_reserve_vram_init.
After removing p2c buffer reservation from this function, there is only one 
buffer reservation case for c2p. So direct error handle and return should be 
better.

--
2.17.1

___
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfxdata=02%7C01%7Cguchun.chen%40amd.com%7C888c561716c342aa9ecc08d782e397d0%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637121786693411170sdata=pH1rob4R5ljvEGo8PSjn1te7ctWLG1Wctv30lNCLyx4%3Dreserved=0
___
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx


RE: [PATCH 2/2] drm/amdgpu: remove memory training p2c buffer reservation

2019-12-17 Thread Chen, Guchun
[AMD Official Use Only - Internal Distribution Only]




-Original Message-
From: amd-gfx  On Behalf Of Tianci Yin
Sent: Tuesday, December 17, 2019 7:23 PM
To: amd-gfx@lists.freedesktop.org
Cc: Long, Gang ; Yin, Tianci (Rico) ; 
Xu, Feifei ; Wang, Kevin(Yang) ; 
Tuikov, Luben ; Deucher, Alexander 
; Zhang, Hawking ; Koenig, 
Christian ; Yuan, Xiaojie 
Subject: [PATCH 2/2] drm/amdgpu: remove memory training p2c buffer reservation

From: "Tianci.Yin" 

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.

Change-Id: Ib1f2f2b4a1f3869c03ffe22e2836cdbee17ba99f
Signed-off-by: Tianci.Yin 
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h |  1 -  
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 14 --
 2 files changed, 15 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h
index 5f8fd3e3535b..3265487b859f 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h
@@ -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;
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
index ce5cb854bdb9..6f0ad1d1d4d7 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
@@ -1681,9 +1681,6 @@ static int amdgpu_ttm_training_reserve_vram_fini(struct 
amdgpu_device *adev)
amdgpu_bo_free_kernel(>c2p_bo, NULL, NULL);
ctx->c2p_bo = NULL;
 
-   amdgpu_bo_free_kernel(>p2c_bo, NULL, NULL);
-   ctx->p2c_bo = NULL;
-
return 0;
 }
 
@@ -1718,17 +1715,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,
->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,
[Guchun] If we have to remove such buffer reservation, from coding style's 
perspective, I suggest removing error handler code by "goto" too in 
amdgpu_ttm_training_reserve_vram_init.
After removing p2c buffer reservation from this function, there is only one 
buffer reservation case for c2p. So direct error handle and return should be 
better.

--
2.17.1

___
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfxdata=02%7C01%7Cguchun.chen%40amd.com%7C888c561716c342aa9ecc08d782e397d0%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637121786693411170sdata=pH1rob4R5ljvEGo8PSjn1te7ctWLG1Wctv30lNCLyx4%3Dreserved=0
___
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx


[PATCH 2/2] drm/amdgpu: remove memory training p2c buffer reservation

2019-12-17 Thread Tianci Yin
From: "Tianci.Yin" 

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.

Change-Id: Ib1f2f2b4a1f3869c03ffe22e2836cdbee17ba99f
Signed-off-by: Tianci.Yin 
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h |  1 -
 drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 14 --
 2 files changed, 15 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h
index 5f8fd3e3535b..3265487b859f 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h
@@ -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;
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
index ce5cb854bdb9..6f0ad1d1d4d7 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
@@ -1681,9 +1681,6 @@ static int amdgpu_ttm_training_reserve_vram_fini(struct 
amdgpu_device *adev)
amdgpu_bo_free_kernel(>c2p_bo, NULL, NULL);
ctx->c2p_bo = NULL;
 
-   amdgpu_bo_free_kernel(>p2c_bo, NULL, NULL);
-   ctx->p2c_bo = NULL;
-
return 0;
 }
 
@@ -1718,17 +1715,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,
->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,
-- 
2.17.1

___
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx