aboutsummaryrefslogtreecommitdiffstats
path: root/common/recipes-kernel/linux/files/0426-drm-amdgpu-make-last_handled_seq-atomic.patch
blob: e9c1d30b5744146748bcfaa4e275f3363f0e66d0 (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
From 63ad8d5882fcd466861fdbe51fc3a119b894d9a3 Mon Sep 17 00:00:00 2001
From: Jammy Zhou <Jammy.Zhou@amd.com>
Date: Fri, 31 Jul 2015 17:54:29 +0800
Subject: [PATCH 0426/1050] drm/amdgpu: make last_handled_seq atomic
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Signed-off-by: Jammy Zhou <Jammy.Zhou@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
---
 drivers/gpu/drm/amd/scheduler/gpu_scheduler.c | 6 +++---
 drivers/gpu/drm/amd/scheduler/gpu_scheduler.h | 2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/amd/scheduler/gpu_scheduler.c b/drivers/gpu/drm/amd/scheduler/gpu_scheduler.c
index 66938f1..55ebbf0 100644
--- a/drivers/gpu/drm/amd/scheduler/gpu_scheduler.c
+++ b/drivers/gpu/drm/amd/scheduler/gpu_scheduler.c
@@ -393,7 +393,7 @@ static int amd_sched_main(void *param)
 
 uint64_t amd_sched_get_handled_seq(struct amd_gpu_scheduler *sched)
 {
-	return sched->last_handled_seq;
+	return atomic64_read(&sched->last_handled_seq);
 }
 
 /**
@@ -414,7 +414,7 @@ void amd_sched_isr(struct amd_gpu_scheduler *sched)
 		job = NULL;
 
 	sched->ops->process_job(sched, job);
-	sched->last_handled_seq++;
+	atomic64_inc(&sched->last_handled_seq);
 	wake_up_interruptible(&sched->wait_queue);
 }
 
@@ -448,7 +448,7 @@ struct amd_gpu_scheduler *amd_sched_create(void *device,
 	sched->granularity = granularity;
 	sched->ring_id = ring;
 	sched->preemption = preemption;
-	sched->last_handled_seq = 0;
+	atomic64_set(&sched->last_handled_seq, 0);
 
 	snprintf(name, sizeof(name), "gpu_sched[%d]", ring);
 	mutex_init(&sched->sched_lock);
diff --git a/drivers/gpu/drm/amd/scheduler/gpu_scheduler.h b/drivers/gpu/drm/amd/scheduler/gpu_scheduler.h
index af2afdf..44f71cd 100644
--- a/drivers/gpu/drm/amd/scheduler/gpu_scheduler.h
+++ b/drivers/gpu/drm/amd/scheduler/gpu_scheduler.h
@@ -112,7 +112,7 @@ struct amd_gpu_scheduler {
 	uint32_t			ring_id;
 	uint32_t			granularity; /* in ms unit */
 	uint32_t			preemption;
-	uint64_t                        last_handled_seq;
+	atomic64_t			last_handled_seq;
 	wait_queue_head_t		wait_queue;
 	struct amd_context_entity	*current_entity;
 	struct mutex			sched_lock;
-- 
1.9.1