Skip to contentSkip to conversation

drm/amd/powerplay: avoid using pm_en before it is initialized

PATCH In review Tiecheng Zhou 2 participants 3 messages Apr 2, 2020 – Apr 3, 2020

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

PATCH 1/1 drm/amd/powerplay: avoid using pm_en before it is initialized

hwmgr->pm_en is initialized at hwmgr_hw_init.
during amdgpu_device_init, there is amdgpu_asic_reset that calls to pp_get_asic_baco_capability, while hwmgr->pm_en has not yet been initialized.

so avoid using pm_en in pp_get_asic_baco_capability.

---
 drivers/gpu/drm/amd/powerplay/amd_powerplay.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/powerplay/amd_powerplay.c +2 -1
index 71b843f542d8..fdff3e1c5e95 100644
@@ -1455,7 +1455,8 @@ static int pp_get_asic_baco_state(void *handle, int *state)
 	if (!hwmgr)
 		return -EINVAL;
 
-	if (!hwmgr->pm_en || !hwmgr->hwmgr_func->get_asic_baco_state)
+	if (!(hwmgr->not_vf && amdgpu_dpm) ||
+		!hwmgr->hwmgr_func->get_asic_baco_state)
 		return 0;
 
 	mutex_lock(&hwmgr->smu_lock);
Signature · 6 lines
2.17.1

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

[AMD Official Use Only - Internal Distribution Only]

Ping...

-----Original Message-----
From: Tiecheng Zhou <[email protected]>
Sent: Thursday, April 2, 2020 5:29 PM
To: [email protected]
Cc: Zhou, Tiecheng <[email protected]>; Tao, Yintian <[email protected]>
Subject: [PATCH] drm/amd/powerplay: avoid using pm_en before it is initialized

hwmgr->pm_en is initialized at hwmgr_hw_init.
during amdgpu_device_init, there is amdgpu_asic_reset that calls to pp_get_asic_baco_capability, while hwmgr->pm_en has not yet been initialized.

so avoid using pm_en in pp_get_asic_baco_capability.

---
 drivers/gpu/drm/amd/powerplay/amd_powerplay.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/powerplay/amd_powerplay.c +2 -1
index 71b843f542d8..fdff3e1c5e95 100644
@@ -1455,7 +1455,8 @@ static int pp_get_asic_baco_state(void *handle, int *state)
 	if (!hwmgr)
 		return -EINVAL;
 
-	if (!hwmgr->pm_en || !hwmgr->hwmgr_func->get_asic_baco_state)
+	if (!(hwmgr->not_vf && amdgpu_dpm) ||
+		!hwmgr->hwmgr_func->get_asic_baco_state)
 		return 0;
 
 	mutex_lock(&hwmgr->smu_lock);

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

Reviewed-by
#2 lore raw

[AMD Official Use Only - Internal Distribution Only]

Quoted 52 lines

-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Zhou, Tiecheng
Sent: Friday, April 3, 2020 12:42 PM
To: Zhou, Tiecheng <[email protected]>; amd- [email protected]
Cc: Tao, Yintian <[email protected]>
Subject: RE: [PATCH] drm/amd/powerplay: avoid using pm_en before it is initialized

[AMD Official Use Only - Internal Distribution Only]

Ping...

-----Original Message-----
From: Tiecheng Zhou <[email protected]>
Sent: Thursday, April 2, 2020 5:29 PM
To: [email protected]
Cc: Zhou, Tiecheng <[email protected]>; Tao, Yintian <[email protected]>
Subject: [PATCH] drm/amd/powerplay: avoid using pm_en before it is initialized

hwmgr->pm_en is initialized at hwmgr_hw_init.
during amdgpu_device_init, there is amdgpu_asic_reset that calls to pp_get_asic_baco_capability, while hwmgr->pm_en has not yet been initialized.

so avoid using pm_en in pp_get_asic_baco_capability.

---
drivers/gpu/drm/amd/powerplay/amd_powerplay.c | 3 ++-

1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/powerplay/amd_powerplay.c +2 -1
index 71b843f542d8..fdff3e1c5e95 100644
@@ -1455,7 +1455,8 @@ static int pp_get_asic_baco_state(void *handle, int
 *state)
 	if (!hwmgr)
 		return -EINVAL;
 
-	if (!hwmgr->pm_en || !hwmgr->hwmgr_func->get_asic_baco_state)
+	if (!(hwmgr->not_vf && amdgpu_dpm) ||
+		!hwmgr->hwmgr_func->get_asic_baco_state)
 		return 0;
 
	mutex_lock(&hwmgr->smu_lock);
Quoted 11 lines

--
2.17.1
_______________________________________________
amd-gfx mailing list
[email protected]
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.fre
edesktop.org%2Fmailman%2Flistinfo%2Famd- gfx&amp;data=02%7C01%7CEmily.Deng%40amd.com%7Cfc7cc02f1db043b393 1108d7d7895f4d%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637 214857946885870&amp;sdata=J8iQUQc8phHtblO1gn9TkoI%2BJ%2BehvD4RVfi 7MybTuCQ%3D&amp;reserved=0

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