diff options
author | Alex Waterman <alexw@nvidia.com> | 2016-12-20 16:55:48 -0500 |
---|---|---|
committer | mobile promotions <svcmobile_promotions@nvidia.com> | 2017-01-09 15:33:16 -0500 |
commit | 6df3992b60959d32c7113cb77e131a2547174f3a (patch) | |
tree | efbdc9e6ccd2330d5c469ca0783ecb0137da8fc4 /drivers/gpu/nvgpu/gk20a/bitmap_allocator_priv.h | |
parent | e229514bece5a109cdbfe263f6329efe987e5939 (diff) |
gpu: nvgpu: Move allocators to common/mm/
Move the GPU allocators to common/mm/ since the allocators are common
code across all GPUs. Also rename the allocator code to move away from
gk20a_ prefixed structs and functions.
This caused one issue with the nvgpu_alloc() and nvgpu_free() functions.
There was a function for allocating either with kmalloc() or vmalloc()
depending on the size of the allocation. Those have now been renamed to
nvgpu_kalloc() and nvgpu_kfree().
Bug 1799159
Change-Id: Iddda92c013612bcb209847084ec85b8953002fa5
Signed-off-by: Alex Waterman <alexw@nvidia.com>
Reviewed-on: http://git-master/r/1274400
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/gk20a/bitmap_allocator_priv.h')
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/bitmap_allocator_priv.h | 70 |
1 files changed, 0 insertions, 70 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/bitmap_allocator_priv.h b/drivers/gpu/nvgpu/gk20a/bitmap_allocator_priv.h deleted file mode 100644 index a686b704..00000000 --- a/drivers/gpu/nvgpu/gk20a/bitmap_allocator_priv.h +++ /dev/null | |||
@@ -1,70 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2016, 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 BITMAP_ALLOCATOR_PRIV_H | ||
18 | #define BITMAP_ALLOCATOR_PRIV_H | ||
19 | |||
20 | #include <linux/rbtree.h> | ||
21 | |||
22 | struct gk20a_allocator; | ||
23 | |||
24 | struct gk20a_bitmap_allocator { | ||
25 | struct gk20a_allocator *owner; | ||
26 | |||
27 | u64 base; /* Base address of the space. */ | ||
28 | u64 length; /* Length of the space. */ | ||
29 | u64 blk_size; /* Size that corresponds to 1 bit. */ | ||
30 | u64 blk_shift; /* Bit shift to divide by blk_size. */ | ||
31 | u64 num_bits; /* Number of allocatable bits. */ | ||
32 | u64 bit_offs; /* Offset of bitmap. */ | ||
33 | |||
34 | /* | ||
35 | * Optimization for making repeated allocations faster. Keep track of | ||
36 | * the next bit after the most recent allocation. This is where the next | ||
37 | * search will start from. This should make allocation faster in cases | ||
38 | * where lots of allocations get made one after another. It shouldn't | ||
39 | * have a negative impact on the case where the allocator is fragmented. | ||
40 | */ | ||
41 | u64 next_blk; | ||
42 | |||
43 | unsigned long *bitmap; /* The actual bitmap! */ | ||
44 | struct rb_root allocs; /* Tree of outstanding allocations. */ | ||
45 | |||
46 | u64 flags; | ||
47 | |||
48 | bool inited; | ||
49 | |||
50 | /* Statistics */ | ||
51 | u64 nr_allocs; | ||
52 | u64 nr_fixed_allocs; | ||
53 | u64 bytes_alloced; | ||
54 | u64 bytes_freed; | ||
55 | }; | ||
56 | |||
57 | struct gk20a_bitmap_alloc { | ||
58 | u64 base; | ||
59 | u64 length; | ||
60 | struct rb_node alloc_entry; /* RB tree of allocations. */ | ||
61 | }; | ||
62 | |||
63 | static inline struct gk20a_bitmap_allocator *bitmap_allocator( | ||
64 | struct gk20a_allocator *a) | ||
65 | { | ||
66 | return (struct gk20a_bitmap_allocator *)(a)->priv; | ||
67 | } | ||
68 | |||
69 | |||
70 | #endif | ||