aboutsummaryrefslogtreecommitdiffstats
path: root/common/recipes-kernel/linux/linux-yocto-4.14.71/3711-drm-amdgpu-Add-helper-to-turn-an-existing-VM-into-a-.patch
blob: 38aa6cdb3940d197ca4ac09efb5774105b4451fa (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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
From 8831a91499df85dfbe4972848ffa58ea4e9f69db Mon Sep 17 00:00:00 2001
From: Felix Kuehling <Felix.Kuehling@amd.com>
Date: Sat, 24 Feb 2018 18:26:47 -0500
Subject: [PATCH 3711/4131] drm/amdgpu: Add helper to turn an existing VM into
 a compute VM

Change-Id: Ie7d1fe63c2d612765a62e9c4d57e361f21cf0d10
Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>

Conflicts:
      drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 21 ++++-----------------
 1 file changed, 4 insertions(+), 17 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
index f3b4241..5a78082 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
@@ -2385,7 +2385,7 @@ static void amdgpu_inc_compute_vms(struct amdgpu_device *adev)
 		/* First Compute VM: enable compute power profile */
 		if (adev->powerplay.pp_funcs->switch_power_profile)
 			amdgpu_dpm_switch_power_profile(adev,
-							PP_SMC_POWER_PROFILE_COMPUTE, true);
+							PP_SMC_POWER_PROFILE_COMPUTE);
 	}
 	mutex_unlock(&id_mgr->lock);
 }
@@ -2411,10 +2411,6 @@ int amdgpu_vm_init(struct amdgpu_device *adev, struct amdgpu_vm *vm,
 	uint64_t flags;
 	int r, i;
 	
-	/* Temporary use only the first VM manager */
-	unsigned vmhub = 0; /*ring->funcs->vmhub;*/
-	struct amdgpu_vmid_mgr *id_mgr = &adev->vm_manager.id_mgr[vmhub];
-
 	vm->va = RB_ROOT_CACHED;
 	for (i = 0; i < AMDGPU_MAX_VMHUBS; i++)
 		vm->reserved_vmid[i] = NULL;
@@ -2498,18 +2494,9 @@ int amdgpu_vm_init(struct amdgpu_device *adev, struct amdgpu_vm *vm,
 	vm->fault_credit = 16;
 	
 	vm->vm_context = vm_context;
-	if (vm_context == AMDGPU_VM_CONTEXT_COMPUTE) {
-		mutex_lock(&id_mgr->lock);
-
-		if ((adev->vm_manager.n_compute_vms++ == 0) &&
-			(!amdgpu_sriov_vf(adev))) {
-			/* First Compute VM: enable compute power profile */
-			if (adev->powerplay.pp_funcs->switch_power_profile)
-				amdgpu_dpm_switch_power_profile(adev,
-						PP_SMC_POWER_PROFILE_COMPUTE, true);
-		}
-		mutex_unlock(&id_mgr->lock);
-	}
+	
+	if (vm_context == AMDGPU_VM_CONTEXT_COMPUTE)
+		amdgpu_inc_compute_vms(adev);
 
 	return 0;
 
-- 
2.7.4