aboutsummaryrefslogtreecommitdiffstats
path: root/common/recipes-kernel/linux/linux-yocto-4.14.71/3048-drm-amdkfd-Invalidate-tlb-before-vmid-deallocation-f.patch
blob: ff4dbed2639ff174a68c52ef074d92efa8d60c4e (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
From 82d8ec5c200e79d50c1ef2dc84983587c70001e4 Mon Sep 17 00:00:00 2001
From: Yong Zhao <yong.zhao@amd.com>
Date: Wed, 20 Dec 2017 18:00:33 -0500
Subject: [PATCH 3048/4131] drm/amdkfd: Invalidate tlb before vmid deallocation
 for non-HWS

For non-HWS case, when the last queue for a process on a device is
destroyed, the pasid to vmid mapping for this process also becomes invalid,
so before that moment we should do a tlb invaldation. Currently we
call invalidates tlb at process exit when vmid is already 0, but that
tlb invalidation actually does not take affect at all due to vmid 0.

Change-Id: Ieaf8161a799211ebde4c0dee35f9278c54041286
Signed-off-by: Yong Zhao <yong.zhao@amd.com>
---
 drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c | 2 ++
 drivers/gpu/drm/amd/amdkfd/kfd_process.c              | 9 ---------
 2 files changed, 2 insertions(+), 9 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c b/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c
index 77f5351..0b1454c 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c
@@ -229,6 +229,8 @@ static void deallocate_vmid(struct device_queue_manager *dqm,
 		if (flush_texture_cache_nocpsch(q->device, qpd))
 			pr_err("Failed to flush TC\n");
 
+	kfd_flush_tlb(dqm->dev, qpd->pqm->process->pasid);
+
 	/* Release the vmid mapping */
 	set_pasid_vmid_mapping(dqm, 0, qpd->vmid);
 
diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_process.c b/drivers/gpu/drm/amd/amdkfd/kfd_process.c
index 2e16ee4..e8e4ddb 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_process.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_process.c
@@ -359,15 +359,6 @@ static void kfd_process_destroy_pdds(struct kfd_process *p)
 
 	list_for_each_entry_safe(pdd, temp, &p->per_device_data,
 				 per_device_list) {
-		/* In case of HWS, by now pasid:vmid mapping has been invalid,
-		 * so flushing tlb using PACKET3_INVALID_TLBS packet will cause
-		 * CP hang. Moreover, flushing tlb is not needed here as it has
-		 * been done by HWS when pasid:vmid is dissociated.
-		 * In summary, flushing tlb is only needed for non-HWS case.
-		 */
-		if (pdd->dev->dqm->sched_policy == KFD_SCHED_POLICY_NO_HWS)
-			kfd_flush_tlb(pdd->dev, p->pasid);
-
 		/* Destroy the GPUVM VM context */
 		if (pdd->vm) {
 			dma_fence_put(p->ef);
-- 
2.7.4