aboutsummaryrefslogtreecommitdiffstats
path: root/common/recipes-kernel/linux/linux-yocto-4.14.71/1775-drm-amdkfd-Finetune-the-queue-reset-scenario.patch
blob: 582be7d7f631ca3197bc3801cc9a07c138f3f5a1 (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
From f265103145feb0c08db012f31051ce29faf56ab3 Mon Sep 17 00:00:00 2001
From: Yong Zhao <Yong.Zhao@amd.com>
Date: Thu, 24 Aug 2017 16:36:04 -0400
Subject: [PATCH 1775/4131] drm/amdkfd: Finetune the queue reset scenario

In case of cswr disabled, when the process terminates or vm fault happens
for pre gfx9 chips, we choose to reset queues on the device anyway, given
by-pasid reset does not work well.

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

diff --git a/drivers/gpu/drm/amd/amdkfd/cik_event_interrupt.c b/drivers/gpu/drm/amd/amdkfd/cik_event_interrupt.c
index 2b93c32..5f122a1 100644
--- a/drivers/gpu/drm/amd/amdkfd/cik_event_interrupt.c
+++ b/drivers/gpu/drm/amd/amdkfd/cik_event_interrupt.c
@@ -97,7 +97,15 @@ static void cik_event_interrupt_wq(struct kfd_dev *dev,
 
 		memset(&info, 0, sizeof(info));
 		dev->kfd2kgd->get_vm_fault_info(dev->kgd, &info);
-		kfd_process_vm_fault(dev->dqm, ihre->pasid, false);
+		/* When CWSR is disabled, we choose to reset the device, which
+		 * will reset the queues from other processes on this device.
+		 * This is a bug that we accept given by-pasid reset does not
+		 * work well.
+		 */
+		if (dev->cwsr_enabled)
+			kfd_process_vm_fault(dev->dqm, ihre->pasid, false);
+		else
+			kfd_process_vm_fault(dev->dqm, ihre->pasid, true);
 		if (!info.page_addr && !info.status)
 			return;
 
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 461abb8..2796d9d 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c
@@ -1546,7 +1546,14 @@ static int process_termination_cpsch(struct device_queue_manager *dqm,
 		}
 	}
 
-	retval = execute_queues_cpsch(dqm, true, false);
+	/* When CWSR is disabled, we choose to reset the device, which will
+	 * reset the queues from other processes on this device. This is
+	 * a bug that we accept given by-pasid reset does not work well.
+	 */
+	if (dqm->dev->cwsr_enabled)
+		retval = execute_queues_cpsch(dqm, true, false);
+	else
+		retval = execute_queues_cpsch(dqm, true, true);
 
 	if (retval || qpd->reset_wavefronts) {
 		pr_warn("Resetting wave fronts (cpsch) on dev %p\n", dqm->dev);
-- 
2.7.4