Skip to contentSkip to conversation

drm/amdgpu/gmc9: rework stolen vga memory handling

PATCH In review Alex Deucher 3 participants 8 messages Aug 30, 2018 – Sep 2, 2018 3 messages not in the archive

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/4 drm/amdgpu/gmc9: rework stolen vga memory handling

No functional change, just rework it in order to adjust the behavior on a per asic level. The problem is that on vega10, something corrupts the lower 8 MB of vram on the second resume from S3. This does not seem to affect Raven, other gmc9 based asics need testing.

---
 drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c | 48 +++++++++++++++++++++--------------
 1 file changed, 29 insertions(+), 19 deletions(-)
drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c +29 -19
index 04d50893a6f2..46cff7d8b375 100644
@@ -692,6 +692,28 @@ static int gmc_v9_0_ecc_available(struct amdgpu_device *adev)
 	return lost_sheep == 0;
 }
 
+static bool gmc_v9_0_keep_stolen_memory(struct amdgpu_device *adev)
+{
+
+	/*
+	 * TODO:
+	 * Currently there is a bug where some memory client outside
+	 * of the driver writes to first 8M of VRAM on S3 resume,
+	 * this overrides GART which by default gets placed in first 8M and
+	 * causes VM_FAULTS once GTT is accessed.
+	 * Keep the stolen memory reservation until the while this is not solved.
+	 * Also check code in gmc_v9_0_get_vbios_fb_size and gmc_v9_0_late_init
+	 */
+	switch (adev->asic_type) {
+	case CHIP_RAVEN:
+	case CHIP_VEGA10:
+	case CHIP_VEGA12:
+	case CHIP_VEGA20:
+	default:
+		return true;
+	}
+}
+
 static int gmc_v9_0_late_init(void *handle)
 {
 	struct amdgpu_device *adev = (struct amdgpu_device *)handle;
@@ -708,10 +730,8 @@ static int gmc_v9_0_late_init(void *handle)
 	unsigned i;
 	int r;
 
-	/*
-	 * TODO - Uncomment once GART corruption issue is fixed.
-	 */
-	/* amdgpu_bo_late_init(adev); */
+	if (!gmc_v9_0_keep_stolen_memory(adev))
+		amdgpu_bo_late_init(adev);
 
 	for(i = 0; i < adev->num_rings; ++i) {
 		struct amdgpu_ring *ring = adev->rings[i];
@@ -848,18 +868,16 @@ static int gmc_v9_0_gart_init(struct amdgpu_device *adev)
 
 static unsigned gmc_v9_0_get_vbios_fb_size(struct amdgpu_device *adev)
 {
-#if 0
 	u32 d1vga_control = RREG32_SOC15(DCE, 0, mmD1VGA_CONTROL);
-#endif
 	unsigned size;
 
 	/*
 	 * TODO Remove once GART corruption is resolved
 	 * Check related code in gmc_v9_0_sw_fini
 	 * */
-	size = 9 * 1024 * 1024;
+	if (gmc_v9_0_keep_stolen_memory(adev))
+		return 9 * 1024 * 1024;
 
-#if 0
 	if (REG_GET_FIELD(d1vga_control, D1VGA_CONTROL, D1VGA_MODE_ENABLE)) {
 		size = 9 * 1024 * 1024; /* reserve 8MB for vga emulator and 1 MB for FB */
 	} else {
@@ -876,6 +894,7 @@ static unsigned gmc_v9_0_get_vbios_fb_size(struct amdgpu_device *adev)
 			break;
 		case CHIP_VEGA10:
 		case CHIP_VEGA12:
+		case CHIP_VEGA20:
 		default:
 			viewport = RREG32_SOC15(DCE, 0, mmSCL0_VIEWPORT_SIZE);
 			size = (REG_GET_FIELD(viewport, SCL0_VIEWPORT_SIZE, VIEWPORT_HEIGHT) *
@@ -888,7 +907,6 @@ static unsigned gmc_v9_0_get_vbios_fb_size(struct amdgpu_device *adev)
 	if ((adev->gmc.real_vram_size - size) < (8 * 1024 * 1024))
 		return 0;
 
-#endif
 	return size;
 }
 
@@ -1000,16 +1018,8 @@ static int gmc_v9_0_sw_fini(void *handle)
 	amdgpu_gem_force_release(adev);
 	amdgpu_vm_manager_fini(adev);
 
-	/*
-	* TODO:
-	* Currently there is a bug where some memory client outside
-	* of the driver writes to first 8M of VRAM on S3 resume,
-	* this overrides GART which by default gets placed in first 8M and
-	* causes VM_FAULTS once GTT is accessed.
-	* Keep the stolen memory reservation until the while this is not solved.
-	* Also check code in gmc_v9_0_get_vbios_fb_size and gmc_v9_0_late_init
-	*/
-	amdgpu_bo_free_kernel(&adev->stolen_vga_memory, NULL, NULL);
+	if (gmc_v9_0_keep_stolen_memory(adev))
+		amdgpu_bo_free_kernel(&adev->stolen_vga_memory, NULL, NULL);
 
 	amdgpu_gart_table_vram_free(adev);
 	amdgpu_bo_fini(adev);
Signature · 6 lines
2.13.6

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
#2 lore raw

PATCH 2/4 drm/amdgpu/gmc9: don't keep stolen memory on Raven

In reply to a message not in the archive

Raven does not appear to be affected by the same issue as vega10. Enable the full stolen memory handling on Raven. Reserve the appropriate size at init time to avoid display artifacts and then free it at the end of init once the new FB is up and running.

---
 drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c | 1 +
 1 file changed, 1 insertion(+)
drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c +1 -0
index 46cff7d8b375..938d03593713 100644
@@ -706,6 +706,7 @@ static bool gmc_v9_0_keep_stolen_memory(struct amdgpu_device *adev)
 	 */
 	switch (adev->asic_type) {
 	case CHIP_RAVEN:
+		return false;
 	case CHIP_VEGA10:
 	case CHIP_VEGA12:
 	case CHIP_VEGA20:
Signature · 6 lines
2.13.6

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
#5 lore raw

PATCH 3/4 drm/amdgpu/gmc9: don't keep stolen memory on vega12

In reply to a message not in the archive

vega12 does not appear to be affected by the same issue as vega10. Enable the full stolen memory handling on vega12. Reserve the appropriate size at init time to avoid display artifacts and then free it at the end of init once the new FB is up and running.

---

Can someone test this on Vega12? I don't have one.

 drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c +2 -1
index 938d03593713..3180113f49ae 100644
@@ -707,8 +707,9 @@ static bool gmc_v9_0_keep_stolen_memory(struct amdgpu_device *adev)
 	switch (adev->asic_type) {
 	case CHIP_RAVEN:
 		return false;
-	case CHIP_VEGA10:
 	case CHIP_VEGA12:
+		return false;
+	case CHIP_VEGA10:
 	case CHIP_VEGA20:
 	default:
 		return true;
Signature · 6 lines
2.13.6

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
#6 lore raw

PATCH 4/4 drm/amdgpu/gmc9: don't keep stolen memory on vega20

In reply to a message not in the archive

Vega20 does not appear to be affected by the same issue as vega10. Enable the full stolen memory handling on vega20. Reserve the appropriate size at init time to avoid display artifacts and then free it at the end of init once the new FB is up and running.

---

Can someone test this on Vega20? I don't have one.

 drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c +3 -4
index 3180113f49ae..f467638eb49d 100644
@@ -705,14 +705,13 @@ static bool gmc_v9_0_keep_stolen_memory(struct amdgpu_device *adev)
 	 * Also check code in gmc_v9_0_get_vbios_fb_size and gmc_v9_0_late_init
 	 */
 	switch (adev->asic_type) {
+	case CHIP_VEGA10:
+		return true;
 	case CHIP_RAVEN:
-		return false;
 	case CHIP_VEGA12:
-		return false;
-	case CHIP_VEGA10:
 	case CHIP_VEGA20:
 	default:
-		return true;
+		return false;
 	}
 }
 
Signature · 6 lines
2.13.6

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Reviewed-by Junwei Zhang
#7 lore raw
In reply to a message not in the archive
Quoted 7 lines · Alex Deucher

No functional change, just rework it in order to adjust the behavior on a per asic level. The problem is that on vega10, something corrupts the lower 8 MB of vram on the second resume from S3. This does not seem to affect Raven, other gmc9 based asics need testing.

Quoted 97 lines
---
  drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c | 48 +++++++++++++++++++++--------------
  1 file changed, 29 insertions(+), 19 deletions(-)
drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c +27 -14
index 04d50893a6f2..46cff7d8b375 100644
@@ -692,6 +692,28 @@ static int gmc_v9_0_ecc_available(struct amdgpu_device *adev)
  	return lost_sheep == 0;
  }
 
+static bool gmc_v9_0_keep_stolen_memory(struct amdgpu_device *adev)
+{
+
+	/*
+	 * TODO:
+	 * Currently there is a bug where some memory client outside
+	 * of the driver writes to first 8M of VRAM on S3 resume,
+	 * this overrides GART which by default gets placed in first 8M and
+	 * causes VM_FAULTS once GTT is accessed.
+	 * Keep the stolen memory reservation until the while this is not solved.
+	 * Also check code in gmc_v9_0_get_vbios_fb_size and gmc_v9_0_late_init
+	 */
+	switch (adev->asic_type) {
+	case CHIP_RAVEN:
+	case CHIP_VEGA10:
+	case CHIP_VEGA12:
+	case CHIP_VEGA20:
+	default:
+		return true;
+	}
+}
+
  static int gmc_v9_0_late_init(void *handle)
  {
  	struct amdgpu_device *adev = (struct amdgpu_device *)handle;
@@ -708,10 +730,8 @@ static int gmc_v9_0_late_init(void *handle)
  	unsigned i;
  	int r;
 
-	/*
-	 * TODO - Uncomment once GART corruption issue is fixed.
-	 */
-	/* amdgpu_bo_late_init(adev); */
+	if (!gmc_v9_0_keep_stolen_memory(adev))
+		amdgpu_bo_late_init(adev);
 
  	for(i = 0; i < adev->num_rings; ++i) {
  		struct amdgpu_ring *ring = adev->rings[i];
@@ -848,18 +868,16 @@ static int gmc_v9_0_gart_init(struct amdgpu_device *adev)
 
  static unsigned gmc_v9_0_get_vbios_fb_size(struct amdgpu_device *adev)
  {
-#if 0
  	u32 d1vga_control = RREG32_SOC15(DCE, 0, mmD1VGA_CONTROL);
-#endif
  	unsigned size;
 
  	/*
  	 * TODO Remove once GART corruption is resolved
  	 * Check related code in gmc_v9_0_sw_fini
  	 * */
-	size = 9 * 1024 * 1024;
+	if (gmc_v9_0_keep_stolen_memory(adev))
+		return 9 * 1024 * 1024;
 
-#if 0
  	if (REG_GET_FIELD(d1vga_control, D1VGA_CONTROL, D1VGA_MODE_ENABLE)) {
  		size = 9 * 1024 * 1024; /* reserve 8MB for vga emulator and 1 MB for FB */
  	} else {
@@ -876,6 +894,7 @@ static unsigned gmc_v9_0_get_vbios_fb_size(struct amdgpu_device *adev)
  			break;
  		case CHIP_VEGA10:
  		case CHIP_VEGA12:
+		case CHIP_VEGA20:
  		default:
  			viewport = RREG32_SOC15(DCE, 0, mmSCL0_VIEWPORT_SIZE);
  			size = (REG_GET_FIELD(viewport, SCL0_VIEWPORT_SIZE, VIEWPORT_HEIGHT) *
@@ -888,7 +907,6 @@ static unsigned gmc_v9_0_get_vbios_fb_size(struct amdgpu_device *adev)
  	if ((adev->gmc.real_vram_size - size) < (8 * 1024 * 1024))
  		return 0;
 
-#endif
  	return size;
  }
 
@@ -1000,16 +1018,8 @@ static int gmc_v9_0_sw_fini(void *handle)
  	amdgpu_gem_force_release(adev);
  	amdgpu_vm_manager_fini(adev);
 
-	/*
-	* TODO:
-	* Currently there is a bug where some memory client outside
-	* of the driver writes to first 8M of VRAM on S3 resume,
-	* this overrides GART which by default gets placed in first 8M and

drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c static int gmc_v9_0_sw_fini(void *handle) · line 1025

Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c +2 -5
-	* causes VM_FAULTS once GTT is accessed.
-	* Keep the stolen memory reservation until the while this is not solved.
-	* Also check code in gmc_v9_0_get_vbios_fb_size and gmc_v9_0_late_init
-	*/
-	amdgpu_bo_free_kernel(&adev->stolen_vga_memory, NULL, NULL);
+	if (gmc_v9_0_keep_stolen_memory(adev))
+		amdgpu_bo_free_kernel(&adev->stolen_vga_memory, NULL, NULL);
 
  	amdgpu_gart_table_vram_free(adev);
  	amdgpu_bo_fini(adev);

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

Reviewed-by Junwei Zhang
#4 lore raw

Re: [PATCH 2/4] drm/amdgpu/gmc9: don't keep stolen memory on Raven

In reply to a message not in the archive
Quoted 8 lines · Alex Deucher

Raven does not appear to be affected by the same issue as vega10. Enable the full stolen memory handling on Raven. Reserve the appropriate size at init time to avoid display artifacts and then free it at the end of init once the new FB is up and running.

Quoted 10 lines
---
  drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c | 1 +
  1 file changed, 1 insertion(+)
drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c +0 -0
index 46cff7d8b375..938d03593713 100644

drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c static bool gmc_v9_0_keep_stolen_memory(struct amdgpu_device *adev) · line 712

Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c +1 -0
@@ -706,6 +706,7 @@ static bool gmc_v9_0_keep_stolen_memory(struct amdgpu_device *adev)
  	 */
  	switch (adev->asic_type) {
  	case CHIP_RAVEN:
+		return false;
  	case CHIP_VEGA10:
  	case CHIP_VEGA12:
  	case CHIP_VEGA20:

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

#8 lore raw
In reply to a message not in the archive

Am 30.08.2018 um 16:53 schrieb Alex Deucher:

Quoted 4 lines

No functional change, just rework it in order to adjust the behavior on a per asic level. The problem is that on vega10, something corrupts the lower 8 MB of vram on the second resume from S3.

Is that tested with engineering samples or production level hardware? Maybe it is just a leftover from BIOS bringup?

Quoted 4 lines

This does not seem to affect Raven, other
gmc9 based asics need testing.

Quoted 96 lines
---
  drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c | 48 +++++++++++++++++++++--------------
  1 file changed, 29 insertions(+), 19 deletions(-)
drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c +27 -14
index 04d50893a6f2..46cff7d8b375 100644
@@ -692,6 +692,28 @@ static int gmc_v9_0_ecc_available(struct amdgpu_device *adev)
  	return lost_sheep == 0;
  }
 
+static bool gmc_v9_0_keep_stolen_memory(struct amdgpu_device *adev)
+{
+
+	/*
+	 * TODO:
+	 * Currently there is a bug where some memory client outside
+	 * of the driver writes to first 8M of VRAM on S3 resume,
+	 * this overrides GART which by default gets placed in first 8M and
+	 * causes VM_FAULTS once GTT is accessed.
+	 * Keep the stolen memory reservation until the while this is not solved.
+	 * Also check code in gmc_v9_0_get_vbios_fb_size and gmc_v9_0_late_init
+	 */
+	switch (adev->asic_type) {
+	case CHIP_RAVEN:
+	case CHIP_VEGA10:
+	case CHIP_VEGA12:
+	case CHIP_VEGA20:
+	default:
+		return true;
+	}
+}
+
  static int gmc_v9_0_late_init(void *handle)
  {
  	struct amdgpu_device *adev = (struct amdgpu_device *)handle;
@@ -708,10 +730,8 @@ static int gmc_v9_0_late_init(void *handle)
  	unsigned i;
  	int r;
 
-	/*
-	 * TODO - Uncomment once GART corruption issue is fixed.
-	 */
-	/* amdgpu_bo_late_init(adev); */
+	if (!gmc_v9_0_keep_stolen_memory(adev))
+		amdgpu_bo_late_init(adev);
 
  	for(i = 0; i < adev->num_rings; ++i) {
  		struct amdgpu_ring *ring = adev->rings[i];
@@ -848,18 +868,16 @@ static int gmc_v9_0_gart_init(struct amdgpu_device *adev)
 
  static unsigned gmc_v9_0_get_vbios_fb_size(struct amdgpu_device *adev)
  {
-#if 0
  	u32 d1vga_control = RREG32_SOC15(DCE, 0, mmD1VGA_CONTROL);
-#endif
  	unsigned size;
 
  	/*
  	 * TODO Remove once GART corruption is resolved
  	 * Check related code in gmc_v9_0_sw_fini
  	 * */
-	size = 9 * 1024 * 1024;
+	if (gmc_v9_0_keep_stolen_memory(adev))
+		return 9 * 1024 * 1024;
 
-#if 0
  	if (REG_GET_FIELD(d1vga_control, D1VGA_CONTROL, D1VGA_MODE_ENABLE)) {
  		size = 9 * 1024 * 1024; /* reserve 8MB for vga emulator and 1 MB for FB */
  	} else {
@@ -876,6 +894,7 @@ static unsigned gmc_v9_0_get_vbios_fb_size(struct amdgpu_device *adev)
  			break;
  		case CHIP_VEGA10:
  		case CHIP_VEGA12:
+		case CHIP_VEGA20:
  		default:
  			viewport = RREG32_SOC15(DCE, 0, mmSCL0_VIEWPORT_SIZE);
  			size = (REG_GET_FIELD(viewport, SCL0_VIEWPORT_SIZE, VIEWPORT_HEIGHT) *
@@ -888,7 +907,6 @@ static unsigned gmc_v9_0_get_vbios_fb_size(struct amdgpu_device *adev)
  	if ((adev->gmc.real_vram_size - size) < (8 * 1024 * 1024))
  		return 0;
 
-#endif
  	return size;
  }
 
@@ -1000,16 +1018,8 @@ static int gmc_v9_0_sw_fini(void *handle)
  	amdgpu_gem_force_release(adev);
  	amdgpu_vm_manager_fini(adev);
 
-	/*
-	* TODO:
-	* Currently there is a bug where some memory client outside
-	* of the driver writes to first 8M of VRAM on S3 resume,
-	* this overrides GART which by default gets placed in first 8M and

drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c static int gmc_v9_0_sw_fini(void *handle) · line 1025

Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c +2 -5
-	* causes VM_FAULTS once GTT is accessed.
-	* Keep the stolen memory reservation until the while this is not solved.
-	* Also check code in gmc_v9_0_get_vbios_fb_size and gmc_v9_0_late_init
-	*/
-	amdgpu_bo_free_kernel(&adev->stolen_vga_memory, NULL, NULL);
+	if (gmc_v9_0_keep_stolen_memory(adev))
+		amdgpu_bo_free_kernel(&adev->stolen_vga_memory, NULL, NULL);
 
  	amdgpu_gart_table_vram_free(adev);
  	amdgpu_bo_fini(adev);

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

#10 lore raw
In reply to a message not in the archive
Quoted 9 lines · Christian König

Am 30.08.2018 um 16:53 schrieb Alex Deucher:

Quoted 4 lines

No functional change, just rework it in order to adjust the behavior on a per asic level. The problem is that on vega10, something corrupts the lower 8 MB of vram on the second resume from S3.

Is that tested with engineering samples or production level hardware? Maybe it is just a leftover from BIOS bringup?

It happens reliably across a bunch of internal boards. Not sure if anyone has tried with OEM boards.

Alex

Quoted 112 lines
Quoted 5 lines

This does not seem to affect Raven, other
gmc9 based asics need testing.

Quoted 104 lines
---
  drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c | 48 +++++++++++++++++++++--------------
  1 file changed, 29 insertions(+), 19 deletions(-)
drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c +29 -19
index 04d50893a6f2..46cff7d8b375 100644
@@ -692,6 +692,28 @@ static int gmc_v9_0_ecc_available(struct amdgpu_device *adev)
      return lost_sheep == 0;
  }
 
+static bool gmc_v9_0_keep_stolen_memory(struct amdgpu_device *adev)
+{
+
+     /*
+      * TODO:
+      * Currently there is a bug where some memory client outside
+      * of the driver writes to first 8M of VRAM on S3 resume,
+      * this overrides GART which by default gets placed in first 8M and
+      * causes VM_FAULTS once GTT is accessed.
+      * Keep the stolen memory reservation until the while this is not solved.
+      * Also check code in gmc_v9_0_get_vbios_fb_size and gmc_v9_0_late_init
+      */
+     switch (adev->asic_type) {
+     case CHIP_RAVEN:
+     case CHIP_VEGA10:
+     case CHIP_VEGA12:
+     case CHIP_VEGA20:
+     default:
+             return true;
+     }
+}
+
  static int gmc_v9_0_late_init(void *handle)
  {
      struct amdgpu_device *adev = (struct amdgpu_device *)handle;
@@ -708,10 +730,8 @@ static int gmc_v9_0_late_init(void *handle)
      unsigned i;
      int r;
 
-     /*
-      * TODO - Uncomment once GART corruption issue is fixed.
-      */
-     /* amdgpu_bo_late_init(adev); */
+     if (!gmc_v9_0_keep_stolen_memory(adev))
+             amdgpu_bo_late_init(adev);
 
      for(i = 0; i < adev->num_rings; ++i) {
              struct amdgpu_ring *ring = adev->rings[i];
@@ -848,18 +868,16 @@ static int gmc_v9_0_gart_init(struct amdgpu_device *adev)
 
  static unsigned gmc_v9_0_get_vbios_fb_size(struct amdgpu_device *adev)
  {
-#if 0
      u32 d1vga_control = RREG32_SOC15(DCE, 0, mmD1VGA_CONTROL);
-#endif
      unsigned size;
 
      /*
       * TODO Remove once GART corruption is resolved
       * Check related code in gmc_v9_0_sw_fini
       * */
-     size = 9 * 1024 * 1024;
+     if (gmc_v9_0_keep_stolen_memory(adev))
+             return 9 * 1024 * 1024;
 
-#if 0
      if (REG_GET_FIELD(d1vga_control, D1VGA_CONTROL, D1VGA_MODE_ENABLE)) {
              size = 9 * 1024 * 1024; /* reserve 8MB for vga emulator and 1 MB for FB */
      } else {
@@ -876,6 +894,7 @@ static unsigned gmc_v9_0_get_vbios_fb_size(struct amdgpu_device *adev)
                      break;
              case CHIP_VEGA10:
              case CHIP_VEGA12:
+             case CHIP_VEGA20:
              default:
                      viewport = RREG32_SOC15(DCE, 0, mmSCL0_VIEWPORT_SIZE);
                      size = (REG_GET_FIELD(viewport, SCL0_VIEWPORT_SIZE, VIEWPORT_HEIGHT) *
@@ -888,7 +907,6 @@ static unsigned gmc_v9_0_get_vbios_fb_size(struct amdgpu_device *adev)
      if ((adev->gmc.real_vram_size - size) < (8 * 1024 * 1024))
              return 0;
 
-#endif
      return size;
  }
 
@@ -1000,16 +1018,8 @@ static int gmc_v9_0_sw_fini(void *handle)
      amdgpu_gem_force_release(adev);
      amdgpu_vm_manager_fini(adev);
 
-     /*
-     * TODO:
-     * Currently there is a bug where some memory client outside
-     * of the driver writes to first 8M of VRAM on S3 resume,
-     * this overrides GART which by default gets placed in first 8M and
-     * causes VM_FAULTS once GTT is accessed.
-     * Keep the stolen memory reservation until the while this is not solved.
-     * Also check code in gmc_v9_0_get_vbios_fb_size and gmc_v9_0_late_init
-     */
-     amdgpu_bo_free_kernel(&adev->stolen_vga_memory, NULL, NULL);
+     if (gmc_v9_0_keep_stolen_memory(adev))
+             amdgpu_bo_free_kernel(&adev->stolen_vga_memory, NULL, NULL);
 
Quoted 3 lines

drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c static int gmc_v9_0_sw_fini(void *handle) · line 1025

Quoted 2 lines
drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c +0 -0
      amdgpu_gart_table_vram_free(adev);
      amdgpu_bo_fini(adev);

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx