All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] drm/amdgpu/gmc: always steal the first 32MB of vram for fw hand-over
@ 2018-04-05 18:26 Andrey Grodzovsky
       [not found] ` <1522952800-32300-1-git-send-email-andrey.grodzovsky-5C7GfCeVMHo@public.gmane.org>
  0 siblings, 1 reply; 13+ messages in thread
From: Andrey Grodzovsky @ 2018-04-05 18:26 UTC (permalink / raw)
  To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW
  Cc: Alex Deucher, Andrey Grodzovsky, ramin.ranjbar-5C7GfCeVMHo

From: Alex Deucher <alexander.deucher@amd.com>

The vbios uses memory from the start of vram for the pre-OS
framebuffer. Reserve this at driver load time to prevent
the driver from using it for other things which may cause
atrifacts on screen before the console has kicked in.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Andrey Grodzovsky <andrey.grodzovsky@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c | 2 +-
 drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c | 2 +-
 drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c | 2 +-
 drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c | 2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c b/drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c
index 5617cf6..056a41c 100644
--- a/drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c
@@ -851,7 +851,7 @@ static int gmc_v6_0_sw_init(void *handle)
 
 	adev->gmc.mc_mask = 0xffffffffffULL;
 
-	adev->gmc.stolen_size = 256 * 1024;
+	adev->gmc.stolen_size = 32 * 1024 * 1024;
 
 	adev->need_dma32 = false;
 	dma_bits = adev->need_dma32 ? 32 : 40;
diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c b/drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c
index 80054f3..cf1b0f8 100644
--- a/drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c
@@ -998,7 +998,7 @@ static int gmc_v7_0_sw_init(void *handle)
 	 */
 	adev->gmc.mc_mask = 0xffffffffffULL; /* 40 bit MC */
 
-	adev->gmc.stolen_size = 256 * 1024;
+	adev->gmc.stolen_size = 32 * 1024 * 1024;
 
 	/* set DMA mask + need_dma32 flags.
 	 * PCIE - can handle 40-bits.
diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c b/drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c
index d71d4cb..c8c5ca2 100644
--- a/drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c
@@ -1096,7 +1096,7 @@ static int gmc_v8_0_sw_init(void *handle)
 	 */
 	adev->gmc.mc_mask = 0xffffffffffULL; /* 40 bit MC */
 
-	adev->gmc.stolen_size = 256 * 1024;
+	adev->gmc.stolen_size = 32 * 1024 * 1024;
 
 	/* set DMA mask + need_dma32 flags.
 	 * PCIE - can handle 40-bits.
diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c b/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c
index 070946e..e55d32d 100644
--- a/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c
@@ -848,7 +848,7 @@ static int gmc_v9_0_sw_init(void *handle)
 	 * It needs to reserve 8M stolen memory for vega10
 	 * TODO: Figure out how to avoid that...
 	 */
-	adev->gmc.stolen_size = 8 * 1024 * 1024;
+	adev->gmc.stolen_size = 32 * 1024 * 1024;
 
 	/* set DMA mask + need_dma32 flags.
 	 * PCIE - can handle 44-bits.
-- 
2.7.4

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

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH 2/2] drm/amdgpu: Free VGA stolen memory as soon as possible.
       [not found] ` <1522952800-32300-1-git-send-email-andrey.grodzovsky-5C7GfCeVMHo@public.gmane.org>
@ 2018-04-05 18:26   ` Andrey Grodzovsky
  2018-04-05 19:27   ` [PATCH 1/2] drm/amdgpu/gmc: always steal the first 32MB of vram for fw hand-over Alex Deucher
  1 sibling, 0 replies; 13+ messages in thread
From: Andrey Grodzovsky @ 2018-04-05 18:26 UTC (permalink / raw)
  To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW
  Cc: Alexander.Deucher-5C7GfCeVMHo, Andrey Grodzovsky,
	ramin.ranjbar-5C7GfCeVMHo

Reserved VRAM is used to avoid overriding pre OS FB.
Once our display stack takes over we don't need the reserved
VRAM anymore.

Signed-off-by: Andrey Grodzovsky <andrey.grodzovsky@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 5 +++++
 drivers/gpu/drm/amd/amdgpu/amdgpu_object.h | 1 +
 drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c    | 6 +++++-
 drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h    | 1 +
 drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c      | 2 ++
 drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c      | 2 ++
 drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c      | 2 ++
 drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c      | 2 ++
 8 files changed, 20 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
index 5abf95a..08f87ae 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
@@ -848,6 +848,11 @@ int amdgpu_bo_init(struct amdgpu_device *adev)
 	return amdgpu_ttm_init(adev);
 }
 
+int amdgpu_bo_late_init(struct amdgpu_device *adev)
+{
+	amdgpu_ttm_late_init(adev);
+}
+
 void amdgpu_bo_fini(struct amdgpu_device *adev)
 {
 	amdgpu_ttm_fini(adev);
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.h
index deb10ec..dfa25a3 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.h
@@ -228,6 +228,7 @@ int amdgpu_bo_pin_restricted(struct amdgpu_bo *bo, u32 domain,
 int amdgpu_bo_unpin(struct amdgpu_bo *bo);
 int amdgpu_bo_evict_vram(struct amdgpu_device *adev);
 int amdgpu_bo_init(struct amdgpu_device *adev);
+int amdgpu_bo_late_init(struct amdgpu_device *adev);
 void amdgpu_bo_fini(struct amdgpu_device *adev);
 int amdgpu_bo_fbdev_mmap(struct amdgpu_bo *bo,
 				struct vm_area_struct *vma);
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
index d2ab404..3ab825f 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
@@ -1503,13 +1503,17 @@ int amdgpu_ttm_init(struct amdgpu_device *adev)
 	return 0;
 }
 
+int amdgpu_ttm_late_init(struct amdgpu_device *adev)
+{
+	amdgpu_bo_free_kernel(&adev->stolen_vga_memory, NULL, NULL);
+}
+
 void amdgpu_ttm_fini(struct amdgpu_device *adev)
 {
 	if (!adev->mman.initialized)
 		return;
 
 	amdgpu_ttm_debugfs_fini(adev);
-	amdgpu_bo_free_kernel(&adev->stolen_vga_memory, NULL, NULL);
 	amdgpu_ttm_fw_reserve_vram_fini(adev);
 	if (adev->mman.aper_base_kaddr)
 		iounmap(adev->mman.aper_base_kaddr);
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h
index 6ea7de8..e8b0ff6 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h
@@ -77,6 +77,7 @@ uint64_t amdgpu_vram_mgr_usage(struct ttm_mem_type_manager *man);
 uint64_t amdgpu_vram_mgr_vis_usage(struct ttm_mem_type_manager *man);
 
 int amdgpu_ttm_init(struct amdgpu_device *adev);
+int amdgpu_ttm_late_init(struct amdgpu_device *adev);
 void amdgpu_ttm_fini(struct amdgpu_device *adev);
 void amdgpu_ttm_set_buffer_funcs_status(struct amdgpu_device *adev,
 					bool enable);
diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c b/drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c
index 056a41c..105b368 100644
--- a/drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c
@@ -819,6 +819,8 @@ static int gmc_v6_0_late_init(void *handle)
 {
 	struct amdgpu_device *adev = (struct amdgpu_device *)handle;
 
+	amdgpu_bo_late_init(adev);
+
 	if (amdgpu_vm_fault_stop != AMDGPU_VM_FAULT_STOP_ALWAYS)
 		return amdgpu_irq_get(adev, &adev->gmc.vm_fault, 0);
 	else
diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c b/drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c
index cf1b0f8..acc6d5c 100644
--- a/drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c
@@ -958,6 +958,8 @@ static int gmc_v7_0_late_init(void *handle)
 {
 	struct amdgpu_device *adev = (struct amdgpu_device *)handle;
 
+	amdgpu_bo_late_init(adev);
+
 	if (amdgpu_vm_fault_stop != AMDGPU_VM_FAULT_STOP_ALWAYS)
 		return amdgpu_irq_get(adev, &adev->gmc.vm_fault, 0);
 	else
diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c b/drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c
index c8c5ca2..a48d15e 100644
--- a/drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c
@@ -1049,6 +1049,8 @@ static int gmc_v8_0_late_init(void *handle)
 {
 	struct amdgpu_device *adev = (struct amdgpu_device *)handle;
 
+	amdgpu_bo_late_init(adev);
+
 	if (amdgpu_vm_fault_stop != AMDGPU_VM_FAULT_STOP_ALWAYS)
 		return amdgpu_irq_get(adev, &adev->gmc.vm_fault, 0);
 	else
diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c b/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c
index e55d32d..b3c1712 100644
--- a/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c
@@ -659,6 +659,8 @@ static int gmc_v9_0_late_init(void *handle)
 	unsigned i;
 	int r;
 
+	amdgpu_bo_late_init(adev);
+
 	for(i = 0; i < adev->num_rings; ++i) {
 		struct amdgpu_ring *ring = adev->rings[i];
 		unsigned vmhub = ring->funcs->vmhub;
-- 
2.7.4

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

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* Re: [PATCH 1/2] drm/amdgpu/gmc: always steal the first 32MB of vram for fw hand-over
       [not found] ` <1522952800-32300-1-git-send-email-andrey.grodzovsky-5C7GfCeVMHo@public.gmane.org>
  2018-04-05 18:26   ` [PATCH 2/2] drm/amdgpu: Free VGA stolen memory as soon as possible Andrey Grodzovsky
@ 2018-04-05 19:27   ` Alex Deucher
       [not found]     ` <CADnq5_MFUWDCDtcVXcnF27DAuE3L5kC9EqKFeCPs4V1AM5gL0A-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  1 sibling, 1 reply; 13+ messages in thread
From: Alex Deucher @ 2018-04-05 19:27 UTC (permalink / raw)
  To: Andrey Grodzovsky; +Cc: Alex Deucher, Ranjbar, Ramin, amd-gfx list

On Thu, Apr 5, 2018 at 2:26 PM, Andrey Grodzovsky
<andrey.grodzovsky@amd.com> wrote:
> From: Alex Deucher <alexander.deucher@amd.com>
>
> The vbios uses memory from the start of vram for the pre-OS
> framebuffer. Reserve this at driver load time to prevent
> the driver from using it for other things which may cause
> atrifacts on screen before the console has kicked in.
>
> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
> Signed-off-by: Andrey Grodzovsky <andrey.grodzovsky@amd.com>
> ---
>  drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c | 2 +-
>  drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c | 2 +-
>  drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c | 2 +-
>  drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c | 2 +-
>  4 files changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c b/drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c
> index 5617cf6..056a41c 100644
> --- a/drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c
> @@ -851,7 +851,7 @@ static int gmc_v6_0_sw_init(void *handle)
>
>         adev->gmc.mc_mask = 0xffffffffffULL;
>
> -       adev->gmc.stolen_size = 256 * 1024;
> +       adev->gmc.stolen_size = 32 * 1024 * 1024;

Maybe move this to a define so we don't have to update all those
places if we have to update this in the future.  Or maybe just call a
helper function if we need more logic for this (see below).

>
>         adev->need_dma32 = false;
>         dma_bits = adev->need_dma32 ? 32 : 40;
> diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c b/drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c
> index 80054f3..cf1b0f8 100644
> --- a/drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c
> @@ -998,7 +998,7 @@ static int gmc_v7_0_sw_init(void *handle)
>          */
>         adev->gmc.mc_mask = 0xffffffffffULL; /* 40 bit MC */
>
> -       adev->gmc.stolen_size = 256 * 1024;
> +       adev->gmc.stolen_size = 32 * 1024 * 1024;
>
>         /* set DMA mask + need_dma32 flags.
>          * PCIE - can handle 40-bits.
> diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c b/drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c
> index d71d4cb..c8c5ca2 100644
> --- a/drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c
> @@ -1096,7 +1096,7 @@ static int gmc_v8_0_sw_init(void *handle)
>          */
>         adev->gmc.mc_mask = 0xffffffffffULL; /* 40 bit MC */
>
> -       adev->gmc.stolen_size = 256 * 1024;
> +       adev->gmc.stolen_size = 32 * 1024 * 1024;

For platforms that might have limited carve out (ST, CZ, RV), we may
want to do something like:
if (adev->gmc.real_vram_size <= 32MB) // 128MB?
    stolen_size = 256K;

>
>         /* set DMA mask + need_dma32 flags.
>          * PCIE - can handle 40-bits.
> diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c b/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c
> index 070946e..e55d32d 100644
> --- a/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c
> @@ -848,7 +848,7 @@ static int gmc_v9_0_sw_init(void *handle)
>          * It needs to reserve 8M stolen memory for vega10
>          * TODO: Figure out how to avoid that...
>          */

The comment above here can be removed in your second patch.

> -       adev->gmc.stolen_size = 8 * 1024 * 1024;
> +       adev->gmc.stolen_size = 32 * 1024 * 1024;
>
>         /* set DMA mask + need_dma32 flags.
>          * PCIE - can handle 44-bits.
> --
> 2.7.4
>
> _______________________________________________
> amd-gfx mailing list
> amd-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [PATCH v2 1/2] drm/amdgpu/gmc: always steal the first 32MB of vram for fw hand-over
       [not found]     ` <CADnq5_MFUWDCDtcVXcnF27DAuE3L5kC9EqKFeCPs4V1AM5gL0A-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2018-04-05 20:41       ` Andrey Grodzovsky
       [not found]         ` <1522960916-15653-1-git-send-email-andrey.grodzovsky-5C7GfCeVMHo@public.gmane.org>
  2018-04-06  7:50       ` [PATCH 1/2] drm/amdgpu/gmc: always steal the first 32MB of vram for fw hand-over Michel Dänzer
  1 sibling, 1 reply; 13+ messages in thread
From: Andrey Grodzovsky @ 2018-04-05 20:41 UTC (permalink / raw)
  To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW
  Cc: Alex Deucher, Andrey Grodzovsky, ramin.ranjbar-5C7GfCeVMHo

From: Alex Deucher <alexander.deucher@amd.com>

The vbios uses memory from the start of vram for the pre-OS
framebuffer. Reserve this at driver load time to prevent
the driver from using it for other things which may cause
atrifacts on screen before the console has kicked in.

v2:
Add common helper function to decide on amount of stolen VRAM.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Andrey Grodzovsky <andrey.grodzovsky@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.h | 9 +++++++++
 drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c   | 2 +-
 drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c   | 2 +-
 drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c   | 2 +-
 drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c   | 2 +-
 5 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.h
index 893c249..c5a3dd2 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.h
@@ -109,4 +109,13 @@ struct amdgpu_gmc {
 	const struct amdgpu_gmc_funcs	*gmc_funcs;
 };
 
+static inline uint64_t gmc_stolen_mem_size(struct amdgpu_gmc *gmc)
+{
+	/* Some systems might have very little VRAM */
+	if(gmc->real_vram_size <= 64 * 1024 * 1024)
+		return  256 * 1024;
+	else
+		return 32 * 1024 * 1024;
+}
+
 #endif
diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c b/drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c
index 5617cf6..378ef65 100644
--- a/drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c
@@ -851,7 +851,7 @@ static int gmc_v6_0_sw_init(void *handle)
 
 	adev->gmc.mc_mask = 0xffffffffffULL;
 
-	adev->gmc.stolen_size = 256 * 1024;
+	adev->gmc.stolen_size = gmc_stolen_mem_size(&adev->gmc);
 
 	adev->need_dma32 = false;
 	dma_bits = adev->need_dma32 ? 32 : 40;
diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c b/drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c
index 80054f3..2cb1b13 100644
--- a/drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c
@@ -998,7 +998,7 @@ static int gmc_v7_0_sw_init(void *handle)
 	 */
 	adev->gmc.mc_mask = 0xffffffffffULL; /* 40 bit MC */
 
-	adev->gmc.stolen_size = 256 * 1024;
+	adev->gmc.stolen_size = gmc_stolen_mem_size(&adev->gmc);
 
 	/* set DMA mask + need_dma32 flags.
 	 * PCIE - can handle 40-bits.
diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c b/drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c
index d71d4cb..979f73e 100644
--- a/drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c
@@ -1096,7 +1096,7 @@ static int gmc_v8_0_sw_init(void *handle)
 	 */
 	adev->gmc.mc_mask = 0xffffffffffULL; /* 40 bit MC */
 
-	adev->gmc.stolen_size = 256 * 1024;
+	adev->gmc.stolen_size = gmc_stolen_mem_size(&adev->gmc);
 
 	/* set DMA mask + need_dma32 flags.
 	 * PCIE - can handle 40-bits.
diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c b/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c
index 070946e..f7c2d61 100644
--- a/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c
@@ -848,7 +848,7 @@ static int gmc_v9_0_sw_init(void *handle)
 	 * It needs to reserve 8M stolen memory for vega10
 	 * TODO: Figure out how to avoid that...
 	 */
-	adev->gmc.stolen_size = 8 * 1024 * 1024;
+	adev->gmc.stolen_size = gmc_stolen_mem_size(&adev->gmc);
 
 	/* set DMA mask + need_dma32 flags.
 	 * PCIE - can handle 44-bits.
-- 
2.7.4

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

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH v2 2/2] drm/amdgpu: Free VGA stolen memory as soon as possible.
       [not found]         ` <1522960916-15653-1-git-send-email-andrey.grodzovsky-5C7GfCeVMHo@public.gmane.org>
@ 2018-04-05 20:41           ` Andrey Grodzovsky
  0 siblings, 0 replies; 13+ messages in thread
From: Andrey Grodzovsky @ 2018-04-05 20:41 UTC (permalink / raw)
  To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW
  Cc: Alexander.Deucher-5C7GfCeVMHo, Andrey Grodzovsky,
	ramin.ranjbar-5C7GfCeVMHo

Reserved VRAM is used to avoid overriding pre OS FB.
Once our display stack takes over we don't need the reserved
VRAM anymore.

v2:
Remove comment, we know actually why we need to reserve the stolen VRAM.
Fix return type for amdgpu_ttm_late_init.

Signed-off-by: Andrey Grodzovsky <andrey.grodzovsky@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 5 +++++
 drivers/gpu/drm/amd/amdgpu/amdgpu_object.h | 1 +
 drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c    | 6 +++++-
 drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h    | 1 +
 drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c      | 2 ++
 drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c      | 2 ++
 drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c      | 2 ++
 drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c      | 6 ++----
 8 files changed, 20 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
index 5abf95a..08f87ae 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
@@ -848,6 +848,11 @@ int amdgpu_bo_init(struct amdgpu_device *adev)
 	return amdgpu_ttm_init(adev);
 }
 
+int amdgpu_bo_late_init(struct amdgpu_device *adev)
+{
+	amdgpu_ttm_late_init(adev);
+}
+
 void amdgpu_bo_fini(struct amdgpu_device *adev)
 {
 	amdgpu_ttm_fini(adev);
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.h
index deb10ec..dfa25a3 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.h
@@ -228,6 +228,7 @@ int amdgpu_bo_pin_restricted(struct amdgpu_bo *bo, u32 domain,
 int amdgpu_bo_unpin(struct amdgpu_bo *bo);
 int amdgpu_bo_evict_vram(struct amdgpu_device *adev);
 int amdgpu_bo_init(struct amdgpu_device *adev);
+int amdgpu_bo_late_init(struct amdgpu_device *adev);
 void amdgpu_bo_fini(struct amdgpu_device *adev);
 int amdgpu_bo_fbdev_mmap(struct amdgpu_bo *bo,
 				struct vm_area_struct *vma);
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
index d2ab404..e1328f3 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
@@ -1503,13 +1503,17 @@ int amdgpu_ttm_init(struct amdgpu_device *adev)
 	return 0;
 }
 
+void amdgpu_ttm_late_init(struct amdgpu_device *adev)
+{
+	amdgpu_bo_free_kernel(&adev->stolen_vga_memory, NULL, NULL);
+}
+
 void amdgpu_ttm_fini(struct amdgpu_device *adev)
 {
 	if (!adev->mman.initialized)
 		return;
 
 	amdgpu_ttm_debugfs_fini(adev);
-	amdgpu_bo_free_kernel(&adev->stolen_vga_memory, NULL, NULL);
 	amdgpu_ttm_fw_reserve_vram_fini(adev);
 	if (adev->mman.aper_base_kaddr)
 		iounmap(adev->mman.aper_base_kaddr);
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h
index 6ea7de8..e969c87 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h
@@ -77,6 +77,7 @@ uint64_t amdgpu_vram_mgr_usage(struct ttm_mem_type_manager *man);
 uint64_t amdgpu_vram_mgr_vis_usage(struct ttm_mem_type_manager *man);
 
 int amdgpu_ttm_init(struct amdgpu_device *adev);
+void amdgpu_ttm_late_init(struct amdgpu_device *adev);
 void amdgpu_ttm_fini(struct amdgpu_device *adev);
 void amdgpu_ttm_set_buffer_funcs_status(struct amdgpu_device *adev,
 					bool enable);
diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c b/drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c
index 378ef65..27c9c64 100644
--- a/drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c
@@ -819,6 +819,8 @@ static int gmc_v6_0_late_init(void *handle)
 {
 	struct amdgpu_device *adev = (struct amdgpu_device *)handle;
 
+	amdgpu_bo_late_init(adev);
+
 	if (amdgpu_vm_fault_stop != AMDGPU_VM_FAULT_STOP_ALWAYS)
 		return amdgpu_irq_get(adev, &adev->gmc.vm_fault, 0);
 	else
diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c b/drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c
index 2cb1b13..12f99f2 100644
--- a/drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c
@@ -958,6 +958,8 @@ static int gmc_v7_0_late_init(void *handle)
 {
 	struct amdgpu_device *adev = (struct amdgpu_device *)handle;
 
+	amdgpu_bo_late_init(adev);
+
 	if (amdgpu_vm_fault_stop != AMDGPU_VM_FAULT_STOP_ALWAYS)
 		return amdgpu_irq_get(adev, &adev->gmc.vm_fault, 0);
 	else
diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c b/drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c
index 979f73e..4e0de31 100644
--- a/drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c
@@ -1049,6 +1049,8 @@ static int gmc_v8_0_late_init(void *handle)
 {
 	struct amdgpu_device *adev = (struct amdgpu_device *)handle;
 
+	amdgpu_bo_late_init(adev);
+
 	if (amdgpu_vm_fault_stop != AMDGPU_VM_FAULT_STOP_ALWAYS)
 		return amdgpu_irq_get(adev, &adev->gmc.vm_fault, 0);
 	else
diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c b/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c
index f7c2d61..596a4bd 100644
--- a/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c
@@ -659,6 +659,8 @@ static int gmc_v9_0_late_init(void *handle)
 	unsigned i;
 	int r;
 
+	amdgpu_bo_late_init(adev);
+
 	for(i = 0; i < adev->num_rings; ++i) {
 		struct amdgpu_ring *ring = adev->rings[i];
 		unsigned vmhub = ring->funcs->vmhub;
@@ -844,10 +846,6 @@ static int gmc_v9_0_sw_init(void *handle)
 	 */
 	adev->gmc.mc_mask = 0xffffffffffffULL; /* 48 bit MC */
 
-	/*
-	 * It needs to reserve 8M stolen memory for vega10
-	 * TODO: Figure out how to avoid that...
-	 */
 	adev->gmc.stolen_size = gmc_stolen_mem_size(&adev->gmc);
 
 	/* set DMA mask + need_dma32 flags.
-- 
2.7.4

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

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* Re: [PATCH 1/2] drm/amdgpu/gmc: always steal the first 32MB of vram for fw hand-over
       [not found]     ` <CADnq5_MFUWDCDtcVXcnF27DAuE3L5kC9EqKFeCPs4V1AM5gL0A-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  2018-04-05 20:41       ` [PATCH v2 " Andrey Grodzovsky
@ 2018-04-06  7:50       ` Michel Dänzer
       [not found]         ` <87cc962a-8a35-36d6-6b48-85c156e68f04-otUistvHUpPR7s880joybQ@public.gmane.org>
  1 sibling, 1 reply; 13+ messages in thread
From: Michel Dänzer @ 2018-04-06  7:50 UTC (permalink / raw)
  To: Alex Deucher, Andrey Grodzovsky
  Cc: Alex Deucher, Ranjbar, Ramin, amd-gfx list

On 2018-04-05 09:27 PM, Alex Deucher wrote:
> On Thu, Apr 5, 2018 at 2:26 PM, Andrey Grodzovsky
> <andrey.grodzovsky@amd.com> wrote:
>> From: Alex Deucher <alexander.deucher@amd.com>
>>
>> The vbios uses memory from the start of vram for the pre-OS
>> framebuffer. Reserve this at driver load time to prevent
>> the driver from using it for other things which may cause
>> atrifacts on screen before the console has kicked in.
>>
>> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
>> Signed-off-by: Andrey Grodzovsky <andrey.grodzovsky@amd.com>

[...]

>> diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c b/drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c
>> index d71d4cb..c8c5ca2 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c
>> @@ -1096,7 +1096,7 @@ static int gmc_v8_0_sw_init(void *handle)
>>          */
>>         adev->gmc.mc_mask = 0xffffffffffULL; /* 40 bit MC */
>>
>> -       adev->gmc.stolen_size = 256 * 1024;
>> +       adev->gmc.stolen_size = 32 * 1024 * 1024;
> 
> For platforms that might have limited carve out (ST, CZ, RV), we may
> want to do something like:
> if (adev->gmc.real_vram_size <= 32MB) // 128MB?
>     stolen_size = 256K;

That means artifacts are likely to still occur during initialization on
systems where we only reserve 256K, right?


I wonder if there's no way to determine which part of VRAM is being
scanned out. If there was, we could just create a normal BO covering
that, which would get destroyed once no CRTC references it anymore.


-- 
Earthling Michel Dänzer               |               http://www.amd.com
Libre software enthusiast             |             Mesa and X developer
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 1/2] drm/amdgpu/gmc: always steal the first 32MB of vram for fw hand-over
       [not found]         ` <87cc962a-8a35-36d6-6b48-85c156e68f04-otUistvHUpPR7s880joybQ@public.gmane.org>
@ 2018-04-06  8:30           ` Christian König
       [not found]             ` <1c6e6260-10cf-f189-45b3-74fd2d1c991c-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
  0 siblings, 1 reply; 13+ messages in thread
From: Christian König @ 2018-04-06  8:30 UTC (permalink / raw)
  To: Michel Dänzer, Alex Deucher, Andrey Grodzovsky
  Cc: Alex Deucher, Ranjbar, Ramin, amd-gfx list

Am 06.04.2018 um 09:50 schrieb Michel Dänzer:
> On 2018-04-05 09:27 PM, Alex Deucher wrote:
>> On Thu, Apr 5, 2018 at 2:26 PM, Andrey Grodzovsky
>> <andrey.grodzovsky@amd.com> wrote:
>>> From: Alex Deucher <alexander.deucher@amd.com>
>>>
>>> The vbios uses memory from the start of vram for the pre-OS
>>> framebuffer. Reserve this at driver load time to prevent
>>> the driver from using it for other things which may cause
>>> atrifacts on screen before the console has kicked in.
>>>
>>> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
>>> Signed-off-by: Andrey Grodzovsky <andrey.grodzovsky@amd.com>
> [...]
>
>>> diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c b/drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c
>>> index d71d4cb..c8c5ca2 100644
>>> --- a/drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c
>>> +++ b/drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c
>>> @@ -1096,7 +1096,7 @@ static int gmc_v8_0_sw_init(void *handle)
>>>           */
>>>          adev->gmc.mc_mask = 0xffffffffffULL; /* 40 bit MC */
>>>
>>> -       adev->gmc.stolen_size = 256 * 1024;
>>> +       adev->gmc.stolen_size = 32 * 1024 * 1024;
>> For platforms that might have limited carve out (ST, CZ, RV), we may
>> want to do something like:
>> if (adev->gmc.real_vram_size <= 32MB) // 128MB?
>>      stolen_size = 256K;
> That means artifacts are likely to still occur during initialization on
> systems where we only reserve 256K, right?
>
>
> I wonder if there's no way to determine which part of VRAM is being
> scanned out. If there was, we could just create a normal BO covering
> that, which would get destroyed once no CRTC references it anymore.

Unfortunately it goes further than that. The stolen VRAM is needed for 
VGA emulation, not only for scanout.

But yes I agree that we somehow figure that value out from the BIOS. If 
I'm not completely mistaken I've also seen some atombios table with that 
info in some discussion.

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

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 1/2] drm/amdgpu/gmc: always steal the first 32MB of vram for fw hand-over
       [not found]             ` <1c6e6260-10cf-f189-45b3-74fd2d1c991c-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
@ 2018-04-06 11:23               ` Andrey Grodzovsky
       [not found]                 ` <40be8e12-8f2e-449f-d09e-aa46aa396f4c-5C7GfCeVMHo@public.gmane.org>
  0 siblings, 1 reply; 13+ messages in thread
From: Andrey Grodzovsky @ 2018-04-06 11:23 UTC (permalink / raw)
  To: christian.koenig-5C7GfCeVMHo, Michel Dänzer, Alex Deucher
  Cc: Alex Deucher, Ranjbar, Ramin, amd-gfx list


[-- Attachment #1.1: Type: text/plain, Size: 746 bytes --]

Me and Alex talked to a BIOS guys yesterday exactly about that, a 
dynamic way to query this info from BIOS, he just told us to reserve 32M 
to cover 4K display.

Andrey


On 04/06/2018 04:30 AM, Christian König wrote:
>> I wonder if there's no way to determine which part of VRAM is being
>> scanned out. If there was, we could just create a normal BO covering
>> that, which would get destroyed once no CRTC references it anymore.
>
> Unfortunately it goes further than that. The stolen VRAM is needed for 
> VGA emulation, not only for scanout.
>
> But yes I agree that we somehow figure that value out from the BIOS. 
> If I'm not completely mistaken I've also seen some atombios table with 
> that info in some discussion.
>
> Christian. 


[-- Attachment #1.2: Type: text/html, Size: 1367 bytes --]

[-- Attachment #2: Type: text/plain, Size: 154 bytes --]

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

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 1/2] drm/amdgpu/gmc: always steal the first 32MB of vram for fw hand-over
       [not found]                 ` <40be8e12-8f2e-449f-d09e-aa46aa396f4c-5C7GfCeVMHo@public.gmane.org>
@ 2018-04-06 12:26                   ` Christian König
       [not found]                     ` <e201782f-0d93-0259-a425-0c0d8cf99ea4-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
  0 siblings, 1 reply; 13+ messages in thread
From: Christian König @ 2018-04-06 12:26 UTC (permalink / raw)
  To: Andrey Grodzovsky, christian.koenig-5C7GfCeVMHo,
	Michel Dänzer, Alex Deucher
  Cc: Alex Deucher, Ranjbar, Ramin, amd-gfx list


[-- Attachment #1.1: Type: text/plain, Size: 1183 bytes --]

I feared that you would say that :(

In this case the patches are Acked-by: Christian König 
<christian.koenig-5C7GfCeVMHo@public.gmane.org>.

Thanks,
Christian.

Am 06.04.2018 um 13:23 schrieb Andrey Grodzovsky:
>
> Me and Alex talked to a BIOS guys yesterday exactly about that, a 
> dynamic way to query this info from BIOS, he just told us to reserve 
> 32M to cover 4K display.
>
> Andrey
>
>
> On 04/06/2018 04:30 AM, Christian König wrote:
>>> I wonder if there's no way to determine which part of VRAM is being
>>> scanned out. If there was, we could just create a normal BO covering
>>> that, which would get destroyed once no CRTC references it anymore.
>>
>> Unfortunately it goes further than that. The stolen VRAM is needed 
>> for VGA emulation, not only for scanout.
>>
>> But yes I agree that we somehow figure that value out from the BIOS. 
>> If I'm not completely mistaken I've also seen some atombios table 
>> with that info in some discussion.
>>
>> Christian. 
>
>
>
> _______________________________________________
> amd-gfx mailing list
> amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx


[-- Attachment #1.2: Type: text/html, Size: 2534 bytes --]

[-- Attachment #2: Type: text/plain, Size: 154 bytes --]

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

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 1/2] drm/amdgpu/gmc: always steal the first 32MB of vram for fw hand-over
       [not found]                     ` <e201782f-0d93-0259-a425-0c0d8cf99ea4-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
@ 2018-04-06 12:39                       ` Andrey Grodzovsky
       [not found]                         ` <cabf944a-934a-f9c4-1e99-20a4e314442e-5C7GfCeVMHo@public.gmane.org>
  0 siblings, 1 reply; 13+ messages in thread
From: Andrey Grodzovsky @ 2018-04-06 12:39 UTC (permalink / raw)
  To: christian.koenig-5C7GfCeVMHo, Michel Dänzer, Alex Deucher
  Cc: Alex Deucher, Ranjbar, Ramin, amd-gfx list


[-- Attachment #1.1: Type: text/plain, Size: 1438 bytes --]

At least the second patch somehow addresses the memory waste concern, 
the reservation will be very transient, during late init the BO will get 
freed.

Andrey


On 04/06/2018 08:26 AM, Christian König wrote:
> I feared that you would say that :(
>
> In this case the patches are Acked-by: Christian König 
> <christian.koenig-5C7GfCeVMHo@public.gmane.org>.
>
> Thanks,
> Christian.
>
> Am 06.04.2018 um 13:23 schrieb Andrey Grodzovsky:
>>
>> Me and Alex talked to a BIOS guys yesterday exactly about that, a 
>> dynamic way to query this info from BIOS, he just told us to reserve 
>> 32M to cover 4K display.
>>
>> Andrey
>>
>>
>> On 04/06/2018 04:30 AM, Christian König wrote:
>>>> I wonder if there's no way to determine which part of VRAM is being
>>>> scanned out. If there was, we could just create a normal BO covering
>>>> that, which would get destroyed once no CRTC references it anymore.
>>>
>>> Unfortunately it goes further than that. The stolen VRAM is needed 
>>> for VGA emulation, not only for scanout.
>>>
>>> But yes I agree that we somehow figure that value out from the BIOS. 
>>> If I'm not completely mistaken I've also seen some atombios table 
>>> with that info in some discussion.
>>>
>>> Christian. 
>>
>>
>>
>> _______________________________________________
>> amd-gfx mailing list
>> amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org
>> https://lists.freedesktop.org/mailman/listinfo/amd-gfx
>


[-- Attachment #1.2: Type: text/html, Size: 3168 bytes --]

[-- Attachment #2: Type: text/plain, Size: 154 bytes --]

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

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 1/2] drm/amdgpu/gmc: always steal the first 32MB of vram for fw hand-over
       [not found]                         ` <cabf944a-934a-f9c4-1e99-20a4e314442e-5C7GfCeVMHo@public.gmane.org>
@ 2018-04-06 13:34                           ` Michel Dänzer
       [not found]                             ` <e38ac7a6-5c7d-8704-b7a9-6cb544eeaf05-otUistvHUpPR7s880joybQ@public.gmane.org>
  0 siblings, 1 reply; 13+ messages in thread
From: Michel Dänzer @ 2018-04-06 13:34 UTC (permalink / raw)
  To: Andrey Grodzovsky, christian.koenig-5C7GfCeVMHo, Alex Deucher
  Cc: Alex Deucher, Ranjbar, Ramin, amd-gfx list

On 2018-04-06 02:39 PM, Andrey Grodzovsky wrote:
>> Am 06.04.2018 um 13:23 schrieb Andrey Grodzovsky:
>>>
>>> Me and Alex talked to a BIOS guys yesterday exactly about that, a
>>> dynamic way to query this info from BIOS, he just told us to reserve
>>> 32M to cover 4K display.

How about reading DCE registers?


> At least the second patch somehow addresses the memory waste concern,
> the reservation will be very transient, during late init the BO will get
> freed.
Sure, I don't think anybody's concerned about that. My concerns are:

* In the cases where we still only reserve 256K, there will likely still
  be artifacts during driver initialization.

* 32M might still not be enough in some cases, e.g. 5K / 8K displays.


P.S. Please don't top-post.

-- 
Earthling Michel Dänzer               |               http://www.amd.com
Libre software enthusiast             |             Mesa and X developer
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 1/2] drm/amdgpu/gmc: always steal the first 32MB of vram for fw hand-over
       [not found]                             ` <e38ac7a6-5c7d-8704-b7a9-6cb544eeaf05-otUistvHUpPR7s880joybQ@public.gmane.org>
@ 2018-04-06 13:44                               ` Andrey Grodzovsky
       [not found]                                 ` <4f97770f-0977-01ad-1b10-6c0e91b4919d-5C7GfCeVMHo@public.gmane.org>
  0 siblings, 1 reply; 13+ messages in thread
From: Andrey Grodzovsky @ 2018-04-06 13:44 UTC (permalink / raw)
  To: Michel Dänzer, christian.koenig-5C7GfCeVMHo, Alex Deucher
  Cc: Alex Deucher, Ranjbar, Ramin, amd-gfx list



On 04/06/2018 09:34 AM, Michel Dänzer wrote:
> On 2018-04-06 02:39 PM, Andrey Grodzovsky wrote:
>>> Am 06.04.2018 um 13:23 schrieb Andrey Grodzovsky:
>>>> Me and Alex talked to a BIOS guys yesterday exactly about that, a
>>>> dynamic way to query this info from BIOS, he just told us to reserve
>>>> 32M to cover 4K display.
> How about reading DCE registers?

I can try and consult with DAL on this.

>
>
>> At least the second patch somehow addresses the memory waste concern,
>> the reservation will be very transient, during late init the BO will get
>> freed.
> Sure, I don't think anybody's concerned about that. My concerns are:
>
> * In the cases where we still only reserve 256K, there will likely still
>    be artifacts during driver initialization.
>
> * 32M might still not be enough in some cases, e.g. 5K / 8K displays.

I see your point, as I said above, will again try to find out if there 
is still a way to know the BIOS FB size.

Andrey

>
>
> P.S. Please don't top-post.
>

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

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 1/2] drm/amdgpu/gmc: always steal the first 32MB of vram for fw hand-over
       [not found]                                 ` <4f97770f-0977-01ad-1b10-6c0e91b4919d-5C7GfCeVMHo@public.gmane.org>
@ 2018-04-06 15:50                                   ` Harry Wentland
  0 siblings, 0 replies; 13+ messages in thread
From: Harry Wentland @ 2018-04-06 15:50 UTC (permalink / raw)
  To: Andrey Grodzovsky, Michel Dänzer,
	christian.koenig-5C7GfCeVMHo, Alex Deucher
  Cc: Alex Deucher, Ranjbar, Ramin, amd-gfx list

On 2018-04-06 09:44 AM, Andrey Grodzovsky wrote:
> 
> 
> On 04/06/2018 09:34 AM, Michel Dänzer wrote:
>> On 2018-04-06 02:39 PM, Andrey Grodzovsky wrote:
>>>> Am 06.04.2018 um 13:23 schrieb Andrey Grodzovsky:
>>>>> Me and Alex talked to a BIOS guys yesterday exactly about that, a
>>>>> dynamic way to query this info from BIOS, he just told us to reserve
>>>>> 32M to cover 4K display.
>> How about reading DCE registers?
> 
> I can try and consult with DAL on this.
> 

Apparently we can read VBIOS allocations from VRAM_UsageByFirmware. Andrey is going to take a look at it. Carving out those allocations is probably better than using GRPH registers to guess VBIOS allocations.

Harry

>>
>>
>>> At least the second patch somehow addresses the memory waste concern,
>>> the reservation will be very transient, during late init the BO will get
>>> freed.
>> Sure, I don't think anybody's concerned about that. My concerns are:
>>
>> * In the cases where we still only reserve 256K, there will likely still
>>    be artifacts during driver initialization.
>>
>> * 32M might still not be enough in some cases, e.g. 5K / 8K displays
> 
> I see your point, as I said above, will again try to find out if there is still a way to know the BIOS FB size.
> 
> Andrey
> 
>>
>>
>> P.S. Please don't top-post.
>>
> 
> _______________________________________________
> amd-gfx mailing list
> amd-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2018-04-06 15:50 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-04-05 18:26 [PATCH 1/2] drm/amdgpu/gmc: always steal the first 32MB of vram for fw hand-over Andrey Grodzovsky
     [not found] ` <1522952800-32300-1-git-send-email-andrey.grodzovsky-5C7GfCeVMHo@public.gmane.org>
2018-04-05 18:26   ` [PATCH 2/2] drm/amdgpu: Free VGA stolen memory as soon as possible Andrey Grodzovsky
2018-04-05 19:27   ` [PATCH 1/2] drm/amdgpu/gmc: always steal the first 32MB of vram for fw hand-over Alex Deucher
     [not found]     ` <CADnq5_MFUWDCDtcVXcnF27DAuE3L5kC9EqKFeCPs4V1AM5gL0A-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2018-04-05 20:41       ` [PATCH v2 " Andrey Grodzovsky
     [not found]         ` <1522960916-15653-1-git-send-email-andrey.grodzovsky-5C7GfCeVMHo@public.gmane.org>
2018-04-05 20:41           ` [PATCH v2 2/2] drm/amdgpu: Free VGA stolen memory as soon as possible Andrey Grodzovsky
2018-04-06  7:50       ` [PATCH 1/2] drm/amdgpu/gmc: always steal the first 32MB of vram for fw hand-over Michel Dänzer
     [not found]         ` <87cc962a-8a35-36d6-6b48-85c156e68f04-otUistvHUpPR7s880joybQ@public.gmane.org>
2018-04-06  8:30           ` Christian König
     [not found]             ` <1c6e6260-10cf-f189-45b3-74fd2d1c991c-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2018-04-06 11:23               ` Andrey Grodzovsky
     [not found]                 ` <40be8e12-8f2e-449f-d09e-aa46aa396f4c-5C7GfCeVMHo@public.gmane.org>
2018-04-06 12:26                   ` Christian König
     [not found]                     ` <e201782f-0d93-0259-a425-0c0d8cf99ea4-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2018-04-06 12:39                       ` Andrey Grodzovsky
     [not found]                         ` <cabf944a-934a-f9c4-1e99-20a4e314442e-5C7GfCeVMHo@public.gmane.org>
2018-04-06 13:34                           ` Michel Dänzer
     [not found]                             ` <e38ac7a6-5c7d-8704-b7a9-6cb544eeaf05-otUistvHUpPR7s880joybQ@public.gmane.org>
2018-04-06 13:44                               ` Andrey Grodzovsky
     [not found]                                 ` <4f97770f-0977-01ad-1b10-6c0e91b4919d-5C7GfCeVMHo@public.gmane.org>
2018-04-06 15:50                                   ` Harry Wentland

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.