summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/include/nvgpu/lock.h
diff options
context:
space:
mode:
authorDeepak Nibade <dnibade@nvidia.com>2017-01-24 06:11:51 -0500
committermobile promotions <svcmobile_promotions@nvidia.com>2017-02-22 07:14:57 -0500
commit1f855af63fdd31fe3dcfee75f4f5f9b62f30d87e (patch)
tree05e3276d6b5622c1b6bbe18ddb8bfcd5f64b12ae /drivers/gpu/nvgpu/include/nvgpu/lock.h
parent76611c4268dec892b170fb245badfca5319fd645 (diff)
gpu: nvgpu: add mutex and spinlock abstraction files
Add new abstraction file <nvgpu/lock.h> for all mutex, spinlock and raw_spinlock operations. Add linux specific file <nvgpu/lock_linux.h> which implements linux specific operations for above Jira NVGPU-13 Change-Id: Idab96aa8bf949d6a92ea0edc9f40e90fca401ea4 Signed-off-by: Deepak Nibade <dnibade@nvidia.com> Reviewed-on: http://git-master/r/1293186 GVS: Gerrit_Virtual_Submit Reviewed-by: Konsta Holtta <kholtta@nvidia.com> Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/include/nvgpu/lock.h')
-rw-r--r--drivers/gpu/nvgpu/include/nvgpu/lock.h63
1 files changed, 63 insertions, 0 deletions
diff --git a/drivers/gpu/nvgpu/include/nvgpu/lock.h b/drivers/gpu/nvgpu/include/nvgpu/lock.h
new file mode 100644
index 00000000..ad070380
--- /dev/null
+++ b/drivers/gpu/nvgpu/include/nvgpu/lock.h
@@ -0,0 +1,63 @@
1/*
2 * Copyright (c) 2017, NVIDIA CORPORATION. All rights reserved.
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms and conditions of the GNU General Public License,
6 * version 2, as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope it will be useful, but WITHOUT
9 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
11 * more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17#ifndef NVGPU_LOCK_H
18#define NVGPU_LOCK_H
19
20#include <nvgpu/lock_linux.h>
21
22/*
23 * struct nvgpu_mutex
24 *
25 * Should be implemented per-OS in a separate library
26 * But implementation should adhere to mutex implementation
27 * as specified in Linux Documentation
28 */
29struct nvgpu_mutex;
30
31/*
32 * struct nvgpu_spinlock
33 *
34 * Should be implemented per-OS in a separate library
35 * But implementation should adhere to spinlock implementation
36 * as specified in Linux Documentation
37 */
38struct nvgpu_spinlock;
39
40/*
41 * struct nvgpu_raw_spinlock
42 *
43 * Should be implemented per-OS in a separate library
44 * But implementation should adhere to raw_spinlock implementation
45 * as specified in Linux Documentation
46 */
47struct nvgpu_raw_spinlock;
48
49int nvgpu_mutex_init(struct nvgpu_mutex *mutex);
50void nvgpu_mutex_acquire(struct nvgpu_mutex *mutex);
51void nvgpu_mutex_release(struct nvgpu_mutex *mutex);
52int nvgpu_mutex_tryacquire(struct nvgpu_mutex *mutex);
53void nvgpu_mutex_destroy(struct nvgpu_mutex *mutex);
54
55void nvgpu_spinlock_init(struct nvgpu_spinlock *spinlock);
56void nvgpu_spinlock_acquire(struct nvgpu_spinlock *spinlock);
57void nvgpu_spinlock_release(struct nvgpu_spinlock *spinlock);
58
59void nvgpu_raw_spinlock_init(struct nvgpu_raw_spinlock *spinlock);
60void nvgpu_raw_spinlock_acquire(struct nvgpu_raw_spinlock *spinlock);
61void nvgpu_raw_spinlock_release(struct nvgpu_raw_spinlock *spinlock);
62
63#endif /* NVGPU_LOCK_H */