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 5aa3afc0e46832b1942766bb2515e2d45b0f5dc9 Mon Sep 17 00:00:00 2001
From: Felix Kuehling <Felix.Kuehling@amd.com>
Date: Thu, 19 May 2016 14:28:28 -0400
Subject: [PATCH 1138/4131] drm/amdkfd: Call destroy_mqd when queue is disabled
When a queue is disabled in update_queue, call destroy_mqd instead
of load_mqd. This will result in a proper dequeue request that
drains the currently running waves. When a new queue is created in
disabled state, don't load the MQD.
Change-Id: Ibf65125454df33c19b1078cc4b60cf16cd62d581
Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>
---
drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c | 18 ++++++++++++++----
1 file changed, 14 insertions(+), 4 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 c8fd16c..e04832f 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c
@@ -299,6 +299,9 @@ static int create_compute_queue_nocpsch(struct device_queue_manager *dqm,
dqm->dev->kfd2kgd->alloc_memory_of_scratch(
dqm->dev->kgd, qpd->sh_hidden_private_base, qpd->vmid);
+ if (!q->properties.is_active)
+ return 0;
+
retval = mqd->load_mqd(mqd, q->mqd, q->pipe,
q->queue, (uint32_t __user *) q->properties.write_ptr,
qpd->page_table_base);
@@ -416,10 +419,17 @@ static int update_queue(struct device_queue_manager *dqm, struct queue *q)
retval = mqd->update_mqd(mqd, q->mqd, &q->properties);
if (dqm->sched_policy == KFD_SCHED_POLICY_NO_HWS &&
- q->properties.type == KFD_QUEUE_TYPE_COMPUTE)
- retval = mqd->load_mqd(mqd, q->mqd, q->pipe,
- q->queue,
- (uint32_t __user *)q->properties.write_ptr, 0);
+ q->properties.type == KFD_QUEUE_TYPE_COMPUTE) {
+ /* FIXME: Handle SDMA queues as well */
+ if (q->properties.is_active)
+ retval = mqd->load_mqd(mqd, q->mqd, q->pipe,
+ q->queue,
+ (uint32_t __user *)q->properties.write_ptr, 0);
+ else if (prev_active)
+ retval = mqd->destroy_mqd(mqd, q->mqd,
+ KFD_PREEMPT_TYPE_WAVEFRONT_DRAIN,
+ KFD_UNMAP_LATENCY_MS, q->pipe, q->queue);
+ }
/*
* check active state vs. the previous state
* and modify counter accordingly
--
2.7.4
|