nvgpu: don't unmap unallocated global ctx buffers

In nvgpu_gr_ctx_unmap_global_ctx_buffers(), don't unmap
buffers that were never allocated.

Issue warning in nvgpu_gmmu_do_update_page_table() if unmapping and
virt_addr is 0.

Bug 200648688
Bug 3093183

Change-Id: Ia2cb5f40bbb6c35575705571eb8c900f4495d58e
Signed-off-by: Peter Daifuku <pdaifuku@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2408315
Reviewed-by: automaticguardword <automaticguardword@nvidia.com>
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: svc-mobile-misra <svc-mobile-misra@nvidia.com>
Reviewed-by: svc-mobile-cert <svc-mobile-cert@nvidia.com>
Reviewed-by: Deepak Nibade <dnibade@nvidia.com>
Reviewed-by: Alex Waterman <alexw@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
GVS: Gerrit_Virtual_Submit
This commit is contained in:
Peter Daifuku
2020-09-03 15:01:57 -07:00
committed by Alex Waterman
parent f5f9cd9cba
commit dac7c587e9
2 changed files with 6 additions and 2 deletions

View File

@@ -182,8 +182,10 @@ static void nvgpu_gr_ctx_unmap_global_ctx_buffers(struct gk20a *g,
nvgpu_log_fn(g, " "); nvgpu_log_fn(g, " ");
for (i = 0U; i < NVGPU_GR_CTX_VA_COUNT; i++) { for (i = 0U; i < NVGPU_GR_CTX_VA_COUNT; i++) {
nvgpu_gr_global_ctx_buffer_unmap(global_ctx_buffer, if (g_bfr_va[i] != 0ULL) {
g_bfr_index[i], vm, g_bfr_va[i]); nvgpu_gr_global_ctx_buffer_unmap(global_ctx_buffer,
g_bfr_index[i], vm, g_bfr_va[i]);
}
} }
(void) memset(g_bfr_va, 0, sizeof(gr_ctx->global_ctx_buffer_va)); (void) memset(g_bfr_va, 0, sizeof(gr_ctx->global_ctx_buffer_va));

View File

@@ -726,6 +726,8 @@ static int nvgpu_gmmu_do_update_page_table(struct vm_gk20a *vm,
* This is considered an unmap. Just pass in 0 as the physical * This is considered an unmap. Just pass in 0 as the physical
* address for the entire GPU range. * address for the entire GPU range.
*/ */
nvgpu_assert(virt_addr != 0ULL);
err = nvgpu_set_pd_level(vm, &vm->pdb, err = nvgpu_set_pd_level(vm, &vm->pdb,
0U, 0U,
0, 0,