Skip to contentSkip to conversation

drm/amd/powerplay: fix suspend error on DPM disabled

PATCH In review Huang Rui 3 participants 6 messages Apr 10, 2017 – Apr 11, 2017 3 messages not in the archive

Subsystems (2)
lore
Share & tools
lore

Huang Rui

author
#0 lore raw

PATCH 1/3 drm/amd/powerplay: fix suspend error on DPM disabled

---
 drivers/gpu/drm/amd/powerplay/amd_powerplay.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/powerplay/amd_powerplay.c +3 -1
index 9da5b0b..f73e80c 100644
@@ -251,7 +251,9 @@ static int pp_suspend(void *handle)
 
 	ret = pp_check(pp_handle);
 
-	if (ret != 0)
+	if (ret == PP_DPM_DISABLED)
+		return 0;
+	else if (ret != 0)
 		return ret;
 
 	eventmgr = pp_handle->eventmgr;
Signature · 6 lines
2.7.4

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

A message that is not in the archive (sent off-list or not yet received): 1491817071-17014-1-git-send-email-ray.huang-5C7GfCeVMHo@public.gmane.org

author
#2 lore raw

PATCH 2/3 drm/amdgpu: do not free fence buf when driver probes.

Fence buf needs to be used on suspend/resume phase.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c +4 -2
index 68ccaed..19180aa 100644
@@ -358,8 +358,6 @@ static int psp_load_fw(struct amdgpu_device *adev)
 	if (ret)
 		goto failed_mem;
 
-	amdgpu_bo_free_kernel(&psp->fence_buf_bo,
-			      &psp->fence_buf_mc_addr, &psp->fence_buf);
 	kfree(cmd);
 
 	return 0;
@@ -423,6 +421,10 @@ static int psp_hw_fini(void *handle)
 		amdgpu_bo_free_kernel(&psp->fw_pri_bo,
 				      &psp->fw_pri_mc_addr, &psp->fw_pri_buf);
 
+	if (psp->fence_buf_bo)
+		amdgpu_bo_free_kernel(&psp->fence_buf_bo,
+				      &psp->fence_buf_mc_addr, &psp->fence_buf);
+
 	return 0;
 }
 
Signature · 6 lines
2.7.4

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

PATCH 3/3 drm/amdgpu: fix to clear ASIC INIT COMPLETE bit on resuming phase

In reply to a message not in the archive

ASIC_INIT_COMPLETE bit must be cleared during S3 resuming phase, because VBIOS will check the bit to decide if execute ASIC_Init posting via kernel driver.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_atombios.c     | 5 ++++-
 drivers/gpu/drm/amd/amdgpu/amdgpu_atomfirmware.c | 6 +++++-
 2 files changed, 9 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_atombios.c +4 -1
index ad43299..b0dd72a8 100644
@@ -1727,8 +1727,11 @@ void amdgpu_atombios_scratch_regs_restore(struct amdgpu_device *adev)
 {
 	int i;
 
-	for (i = 0; i < AMDGPU_BIOS_NUM_SCRATCH; i++)
+	for (i = 0; i < AMDGPU_BIOS_NUM_SCRATCH; i++) {
+		if (i == 7)
+			adev->bios_scratch[i] &= ~ATOM_S7_ASIC_INIT_COMPLETE_MASK;
 		WREG32(mmBIOS_SCRATCH_0 + i, adev->bios_scratch[i]);
+	}
 }
 
 void amdgpu_atombios_scratch_regs_engine_hung(struct amdgpu_device *adev,
drivers/gpu/drm/amd/amdgpu/amdgpu_atomfirmware.c +5 -1
index 4b9abd6..c7e28bf 100644
@@ -26,6 +26,7 @@
 #include "atomfirmware.h"
 #include "amdgpu_atomfirmware.h"
 #include "atom.h"
+#include "atombios.h"
 
 #define get_index_into_master_table(master_table, table_name) (offsetof(struct master_table, table_name) / sizeof(uint16_t))
 
@@ -77,8 +78,11 @@ void amdgpu_atomfirmware_scratch_regs_restore(struct amdgpu_device *adev)
 {
 	int i;
 
-	for (i = 0; i < AMDGPU_BIOS_NUM_SCRATCH; i++)
+	for (i = 0; i < AMDGPU_BIOS_NUM_SCRATCH; i++) {
+		if (i == 7)
+			adev->bios_scratch[i] &= ~ATOM_S7_ASIC_INIT_COMPLETE_MASK;
 		WREG32(adev->bios_scratch_reg_offset + i, adev->bios_scratch[i]);
+	}
 }
 
 int amdgpu_atomfirmware_allocate_fb_scratch(struct amdgpu_device *adev)
Signature · 6 lines
2.7.4

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

A message that is not in the archive (sent off-list or not yet received): 1491817071-17014-3-git-send-email-ray.huang-5C7GfCeVMHo@public.gmane.org

#5 lore raw

Re: [PATCH 3/3] drm/amdgpu: fix to clear ASIC INIT COMPLETE bit on resuming phase

Quoted 16 lines · Huang Rui

ASIC_INIT_COMPLETE bit must be cleared during S3 resuming phase, because VBIOS will check the bit to decide if execute ASIC_Init posting via kernel driver.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_atombios.c     | 5 ++++-
 drivers/gpu/drm/amd/amdgpu/amdgpu_atomfirmware.c | 6 +++++-
 2 files changed, 9 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_atombios.c +0 -0
index ad43299..b0dd72a8 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_atombios.c void amdgpu_atombios_scratch_regs_restore(struct · line 1735

Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_atombios.c +3 -1
@@ -1727,8 +1727,11 @@ void amdgpu_atombios_scratch_regs_restore(struct
 amdgpu_device *adev)
 {
        int i;
 
-       for (i = 0; i < AMDGPU_BIOS_NUM_SCRATCH; i++)
+       for (i = 0; i < AMDGPU_BIOS_NUM_SCRATCH; i++) {
+               if (i == 7)
+                       adev->bios_scratch[i] &=
 ~ATOM_S7_ASIC_INIT_COMPLETE_MASK;
 

Maybe move this line before the loop?
A comment may also be useful so that somebody doesn't delete the code again in future.

Gražvydas

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

A message that is not in the archive (sent off-list or not yet received): CANOLnOOcnUitqWAWjtTEa0U69pEj5mFMMJZSHrKz5S_TQEcoDA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org

author
#7 lore raw

Re: [PATCH 3/3] drm/amdgpu: fix to clear ASIC INIT COMPLETE bit on resuming phase

Quoted 29 lines · Grazvydas Ignotas

On Mon, Apr 10, 2017 at 12:37 PM, Huang Rui <[email protected]> wrote:

ASIC_INIT_COMPLETE bit must be cleared during S3 resuming phase, because VBIOS will check the bit to decide if execute ASIC_Init posting via kernel driver.

---
drivers/gpu/drm/amd/amdgpu/amdgpu_atombios.c | 5 ++++-
drivers/gpu/drm/amd/amdgpu/amdgpu_atomfirmware.c | 6 +++++- 2 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_atombios.c b/drivers/gpu/drm /amd/amdgpu/amdgpu_atombios.c
index ad43299..b0dd72a8 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_atombios.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_atombios.c
@@ -1727,8 +1727,11 @@ void amdgpu_atombios_scratch_regs_restore(struct amdgpu_device *adev)
{
int i;

- for (i = 0; i < AMDGPU_BIOS_NUM_SCRATCH; i++)
+ for (i = 0; i < AMDGPU_BIOS_NUM_SCRATCH; i++) {
+ if (i == 7)
+ adev->bios_scratch[i] &=
~ATOM_S7_ASIC_INIT_COMPLETE_MASK;

Quoted 4 lines

Maybe move this line before the loop?
A comment may also be useful so that somebody doesn't delete the code again in future.

OK. I'm fine to move it before this loop.

	/*
	 * VBIOS will check ASIC_INIT_COMPLETE bit to decide if
	 * execute ASIC_Init posting via driver
	 */
	adev->bios_scratch[7] &= ~ATOM_S7_ASIC_INIT_COMPLETE_MASK;

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

Reviewed-by Alex Deucher
#8 lore raw

RE: [PATCH 3/3] drm/amdgpu: fix to clear ASIC INIT COMPLETE bit on resuming phase

In reply to a message not in the archive
Quoted 9 lines

-----Original Message-----
From: amd-gfx [mailto:[email protected]] On Behalf Of Huang Rui
Sent: Monday, April 10, 2017 5:38 AM
To: [email protected]; Deucher, Alexander
Cc: Huang, Ray
Subject: [PATCH 3/3] drm/amdgpu: fix to clear ASIC INIT COMPLETE bit on resuming phase

Quoted 5 lines

ASIC_INIT_COMPLETE bit must be cleared during S3 resuming phase, because VBIOS will check the bit to decide if execute ASIC_Init posting via kernel driver.

Series is:

Quoted 61 lines
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_atombios.c     | 5 ++++-
 drivers/gpu/drm/amd/amdgpu/amdgpu_atomfirmware.c | 6 +++++-
 2 files changed, 9 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_atombios.c +4 -1
index ad43299..b0dd72a8 100644
@@ -1727,8 +1727,11 @@ void
 amdgpu_atombios_scratch_regs_restore(struct amdgpu_device *adev)
 {
 	int i;
 
-	for (i = 0; i < AMDGPU_BIOS_NUM_SCRATCH; i++)
+	for (i = 0; i < AMDGPU_BIOS_NUM_SCRATCH; i++) {
+		if (i == 7)
+			adev->bios_scratch[i] &=
 ~ATOM_S7_ASIC_INIT_COMPLETE_MASK;
 		WREG32(mmBIOS_SCRATCH_0 + i, adev->bios_scratch[i]);
+	}
 }

void amdgpu_atombios_scratch_regs_engine_hung(struct amdgpu_device
*adev,

drivers/gpu/drm/amd/amdgpu/amdgpu_atomfirmware.c +1 -0
index 4b9abd6..c7e28bf 100644
@@ -26,6 +26,7 @@
 #include "atomfirmware.h"
 #include "amdgpu_atomfirmware.h"
 #include "atom.h"
+#include "atombios.h"
 
 #define get_index_into_master_table(master_table, table_name)
 (offsetof(struct master_table, table_name) / sizeof(uint16_t))
@@ -77,8 +78,11 @@ void

amdgpu_atomfirmware_scratch_regs_restore(struct amdgpu_device *adev)
{

drivers/gpu/drm/amd/amdgpu/amdgpu_atomfirmware.c +3 -1
 	int i;
 
-	for (i = 0; i < AMDGPU_BIOS_NUM_SCRATCH; i++)
+	for (i = 0; i < AMDGPU_BIOS_NUM_SCRATCH; i++) {
+		if (i == 7)
+			adev->bios_scratch[i] &=

~ATOM_S7_ASIC_INIT_COMPLETE_MASK;
WREG32(adev->bios_scratch_reg_offset + i, adev-

Quoted 1 line

bios_scratch[i]);

drivers/gpu/drm/amd/amdgpu/amdgpu_atomfirmware.c +1 -0
+	}
 }
 
 int amdgpu_atomfirmware_allocate_fb_scratch(struct amdgpu_device

*adev)
--
2.7.4

Quoted 4 lines

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

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