summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/include
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu/nvgpu/include')
-rw-r--r--drivers/gpu/nvgpu/include/nvgpu/comptags.h57
1 files changed, 57 insertions, 0 deletions
diff --git a/drivers/gpu/nvgpu/include/nvgpu/comptags.h b/drivers/gpu/nvgpu/include/nvgpu/comptags.h
new file mode 100644
index 00000000..6e3062ec
--- /dev/null
+++ b/drivers/gpu/nvgpu/include/nvgpu/comptags.h
@@ -0,0 +1,57 @@
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_COMPTAGS__
18#define __NVGPU_COMPTAGS__
19
20#include <nvgpu/lock.h>
21
22struct gk20a;
23
24struct gk20a_comptags {
25 u32 offset;
26 u32 lines;
27 u32 allocated_lines;
28 bool user_mappable;
29};
30
31struct gk20a_comptag_allocator {
32 struct gk20a *g;
33
34 struct nvgpu_mutex lock;
35
36 /* This bitmap starts at ctag 1. 0th cannot be taken. */
37 unsigned long *bitmap;
38
39 /* Size of bitmap, not max ctags, so one less. */
40 unsigned long size;
41};
42
43/* real size here, but first (ctag 0) isn't used */
44int gk20a_comptag_allocator_init(struct gk20a *g,
45 struct gk20a_comptag_allocator *allocator,
46 unsigned long size);
47void gk20a_comptag_allocator_destroy(struct gk20a *g,
48 struct gk20a_comptag_allocator *allocator);
49
50int gk20a_comptaglines_alloc(struct gk20a_comptag_allocator *allocator,
51 u32 *offset, u32 len);
52void gk20a_comptaglines_free(struct gk20a_comptag_allocator *allocator,
53 u32 offset, u32 len);
54
55
56
57#endif