Skip to contentSkip to conversation

drm/amdgpu: remove power on/off SDMA in SMU hw_init/fini()

PATCH In review Lang Yu 2 participants 11 messages Dec 3, 2021 – Dec 6, 2021

Subsystems (3)
lore
Share & tools
lore

Lang Yu

author
#0 lore raw

PATCH 1/2 drm/amdgpu: remove power on/off SDMA in SMU hw_init/fini()

Currently, we don't find some neccesities to power on/off SDMA in SMU hw_init/fini(). It makes more sense in SDMA hw_init/fini().

---
 drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c | 5 -----
 1 file changed, 5 deletions(-)
drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c +0 -5
index 5839918cb574..2d718c30c8eb 100644
@@ -1350,7 +1350,6 @@ static int smu_hw_init(void *handle)
 	}
 
 	if (smu->is_apu) {
-		smu_powergate_sdma(&adev->smu, false);
 		smu_dpm_set_vcn_enable(smu, true);
 		smu_dpm_set_jpeg_enable(smu, true);
 		smu_set_gfx_cgpg(&adev->smu, true);
@@ -1512,10 +1511,6 @@ static int smu_hw_fini(void *handle)
 	if (amdgpu_sriov_vf(adev)&& !amdgpu_sriov_is_pp_one_vf(adev))
 		return 0;
 
-	if (smu->is_apu) {
-		smu_powergate_sdma(&adev->smu, true);
-	}
-
 	smu_dpm_set_vcn_enable(smu, false);
 	smu_dpm_set_jpeg_enable(smu, false);
 
Signature · 1 line
2.25.1
author
#1 lore raw

PATCH 2/2 drm/amdgpu: allow APU to send power gate message when dpm is disabled

The general hw fini sequence is SMU-> ... ->SDMA-> ...
We need to send power gate message to power off SDMA(in SDMA hw_fini()) afer dpm is disabled(in SMU hw_fini()). Allow that for APU.

---
 drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c +1 -1
index 2d718c30c8eb..285a237f3605 100644
@@ -277,7 +277,7 @@ static int smu_dpm_set_power_gate(void *handle,
 	struct smu_context *smu = handle;
 	int ret = 0;
 
-	if (!smu->pm_enabled || !smu->adev->pm.dpm_enabled) {
+	if (!smu->pm_enabled || (!smu->is_apu && !smu->adev->pm.dpm_enabled)) {
 		dev_WARN(smu->adev->dev,
 			 "SMU uninitialized but power %s requested for %u!\n",
 			 gate ? "gate" : "ungate", block_type);
Signature · 1 line
2.25.1
#2 lore raw

Re: [PATCH 2/2] drm/amdgpu: allow APU to send power gate message when dpm is disabled

Quoted 3 lines · Lang Yu

The general hw fini sequence is SMU-> ... ->SDMA-> ...
We need to send power gate message to power off SDMA(in SDMA hw_fini()) afer dpm is disabled(in SMU hw_fini()). Allow that for APU.

This message is not right. In APUs there is no message provided by FW to enable/disable DPM, it is done in BIOS. Rephrase to something like after smu hw_fini is completed.

Quoted 11 lines
---
  drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c +0 -0
index 2d718c30c8eb..285a237f3605 100644

drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c static int smu_dpm_set_power_gate(void *handle, · line 280

Quoted 5 lines
drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c +1 -1
@@ -277,7 +277,7 @@ static int smu_dpm_set_power_gate(void *handle,
  	struct smu_context *smu = handle;
  	int ret = 0;
 
-	if (!smu->pm_enabled || !smu->adev->pm.dpm_enabled) {
+	if (!smu->pm_enabled || (!smu->is_apu && !smu->adev->pm.dpm_enabled)) {

This check was there before also, only the WARN is added. That means it was skipping sending messages in APUs also and so far this was working fine (until this gets noticed because of the warning).

Now this would try to send the message to APU without any check. That doesn't look good. Ideal way should be to fix the sequence. Otherwise, suggest to do something like below as the last step of smu hw cleanup rather than sending the message blindly.

	if (smu->is_apu)
		smu->pm.dpm_enabled = smu_is_dpm_running(smu);

Thanks,
Lijo

Quoted 4 lines
drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c +0 -0
  		dev_WARN(smu->adev->dev,
  			 "SMU uninitialized but power %s requested for %u!\n",
  			 gate ? "gate" : "ungate", block_type);
author
#3 lore raw

RE: [PATCH 2/2] drm/amdgpu: allow APU to send power gate message when dpm is disabled

[Public]

Quoted 11 lines

-----Original Message-----
From: Lazar, Lijo <[email protected]>
Sent: Friday, December 3, 2021 5:52 PM
To: Yu, Lang <[email protected]>; [email protected]
Cc: Deucher, Alexander <[email protected]>; Huang, Ray <[email protected]>
Subject: Re: [PATCH 2/2] drm/amdgpu: allow APU to send power gate message when dpm is disabled

Quoted 8 lines
Quoted 3 lines · Lang Yu

The general hw fini sequence is SMU-> ... ->SDMA-> ...
We need to send power gate message to power off SDMA(in SDMA hw_fini()) afer dpm is disabled(in SMU hw_fini()). Allow that for APU.

This message is not right. In APUs there is no message provided by FW to enable/disable DPM, it is done in BIOS. Rephrase to something like after smu hw_fini is completed.

It is power on/off SDMA message. Not enable/disable DPM.

Quoted 24 lines
Quoted 12 lines
---
  drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c +0 -0
index 2d718c30c8eb..285a237f3605 100644

drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c static int smu_dpm_set_power_gate(void *handle, · line 281

Quoted 6 lines
drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c +2 -1
@@ -277,7 +277,7 @@ static int smu_dpm_set_power_gate(void *handle,
  	struct smu_context *smu = handle;
  	int ret = 0;
 
-	if (!smu->pm_enabled || !smu->adev->pm.dpm_enabled) {
+	if (!smu->pm_enabled || (!smu->is_apu &&
+!smu->adev->pm.dpm_enabled)) {

This check was there before also, only the WARN is added. That means it was skipping sending messages in APUs also and so far this was working fine (until this gets noticed because of the warning).

Quoted 7 lines

Now this would try to send the message to APU without any check. That doesn't look good. Ideal way should be to fix the sequence. Otherwise, suggest to do something like below as the last step of smu hw cleanup rather than sending the message blindly.

	if (smu->is_apu)
		smu->pm.dpm_enabled = smu_is_dpm_running(smu);

smu_is_dpm_running(smu) will cause errors in suspend.

Here we just send some IP power on/off messages. Is it necessary to enable DPM to send such messages?

Regards,
Lang

Quoted 7 lines

Thanks,
Lijo

Quoted 4 lines
drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c +0 -0
  		dev_WARN(smu->adev->dev,
  			 "SMU uninitialized but power %s requested for %u!\n",
  			 gate ? "gate" : "ungate", block_type);
#4 lore raw

Re: [PATCH 2/2] drm/amdgpu: allow APU to send power gate message when dpm is disabled

Quoted 20 lines · Lang

[Public]

Quoted 16 lines

-----Original Message-----
From: Lazar, Lijo <[email protected]>
Sent: Friday, December 3, 2021 5:52 PM
To: Yu, Lang <[email protected]>; [email protected]
Cc: Deucher, Alexander <[email protected]>; Huang, Ray <[email protected]>
Subject: Re: [PATCH 2/2] drm/amdgpu: allow APU to send power gate message when dpm is disabled

Quoted 3 lines · Lang Yu

The general hw fini sequence is SMU-> ... ->SDMA-> ...
We need to send power gate message to power off SDMA(in SDMA hw_fini()) afer dpm is disabled(in SMU hw_fini()). Allow that for APU.

Quoted 6 lines
Quoted 3 lines

This message is not right. In APUs there is no message provided by FW to enable/disable DPM, it is done in BIOS. Rephrase to something like after smu hw_fini is completed.

It is power on/off SDMA message. Not enable/disable DPM.

Bad choice of word :) I didn't mean FW message, it was about this line in "commit message" - "afer dpm is disabled".

Quoted 29 lines
Quoted 29 lines
Quoted 12 lines
---
   drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c | 2 +-
   1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c +0 -0
index 2d718c30c8eb..285a237f3605 100644

drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c static int smu_dpm_set_power_gate(void *handle, · line 281

Quoted 6 lines
drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c +2 -1
@@ -277,7 +277,7 @@ static int smu_dpm_set_power_gate(void *handle,
   	struct smu_context *smu = handle;
   	int ret = 0;
 
-	if (!smu->pm_enabled || !smu->adev->pm.dpm_enabled) {
+	if (!smu->pm_enabled || (!smu->is_apu &&
+!smu->adev->pm.dpm_enabled)) {

This check was there before also, only the WARN is added. That means it was skipping sending messages in APUs also and so far this was working fine (until this gets noticed because of the warning).

Now this would try to send the message to APU without any check. That doesn't look good. Ideal way should be to fix the sequence. Otherwise, suggest to do something like below as the last step of smu hw cleanup rather than sending the message blindly.

Quoted 5 lines
Quoted 2 lines
	if (smu->is_apu)
		smu->pm.dpm_enabled = smu_is_dpm_running(smu);

smu_is_dpm_running(smu) will cause errors in suspend.

That is interesting. What is the error you get?

Thanks,
Lijo

Quoted 13 lines

Here we just send some IP power on/off messages. Is it necessary to enable DPM to send such messages?

Regards,
Lang

Quoted 7 lines

Thanks,
Lijo

Quoted 4 lines
drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c +0 -0
   		dev_WARN(smu->adev->dev,
   			 "SMU uninitialized but power %s requested for %u!\n",
   			 gate ? "gate" : "ungate", block_type);
author
#5 lore raw

RE: [PATCH 2/2] drm/amdgpu: allow APU to send power gate message when dpm is disabled

[Public]

Quoted 32 lines

-----Original Message-----
From: Lazar, Lijo <[email protected]>
Sent: Monday, December 6, 2021 11:41 AM
To: Yu, Lang <[email protected]>; [email protected]
Cc: Deucher, Alexander <[email protected]>; Huang, Ray <[email protected]>
Subject: Re: [PATCH 2/2] drm/amdgpu: allow APU to send power gate message when dpm is disabled

Quoted 20 lines · Lang

[Public]

Quoted 16 lines

-----Original Message-----
From: Lazar, Lijo <[email protected]>
Sent: Friday, December 3, 2021 5:52 PM
To: Yu, Lang <[email protected]>; [email protected]
Cc: Deucher, Alexander <[email protected]>; Huang, Ray <[email protected]>
Subject: Re: [PATCH 2/2] drm/amdgpu: allow APU to send power gate message when dpm is disabled

Quoted 3 lines · Lang Yu

The general hw fini sequence is SMU-> ... ->SDMA-> ...
We need to send power gate message to power off SDMA(in SDMA hw_fini()) afer dpm is disabled(in SMU hw_fini()). Allow that for APU.

Quoted 8 lines
Quoted 6 lines
Quoted 3 lines

This message is not right. In APUs there is no message provided by FW to enable/disable DPM, it is done in BIOS. Rephrase to something like after smu hw_fini is completed.

It is power on/off SDMA message. Not enable/disable DPM.

Bad choice of word :) I didn't mean FW message, it was about this line in "commit message" - "afer dpm is disabled".

Ok. I got it.

Quoted 30 lines
Quoted 30 lines
Quoted 30 lines
Quoted 13 lines
---
   drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c | 2 +-
   1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c +0 -0
index 2d718c30c8eb..285a237f3605 100644

drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c static int smu_dpm_set_power_gate(void *handle, · line 281

Quoted 6 lines
drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c +2 -1
@@ -277,7 +277,7 @@ static int smu_dpm_set_power_gate(void *handle,
   	struct smu_context *smu = handle;
   	int ret = 0;
 
-	if (!smu->pm_enabled || !smu->adev->pm.dpm_enabled) {
+	if (!smu->pm_enabled || (!smu->is_apu &&
+!smu->adev->pm.dpm_enabled)) {

This check was there before also, only the WARN is added. That means it was skipping sending messages in APUs also and so far this was working fine (until this gets noticed because of the warning).

Now this would try to send the message to APU without any check. That doesn't look good. Ideal way should be to fix the sequence. Otherwise, suggest to do something like below as the last step of smu hw cleanup rather than sending the message blindly.

Quoted 6 lines
Quoted 5 lines
Quoted 2 lines
	if (smu->is_apu)
		smu->pm.dpm_enabled = smu_is_dpm_running(smu);

smu_is_dpm_running(smu) will cause errors in suspend.

That is interesting. What is the error you get?

[drm:amdgpu_dpm_enable_uvd [amdgpu]] *ERROR* Dpm enable uvd failed, ret = -95 That means EOPNOTSUPP.

Actually, in resume process, but adev->in_suspend is still false. For Renoir series APU, smu_is_dpm_running is hardcoded as following,

static bool renoir_is_dpm_running(struct smu_context *smu)

{
	struct amdgpu_device *adev = smu->adev;

	/*
	 * Until now, the pmfw hasn't exported the interface of SMU
	 * feature mask to APU SKU so just force on all the feature
	 * at early initial stage.
	 */
	if (adev->in_suspend)
		return false;
	else
		return true;

}

So we got such an error.

Regards,
Lang

Quoted 16 lines

Thanks,
Lijo

Quoted 13 lines

Here we just send some IP power on/off messages. Is it necessary to enable DPM to send such messages?

Regards,
Lang

Quoted 7 lines

Thanks,
Lijo

Quoted 4 lines
drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c +0 -0
   		dev_WARN(smu->adev->dev,
   			 "SMU uninitialized but power %s requested for %u!\n",
   			 gate ? "gate" : "ungate", block_type);
author
#6 lore raw

RE: [PATCH 2/2] drm/amdgpu: allow APU to send power gate message when dpm is disabled

[Public]

A typo.

Quoted 135 lines

-----Original Message-----
From: Yu, Lang
Sent: Monday, December 6, 2021 2:47 PM
To: Lazar, Lijo <[email protected]>; [email protected]
Cc: Deucher, Alexander <[email protected]>; Huang, Ray <[email protected]>
Subject: RE: [PATCH 2/2] drm/amdgpu: allow APU to send power gate message when dpm is disabled

[Public]

Quoted 32 lines

-----Original Message-----
From: Lazar, Lijo <[email protected]>
Sent: Monday, December 6, 2021 11:41 AM
To: Yu, Lang <[email protected]>; [email protected]
Cc: Deucher, Alexander <[email protected]>; Huang, Ray <[email protected]>
Subject: Re: [PATCH 2/2] drm/amdgpu: allow APU to send power gate message when dpm is disabled

Quoted 20 lines · Lang

[Public]

Quoted 16 lines

-----Original Message-----
From: Lazar, Lijo <[email protected]>
Sent: Friday, December 3, 2021 5:52 PM
To: Yu, Lang <[email protected]>; [email protected]
Cc: Deucher, Alexander <[email protected]>; Huang, Ray <[email protected]>
Subject: Re: [PATCH 2/2] drm/amdgpu: allow APU to send power gate message when dpm is disabled

Quoted 3 lines · Lang Yu

The general hw fini sequence is SMU-> ... ->SDMA-> ...
We need to send power gate message to power off SDMA(in SDMA hw_fini()) afer dpm is disabled(in SMU hw_fini()). Allow that for APU.

Quoted 8 lines
Quoted 6 lines
Quoted 3 lines

This message is not right. In APUs there is no message provided by FW to enable/disable DPM, it is done in BIOS. Rephrase to something like after smu hw_fini is completed.

It is power on/off SDMA message. Not enable/disable DPM.

Bad choice of word :) I didn't mean FW message, it was about this line in "commit message" - "afer dpm is disabled".

Ok. I got it.

Quoted 30 lines
Quoted 30 lines
Quoted 30 lines
Quoted 13 lines
---
   drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c | 2 +-
   1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c +0 -0
index 2d718c30c8eb..285a237f3605 100644

drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c static int smu_dpm_set_power_gate(void *handle, · line 281

Quoted 6 lines
drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c +2 -1
@@ -277,7 +277,7 @@ static int smu_dpm_set_power_gate(void *handle,
   	struct smu_context *smu = handle;
   	int ret = 0;
 
-	if (!smu->pm_enabled || !smu->adev->pm.dpm_enabled) {
+	if (!smu->pm_enabled || (!smu->is_apu &&
+!smu->adev->pm.dpm_enabled)) {

This check was there before also, only the WARN is added. That means it was skipping sending messages in APUs also and so far this was working fine (until this gets noticed because of the warning).

Now this would try to send the message to APU without any check. That doesn't look good. Ideal way should be to fix the sequence. Otherwise, suggest to do something like below as the last step of smu hw cleanup rather than sending the message blindly.

Quoted 6 lines
Quoted 5 lines
Quoted 2 lines
	if (smu->is_apu)
		smu->pm.dpm_enabled = smu_is_dpm_running(smu);

smu_is_dpm_running(smu) will cause errors in suspend.

That is interesting. What is the error you get?

[drm:amdgpu_dpm_enable_uvd [amdgpu]] *ERROR* Dpm enable uvd failed, ret = -95 That means EOPNOTSUPP.

Actually, in resume process, but adev->in_suspend is still true. For Renoir series APU, smu_is_dpm_running is hardcoded as following,

static bool renoir_is_dpm_running(struct smu_context *smu) {
	struct amdgpu_device *adev = smu->adev;

	/*
	 * Until now, the pmfw hasn't exported the interface of SMU
	 * feature mask to APU SKU so just force on all the feature
	 * at early initial stage.
	 */
	if (adev->in_suspend)
		return false;
	else
		return true;

}

So we got such an error.

Regards,
Lang

Quoted 16 lines

Thanks,
Lijo

Quoted 13 lines

Here we just send some IP power on/off messages. Is it necessary to enable DPM to send such messages?

Regards,
Lang

Quoted 7 lines

Thanks,
Lijo

Quoted 4 lines
drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c +0 -0
   		dev_WARN(smu->adev->dev,
   			 "SMU uninitialized but power %s requested for %u!\n",
   			 gate ? "gate" : "ungate", block_type);
#7 lore raw

Re: [PATCH 2/2] drm/amdgpu: allow APU to send power gate message when dpm is disabled

Quoted 114 lines · Lang

[Public]

A typo.

Quoted 110 lines

-----Original Message-----
From: Yu, Lang
Sent: Monday, December 6, 2021 2:47 PM
To: Lazar, Lijo <[email protected]>; [email protected]
Cc: Deucher, Alexander <[email protected]>; Huang, Ray <[email protected]>
Subject: RE: [PATCH 2/2] drm/amdgpu: allow APU to send power gate message when dpm is disabled

[Public]

Quoted 32 lines

-----Original Message-----
From: Lazar, Lijo <[email protected]>
Sent: Monday, December 6, 2021 11:41 AM
To: Yu, Lang <[email protected]>; [email protected]
Cc: Deucher, Alexander <[email protected]>; Huang, Ray <[email protected]>
Subject: Re: [PATCH 2/2] drm/amdgpu: allow APU to send power gate message when dpm is disabled

Quoted 20 lines · Lang

[Public]

Quoted 16 lines

-----Original Message-----
From: Lazar, Lijo <[email protected]>
Sent: Friday, December 3, 2021 5:52 PM
To: Yu, Lang <[email protected]>; [email protected]
Cc: Deucher, Alexander <[email protected]>; Huang, Ray <[email protected]>
Subject: Re: [PATCH 2/2] drm/amdgpu: allow APU to send power gate message when dpm is disabled

Quoted 3 lines · Lang Yu

The general hw fini sequence is SMU-> ... ->SDMA-> ...
We need to send power gate message to power off SDMA(in SDMA hw_fini()) afer dpm is disabled(in SMU hw_fini()). Allow that for APU.

Quoted 8 lines
Quoted 6 lines
Quoted 3 lines

This message is not right. In APUs there is no message provided by FW to enable/disable DPM, it is done in BIOS. Rephrase to something like after smu hw_fini is completed.

It is power on/off SDMA message. Not enable/disable DPM.

Bad choice of word :) I didn't mean FW message, it was about this line in "commit message" - "afer dpm is disabled".

Ok. I got it.

Quoted 30 lines
Quoted 30 lines
Quoted 30 lines
Quoted 13 lines
---
    drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c | 2 +-
    1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c +0 -0
index 2d718c30c8eb..285a237f3605 100644

drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c static int smu_dpm_set_power_gate(void *handle, · line 281

Quoted 6 lines
drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c +2 -1
@@ -277,7 +277,7 @@ static int smu_dpm_set_power_gate(void *handle,
    	struct smu_context *smu = handle;
    	int ret = 0;
 
-	if (!smu->pm_enabled || !smu->adev->pm.dpm_enabled) {
+	if (!smu->pm_enabled || (!smu->is_apu &&
+!smu->adev->pm.dpm_enabled)) {

This check was there before also, only the WARN is added. That means it was skipping sending messages in APUs also and so far this was working fine (until this gets noticed because of the warning).

Now this would try to send the message to APU without any check. That doesn't look good. Ideal way should be to fix the sequence. Otherwise, suggest to do something like below as the last step of smu hw cleanup rather than sending the message blindly.

Quoted 6 lines
Quoted 5 lines
Quoted 2 lines
	if (smu->is_apu)
		smu->pm.dpm_enabled = smu_is_dpm_running(smu);

smu_is_dpm_running(smu) will cause errors in suspend.

That is interesting. What is the error you get?

[drm:amdgpu_dpm_enable_uvd [amdgpu]] *ERROR* Dpm enable uvd failed, ret = -95 That means EOPNOTSUPP.

Actually, in resume process, but adev->in_suspend is still true. For Renoir series APU, smu_is_dpm_running is hardcoded as following,

static bool renoir_is_dpm_running(struct smu_context *smu) {
	struct amdgpu_device *adev = smu->adev;

	/*
	 * Until now, the pmfw hasn't exported the interface of SMU
	 * feature mask to APU SKU so just force on all the feature
	 * at early initial stage.
	 */
	if (adev->in_suspend)
		return false;
	else

Renoir suspend shouldn't be a special case. FW should keep running with features enabled after driver suspend. Could you try with a return true all the time for this?

Thanks,
Lijo

Quoted 25 lines
Quoted 25 lines
		return true;

}

So we got such an error.

Regards,
Lang

Quoted 16 lines

Thanks,
Lijo

Quoted 13 lines

Here we just send some IP power on/off messages. Is it necessary to enable DPM to send such messages?

Regards,
Lang

Quoted 7 lines

Thanks,
Lijo

Quoted 4 lines
drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c +0 -0
    		dev_WARN(smu->adev->dev,
    			 "SMU uninitialized but power %s requested for %u!\n",
    			 gate ? "gate" : "ungate", block_type);
author
#8 lore raw

Re: [PATCH 2/2] drm/amdgpu: allow APU to send power gate message when dpm is disabled

Quoted 118 lines · Lijo
Quoted 114 lines · Lang

[Public]

A typo.

Quoted 110 lines

-----Original Message-----
From: Yu, Lang
Sent: Monday, December 6, 2021 2:47 PM
To: Lazar, Lijo <[email protected]>; [email protected]
Cc: Deucher, Alexander <[email protected]>; Huang, Ray <[email protected]>
Subject: RE: [PATCH 2/2] drm/amdgpu: allow APU to send power gate message when dpm is disabled

[Public]

Quoted 32 lines

-----Original Message-----
From: Lazar, Lijo <[email protected]>
Sent: Monday, December 6, 2021 11:41 AM
To: Yu, Lang <[email protected]>; [email protected]
Cc: Deucher, Alexander <[email protected]>; Huang, Ray <[email protected]>
Subject: Re: [PATCH 2/2] drm/amdgpu: allow APU to send power gate message when dpm is disabled

Quoted 20 lines · Lang

[Public]

Quoted 16 lines

-----Original Message-----
From: Lazar, Lijo <[email protected]>
Sent: Friday, December 3, 2021 5:52 PM
To: Yu, Lang <[email protected]>; [email protected]
Cc: Deucher, Alexander <[email protected]>; Huang, Ray <[email protected]>
Subject: Re: [PATCH 2/2] drm/amdgpu: allow APU to send power gate message when dpm is disabled

Quoted 3 lines · Lang Yu

The general hw fini sequence is SMU-> ... ->SDMA-> ...
We need to send power gate message to power off SDMA(in SDMA hw_fini()) afer dpm is disabled(in SMU hw_fini()). Allow that for APU.

Quoted 8 lines
Quoted 6 lines
Quoted 3 lines

This message is not right. In APUs there is no message provided by FW to enable/disable DPM, it is done in BIOS. Rephrase to something like after smu hw_fini is completed.

It is power on/off SDMA message. Not enable/disable DPM.

Bad choice of word :) I didn't mean FW message, it was about this line in "commit message" - "afer dpm is disabled".

Ok. I got it.

Quoted 30 lines
Quoted 30 lines
Quoted 30 lines
Quoted 13 lines
---
    drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c | 2 +-
    1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c +0 -0
index 2d718c30c8eb..285a237f3605 100644

drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c static int smu_dpm_set_power_gate(void *handle, · line 281

Quoted 6 lines
drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c +2 -1
@@ -277,7 +277,7 @@ static int smu_dpm_set_power_gate(void *handle,
    	struct smu_context *smu = handle;
    	int ret = 0;
 
-	if (!smu->pm_enabled || !smu->adev->pm.dpm_enabled) {
+	if (!smu->pm_enabled || (!smu->is_apu &&
+!smu->adev->pm.dpm_enabled)) {

This check was there before also, only the WARN is added. That means it was skipping sending messages in APUs also and so far this was working fine (until this gets noticed because of the warning).

Now this would try to send the message to APU without any check. That doesn't look good. Ideal way should be to fix the sequence. Otherwise, suggest to do something like below as the last step of smu hw cleanup rather than sending the message blindly.

Quoted 6 lines
Quoted 5 lines
Quoted 2 lines
	if (smu->is_apu)
		smu->pm.dpm_enabled = smu_is_dpm_running(smu);

smu_is_dpm_running(smu) will cause errors in suspend.

That is interesting. What is the error you get?

[drm:amdgpu_dpm_enable_uvd [amdgpu]] *ERROR* Dpm enable uvd failed, ret = -95 That means EOPNOTSUPP.

Actually, in resume process, but adev->in_suspend is still true. For Renoir series APU, smu_is_dpm_running is hardcoded as following,

static bool renoir_is_dpm_running(struct smu_context *smu) {
	struct amdgpu_device *adev = smu->adev;

	/*
	 * Until now, the pmfw hasn't exported the interface of SMU
	 * feature mask to APU SKU so just force on all the feature
	 * at early initial stage.
	 */
	if (adev->in_suspend)
		return false;
	else
Quoted 3 lines

Renoir suspend shouldn't be a special case. FW should keep running with features enabled after driver suspend. Could you try with a return true all the time for this?

That worked.

But we just send an IP power on/off message here.

Do we really need dpm running?

Regards,
Lang

Quoted 28 lines

Thanks,
Lijo

Quoted 25 lines
Quoted 25 lines
		return true;

}

So we got such an error.

Regards,
Lang

Quoted 16 lines

Thanks,
Lijo

Quoted 13 lines

Here we just send some IP power on/off messages. Is it necessary to enable DPM to send such messages?

Regards,
Lang

Quoted 7 lines

Thanks,
Lijo

Quoted 4 lines
drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c +0 -0
    		dev_WARN(smu->adev->dev,
    			 "SMU uninitialized but power %s requested for %u!\n",
    			 gate ? "gate" : "ungate", block_type);
#9 lore raw

Re: [PATCH 2/2] drm/amdgpu: allow APU to send power gate message when dpm is disabled

Quoted 123 lines · Lang Yu
Quoted 118 lines · Lijo
Quoted 114 lines · Lang

[Public]

A typo.

Quoted 110 lines

-----Original Message-----
From: Yu, Lang
Sent: Monday, December 6, 2021 2:47 PM
To: Lazar, Lijo <[email protected]>; [email protected]
Cc: Deucher, Alexander <[email protected]>; Huang, Ray <[email protected]>
Subject: RE: [PATCH 2/2] drm/amdgpu: allow APU to send power gate message when dpm is disabled

[Public]

Quoted 32 lines

-----Original Message-----
From: Lazar, Lijo <[email protected]>
Sent: Monday, December 6, 2021 11:41 AM
To: Yu, Lang <[email protected]>; [email protected]
Cc: Deucher, Alexander <[email protected]>; Huang, Ray <[email protected]>
Subject: Re: [PATCH 2/2] drm/amdgpu: allow APU to send power gate message when dpm is disabled

Quoted 20 lines · Lang

[Public]

Quoted 16 lines

-----Original Message-----
From: Lazar, Lijo <[email protected]>
Sent: Friday, December 3, 2021 5:52 PM
To: Yu, Lang <[email protected]>; [email protected]
Cc: Deucher, Alexander <[email protected]>; Huang, Ray <[email protected]>
Subject: Re: [PATCH 2/2] drm/amdgpu: allow APU to send power gate message when dpm is disabled

Quoted 3 lines · Lang Yu

The general hw fini sequence is SMU-> ... ->SDMA-> ...
We need to send power gate message to power off SDMA(in SDMA hw_fini()) afer dpm is disabled(in SMU hw_fini()). Allow that for APU.

Quoted 8 lines
Quoted 6 lines
Quoted 3 lines

This message is not right. In APUs there is no message provided by FW to enable/disable DPM, it is done in BIOS. Rephrase to something like after smu hw_fini is completed.

It is power on/off SDMA message. Not enable/disable DPM.

Bad choice of word :) I didn't mean FW message, it was about this line in "commit message" - "afer dpm is disabled".

Ok. I got it.

Quoted 30 lines
Quoted 30 lines
Quoted 30 lines
Quoted 13 lines
---
     drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c | 2 +-
     1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c +0 -0
index 2d718c30c8eb..285a237f3605 100644

drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c static int smu_dpm_set_power_gate(void *handle, · line 281

Quoted 6 lines
drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c +2 -1
@@ -277,7 +277,7 @@ static int smu_dpm_set_power_gate(void *handle,
     	struct smu_context *smu = handle;
     	int ret = 0;
 
-	if (!smu->pm_enabled || !smu->adev->pm.dpm_enabled) {
+	if (!smu->pm_enabled || (!smu->is_apu &&
+!smu->adev->pm.dpm_enabled)) {

This check was there before also, only the WARN is added. That means it was skipping sending messages in APUs also and so far this was working fine (until this gets noticed because of the warning).

Now this would try to send the message to APU without any check. That doesn't look good. Ideal way should be to fix the sequence. Otherwise, suggest to do something like below as the last step of smu hw cleanup rather than sending the message blindly.

Quoted 6 lines
Quoted 5 lines
Quoted 2 lines
	if (smu->is_apu)
		smu->pm.dpm_enabled = smu_is_dpm_running(smu);

smu_is_dpm_running(smu) will cause errors in suspend.

That is interesting. What is the error you get?

[drm:amdgpu_dpm_enable_uvd [amdgpu]] *ERROR* Dpm enable uvd failed, ret = -95 That means EOPNOTSUPP.

Actually, in resume process, but adev->in_suspend is still true. For Renoir series APU, smu_is_dpm_running is hardcoded as following,

static bool renoir_is_dpm_running(struct smu_context *smu) {
	struct amdgpu_device *adev = smu->adev;

	/*
	 * Until now, the pmfw hasn't exported the interface of SMU
	 * feature mask to APU SKU so just force on all the feature
	 * at early initial stage.
	 */
	if (adev->in_suspend)
		return false;
	else
Quoted 3 lines

Renoir suspend shouldn't be a special case. FW should keep running with features enabled after driver suspend. Could you try with a return true all the time for this?

Quoted 6 lines

That worked.

But we just send an IP power on/off message here.

Do we really need dpm running?

Yes, but it is a power management message. From a FW perspective, power management starts when DPM is enabled. Without that, it's not bothered about any power management features. Only a few non-PM related messages like i2c table transfer etc. work when it is not enabled. Usually for APUs, DPM gets enabled early through BIOS and driver doesn't have much control.

If dpm_enabled is not causing any SW logical errors, better to keep it coherent with FW DPM for swsmu based ASICs.

Thanks,
Lijo

Quoted 31 lines

Regards,
Lang

Quoted 28 lines

Thanks,
Lijo

Quoted 25 lines
Quoted 25 lines
		return true;

}

So we got such an error.

Regards,
Lang

Quoted 16 lines

Thanks,
Lijo

Quoted 13 lines

Here we just send some IP power on/off messages. Is it necessary to enable DPM to send such messages?

Regards,
Lang

Quoted 7 lines

Thanks,
Lijo

Quoted 4 lines
drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c +0 -0
     		dev_WARN(smu->adev->dev,
     			 "SMU uninitialized but power %s requested for %u!\n",
     			 gate ? "gate" : "ungate", block_type);
author
#10 lore raw

Re: [PATCH 2/2] drm/amdgpu: allow APU to send power gate message when dpm is disabled

Quoted 133 lines · Lijo
Quoted 123 lines · Lang Yu
Quoted 118 lines · Lijo
Quoted 114 lines · Lang

[Public]

A typo.

Quoted 110 lines

-----Original Message-----
From: Yu, Lang
Sent: Monday, December 6, 2021 2:47 PM
To: Lazar, Lijo <[email protected]>; [email protected]
Cc: Deucher, Alexander <[email protected]>; Huang, Ray <[email protected]>
Subject: RE: [PATCH 2/2] drm/amdgpu: allow APU to send power gate message when dpm is disabled

[Public]

Quoted 32 lines

-----Original Message-----
From: Lazar, Lijo <[email protected]>
Sent: Monday, December 6, 2021 11:41 AM
To: Yu, Lang <[email protected]>; [email protected]
Cc: Deucher, Alexander <[email protected]>; Huang, Ray <[email protected]>
Subject: Re: [PATCH 2/2] drm/amdgpu: allow APU to send power gate message when dpm is disabled

Quoted 20 lines · Lang

[Public]

Quoted 16 lines

-----Original Message-----
From: Lazar, Lijo <[email protected]>
Sent: Friday, December 3, 2021 5:52 PM
To: Yu, Lang <[email protected]>; [email protected]
Cc: Deucher, Alexander <[email protected]>; Huang, Ray <[email protected]>
Subject: Re: [PATCH 2/2] drm/amdgpu: allow APU to send power gate message when dpm is disabled

Quoted 3 lines · Lang Yu

The general hw fini sequence is SMU-> ... ->SDMA-> ...
We need to send power gate message to power off SDMA(in SDMA hw_fini()) afer dpm is disabled(in SMU hw_fini()). Allow that for APU.

Quoted 8 lines
Quoted 6 lines
Quoted 3 lines

This message is not right. In APUs there is no message provided by FW to enable/disable DPM, it is done in BIOS. Rephrase to something like after smu hw_fini is completed.

It is power on/off SDMA message. Not enable/disable DPM.

Bad choice of word :) I didn't mean FW message, it was about this line in "commit message" - "afer dpm is disabled".

Ok. I got it.

Quoted 30 lines
Quoted 30 lines
Quoted 30 lines
Quoted 13 lines
---
     drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c | 2 +-
     1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c +0 -0
index 2d718c30c8eb..285a237f3605 100644

drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c static int smu_dpm_set_power_gate(void *handle, · line 281

Quoted 6 lines
drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c +2 -1
@@ -277,7 +277,7 @@ static int smu_dpm_set_power_gate(void *handle,
     	struct smu_context *smu = handle;
     	int ret = 0;
 
-	if (!smu->pm_enabled || !smu->adev->pm.dpm_enabled) {
+	if (!smu->pm_enabled || (!smu->is_apu &&
+!smu->adev->pm.dpm_enabled)) {

This check was there before also, only the WARN is added. That means it was skipping sending messages in APUs also and so far this was working fine (until this gets noticed because of the warning).

Now this would try to send the message to APU without any check. That doesn't look good. Ideal way should be to fix the sequence. Otherwise, suggest to do something like below as the last step of smu hw cleanup rather than sending the message blindly.

Quoted 6 lines
Quoted 5 lines
Quoted 2 lines
	if (smu->is_apu)
		smu->pm.dpm_enabled = smu_is_dpm_running(smu);

smu_is_dpm_running(smu) will cause errors in suspend.

That is interesting. What is the error you get?

[drm:amdgpu_dpm_enable_uvd [amdgpu]] *ERROR* Dpm enable uvd failed, ret = -95 That means EOPNOTSUPP.

Actually, in resume process, but adev->in_suspend is still true. For Renoir series APU, smu_is_dpm_running is hardcoded as following,

static bool renoir_is_dpm_running(struct smu_context *smu) {
	struct amdgpu_device *adev = smu->adev;

	/*
	 * Until now, the pmfw hasn't exported the interface of SMU
	 * feature mask to APU SKU so just force on all the feature
	 * at early initial stage.
	 */
	if (adev->in_suspend)
		return false;
	else
Quoted 3 lines

Renoir suspend shouldn't be a special case. FW should keep running with features enabled after driver suspend. Could you try with a return true all the time for this?

Quoted 6 lines

That worked.

But we just send an IP power on/off message here.

Do we really need dpm running?

Quoted 8 lines

Yes, but it is a power management message. From a FW perspective, power management starts when DPM is enabled. Without that, it's not bothered about any power management features. Only a few non-PM related messages like i2c table transfer etc. work when it is not enabled. Usually for APUs, DPM gets enabled early through BIOS and driver doesn't have much control.

If dpm_enabled is not causing any SW logical errors, better to keep it coherent with FW DPM for swsmu based ASICs.

As you said for APUs, DPM gets enabled early through BIOS. Are there any cases it is disabled by diver or BIOS or itself after that?

1, If not, why we query if it is running for APUs. 2, If yes, who enable it again for APus?

Regards,
Lang

Quoted 34 lines

Thanks,
Lijo

Quoted 31 lines

Regards,
Lang

Quoted 28 lines

Thanks,
Lijo

Quoted 25 lines
Quoted 25 lines
		return true;

}

So we got such an error.

Regards,
Lang

Quoted 16 lines

Thanks,
Lijo

Quoted 13 lines

Here we just send some IP power on/off messages. Is it necessary to enable DPM to send such messages?

Regards,
Lang

Quoted 7 lines

Thanks,
Lijo

Quoted 4 lines
drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c +0 -0
     		dev_WARN(smu->adev->dev,
     			 "SMU uninitialized but power %s requested for %u!\n",
     			 gate ? "gate" : "ungate", block_type);