summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu
diff options
context:
space:
mode:
authorDeepak Nibade <dnibade@nvidia.com>2017-04-11 08:32:12 -0400
committermobile promotions <svcmobile_promotions@nvidia.com>2017-04-12 18:34:31 -0400
commit50f5fd2cb02553291e52bb0e7f3c9e78a0b8eef1 (patch)
treedbcdcc34731dd8525b1bd462003f89c618458abf /drivers/gpu/nvgpu
parenta6adaaab7a90d86a71943f9977920ad7f726cea8 (diff)
gpu: nvgpu: use nvgpu list for dynamic joblist
Use nvgpu list APIs instead of linux list APIs for dynamic joblist Jira NVGPU-13 Change-Id: I53779037589b1b6260d877d3bc9bd611ea9831ba Signed-off-by: Deepak Nibade <dnibade@nvidia.com> Reviewed-on: http://git-master/r/1460576 Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com> Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu')
-rw-r--r--drivers/gpu/nvgpu/gk20a/channel_gk20a.c19
-rw-r--r--drivers/gpu/nvgpu/gk20a/channel_gk20a.h11
2 files changed, 19 insertions, 11 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/channel_gk20a.c b/drivers/gpu/nvgpu/gk20a/channel_gk20a.c
index f5ba9e50..77d9dc60 100644
--- a/drivers/gpu/nvgpu/gk20a/channel_gk20a.c
+++ b/drivers/gpu/nvgpu/gk20a/channel_gk20a.c
@@ -243,8 +243,9 @@ void gk20a_channel_abort_clean_up(struct channel_gk20a *ch)
243 tmp_get = (tmp_get + 1) % ch->joblist.pre_alloc.length; 243 tmp_get = (tmp_get + 1) % ch->joblist.pre_alloc.length;
244 } 244 }
245 } else { 245 } else {
246 list_for_each_entry_safe(job, n, 246 nvgpu_list_for_each_entry_safe(job, n,
247 &ch->joblist.dynamic.jobs, list) { 247 &ch->joblist.dynamic.jobs,
248 channel_gk20a_job, list) {
248 if (job->post_fence->semaphore) { 249 if (job->post_fence->semaphore) {
249 __nvgpu_semaphore_release( 250 __nvgpu_semaphore_release(
250 job->post_fence->semaphore, true); 251 job->post_fence->semaphore, true);
@@ -1079,9 +1080,9 @@ static struct channel_gk20a_job *channel_gk20a_joblist_peek(
1079 job = &c->joblist.pre_alloc.jobs[get]; 1080 job = &c->joblist.pre_alloc.jobs[get];
1080 } 1081 }
1081 } else { 1082 } else {
1082 if (!list_empty(&c->joblist.dynamic.jobs)) 1083 if (!nvgpu_list_empty(&c->joblist.dynamic.jobs))
1083 job = list_first_entry(&c->joblist.dynamic.jobs, 1084 job = nvgpu_list_first_entry(&c->joblist.dynamic.jobs,
1084 struct channel_gk20a_job, list); 1085 channel_gk20a_job, list);
1085 } 1086 }
1086 1087
1087 return job; 1088 return job;
@@ -1094,7 +1095,7 @@ static void channel_gk20a_joblist_add(struct channel_gk20a *c,
1094 c->joblist.pre_alloc.put = (c->joblist.pre_alloc.put + 1) % 1095 c->joblist.pre_alloc.put = (c->joblist.pre_alloc.put + 1) %
1095 (c->joblist.pre_alloc.length); 1096 (c->joblist.pre_alloc.length);
1096 } else { 1097 } else {
1097 list_add_tail(&job->list, &c->joblist.dynamic.jobs); 1098 nvgpu_list_add_tail(&job->list, &c->joblist.dynamic.jobs);
1098 } 1099 }
1099} 1100}
1100 1101
@@ -1105,7 +1106,7 @@ static void channel_gk20a_joblist_delete(struct channel_gk20a *c,
1105 c->joblist.pre_alloc.get = (c->joblist.pre_alloc.get + 1) % 1106 c->joblist.pre_alloc.get = (c->joblist.pre_alloc.get + 1) %
1106 (c->joblist.pre_alloc.length); 1107 (c->joblist.pre_alloc.length);
1107 } else { 1108 } else {
1108 list_del_init(&job->list); 1109 nvgpu_list_del(&job->list);
1109 } 1110 }
1110} 1111}
1111 1112
@@ -1117,7 +1118,7 @@ bool channel_gk20a_joblist_is_empty(struct channel_gk20a *c)
1117 return !(CIRC_CNT(put, get, c->joblist.pre_alloc.length)); 1118 return !(CIRC_CNT(put, get, c->joblist.pre_alloc.length));
1118 } 1119 }
1119 1120
1120 return list_empty(&c->joblist.dynamic.jobs); 1121 return nvgpu_list_empty(&c->joblist.dynamic.jobs);
1121} 1122}
1122 1123
1123bool channel_gk20a_is_prealloc_enabled(struct channel_gk20a *c) 1124bool channel_gk20a_is_prealloc_enabled(struct channel_gk20a *c)
@@ -2644,7 +2645,7 @@ int gk20a_init_channel_support(struct gk20a *g, u32 chid)
2644 nvgpu_spinlock_init(&c->joblist.dynamic.lock); 2645 nvgpu_spinlock_init(&c->joblist.dynamic.lock);
2645 nvgpu_raw_spinlock_init(&c->timeout.lock); 2646 nvgpu_raw_spinlock_init(&c->timeout.lock);
2646 2647
2647 INIT_LIST_HEAD(&c->joblist.dynamic.jobs); 2648 nvgpu_init_list_node(&c->joblist.dynamic.jobs);
2648 nvgpu_init_list_node(&c->dbg_s_list); 2649 nvgpu_init_list_node(&c->dbg_s_list);
2649 nvgpu_init_list_node(&c->event_id_list); 2650 nvgpu_init_list_node(&c->event_id_list);
2650 nvgpu_init_list_node(&c->worker_item); 2651 nvgpu_init_list_node(&c->worker_item);
diff --git a/drivers/gpu/nvgpu/gk20a/channel_gk20a.h b/drivers/gpu/nvgpu/gk20a/channel_gk20a.h
index d52c1b6f..3312f8f1 100644
--- a/drivers/gpu/nvgpu/gk20a/channel_gk20a.h
+++ b/drivers/gpu/nvgpu/gk20a/channel_gk20a.h
@@ -65,7 +65,14 @@ struct channel_gk20a_job {
65 struct gk20a_fence *post_fence; 65 struct gk20a_fence *post_fence;
66 struct priv_cmd_entry *wait_cmd; 66 struct priv_cmd_entry *wait_cmd;
67 struct priv_cmd_entry *incr_cmd; 67 struct priv_cmd_entry *incr_cmd;
68 struct list_head list; 68 struct nvgpu_list_node list;
69};
70
71static inline struct channel_gk20a_job *
72channel_gk20a_job_from_list(struct nvgpu_list_node *node)
73{
74 return (struct channel_gk20a_job *)
75 ((uintptr_t)node - offsetof(struct channel_gk20a_job, list));
69}; 76};
70 77
71struct channel_gk20a_joblist { 78struct channel_gk20a_joblist {
@@ -79,7 +86,7 @@ struct channel_gk20a_joblist {
79 } pre_alloc; 86 } pre_alloc;
80 87
81 struct { 88 struct {
82 struct list_head jobs; 89 struct nvgpu_list_node jobs;
83 struct nvgpu_spinlock lock; 90 struct nvgpu_spinlock lock;
84 } dynamic; 91 } dynamic;
85 92