Re: [PATCH 2/2] drm/amdgpu: keep the stolen memory in visible vram region

2019-08-29 Thread Yin, Tianci (Rico)
Ok, I'll fix that, thanks!

From: Christian König 
Sent: Thursday, August 29, 2019 15:13
To: Yin, Tianci (Rico) ; amd-gfx@lists.freedesktop.org 

Cc: Xu, Feifei ; Ma, Le ; Xiao, Jack 
; Zhang, Hawking 
Subject: Re: [PATCH 2/2] drm/amdgpu: keep the stolen memory in visible vram 
region

Am 29.08.19 um 05:05 schrieb Tianci Yin:
> From: "Tianci.Yin" 
>
> stolen memory should be fixed in visible region.
>
> Change-Id: Icbbbd39fd113e93423aad8d2555f4073c08020e5
> Signed-off-by: Tianci.Yin 
> ---
>   drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 6 --
>   drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c   | 3 ++-
>   2 files changed, 6 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c 
> b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
> index 801f912..dcd32d0 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
> @@ -1733,6 +1733,7 @@ int amdgpu_ttm_init(struct amdgpu_device *adev)
>uint64_t gtt_size;
>int r;
>u64 vis_vram_limit;
> + void *stolen_vga_buf;
>
>mutex_init(>mman.gtt_window_lock);
>
> @@ -1787,7 +1788,7 @@ int amdgpu_ttm_init(struct amdgpu_device *adev)
>r = amdgpu_bo_create_kernel(adev, adev->gmc.stolen_size, PAGE_SIZE,
>AMDGPU_GEM_DOMAIN_VRAM,
>>stolen_vga_memory,
> - NULL, NULL);
> + NULL, _vga_buf);
>if (r)
>return r;
>DRM_INFO("amdgpu: %uM of VRAM memory ready\n",
> @@ -1851,8 +1852,9 @@ int amdgpu_ttm_init(struct amdgpu_device *adev)
>*/
>   void amdgpu_ttm_late_init(struct amdgpu_device *adev)
>   {
> + void *stolen_vga_buf;

Coding style says we should add a new line between declaration and code.

Apart from that the series is Reviewed-by: Christian König
.

>/* return the VGA stolen memory (if any) back to VRAM */
> - amdgpu_bo_free_kernel(>stolen_vga_memory, NULL, NULL);
> + amdgpu_bo_free_kernel(>stolen_vga_memory, NULL, _vga_buf);
>   }
>
>   /**
> diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c 
> b/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c
> index f77138b..ab43ae2 100644
> --- a/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c
> @@ -1248,6 +1248,7 @@ static int gmc_v9_0_sw_init(void *handle)
>   static int gmc_v9_0_sw_fini(void *handle)
>   {
>struct amdgpu_device *adev = (struct amdgpu_device *)handle;
> + void *stolen_vga_buf;
>
>if (amdgpu_ras_is_supported(adev, AMDGPU_RAS_BLOCK__UMC) &&
>adev->gmc.umc_ras_if) {
> @@ -1280,7 +1281,7 @@ static int gmc_v9_0_sw_fini(void *handle)
>amdgpu_vm_manager_fini(adev);
>
>if (gmc_v9_0_keep_stolen_memory(adev))
> - amdgpu_bo_free_kernel(>stolen_vga_memory, NULL, NULL);
> + amdgpu_bo_free_kernel(>stolen_vga_memory, NULL, 
> _vga_buf);
>
>amdgpu_gart_table_vram_free(adev);
>amdgpu_bo_fini(adev);

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

Re: [PATCH 2/2] drm/amdgpu: keep the stolen memory in visible vram region

2019-08-29 Thread Christian König

Am 29.08.19 um 05:05 schrieb Tianci Yin:

From: "Tianci.Yin" 

stolen memory should be fixed in visible region.

Change-Id: Icbbbd39fd113e93423aad8d2555f4073c08020e5
Signed-off-by: Tianci.Yin 
---
  drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 6 --
  drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c   | 3 ++-
  2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
index 801f912..dcd32d0 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
@@ -1733,6 +1733,7 @@ int amdgpu_ttm_init(struct amdgpu_device *adev)
uint64_t gtt_size;
int r;
u64 vis_vram_limit;
+   void *stolen_vga_buf;
  
  	mutex_init(>mman.gtt_window_lock);
  
@@ -1787,7 +1788,7 @@ int amdgpu_ttm_init(struct amdgpu_device *adev)

r = amdgpu_bo_create_kernel(adev, adev->gmc.stolen_size, PAGE_SIZE,
AMDGPU_GEM_DOMAIN_VRAM,
>stolen_vga_memory,
-   NULL, NULL);
+   NULL, _vga_buf);
if (r)
return r;
DRM_INFO("amdgpu: %uM of VRAM memory ready\n",
@@ -1851,8 +1852,9 @@ int amdgpu_ttm_init(struct amdgpu_device *adev)
   */
  void amdgpu_ttm_late_init(struct amdgpu_device *adev)
  {
+   void *stolen_vga_buf;


Coding style says we should add a new line between declaration and code.

Apart from that the series is Reviewed-by: Christian König 
.



/* return the VGA stolen memory (if any) back to VRAM */
-   amdgpu_bo_free_kernel(>stolen_vga_memory, NULL, NULL);
+   amdgpu_bo_free_kernel(>stolen_vga_memory, NULL, _vga_buf);
  }
  
  /**

diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c 
b/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c
index f77138b..ab43ae2 100644
--- a/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c
@@ -1248,6 +1248,7 @@ static int gmc_v9_0_sw_init(void *handle)
  static int gmc_v9_0_sw_fini(void *handle)
  {
struct amdgpu_device *adev = (struct amdgpu_device *)handle;
+   void *stolen_vga_buf;
  
  	if (amdgpu_ras_is_supported(adev, AMDGPU_RAS_BLOCK__UMC) &&

adev->gmc.umc_ras_if) {
@@ -1280,7 +1281,7 @@ static int gmc_v9_0_sw_fini(void *handle)
amdgpu_vm_manager_fini(adev);
  
  	if (gmc_v9_0_keep_stolen_memory(adev))

-   amdgpu_bo_free_kernel(>stolen_vga_memory, NULL, NULL);
+   amdgpu_bo_free_kernel(>stolen_vga_memory, NULL, 
_vga_buf);
  
  	amdgpu_gart_table_vram_free(adev);

amdgpu_bo_fini(adev);


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

[PATCH 2/2] drm/amdgpu: keep the stolen memory in visible vram region

2019-08-28 Thread Tianci Yin
From: "Tianci.Yin" 

stolen memory should be fixed in visible region.

Change-Id: Icbbbd39fd113e93423aad8d2555f4073c08020e5
Signed-off-by: Tianci.Yin 
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 6 --
 drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c   | 3 ++-
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
index 801f912..dcd32d0 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
@@ -1733,6 +1733,7 @@ int amdgpu_ttm_init(struct amdgpu_device *adev)
uint64_t gtt_size;
int r;
u64 vis_vram_limit;
+   void *stolen_vga_buf;
 
mutex_init(>mman.gtt_window_lock);
 
@@ -1787,7 +1788,7 @@ int amdgpu_ttm_init(struct amdgpu_device *adev)
r = amdgpu_bo_create_kernel(adev, adev->gmc.stolen_size, PAGE_SIZE,
AMDGPU_GEM_DOMAIN_VRAM,
>stolen_vga_memory,
-   NULL, NULL);
+   NULL, _vga_buf);
if (r)
return r;
DRM_INFO("amdgpu: %uM of VRAM memory ready\n",
@@ -1851,8 +1852,9 @@ int amdgpu_ttm_init(struct amdgpu_device *adev)
  */
 void amdgpu_ttm_late_init(struct amdgpu_device *adev)
 {
+   void *stolen_vga_buf;
/* return the VGA stolen memory (if any) back to VRAM */
-   amdgpu_bo_free_kernel(>stolen_vga_memory, NULL, NULL);
+   amdgpu_bo_free_kernel(>stolen_vga_memory, NULL, _vga_buf);
 }
 
 /**
diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c 
b/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c
index f77138b..ab43ae2 100644
--- a/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c
@@ -1248,6 +1248,7 @@ static int gmc_v9_0_sw_init(void *handle)
 static int gmc_v9_0_sw_fini(void *handle)
 {
struct amdgpu_device *adev = (struct amdgpu_device *)handle;
+   void *stolen_vga_buf;
 
if (amdgpu_ras_is_supported(adev, AMDGPU_RAS_BLOCK__UMC) &&
adev->gmc.umc_ras_if) {
@@ -1280,7 +1281,7 @@ static int gmc_v9_0_sw_fini(void *handle)
amdgpu_vm_manager_fini(adev);
 
if (gmc_v9_0_keep_stolen_memory(adev))
-   amdgpu_bo_free_kernel(>stolen_vga_memory, NULL, NULL);
+   amdgpu_bo_free_kernel(>stolen_vga_memory, NULL, 
_vga_buf);
 
amdgpu_gart_table_vram_free(adev);
amdgpu_bo_fini(adev);
-- 
2.7.4

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

[PATCH 2/2] drm/amdgpu: keep the stolen memory in visible vram region

2019-08-28 Thread Tianci Yin
From: "Tianci.Yin" 

stolen memory should be fixed in visible region.

Change-Id: Icbbbd39fd113e93423aad8d2555f4073c08020e5
Signed-off-by: Tianci.Yin 
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 6 --
 drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c   | 3 ++-
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
index 801f912..dcd32d0 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
@@ -1733,6 +1733,7 @@ int amdgpu_ttm_init(struct amdgpu_device *adev)
uint64_t gtt_size;
int r;
u64 vis_vram_limit;
+   void *stolen_vga_buf;
 
mutex_init(>mman.gtt_window_lock);
 
@@ -1787,7 +1788,7 @@ int amdgpu_ttm_init(struct amdgpu_device *adev)
r = amdgpu_bo_create_kernel(adev, adev->gmc.stolen_size, PAGE_SIZE,
AMDGPU_GEM_DOMAIN_VRAM,
>stolen_vga_memory,
-   NULL, NULL);
+   NULL, _vga_buf);
if (r)
return r;
DRM_INFO("amdgpu: %uM of VRAM memory ready\n",
@@ -1851,8 +1852,9 @@ int amdgpu_ttm_init(struct amdgpu_device *adev)
  */
 void amdgpu_ttm_late_init(struct amdgpu_device *adev)
 {
+   void *stolen_vga_buf;
/* return the VGA stolen memory (if any) back to VRAM */
-   amdgpu_bo_free_kernel(>stolen_vga_memory, NULL, NULL);
+   amdgpu_bo_free_kernel(>stolen_vga_memory, NULL, _vga_buf);
 }
 
 /**
diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c 
b/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c
index f77138b..ab43ae2 100644
--- a/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c
@@ -1248,6 +1248,7 @@ static int gmc_v9_0_sw_init(void *handle)
 static int gmc_v9_0_sw_fini(void *handle)
 {
struct amdgpu_device *adev = (struct amdgpu_device *)handle;
+   void *stolen_vga_buf;
 
if (amdgpu_ras_is_supported(adev, AMDGPU_RAS_BLOCK__UMC) &&
adev->gmc.umc_ras_if) {
@@ -1280,7 +1281,7 @@ static int gmc_v9_0_sw_fini(void *handle)
amdgpu_vm_manager_fini(adev);
 
if (gmc_v9_0_keep_stolen_memory(adev))
-   amdgpu_bo_free_kernel(>stolen_vga_memory, NULL, NULL);
+   amdgpu_bo_free_kernel(>stolen_vga_memory, NULL, 
_vga_buf);
 
amdgpu_gart_table_vram_free(adev);
amdgpu_bo_fini(adev);
-- 
2.7.4

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

[PATCH 2/2] drm/amdgpu: keep the stolen memory in visible vram region

2019-08-28 Thread Tianci Yin
From: "Tianci.Yin" 

stolen memory should be fixed in visible region.

Change-Id: Icbbbd39fd113e93423aad8d2555f4073c08020e5
Signed-off-by: Tianci.Yin 
---
 drivers/gpu/drm/amd/amdgpu/amdgpu.h | 1 +
 drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 4 ++--
 drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c   | 2 +-
 3 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h 
b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
index 11e0fc0..d1a8f87 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
@@ -817,6 +817,7 @@ struct amdgpu_device {
uint8_t *bios;
uint32_tbios_size;
struct amdgpu_bo*stolen_vga_memory;
+   void*stolen_vga_buf;
uint32_tbios_scratch_reg_offset;
uint32_tbios_scratch[AMDGPU_BIOS_NUM_SCRATCH];
 
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
index 801f912..5ac9a66 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
@@ -1787,7 +1787,7 @@ int amdgpu_ttm_init(struct amdgpu_device *adev)
r = amdgpu_bo_create_kernel(adev, adev->gmc.stolen_size, PAGE_SIZE,
AMDGPU_GEM_DOMAIN_VRAM,
>stolen_vga_memory,
-   NULL, NULL);
+   NULL, >stolen_vga_buf);
if (r)
return r;
DRM_INFO("amdgpu: %uM of VRAM memory ready\n",
@@ -1852,7 +1852,7 @@ int amdgpu_ttm_init(struct amdgpu_device *adev)
 void amdgpu_ttm_late_init(struct amdgpu_device *adev)
 {
/* return the VGA stolen memory (if any) back to VRAM */
-   amdgpu_bo_free_kernel(>stolen_vga_memory, NULL, NULL);
+   amdgpu_bo_free_kernel(>stolen_vga_memory, NULL, 
>stolen_vga_buf);
 }
 
 /**
diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c 
b/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c
index f77138b..602d7c7 100644
--- a/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c
@@ -1280,7 +1280,7 @@ static int gmc_v9_0_sw_fini(void *handle)
amdgpu_vm_manager_fini(adev);
 
if (gmc_v9_0_keep_stolen_memory(adev))
-   amdgpu_bo_free_kernel(>stolen_vga_memory, NULL, NULL);
+   amdgpu_bo_free_kernel(>stolen_vga_memory, NULL, 
>stolen_vga_buf);
 
amdgpu_gart_table_vram_free(adev);
amdgpu_bo_fini(adev);
-- 
2.7.4

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