summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/include
diff options
context:
space:
mode:
authorAlex Waterman <alexw@nvidia.com>2017-04-06 18:30:01 -0400
committermobile promotions <svcmobile_promotions@nvidia.com>2017-04-20 19:14:32 -0400
commite32f62fadfcde413bcd9b5af61ad884e27ba2bf1 (patch)
treeeff606a0826841eae6ade5906acd9da589d1179a /drivers/gpu/nvgpu/include
parent52bd58b560d0b3b49c03ef5c2637b67adeac8193 (diff)
gpu: nvgpu: Move Linux nvgpu_mem fields
Hide the Linux specific nvgpu_mem fields so that in subsequent patches core code can instead of using struct sg_table it can use mem_desc. Routines for accessing system specific fields will be added as needed. This is the first step in a fairly major overhaul of the GMMU mapping routines. There are numerous issues with the current design (or lack there of): massively coupled code, system dependencies, disorganization, etc. JIRA NVGPU-12 JIRA NVGPU-30 Change-Id: I2e7d3ae3a07468cfc17c1c642d28ed1b0952474d Signed-off-by: Alex Waterman <alexw@nvidia.com> Reviewed-on: http://git-master/r/1464076 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/linux/nvgpu_mem.h29
-rw-r--r--drivers/gpu/nvgpu/include/nvgpu/nvgpu_mem.h48
2 files changed, 58 insertions, 19 deletions
diff --git a/drivers/gpu/nvgpu/include/nvgpu/linux/nvgpu_mem.h b/drivers/gpu/nvgpu/include/nvgpu/linux/nvgpu_mem.h
new file mode 100644
index 00000000..8b1e646e
--- /dev/null
+++ b/drivers/gpu/nvgpu/include/nvgpu/linux/nvgpu_mem.h
@@ -0,0 +1,29 @@
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_LINUX_NVGPU_MEM_H__
18#define __NVGPU_LINUX_NVGPU_MEM_H__
19
20struct page;
21struct sg_table;
22
23struct nvgpu_mem_priv {
24 struct page **pages;
25 struct sg_table *sgt;
26 unsigned long flags;
27};
28
29#endif
diff --git a/drivers/gpu/nvgpu/include/nvgpu/nvgpu_mem.h b/drivers/gpu/nvgpu/include/nvgpu/nvgpu_mem.h
index ae5dcc6e..1590ee7a 100644
--- a/drivers/gpu/nvgpu/include/nvgpu/nvgpu_mem.h
+++ b/drivers/gpu/nvgpu/include/nvgpu/nvgpu_mem.h
@@ -17,10 +17,11 @@
17#ifndef __NVGPU_NVGPU_MEM_H__ 17#ifndef __NVGPU_NVGPU_MEM_H__
18#define __NVGPU_NVGPU_MEM_H__ 18#define __NVGPU_NVGPU_MEM_H__
19 19
20#include <linux/types.h> 20#include <nvgpu/types.h>
21
22#include <nvgpu/list.h> 21#include <nvgpu/list.h>
23 22
23#include <nvgpu/linux/nvgpu_mem.h>
24
24struct page; 25struct page;
25struct sg_table; 26struct sg_table;
26 27
@@ -39,18 +40,32 @@ enum nvgpu_aperture {
39}; 40};
40 41
41struct nvgpu_mem { 42struct nvgpu_mem {
42 void *cpu_va; /* sysmem only */ 43 /*
43 struct page **pages; /* sysmem only */ 44 * Populated for all nvgpu_mem structs - vidmem or system.
44 struct sg_table *sgt; 45 */
45 enum nvgpu_aperture aperture; 46 enum nvgpu_aperture aperture;
46 size_t size; 47 size_t size;
47 u64 gpu_va; 48 u64 gpu_va;
48 bool fixed; /* vidmem only */ 49 bool skip_wmb;
49 bool user_mem; /* vidmem only */ 50
50 struct nvgpu_allocator *allocator; /* vidmem only */ 51 /*
51 struct nvgpu_list_node clear_list_entry; /* vidmem only */ 52 * Only populated for a sysmem allocation.
52 bool skip_wmb; 53 */
53 unsigned long flags; 54 void *cpu_va;
55
56 /*
57 * Fields only populated for vidmem allocations.
58 */
59 bool fixed;
60 bool user_mem;
61 struct nvgpu_allocator *allocator;
62 struct nvgpu_list_node clear_list_entry;
63
64 /*
65 * This is defined by the system specific header. It can be empty if
66 * there's no system specific stuff for a given system.
67 */
68 struct nvgpu_mem_priv priv;
54}; 69};
55 70
56static inline struct nvgpu_mem * 71static inline struct nvgpu_mem *
@@ -61,11 +76,6 @@ nvgpu_mem_from_clear_list_entry(struct nvgpu_list_node *node)
61 clear_list_entry)); 76 clear_list_entry));
62}; 77};
63 78
64struct nvgpu_mem_sub {
65 u32 offset;
66 u32 size;
67};
68
69static inline const char *nvgpu_aperture_str(enum nvgpu_aperture aperture) 79static inline const char *nvgpu_aperture_str(enum nvgpu_aperture aperture)
70{ 80{
71 switch (aperture) { 81 switch (aperture) {