summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/gk20a/css_gr_gk20a.c
diff options
context:
space:
mode:
authorDeepak Nibade <dnibade@nvidia.com>2017-01-24 08:30:42 -0500
committermobile promotions <svcmobile_promotions@nvidia.com>2017-02-22 07:15:02 -0500
commit8ee3aa4b3175d8d27e57a0f5d5e2cdf3d78a4a58 (patch)
tree505dfd2ea2aca2f1cbdb254baee980862d21e04d /drivers/gpu/nvgpu/gk20a/css_gr_gk20a.c
parent1f855af63fdd31fe3dcfee75f4f5f9b62f30d87e (diff)
gpu: nvgpu: use common nvgpu mutex/spinlock APIs
Instead of using Linux APIs for mutex and spinlocks directly, use new APIs defined in <nvgpu/lock.h> Replace Linux specific mutex/spinlock declaration, init, lock, unlock APIs with new APIs e.g struct mutex is replaced by struct nvgpu_mutex and mutex_lock() is replaced by nvgpu_mutex_acquire() And also include <nvgpu/lock.h> instead of including <linux/mutex.h> and <linux/spinlock.h> Add explicit nvgpu/lock.h includes to below files to fix complilation failures. gk20a/platform_gk20a.h include/nvgpu/allocator.h Jira NVGPU-13 Change-Id: I81a05d21ecdbd90c2076a9f0aefd0e40b215bd33 Signed-off-by: Deepak Nibade <dnibade@nvidia.com> Reviewed-on: http://git-master/r/1293187 Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com> Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/gk20a/css_gr_gk20a.c')
-rw-r--r--drivers/gpu/nvgpu/gk20a/css_gr_gk20a.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/css_gr_gk20a.c b/drivers/gpu/nvgpu/gk20a/css_gr_gk20a.c
index aa92796c..4bc7ee52 100644
--- a/drivers/gpu/nvgpu/gk20a/css_gr_gk20a.c
+++ b/drivers/gpu/nvgpu/gk20a/css_gr_gk20a.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * GK20A Cycle stats snapshots support (subsystem for gr_gk20a). 2 * GK20A Cycle stats snapshots support (subsystem for gr_gk20a).
3 * 3 *
4 * Copyright (c) 2015-2016, NVIDIA CORPORATION. All rights reserved. 4 * Copyright (c) 2015-2017, NVIDIA CORPORATION. All rights reserved.
5 * 5 *
6 * This program is free software; you can redistribute it and/or modify it 6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms and conditions of the GNU General Public License, 7 * under the terms and conditions of the GNU General Public License,
@@ -19,7 +19,7 @@
19#include <linux/bitops.h> 19#include <linux/bitops.h>
20#include <linux/dma-mapping.h> 20#include <linux/dma-mapping.h>
21#include <linux/dma-buf.h> 21#include <linux/dma-buf.h>
22#include <linux/mutex.h> 22#include <nvgpu/lock.h>
23#include <linux/vmalloc.h> 23#include <linux/vmalloc.h>
24 24
25#include "gk20a.h" 25#include "gk20a.h"
@@ -557,7 +557,7 @@ int gr_gk20a_css_attach(struct channel_gk20a *ch,
557 gr = &g->gr; 557 gr = &g->gr;
558 *cs_client = NULL; 558 *cs_client = NULL;
559 559
560 mutex_lock(&gr->cs_lock); 560 nvgpu_mutex_acquire(&gr->cs_lock);
561 561
562 ret = css_gr_create_shared_data(gr); 562 ret = css_gr_create_shared_data(gr);
563 if (ret) 563 if (ret)
@@ -577,7 +577,7 @@ int gr_gk20a_css_attach(struct channel_gk20a *ch,
577 if (perfmon_start) 577 if (perfmon_start)
578 *perfmon_start = (*cs_client)->perfmon_start; 578 *perfmon_start = (*cs_client)->perfmon_start;
579 579
580 mutex_unlock(&gr->cs_lock); 580 nvgpu_mutex_release(&gr->cs_lock);
581 581
582 return 0; 582 return 0;
583 583
@@ -591,7 +591,7 @@ failed:
591 if (list_empty(&gr->cs_data->clients)) 591 if (list_empty(&gr->cs_data->clients))
592 css_gr_free_shared_data(gr); 592 css_gr_free_shared_data(gr);
593 } 593 }
594 mutex_unlock(&gr->cs_lock); 594 nvgpu_mutex_release(&gr->cs_lock);
595 595
596 if (perfmon_start) 596 if (perfmon_start)
597 *perfmon_start = 0; 597 *perfmon_start = 0;
@@ -610,7 +610,7 @@ int gr_gk20a_css_detach(struct channel_gk20a *ch,
610 return -EINVAL; 610 return -EINVAL;
611 611
612 gr = &g->gr; 612 gr = &g->gr;
613 mutex_lock(&gr->cs_lock); 613 nvgpu_mutex_acquire(&gr->cs_lock);
614 if (gr->cs_data) { 614 if (gr->cs_data) {
615 struct gk20a_cs_snapshot *data = gr->cs_data; 615 struct gk20a_cs_snapshot *data = gr->cs_data;
616 616
@@ -623,7 +623,7 @@ int gr_gk20a_css_detach(struct channel_gk20a *ch,
623 } else { 623 } else {
624 ret = -EBADF; 624 ret = -EBADF;
625 } 625 }
626 mutex_unlock(&gr->cs_lock); 626 nvgpu_mutex_release(&gr->cs_lock);
627 627
628 return ret; 628 return ret;
629} 629}
@@ -639,9 +639,9 @@ int gr_gk20a_css_flush(struct channel_gk20a *ch,
639 return -EINVAL; 639 return -EINVAL;
640 640
641 gr = &g->gr; 641 gr = &g->gr;
642 mutex_lock(&gr->cs_lock); 642 nvgpu_mutex_acquire(&gr->cs_lock);
643 ret = css_gr_flush_snapshots(ch); 643 ret = css_gr_flush_snapshots(ch);
644 mutex_unlock(&gr->cs_lock); 644 nvgpu_mutex_release(&gr->cs_lock);
645 645
646 return ret; 646 return ret;
647} 647}
@@ -651,10 +651,10 @@ void gr_gk20a_free_cyclestats_snapshot_data(struct gk20a *g)
651{ 651{
652 struct gr_gk20a *gr = &g->gr; 652 struct gr_gk20a *gr = &g->gr;
653 653
654 mutex_lock(&gr->cs_lock); 654 nvgpu_mutex_acquire(&gr->cs_lock);
655 css_gr_free_shared_data(gr); 655 css_gr_free_shared_data(gr);
656 mutex_unlock(&gr->cs_lock); 656 nvgpu_mutex_release(&gr->cs_lock);
657 mutex_destroy(&gr->cs_lock); 657 nvgpu_mutex_destroy(&gr->cs_lock);
658} 658}
659 659
660static int css_hw_check_data_available(struct channel_gk20a *ch, u32 *pending, 660static int css_hw_check_data_available(struct channel_gk20a *ch, u32 *pending,