diff options
author | Debarshi Dutta <ddutta@nvidia.com> | 2017-08-18 06:52:29 -0400 |
---|---|---|
committer | mobile promotions <svcmobile_promotions@nvidia.com> | 2017-08-22 06:53:51 -0400 |
commit | 81868a187fa3b217368206f17b19309846e8e7fb (patch) | |
tree | 2b59e33b61cc6e206f7781f3b4ab44c5c7b6d721 /drivers/gpu/nvgpu/common/mm | |
parent | 5f010177de985c901c33c914efe70a8498a5974f (diff) |
gpu: nvgpu: Nvgpu abstraction for linux barriers.
construct wrapper nvgpu_* methods to replace
mb,rmb,wmb,smp_mb,smp_rmb,smp_wmb,read_barrier_depends and
smp_read_barrier_depends.
NVGPU-122
Change-Id: I8d24dd70fef5cb0fadaacc15f3ab11531667a0df
Signed-off-by: Debarshi <ddutta@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1541199
Reviewed-by: svccoveritychecker <svccoveritychecker@nvidia.com>
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Sourab Gupta <sourabg@nvidia.com>
Reviewed-by: Vijayakumar Subbu <vsubbu@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/common/mm')
-rw-r--r-- | drivers/gpu/nvgpu/common/mm/bitmap_allocator.c | 5 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/common/mm/buddy_allocator.c | 5 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/common/mm/gmmu.c | 13 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/common/mm/lockless_allocator.c | 5 |
4 files changed, 16 insertions, 12 deletions
diff --git a/drivers/gpu/nvgpu/common/mm/bitmap_allocator.c b/drivers/gpu/nvgpu/common/mm/bitmap_allocator.c index eae0475a..274e9c93 100644 --- a/drivers/gpu/nvgpu/common/mm/bitmap_allocator.c +++ b/drivers/gpu/nvgpu/common/mm/bitmap_allocator.c | |||
@@ -18,6 +18,7 @@ | |||
18 | #include <nvgpu/allocator.h> | 18 | #include <nvgpu/allocator.h> |
19 | #include <nvgpu/kmem.h> | 19 | #include <nvgpu/kmem.h> |
20 | #include <nvgpu/bug.h> | 20 | #include <nvgpu/bug.h> |
21 | #include <nvgpu/barrier.h> | ||
21 | 22 | ||
22 | #include "bitmap_allocator_priv.h" | 23 | #include "bitmap_allocator_priv.h" |
23 | 24 | ||
@@ -40,7 +41,7 @@ static int nvgpu_bitmap_alloc_inited(struct nvgpu_allocator *a) | |||
40 | struct nvgpu_bitmap_allocator *ba = a->priv; | 41 | struct nvgpu_bitmap_allocator *ba = a->priv; |
41 | int inited = ba->inited; | 42 | int inited = ba->inited; |
42 | 43 | ||
43 | rmb(); | 44 | nvgpu_smp_rmb(); |
44 | return inited; | 45 | return inited; |
45 | } | 46 | } |
46 | 47 | ||
@@ -408,7 +409,7 @@ int nvgpu_bitmap_allocator_init(struct gk20a *g, struct nvgpu_allocator *__a, | |||
408 | goto fail; | 409 | goto fail; |
409 | } | 410 | } |
410 | 411 | ||
411 | wmb(); | 412 | nvgpu_smp_wmb(); |
412 | a->inited = true; | 413 | a->inited = true; |
413 | 414 | ||
414 | #ifdef CONFIG_DEBUG_FS | 415 | #ifdef CONFIG_DEBUG_FS |
diff --git a/drivers/gpu/nvgpu/common/mm/buddy_allocator.c b/drivers/gpu/nvgpu/common/mm/buddy_allocator.c index 0ef94c10..3e305bb8 100644 --- a/drivers/gpu/nvgpu/common/mm/buddy_allocator.c +++ b/drivers/gpu/nvgpu/common/mm/buddy_allocator.c | |||
@@ -18,6 +18,7 @@ | |||
18 | #include <nvgpu/kmem.h> | 18 | #include <nvgpu/kmem.h> |
19 | #include <nvgpu/bug.h> | 19 | #include <nvgpu/bug.h> |
20 | #include <nvgpu/log2.h> | 20 | #include <nvgpu/log2.h> |
21 | #include <nvgpu/barrier.h> | ||
21 | 22 | ||
22 | #include "gk20a/mm_gk20a.h" | 23 | #include "gk20a/mm_gk20a.h" |
23 | #include "gk20a/platform_gk20a.h" | 24 | #include "gk20a/platform_gk20a.h" |
@@ -1064,7 +1065,7 @@ static int nvgpu_buddy_alloc_inited(struct nvgpu_allocator *a) | |||
1064 | struct nvgpu_buddy_allocator *ba = a->priv; | 1065 | struct nvgpu_buddy_allocator *ba = a->priv; |
1065 | int inited = ba->initialized; | 1066 | int inited = ba->initialized; |
1066 | 1067 | ||
1067 | rmb(); | 1068 | nvgpu_smp_rmb(); |
1068 | return inited; | 1069 | return inited; |
1069 | } | 1070 | } |
1070 | 1071 | ||
@@ -1289,7 +1290,7 @@ int __nvgpu_buddy_allocator_init(struct gk20a *g, struct nvgpu_allocator *__a, | |||
1289 | if (err) | 1290 | if (err) |
1290 | goto fail; | 1291 | goto fail; |
1291 | 1292 | ||
1292 | wmb(); | 1293 | nvgpu_smp_wmb(); |
1293 | a->initialized = 1; | 1294 | a->initialized = 1; |
1294 | 1295 | ||
1295 | #ifdef CONFIG_DEBUG_FS | 1296 | #ifdef CONFIG_DEBUG_FS |
diff --git a/drivers/gpu/nvgpu/common/mm/gmmu.c b/drivers/gpu/nvgpu/common/mm/gmmu.c index 73dff2c3..7f486d68 100644 --- a/drivers/gpu/nvgpu/common/mm/gmmu.c +++ b/drivers/gpu/nvgpu/common/mm/gmmu.c | |||
@@ -21,6 +21,7 @@ | |||
21 | #include <nvgpu/nvgpu_mem.h> | 21 | #include <nvgpu/nvgpu_mem.h> |
22 | #include <nvgpu/enabled.h> | 22 | #include <nvgpu/enabled.h> |
23 | #include <nvgpu/page_allocator.h> | 23 | #include <nvgpu/page_allocator.h> |
24 | #include <nvgpu/barrier.h> | ||
24 | 25 | ||
25 | #include "gk20a/gk20a.h" | 26 | #include "gk20a/gk20a.h" |
26 | #include "gk20a/mm_gk20a.h" | 27 | #include "gk20a/mm_gk20a.h" |
@@ -164,8 +165,8 @@ int nvgpu_gmmu_init_page_table(struct vm_gk20a *vm) | |||
164 | return err; | 165 | return err; |
165 | 166 | ||
166 | /* | 167 | /* |
167 | * One mb() is done after all mapping operations. Don't need individual | 168 | * One nvgpu_smp_mb() is done after all mapping operations. Don't need |
168 | * barriers for each PD write. | 169 | * individual barriers for each PD write. |
169 | */ | 170 | */ |
170 | vm->pdb.mem->skip_wmb = true; | 171 | vm->pdb.mem->skip_wmb = true; |
171 | 172 | ||
@@ -259,8 +260,8 @@ static int pd_allocate(struct vm_gk20a *vm, | |||
259 | } | 260 | } |
260 | 261 | ||
261 | /* | 262 | /* |
262 | * One mb() is done after all mapping operations. Don't need individual | 263 | * One nvgpu_smp_mb() is done after all mapping operations. Don't need |
263 | * barriers for each PD write. | 264 | * individual barriers for each PD write. |
264 | */ | 265 | */ |
265 | pd->mem->skip_wmb = true; | 266 | pd->mem->skip_wmb = true; |
266 | 267 | ||
@@ -714,7 +715,7 @@ static int __nvgpu_gmmu_update_page_table(struct vm_gk20a *vm, | |||
714 | attrs); | 715 | attrs); |
715 | 716 | ||
716 | unmap_gmmu_pages(g, &vm->pdb); | 717 | unmap_gmmu_pages(g, &vm->pdb); |
717 | mb(); | 718 | nvgpu_smp_mb(); |
718 | 719 | ||
719 | __gmmu_dbg(g, attrs, "%-5s Done!", sgt ? "MAP" : "UNMAP"); | 720 | __gmmu_dbg(g, attrs, "%-5s Done!", sgt ? "MAP" : "UNMAP"); |
720 | 721 | ||
@@ -983,7 +984,7 @@ int __nvgpu_set_pte(struct gk20a *g, struct vm_gk20a *vm, u64 vaddr, u32 *pte) | |||
983 | * There probably also needs to be a TLB invalidate as well but we leave | 984 | * There probably also needs to be a TLB invalidate as well but we leave |
984 | * that to the caller of this function. | 985 | * that to the caller of this function. |
985 | */ | 986 | */ |
986 | wmb(); | 987 | nvgpu_smp_wmb(); |
987 | 988 | ||
988 | return 0; | 989 | return 0; |
989 | } | 990 | } |
diff --git a/drivers/gpu/nvgpu/common/mm/lockless_allocator.c b/drivers/gpu/nvgpu/common/mm/lockless_allocator.c index eeb86095..8f712a14 100644 --- a/drivers/gpu/nvgpu/common/mm/lockless_allocator.c +++ b/drivers/gpu/nvgpu/common/mm/lockless_allocator.c | |||
@@ -17,6 +17,7 @@ | |||
17 | #include <nvgpu/atomic.h> | 17 | #include <nvgpu/atomic.h> |
18 | #include <nvgpu/allocator.h> | 18 | #include <nvgpu/allocator.h> |
19 | #include <nvgpu/kmem.h> | 19 | #include <nvgpu/kmem.h> |
20 | #include <nvgpu/barrier.h> | ||
20 | 21 | ||
21 | #include "lockless_allocator_priv.h" | 22 | #include "lockless_allocator_priv.h" |
22 | 23 | ||
@@ -39,7 +40,7 @@ static int nvgpu_lockless_alloc_inited(struct nvgpu_allocator *a) | |||
39 | struct nvgpu_lockless_allocator *pa = a->priv; | 40 | struct nvgpu_lockless_allocator *pa = a->priv; |
40 | int inited = pa->inited; | 41 | int inited = pa->inited; |
41 | 42 | ||
42 | rmb(); | 43 | nvgpu_smp_rmb(); |
43 | return inited; | 44 | return inited; |
44 | } | 45 | } |
45 | 46 | ||
@@ -198,7 +199,7 @@ int nvgpu_lockless_allocator_init(struct gk20a *g, struct nvgpu_allocator *__a, | |||
198 | a->flags = flags; | 199 | a->flags = flags; |
199 | nvgpu_atomic_set(&a->nr_allocs, 0); | 200 | nvgpu_atomic_set(&a->nr_allocs, 0); |
200 | 201 | ||
201 | wmb(); | 202 | nvgpu_smp_wmb(); |
202 | a->inited = true; | 203 | a->inited = true; |
203 | 204 | ||
204 | #ifdef CONFIG_DEBUG_FS | 205 | #ifdef CONFIG_DEBUG_FS |