diff options
author | Deepak Nibade <dnibade@nvidia.com> | 2017-04-11 08:18:00 -0400 |
---|---|---|
committer | mobile promotions <svcmobile_promotions@nvidia.com> | 2017-04-12 18:34:20 -0400 |
commit | f474a9e0e41d62f6a804c6501068da621556013e (patch) | |
tree | d440cd5a2be155a7013ddc8db47049fa772ec9b3 /drivers | |
parent | c3c3a3c5715d6aa38544922b76a636135429fd22 (diff) |
gpu: nvgpu: use nvgpu list for event id list
Use nvgpu list APIs instead of linux list APIs
to store event IDs into channel and TSGs
Jira NVGPU-13
Change-Id: I51e4b6ab3b38c845a870901b4d498927ca404a78
Signed-off-by: Deepak Nibade <dnibade@nvidia.com>
Reviewed-on: http://git-master/r/1460574
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/gpu/nvgpu/common/linux/ioctl_channel.c | 8 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/common/linux/ioctl_tsg.c | 8 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/channel_gk20a.c | 7 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/channel_gk20a.h | 11 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/tsg_gk20a.c | 7 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/tsg_gk20a.h | 2 |
6 files changed, 26 insertions, 17 deletions
diff --git a/drivers/gpu/nvgpu/common/linux/ioctl_channel.c b/drivers/gpu/nvgpu/common/linux/ioctl_channel.c index 0e121aa7..8da9eacb 100644 --- a/drivers/gpu/nvgpu/common/linux/ioctl_channel.c +++ b/drivers/gpu/nvgpu/common/linux/ioctl_channel.c | |||
@@ -574,13 +574,13 @@ static int gk20a_event_id_release(struct inode *inode, struct file *filp) | |||
574 | struct tsg_gk20a *tsg = g->fifo.tsg + event_id_data->id; | 574 | struct tsg_gk20a *tsg = g->fifo.tsg + event_id_data->id; |
575 | 575 | ||
576 | nvgpu_mutex_acquire(&tsg->event_id_list_lock); | 576 | nvgpu_mutex_acquire(&tsg->event_id_list_lock); |
577 | list_del_init(&event_id_data->event_id_node); | 577 | nvgpu_list_del(&event_id_data->event_id_node); |
578 | nvgpu_mutex_release(&tsg->event_id_list_lock); | 578 | nvgpu_mutex_release(&tsg->event_id_list_lock); |
579 | } else { | 579 | } else { |
580 | struct channel_gk20a *ch = g->fifo.channel + event_id_data->id; | 580 | struct channel_gk20a *ch = g->fifo.channel + event_id_data->id; |
581 | 581 | ||
582 | nvgpu_mutex_acquire(&ch->event_id_list_lock); | 582 | nvgpu_mutex_acquire(&ch->event_id_list_lock); |
583 | list_del_init(&event_id_data->event_id_node); | 583 | nvgpu_list_del(&event_id_data->event_id_node); |
584 | nvgpu_mutex_release(&ch->event_id_list_lock); | 584 | nvgpu_mutex_release(&ch->event_id_list_lock); |
585 | } | 585 | } |
586 | 586 | ||
@@ -697,10 +697,10 @@ static int gk20a_channel_event_id_enable(struct channel_gk20a *ch, | |||
697 | err = nvgpu_mutex_init(&event_id_data->lock); | 697 | err = nvgpu_mutex_init(&event_id_data->lock); |
698 | if (err) | 698 | if (err) |
699 | goto clean_up_free; | 699 | goto clean_up_free; |
700 | INIT_LIST_HEAD(&event_id_data->event_id_node); | 700 | nvgpu_init_list_node(&event_id_data->event_id_node); |
701 | 701 | ||
702 | nvgpu_mutex_acquire(&ch->event_id_list_lock); | 702 | nvgpu_mutex_acquire(&ch->event_id_list_lock); |
703 | list_add_tail(&event_id_data->event_id_node, &ch->event_id_list); | 703 | nvgpu_list_add_tail(&event_id_data->event_id_node, &ch->event_id_list); |
704 | nvgpu_mutex_release(&ch->event_id_list_lock); | 704 | nvgpu_mutex_release(&ch->event_id_list_lock); |
705 | 705 | ||
706 | fd_install(local_fd, file); | 706 | fd_install(local_fd, file); |
diff --git a/drivers/gpu/nvgpu/common/linux/ioctl_tsg.c b/drivers/gpu/nvgpu/common/linux/ioctl_tsg.c index 55a909dd..433b7c5d 100644 --- a/drivers/gpu/nvgpu/common/linux/ioctl_tsg.c +++ b/drivers/gpu/nvgpu/common/linux/ioctl_tsg.c | |||
@@ -55,8 +55,8 @@ static int gk20a_tsg_get_event_data_from_id(struct tsg_gk20a *tsg, | |||
55 | bool event_found = false; | 55 | bool event_found = false; |
56 | 56 | ||
57 | nvgpu_mutex_acquire(&tsg->event_id_list_lock); | 57 | nvgpu_mutex_acquire(&tsg->event_id_list_lock); |
58 | list_for_each_entry(local_event_id_data, &tsg->event_id_list, | 58 | nvgpu_list_for_each_entry(local_event_id_data, &tsg->event_id_list, |
59 | event_id_node) { | 59 | gk20a_event_id_data, event_id_node) { |
60 | if (local_event_id_data->event_id == event_id) { | 60 | if (local_event_id_data->event_id == event_id) { |
61 | event_found = true; | 61 | event_found = true; |
62 | break; | 62 | break; |
@@ -148,10 +148,10 @@ static int gk20a_tsg_event_id_enable(struct tsg_gk20a *tsg, | |||
148 | if (err) | 148 | if (err) |
149 | goto clean_up_free; | 149 | goto clean_up_free; |
150 | 150 | ||
151 | INIT_LIST_HEAD(&event_id_data->event_id_node); | 151 | nvgpu_init_list_node(&event_id_data->event_id_node); |
152 | 152 | ||
153 | nvgpu_mutex_acquire(&tsg->event_id_list_lock); | 153 | nvgpu_mutex_acquire(&tsg->event_id_list_lock); |
154 | list_add_tail(&event_id_data->event_id_node, &tsg->event_id_list); | 154 | nvgpu_list_add_tail(&event_id_data->event_id_node, &tsg->event_id_list); |
155 | nvgpu_mutex_release(&tsg->event_id_list_lock); | 155 | nvgpu_mutex_release(&tsg->event_id_list_lock); |
156 | 156 | ||
157 | fd_install(local_fd, file); | 157 | fd_install(local_fd, file); |
diff --git a/drivers/gpu/nvgpu/gk20a/channel_gk20a.c b/drivers/gpu/nvgpu/gk20a/channel_gk20a.c index 88600f46..b729e0f8 100644 --- a/drivers/gpu/nvgpu/gk20a/channel_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/channel_gk20a.c | |||
@@ -828,10 +828,11 @@ struct channel_gk20a *gk20a_open_new_channel(struct gk20a *g, | |||
828 | 828 | ||
829 | /* unhook all events created on this channel */ | 829 | /* unhook all events created on this channel */ |
830 | nvgpu_mutex_acquire(&ch->event_id_list_lock); | 830 | nvgpu_mutex_acquire(&ch->event_id_list_lock); |
831 | list_for_each_entry_safe(event_id_data, event_id_data_temp, | 831 | nvgpu_list_for_each_entry_safe(event_id_data, event_id_data_temp, |
832 | &ch->event_id_list, | 832 | &ch->event_id_list, |
833 | gk20a_event_id_data, | ||
833 | event_id_node) { | 834 | event_id_node) { |
834 | list_del_init(&event_id_data->event_id_node); | 835 | nvgpu_list_del(&event_id_data->event_id_node); |
835 | } | 836 | } |
836 | nvgpu_mutex_release(&ch->event_id_list_lock); | 837 | nvgpu_mutex_release(&ch->event_id_list_lock); |
837 | 838 | ||
@@ -2644,7 +2645,7 @@ int gk20a_init_channel_support(struct gk20a *g, u32 chid) | |||
2644 | 2645 | ||
2645 | INIT_LIST_HEAD(&c->joblist.dynamic.jobs); | 2646 | INIT_LIST_HEAD(&c->joblist.dynamic.jobs); |
2646 | nvgpu_init_list_node(&c->dbg_s_list); | 2647 | nvgpu_init_list_node(&c->dbg_s_list); |
2647 | INIT_LIST_HEAD(&c->event_id_list); | 2648 | nvgpu_init_list_node(&c->event_id_list); |
2648 | INIT_LIST_HEAD(&c->worker_item); | 2649 | INIT_LIST_HEAD(&c->worker_item); |
2649 | 2650 | ||
2650 | err = nvgpu_mutex_init(&c->ioctl_lock); | 2651 | err = nvgpu_mutex_init(&c->ioctl_lock); |
diff --git a/drivers/gpu/nvgpu/gk20a/channel_gk20a.h b/drivers/gpu/nvgpu/gk20a/channel_gk20a.h index 223aa641..0514c5b8 100644 --- a/drivers/gpu/nvgpu/gk20a/channel_gk20a.h +++ b/drivers/gpu/nvgpu/gk20a/channel_gk20a.h | |||
@@ -109,7 +109,14 @@ struct gk20a_event_id_data { | |||
109 | 109 | ||
110 | wait_queue_head_t event_id_wq; | 110 | wait_queue_head_t event_id_wq; |
111 | struct nvgpu_mutex lock; | 111 | struct nvgpu_mutex lock; |
112 | struct list_head event_id_node; | 112 | struct nvgpu_list_node event_id_node; |
113 | }; | ||
114 | |||
115 | static inline struct gk20a_event_id_data * | ||
116 | gk20a_event_id_data_from_event_id_node(struct nvgpu_list_node *node) | ||
117 | { | ||
118 | return (struct gk20a_event_id_data *) | ||
119 | ((uintptr_t)node - offsetof(struct gk20a_event_id_data, event_id_node)); | ||
113 | }; | 120 | }; |
114 | 121 | ||
115 | /* | 122 | /* |
@@ -226,7 +233,7 @@ struct channel_gk20a { | |||
226 | struct nvgpu_mutex dbg_s_lock; | 233 | struct nvgpu_mutex dbg_s_lock; |
227 | struct nvgpu_list_node dbg_s_list; | 234 | struct nvgpu_list_node dbg_s_list; |
228 | 235 | ||
229 | struct list_head event_id_list; | 236 | struct nvgpu_list_node event_id_list; |
230 | struct nvgpu_mutex event_id_list_lock; | 237 | struct nvgpu_mutex event_id_list_lock; |
231 | 238 | ||
232 | bool has_timedout; | 239 | bool has_timedout; |
diff --git a/drivers/gpu/nvgpu/gk20a/tsg_gk20a.c b/drivers/gpu/nvgpu/gk20a/tsg_gk20a.c index 5f07ade7..d1e667b6 100644 --- a/drivers/gpu/nvgpu/gk20a/tsg_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/tsg_gk20a.c | |||
@@ -145,7 +145,7 @@ int gk20a_init_tsg_support(struct gk20a *g, u32 tsgid) | |||
145 | nvgpu_init_list_node(&tsg->ch_list); | 145 | nvgpu_init_list_node(&tsg->ch_list); |
146 | init_rwsem(&tsg->ch_list_lock); | 146 | init_rwsem(&tsg->ch_list_lock); |
147 | 147 | ||
148 | INIT_LIST_HEAD(&tsg->event_id_list); | 148 | nvgpu_init_list_node(&tsg->event_id_list); |
149 | err = nvgpu_mutex_init(&tsg->event_id_list_lock); | 149 | err = nvgpu_mutex_init(&tsg->event_id_list_lock); |
150 | if (err) { | 150 | if (err) { |
151 | tsg->in_use = true; /* make this TSG unusable */ | 151 | tsg->in_use = true; /* make this TSG unusable */ |
@@ -297,10 +297,11 @@ void gk20a_tsg_release(struct kref *ref) | |||
297 | 297 | ||
298 | /* unhook all events created on this TSG */ | 298 | /* unhook all events created on this TSG */ |
299 | nvgpu_mutex_acquire(&tsg->event_id_list_lock); | 299 | nvgpu_mutex_acquire(&tsg->event_id_list_lock); |
300 | list_for_each_entry_safe(event_id_data, event_id_data_temp, | 300 | nvgpu_list_for_each_entry_safe(event_id_data, event_id_data_temp, |
301 | &tsg->event_id_list, | 301 | &tsg->event_id_list, |
302 | gk20a_event_id_data, | ||
302 | event_id_node) { | 303 | event_id_node) { |
303 | list_del_init(&event_id_data->event_id_node); | 304 | nvgpu_list_del(&event_id_data->event_id_node); |
304 | } | 305 | } |
305 | nvgpu_mutex_release(&tsg->event_id_list_lock); | 306 | nvgpu_mutex_release(&tsg->event_id_list_lock); |
306 | 307 | ||
diff --git a/drivers/gpu/nvgpu/gk20a/tsg_gk20a.h b/drivers/gpu/nvgpu/gk20a/tsg_gk20a.h index 730a80b6..178b8672 100644 --- a/drivers/gpu/nvgpu/gk20a/tsg_gk20a.h +++ b/drivers/gpu/nvgpu/gk20a/tsg_gk20a.h | |||
@@ -52,7 +52,7 @@ struct tsg_gk20a { | |||
52 | 52 | ||
53 | u32 interleave_level; | 53 | u32 interleave_level; |
54 | 54 | ||
55 | struct list_head event_id_list; | 55 | struct nvgpu_list_node event_id_list; |
56 | struct nvgpu_mutex event_id_list_lock; | 56 | struct nvgpu_mutex event_id_list_lock; |
57 | 57 | ||
58 | u32 runlist_id; | 58 | u32 runlist_id; |