diff options
author | Timo Alho <talho@nvidia.com> | 2017-11-03 08:29:12 -0400 |
---|---|---|
committer | Jani Uusi-Rantala <juusirantala@nvidia.com> | 2017-11-03 11:36:50 -0400 |
commit | fe1e09d473044f7caaf8b834a094f4784bc5f5e1 (patch) | |
tree | a8ec4ae3c1f1c136012317ee09cc178ffe0280d8 /drivers/gpu | |
parent | de399ccb0019513a5f9e8f2bcadb02486f99bc80 (diff) |
Revert "gpu: nvgpu: fix patch buf count update for vidmem"
This reverts commit de399ccb0019513a5f9e8f2bcadb02486f99bc80.
Bug 2012077
Change-Id: Ie608c3b41aa91f9aaed3fad240ed882a0c6f1ea2
Signed-off-by: Timo Alho <talho@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1591423
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
Tested-by: Terje Bergstrom <tbergstrom@nvidia.com>
GVS: Gerrit_Virtual_Submit
Diffstat (limited to 'drivers/gpu')
-rw-r--r-- | drivers/gpu/nvgpu/common/linux/nvgpu_mem.c | 19 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/gr_gk20a.c | 4 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/include/nvgpu/nvgpu_mem.h | 10 |
3 files changed, 8 insertions, 25 deletions
diff --git a/drivers/gpu/nvgpu/common/linux/nvgpu_mem.c b/drivers/gpu/nvgpu/common/linux/nvgpu_mem.c index 2bf26602..1dbbd1a0 100644 --- a/drivers/gpu/nvgpu/common/linux/nvgpu_mem.c +++ b/drivers/gpu/nvgpu/common/linux/nvgpu_mem.c | |||
@@ -60,14 +60,6 @@ int nvgpu_mem_begin(struct gk20a *g, struct nvgpu_mem *mem) | |||
60 | { | 60 | { |
61 | void *cpu_va; | 61 | void *cpu_va; |
62 | 62 | ||
63 | if (WARN_ON(mem->cpu_accessible)) { | ||
64 | nvgpu_warn(g, "nested"); | ||
65 | return -EBUSY; | ||
66 | } | ||
67 | |||
68 | /* flag that the intent is to allow CPU access to the memory. */ | ||
69 | mem->cpu_accessible = true; | ||
70 | |||
71 | if (mem->aperture != APERTURE_SYSMEM || g->mm.force_pramin) | 63 | if (mem->aperture != APERTURE_SYSMEM || g->mm.force_pramin) |
72 | return 0; | 64 | return 0; |
73 | 65 | ||
@@ -79,14 +71,17 @@ int nvgpu_mem_begin(struct gk20a *g, struct nvgpu_mem *mem) | |||
79 | if (!(mem->priv.flags & NVGPU_DMA_NO_KERNEL_MAPPING)) | 71 | if (!(mem->priv.flags & NVGPU_DMA_NO_KERNEL_MAPPING)) |
80 | return 0; | 72 | return 0; |
81 | 73 | ||
74 | if (WARN_ON(mem->cpu_va)) { | ||
75 | nvgpu_warn(g, "nested"); | ||
76 | return -EBUSY; | ||
77 | } | ||
78 | |||
82 | cpu_va = vmap(mem->priv.pages, | 79 | cpu_va = vmap(mem->priv.pages, |
83 | PAGE_ALIGN(mem->size) >> PAGE_SHIFT, | 80 | PAGE_ALIGN(mem->size) >> PAGE_SHIFT, |
84 | 0, pgprot_writecombine(PAGE_KERNEL)); | 81 | 0, pgprot_writecombine(PAGE_KERNEL)); |
85 | 82 | ||
86 | if (WARN_ON(!cpu_va)) { | 83 | if (WARN_ON(!cpu_va)) |
87 | mem->cpu_accessible = false; | ||
88 | return -ENOMEM; | 84 | return -ENOMEM; |
89 | } | ||
90 | 85 | ||
91 | mem->cpu_va = cpu_va; | 86 | mem->cpu_va = cpu_va; |
92 | return 0; | 87 | return 0; |
@@ -94,8 +89,6 @@ int nvgpu_mem_begin(struct gk20a *g, struct nvgpu_mem *mem) | |||
94 | 89 | ||
95 | void nvgpu_mem_end(struct gk20a *g, struct nvgpu_mem *mem) | 90 | void nvgpu_mem_end(struct gk20a *g, struct nvgpu_mem *mem) |
96 | { | 91 | { |
97 | mem->cpu_accessible = false; | ||
98 | |||
99 | if (mem->aperture != APERTURE_SYSMEM || g->mm.force_pramin) | 92 | if (mem->aperture != APERTURE_SYSMEM || g->mm.force_pramin) |
100 | return; | 93 | return; |
101 | 94 | ||
diff --git a/drivers/gpu/nvgpu/gk20a/gr_gk20a.c b/drivers/gpu/nvgpu/gk20a/gr_gk20a.c index 06fb5497..2a20c2d9 100644 --- a/drivers/gpu/nvgpu/gk20a/gr_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/gr_gk20a.c | |||
@@ -682,7 +682,7 @@ int gr_gk20a_ctx_patch_write_begin(struct gk20a *g, | |||
682 | if (err) | 682 | if (err) |
683 | return err; | 683 | return err; |
684 | 684 | ||
685 | if (nvgpu_mem_cpu_accessible(&ch_ctx->gr_ctx->mem)) { | 685 | if (ch_ctx->gr_ctx->mem.cpu_va) { |
686 | /* reset patch count if ucode has already processed it */ | 686 | /* reset patch count if ucode has already processed it */ |
687 | ch_ctx->patch_ctx.data_count = nvgpu_mem_rd(g, | 687 | ch_ctx->patch_ctx.data_count = nvgpu_mem_rd(g, |
688 | &ch_ctx->gr_ctx->mem, | 688 | &ch_ctx->gr_ctx->mem, |
@@ -699,7 +699,7 @@ void gr_gk20a_ctx_patch_write_end(struct gk20a *g, | |||
699 | nvgpu_mem_end(g, &ch_ctx->patch_ctx.mem); | 699 | nvgpu_mem_end(g, &ch_ctx->patch_ctx.mem); |
700 | 700 | ||
701 | /* Write context count to context image if it is mapped */ | 701 | /* Write context count to context image if it is mapped */ |
702 | if (nvgpu_mem_cpu_accessible(&ch_ctx->gr_ctx->mem)) { | 702 | if (ch_ctx->gr_ctx->mem.cpu_va) { |
703 | nvgpu_mem_wr(g, &ch_ctx->gr_ctx->mem, | 703 | nvgpu_mem_wr(g, &ch_ctx->gr_ctx->mem, |
704 | ctxsw_prog_main_image_patch_count_o(), | 704 | ctxsw_prog_main_image_patch_count_o(), |
705 | ch_ctx->patch_ctx.data_count); | 705 | ch_ctx->patch_ctx.data_count); |
diff --git a/drivers/gpu/nvgpu/include/nvgpu/nvgpu_mem.h b/drivers/gpu/nvgpu/include/nvgpu/nvgpu_mem.h index bae50347..6feacff7 100644 --- a/drivers/gpu/nvgpu/include/nvgpu/nvgpu_mem.h +++ b/drivers/gpu/nvgpu/include/nvgpu/nvgpu_mem.h | |||
@@ -122,7 +122,6 @@ struct nvgpu_mem { | |||
122 | size_t aligned_size; | 122 | size_t aligned_size; |
123 | u64 gpu_va; | 123 | u64 gpu_va; |
124 | bool skip_wmb; | 124 | bool skip_wmb; |
125 | bool cpu_accessible; | ||
126 | 125 | ||
127 | /* | 126 | /* |
128 | * Set when a nvgpu_mem struct is not a "real" nvgpu_mem struct. Instead | 127 | * Set when a nvgpu_mem struct is not a "real" nvgpu_mem struct. Instead |
@@ -212,15 +211,6 @@ static inline bool nvgpu_mem_is_valid(struct nvgpu_mem *mem) | |||
212 | } | 211 | } |
213 | 212 | ||
214 | /* | 213 | /* |
215 | * Returns true if the passed nvgpu_mem can be accessed by the CPU by virtue | ||
216 | * of having called nvgpu_mem_begin successfully. | ||
217 | */ | ||
218 | static inline bool nvgpu_mem_cpu_accessible(struct nvgpu_mem *mem) | ||
219 | { | ||
220 | return mem->cpu_accessible; | ||
221 | } | ||
222 | |||
223 | /* | ||
224 | * Create a nvgpu_sgt of the default implementation | 214 | * Create a nvgpu_sgt of the default implementation |
225 | */ | 215 | */ |
226 | struct nvgpu_sgt *nvgpu_sgt_create(struct gk20a *g); | 216 | struct nvgpu_sgt *nvgpu_sgt_create(struct gk20a *g); |