diff options
author | Terje Bergstrom <tbergstrom@nvidia.com> | 2018-04-18 15:59:00 -0400 |
---|---|---|
committer | mobile promotions <svcmobile_promotions@nvidia.com> | 2018-06-15 20:47:31 -0400 |
commit | 2a2c16af5f9f1ccfc93a13e820d5381e5c881e92 (patch) | |
tree | 2e5d7b042270a649978e5bb540857012c85fb5b5 /drivers/gpu/nvgpu/common/linux/kmem_priv.h | |
parent | 98d996f4ffb0137d119b5849cae46d7b7e5693e1 (diff) |
gpu: nvgpu: Move Linux files away from common
Move all Linux source code files to drivers/gpu/nvgpu/os/linux from
drivers/gpu/nvgpu/common/linux. This changes the meaning of common
to be OS independent.
JIRA NVGPU-598
JIRA NVGPU-601
Change-Id: Ib7f2a43d3688bb0d0b7dcc48469a6783fd988ce9
Signed-off-by: Terje Bergstrom <tbergstrom@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1747714
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/common/linux/kmem_priv.h')
-rw-r--r-- | drivers/gpu/nvgpu/common/linux/kmem_priv.h | 105 |
1 files changed, 0 insertions, 105 deletions
diff --git a/drivers/gpu/nvgpu/common/linux/kmem_priv.h b/drivers/gpu/nvgpu/common/linux/kmem_priv.h deleted file mode 100644 index a41762af..00000000 --- a/drivers/gpu/nvgpu/common/linux/kmem_priv.h +++ /dev/null | |||
@@ -1,105 +0,0 @@ | |||
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 __KMEM_PRIV_H__ | ||
18 | #define __KMEM_PRIV_H__ | ||
19 | |||
20 | #include <nvgpu/rbtree.h> | ||
21 | #include <nvgpu/lock.h> | ||
22 | |||
23 | struct seq_file; | ||
24 | |||
25 | #define __pstat(s, fmt, msg...) \ | ||
26 | do { \ | ||
27 | if (s) \ | ||
28 | seq_printf(s, fmt, ##msg); \ | ||
29 | else \ | ||
30 | pr_info(fmt, ##msg); \ | ||
31 | } while (0) | ||
32 | |||
33 | #define MAX_STACK_TRACE 20 | ||
34 | |||
35 | /* | ||
36 | * Linux specific version of the nvgpu_kmem_cache struct. This type is | ||
37 | * completely opaque to the rest of the driver. | ||
38 | */ | ||
39 | struct nvgpu_kmem_cache { | ||
40 | struct gk20a *g; | ||
41 | struct kmem_cache *cache; | ||
42 | |||
43 | /* | ||
44 | * Memory to hold the kmem_cache unique name. Only necessary on our | ||
45 | * k3.10 kernel when not using the SLUB allocator but it's easier to | ||
46 | * just carry this on to newer kernels. | ||
47 | */ | ||
48 | char name[128]; | ||
49 | }; | ||
50 | |||
51 | #ifdef CONFIG_NVGPU_TRACK_MEM_USAGE | ||
52 | |||
53 | struct nvgpu_mem_alloc { | ||
54 | struct nvgpu_mem_alloc_tracker *owner; | ||
55 | |||
56 | void *ip; | ||
57 | #ifdef __NVGPU_SAVE_KALLOC_STACK_TRACES | ||
58 | unsigned long stack[MAX_STACK_TRACE]; | ||
59 | int stack_length; | ||
60 | #endif | ||
61 | |||
62 | u64 addr; | ||
63 | |||
64 | unsigned long size; | ||
65 | unsigned long real_size; | ||
66 | |||
67 | struct nvgpu_rbtree_node allocs_entry; | ||
68 | }; | ||
69 | |||
70 | static inline struct nvgpu_mem_alloc * | ||
71 | nvgpu_mem_alloc_from_rbtree_node(struct nvgpu_rbtree_node *node) | ||
72 | { | ||
73 | return (struct nvgpu_mem_alloc *) | ||
74 | ((uintptr_t)node - offsetof(struct nvgpu_mem_alloc, allocs_entry)); | ||
75 | }; | ||
76 | |||
77 | /* | ||
78 | * Linux specific tracking of vmalloc, kmalloc, etc. | ||
79 | */ | ||
80 | struct nvgpu_mem_alloc_tracker { | ||
81 | const char *name; | ||
82 | struct nvgpu_kmem_cache *allocs_cache; | ||
83 | struct nvgpu_rbtree_node *allocs; | ||
84 | struct nvgpu_mutex lock; | ||
85 | |||
86 | u64 bytes_alloced; | ||
87 | u64 bytes_freed; | ||
88 | u64 bytes_alloced_real; | ||
89 | u64 bytes_freed_real; | ||
90 | u64 nr_allocs; | ||
91 | u64 nr_frees; | ||
92 | |||
93 | unsigned long min_alloc; | ||
94 | unsigned long max_alloc; | ||
95 | }; | ||
96 | |||
97 | void nvgpu_lock_tracker(struct nvgpu_mem_alloc_tracker *tracker); | ||
98 | void nvgpu_unlock_tracker(struct nvgpu_mem_alloc_tracker *tracker); | ||
99 | |||
100 | void kmem_print_mem_alloc(struct gk20a *g, | ||
101 | struct nvgpu_mem_alloc *alloc, | ||
102 | struct seq_file *s); | ||
103 | #endif /* CONFIG_NVGPU_TRACK_MEM_USAGE */ | ||
104 | |||
105 | #endif /* __KMEM_PRIV_H__ */ | ||