aboutsummaryrefslogtreecommitdiffstats
path: root/meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.19.8/4390-drm-amdgpu-fix-vega20-pstate-status-change.patch
blob: 712100ee27ede915a0e13ddda970ed5d53820067 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
From 99e982dad30772ca6c977f5c5bc2e2ba6f89fb04 Mon Sep 17 00:00:00 2001
From: Jonathan Kim <jonathan.kim@amd.com>
Date: Wed, 6 Nov 2019 08:20:21 -0500
Subject: [PATCH 4390/4736] 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
Signed-off-by: Jonathan Kim <jonathan.kim@amd.com>
Reviewed-by: Evan Quan <Evan.Quan@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c
index e58bad7f64c6..6c6893b94114 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c
@@ -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:
-- 
2.17.1