diff options
author | Alex Waterman <alexw@nvidia.com> | 2017-04-10 17:04:15 -0400 |
---|---|---|
committer | mobile promotions <svcmobile_promotions@nvidia.com> | 2017-05-11 09:04:12 -0400 |
commit | c3fa78b1d9cba28547ca59154207d434931ae746 (patch) | |
tree | 42117714f2d8dd217229e6c183d4b6affd29c7d1 /drivers/gpu/nvgpu/include | |
parent | 36c1fdccc994d337fc15dd2b67ff05435f37dec9 (diff) |
gpu: nvgpu: Separate GMMU out of mm_gk20a.c
Begin moving (and renaming) the GMMU code into common/mm/gmmu.c. This
block of code will be responsible for handling the platform/OS
independent GMMU operations.
JIRA NVGPU-12
JIRA NVGPU-30
Change-Id: Ide761bab75e5d84be3dcb977c4842ae4b3a7c1b3
Signed-off-by: Alex Waterman <alexw@nvidia.com>
Reviewed-on: http://git-master/r/1464083
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/dma.h | 5 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/include/nvgpu/gmmu.h | 69 |
2 files changed, 74 insertions, 0 deletions
diff --git a/drivers/gpu/nvgpu/include/nvgpu/dma.h b/drivers/gpu/nvgpu/include/nvgpu/dma.h index 43cff215..1c6474e7 100644 --- a/drivers/gpu/nvgpu/include/nvgpu/dma.h +++ b/drivers/gpu/nvgpu/include/nvgpu/dma.h | |||
@@ -197,6 +197,11 @@ void nvgpu_dma_free(struct gk20a *g, struct nvgpu_mem *mem); | |||
197 | * Note this is different than mapping it into the CPU. This memory can be | 197 | * Note this is different than mapping it into the CPU. This memory can be |
198 | * either placed in VIDMEM or SYSMEM, which ever is more convenient for the | 198 | * either placed in VIDMEM or SYSMEM, which ever is more convenient for the |
199 | * driver. | 199 | * driver. |
200 | * | ||
201 | * Note: currently a bug exists in the nvgpu_dma_alloc_map*() routines: you | ||
202 | * cannot use nvgpu_gmmu_map() on said buffer - it will overwrite the necessary | ||
203 | * information for the DMA unmap routines to actually unmap the buffer. You | ||
204 | * will either leak mappings or see GMMU faults. | ||
200 | */ | 205 | */ |
201 | int nvgpu_dma_alloc_map(struct vm_gk20a *vm, size_t size, | 206 | int nvgpu_dma_alloc_map(struct vm_gk20a *vm, size_t size, |
202 | struct nvgpu_mem *mem); | 207 | struct nvgpu_mem *mem); |
diff --git a/drivers/gpu/nvgpu/include/nvgpu/gmmu.h b/drivers/gpu/nvgpu/include/nvgpu/gmmu.h new file mode 100644 index 00000000..7fb0147e --- /dev/null +++ b/drivers/gpu/nvgpu/include/nvgpu/gmmu.h | |||
@@ -0,0 +1,69 @@ | |||
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_GMMU_H__ | ||
18 | #define __NVGPU_GMMU_H__ | ||
19 | |||
20 | #include <nvgpu/types.h> | ||
21 | |||
22 | /* | ||
23 | * This is the GMMU API visible to blocks outside of the GMMU. Basically this | ||
24 | * API supports all the different types of mappings that might be done in the | ||
25 | * GMMU. | ||
26 | */ | ||
27 | |||
28 | struct vm_gk20a; | ||
29 | struct nvgpu_mem; | ||
30 | |||
31 | enum nvgpu_aperture; | ||
32 | |||
33 | /** | ||
34 | * nvgpu_gmmu_map - Map memory into the GMMU. | ||
35 | * | ||
36 | * Kernel space. | ||
37 | */ | ||
38 | u64 nvgpu_gmmu_map(struct vm_gk20a *vm, | ||
39 | struct nvgpu_mem *mem, | ||
40 | u64 size, | ||
41 | u32 flags, | ||
42 | int rw_flag, | ||
43 | bool priv, | ||
44 | enum nvgpu_aperture aperture); | ||
45 | |||
46 | /** | ||
47 | * nvgpu_gmmu_map_fixed - Map memory into the GMMU. | ||
48 | * | ||
49 | * Kernel space. | ||
50 | */ | ||
51 | u64 nvgpu_gmmu_map_fixed(struct vm_gk20a *vm, | ||
52 | struct nvgpu_mem *mem, | ||
53 | u64 addr, | ||
54 | u64 size, | ||
55 | u32 flags, | ||
56 | int rw_flag, | ||
57 | bool priv, | ||
58 | enum nvgpu_aperture aperture); | ||
59 | |||
60 | /** | ||
61 | * nvgpu_gmmu_unmap - Unmap a buffer. | ||
62 | * | ||
63 | * Kernel space. | ||
64 | */ | ||
65 | void nvgpu_gmmu_unmap(struct vm_gk20a *vm, | ||
66 | struct nvgpu_mem *mem, | ||
67 | u64 gpu_va); | ||
68 | |||
69 | #endif | ||