summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/include
diff options
context:
space:
mode:
authorAlex Waterman <alexw@nvidia.com>2017-09-07 18:27:55 -0400
committermobile promotions <svcmobile_promotions@nvidia.com>2017-10-18 19:00:37 -0400
commitb3446bc0b6fca6cb992667f80a95f8503b6a652a (patch)
tree9882c36bfaef83da9d0a6eefec5e8c3564b93cea /drivers/gpu/nvgpu/include
parentbee9c830c7898ceebf8c396b40598350229a7203 (diff)
gpu: nvgpu: Move dma_buf usage from mm_gk20a.c
Move most of the dma_buf usage present in the mm_gk20a.c code out to Linux specific code and some commom/mm code. There's two primary groups of code: 1. dma_buf priv field code (for holding comptag data) 2. Comptag usage that relies on dma_buf pointers For (1) the dma_buf code was simply moved to common/linux/dmabuf.c since most of this code is clearly Linux specific. The comptag code was a bit more complicated since there is two parts to the comptag code. Firstly there's the code that manages the comptag memory. This is essentially a simple allocator. This was moved to common/mm/comptags.c since it can be shared across all chips. The second set of code is moved to common/linux/comptags.c since it is the interface between dma_bufs and the comptag memory. Two other fixes were done as well: - Add struct gk20a to the comptag allocator init so that the proper nvgpu_vzalloc() function could be used. - Add necessary includes to common/linux/vm_priv.h. JIRA NVGPU-30 JIRA NVGPU-138 Change-Id: I96c57f2763e5ebe18a2f2ee4b33e0e1a2597848c Signed-off-by: Alex Waterman <alexw@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/1566628 Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com> Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
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