Skip to contentSkip to conversation

drm/amdgpu: fix vega20 pstate status change

PATCH In review Kim, Jonathan 2 participants 2 messages Nov 6, 2019 – Nov 7, 2019 1 message not in the archive

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

PATCH 1/1 drm/amdgpu: fix vega20 pstate status change

vega20 only requires all devices be set to same pstate level for low pstate and not high.

Change-Id I399c84a47f6e24abca937ce950685c0c7f0e3279
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c +4 -3
index de20a9a1c444..61d13d8b7b20 100644
@@ -276,6 +276,7 @@ int amdgpu_xgmi_set_pstate(struct amdgpu_device *adev, int pstate)
 	struct amdgpu_hive_info *hive = amdgpu_get_xgmi_hive(adev, 0);
 	struct amdgpu_device *tmp_adev;
 	bool update_hive_pstate = true;
+	bool is_high_pstate = pstate && adev->asic_type == CHIP_VEGA20;
 
 	if (!hive)
 		return 0;
@@ -283,8 +284,8 @@ int amdgpu_xgmi_set_pstate(struct amdgpu_device *adev, int pstate)
 	mutex_lock(&hive->hive_lock);
 
 	if (hive->pstate == pstate) {
-		mutex_unlock(&hive->hive_lock);
-		return 0;
+		adev->pstate = is_high_pstate ? pstate : adev->pstate;
+		goto out;
 	}
 
 	dev_dbg(adev->dev, "Set xgmi pstate %d.\n", pstate);
@@ -317,7 +318,7 @@ int amdgpu_xgmi_set_pstate(struct amdgpu_device *adev, int pstate)
 			break;
 		}
 	}
-	if (update_hive_pstate)
+	if (update_hive_pstate || is_high_pstate)
 		hive->pstate = pstate;
 
 out:
Signature · 6 lines
2.17.1

_______________________________________________
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): [email protected]

Reviewed-by Evan Quan
#2 lore raw
Quoted 56 lines

-----Original Message-----
From: Kim, Jonathan <[email protected]>
Sent: Wednesday, November 6, 2019 10:04 PM
To: [email protected]
Cc: Kuehling, Felix <[email protected]>; Quan, Evan <[email protected]>; Strawbridge, Michael <[email protected]>; Kim, Jonathan <[email protected]>; Kim, Jonathan <[email protected]>
Subject: [PATCH] drm/amdgpu: fix vega20 pstate status change

vega20 only requires all devices be set to same pstate level for low pstate and not high.

Change-Id I399c84a47f6e24abca937ce950685c0c7f0e3279
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c +1 -0
index de20a9a1c444..61d13d8b7b20 100644
@@ -276,6 +276,7 @@ int amdgpu_xgmi_set_pstate(struct amdgpu_device
 *adev, int pstate)
 	struct amdgpu_hive_info *hive = amdgpu_get_xgmi_hive(adev, 0);
 	struct amdgpu_device *tmp_adev;
 	bool update_hive_pstate = true;
+	bool is_high_pstate = pstate && adev->asic_type == CHIP_VEGA20;
 
 	if (!hive)
drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c +2 -2
 		return 0;
@@ -283,8 +284,8 @@ int amdgpu_xgmi_set_pstate(struct amdgpu_device
 *adev, int pstate)
 	mutex_lock(&hive->hive_lock);
 
 	if (hive->pstate == pstate) {
-		mutex_unlock(&hive->hive_lock);
-		return 0;
+		adev->pstate = is_high_pstate ? pstate : adev->pstate;
+		goto out;
 	}
 

dev_dbg(adev->dev, "Set xgmi pstate %d.\n", pstate); @@ -317,7
+318,7 @@ int amdgpu_xgmi_set_pstate(struct amdgpu_device *adev, int pstate)

drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c +1 -2
 			break;
 		}
 	}
-	if (update_hive_pstate)
+	if (update_hive_pstate || is_high_pstate)
 		hive->pstate = pstate;
 
 out:
--
Quoted 1 line

2.17.1

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