summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDeepak Nibade <dnibade@nvidia.com>2017-03-31 06:49:41 -0400
committermobile promotions <svcmobile_promotions@nvidia.com>2017-04-03 11:55:19 -0400
commit42852f182a783e7bcd157fa0a9390c77e9376a60 (patch)
tree1a781297018d65c5ef9c5b5aa61b44639f5a0ae2
parent468d6888fc6db207cb239e270752f3f8f2f0ed87 (diff)
gpu: nvgpu: use nvgpu list for cycle stats snapshot clients
Use nvgpu list APIs instead of linux list APIs for cycle stats snapshot clients list Jira NVGPU-13 Change-Id: I124812b70ca8deb26ee1644d4d79cc404fd2aed9 Signed-off-by: Deepak Nibade <dnibade@nvidia.com> Reviewed-on: http://git-master/r/1454010 Reviewed-by: svccoveritychecker <svccoveritychecker@nvidia.com> GVS: Gerrit_Virtual_Submit Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
-rw-r--r--drivers/gpu/nvgpu/gk20a/css_gr_gk20a.c29
-rw-r--r--drivers/gpu/nvgpu/gk20a/css_gr_gk20a.h11
2 files changed, 21 insertions, 19 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/css_gr_gk20a.c b/drivers/gpu/nvgpu/gk20a/css_gr_gk20a.c
index 53d5f78d..640e6179 100644
--- a/drivers/gpu/nvgpu/gk20a/css_gr_gk20a.c
+++ b/drivers/gpu/nvgpu/gk20a/css_gr_gk20a.c
@@ -118,7 +118,7 @@ static int css_gr_create_shared_data(struct gr_gk20a *gr)
118 if (!data) 118 if (!data)
119 return -ENOMEM; 119 return -ENOMEM;
120 120
121 INIT_LIST_HEAD(&data->clients); 121 nvgpu_init_list_node(&data->clients);
122 gr->cs_data = data; 122 gr->cs_data = data;
123 123
124 return 0; 124 return 0;
@@ -243,14 +243,12 @@ static void css_gr_free_shared_data(struct gr_gk20a *gr)
243 243
244 244
245static struct gk20a_cs_snapshot_client* 245static struct gk20a_cs_snapshot_client*
246css_gr_search_client(struct list_head *clients, u32 perfmon) 246css_gr_search_client(struct nvgpu_list_node *clients, u32 perfmon)
247{ 247{
248 struct list_head *pos; 248 struct gk20a_cs_snapshot_client *client;
249 249
250 list_for_each(pos, clients) { 250 nvgpu_list_for_each_entry(client, clients,
251 struct gk20a_cs_snapshot_client *client = 251 gk20a_cs_snapshot_client, list) {
252 container_of(pos,
253 struct gk20a_cs_snapshot_client, list);
254 if (CONTAINS_PERFMON(client, perfmon)) 252 if (CONTAINS_PERFMON(client, perfmon))
255 return client; 253 return client;
256 } 254 }
@@ -284,7 +282,7 @@ static int css_gr_flush_snapshots(struct channel_gk20a *ch)
284 if (!css) 282 if (!css)
285 return -EINVAL; 283 return -EINVAL;
286 284
287 if (list_empty(&css->clients)) 285 if (nvgpu_list_empty(&css->clients))
288 return -EBADF; 286 return -EBADF;
289 287
290 /* check data available */ 288 /* check data available */
@@ -296,11 +294,8 @@ static int css_gr_flush_snapshots(struct channel_gk20a *ch)
296 return 0; 294 return 0;
297 295
298 if (hw_overflow) { 296 if (hw_overflow) {
299 struct list_head *pos; 297 nvgpu_list_for_each_entry(cur, &css->clients,
300 298 gk20a_cs_snapshot_client, list) {
301 list_for_each(pos, &css->clients) {
302 cur = container_of(pos,
303 struct gk20a_cs_snapshot_client, list);
304 cur->snapshot->hw_overflow_events_occured++; 299 cur->snapshot->hw_overflow_events_occured++;
305 } 300 }
306 301
@@ -445,7 +440,7 @@ static int css_gr_free_client_data(struct gk20a *g,
445 int ret = 0; 440 int ret = 0;
446 441
447 if (client->list.next && client->list.prev) 442 if (client->list.next && client->list.prev)
448 list_del(&client->list); 443 nvgpu_list_del(&client->list);
449 444
450 if (client->perfmon_start && client->perfmon_count 445 if (client->perfmon_start && client->perfmon_count
451 && g->ops.css.release_perfmon_ids) { 446 && g->ops.css.release_perfmon_ids) {
@@ -524,7 +519,7 @@ static int css_gr_create_client_data(struct gk20a *g,
524 } 519 }
525 } 520 }
526 521
527 list_add_tail(&cur->list, &data->clients); 522 nvgpu_list_add_tail(&cur->list, &data->clients);
528 *client = cur; 523 *client = cur;
529 524
530 return 0; 525 return 0;
@@ -590,7 +585,7 @@ failed:
590 *cs_client = NULL; 585 *cs_client = NULL;
591 } 586 }
592 587
593 if (list_empty(&gr->cs_data->clients)) 588 if (nvgpu_list_empty(&gr->cs_data->clients))
594 css_gr_free_shared_data(gr); 589 css_gr_free_shared_data(gr);
595 } 590 }
596 nvgpu_mutex_release(&gr->cs_lock); 591 nvgpu_mutex_release(&gr->cs_lock);
@@ -620,7 +615,7 @@ int gr_gk20a_css_detach(struct channel_gk20a *ch,
620 g->ops.css.detach_snapshot(ch, cs_client); 615 g->ops.css.detach_snapshot(ch, cs_client);
621 616
622 ret = css_gr_free_client_data(g, data, cs_client); 617 ret = css_gr_free_client_data(g, data, cs_client);
623 if (list_empty(&data->clients)) 618 if (nvgpu_list_empty(&data->clients))
624 css_gr_free_shared_data(gr); 619 css_gr_free_shared_data(gr);
625 } else { 620 } else {
626 ret = -EBADF; 621 ret = -EBADF;
diff --git a/drivers/gpu/nvgpu/gk20a/css_gr_gk20a.h b/drivers/gpu/nvgpu/gk20a/css_gr_gk20a.h
index be638abf..d6cea7c6 100644
--- a/drivers/gpu/nvgpu/gk20a/css_gr_gk20a.h
+++ b/drivers/gpu/nvgpu/gk20a/css_gr_gk20a.h
@@ -88,7 +88,7 @@ struct gk20a_cs_snapshot_fifo_entry {
88 88
89/* cycle stats snapshot client data (e.g. associated with channel) */ 89/* cycle stats snapshot client data (e.g. associated with channel) */
90struct gk20a_cs_snapshot_client { 90struct gk20a_cs_snapshot_client {
91 struct list_head list; 91 struct nvgpu_list_node list;
92 u32 dmabuf_fd; 92 u32 dmabuf_fd;
93 struct dma_buf *dma_handler; 93 struct dma_buf *dma_handler;
94 struct gk20a_cs_snapshot_fifo *snapshot; 94 struct gk20a_cs_snapshot_fifo *snapshot;
@@ -97,6 +97,13 @@ struct gk20a_cs_snapshot_client {
97 u32 perfmon_count; 97 u32 perfmon_count;
98}; 98};
99 99
100static inline struct gk20a_cs_snapshot_client *
101gk20a_cs_snapshot_client_from_list(struct nvgpu_list_node *node)
102{
103 return (struct gk20a_cs_snapshot_client *)
104 ((uintptr_t)node - offsetof(struct gk20a_cs_snapshot_client, list));
105};
106
100/* should correlate with size of gk20a_cs_snapshot_fifo_entry::perfmon_id */ 107/* should correlate with size of gk20a_cs_snapshot_fifo_entry::perfmon_id */
101#define CSS_MAX_PERFMON_IDS 256 108#define CSS_MAX_PERFMON_IDS 256
102 109
@@ -106,7 +113,7 @@ struct gk20a_cs_snapshot_client {
106/* cycle stats snapshot control structure for one HW entry and many clients */ 113/* cycle stats snapshot control structure for one HW entry and many clients */
107struct gk20a_cs_snapshot { 114struct gk20a_cs_snapshot {
108 unsigned long perfmon_ids[PM_BITMAP_SIZE]; 115 unsigned long perfmon_ids[PM_BITMAP_SIZE];
109 struct list_head clients; 116 struct nvgpu_list_node clients;
110 struct mem_desc hw_memdesc; 117 struct mem_desc hw_memdesc;
111 /* pointer to allocated cpu_va memory where GPU place data */ 118 /* pointer to allocated cpu_va memory where GPU place data */
112 struct gk20a_cs_snapshot_fifo_entry *hw_snapshot; 119 struct gk20a_cs_snapshot_fifo_entry *hw_snapshot;