summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/gpu/nvgpu/gm20b/acr_gm20b.c18
1 files changed, 14 insertions, 4 deletions
diff --git a/drivers/gpu/nvgpu/gm20b/acr_gm20b.c b/drivers/gpu/nvgpu/gm20b/acr_gm20b.c
index 7c56c4cc..98d1a34d 100644
--- a/drivers/gpu/nvgpu/gm20b/acr_gm20b.c
+++ b/drivers/gpu/nvgpu/gm20b/acr_gm20b.c
@@ -383,12 +383,13 @@ int prepare_ucode_blob(struct gk20a *g)
383 int err; 383 int err;
384 struct ls_flcn_mgr lsfm_l, *plsfm; 384 struct ls_flcn_mgr lsfm_l, *plsfm;
385 struct pmu_gk20a *pmu = &g->pmu; 385 struct pmu_gk20a *pmu = &g->pmu;
386 phys_addr_t wpr_addr; 386 phys_addr_t wpr_addr, wpr_page;
387 u32 wprsize; 387 u32 wprsize;
388 int i;
388 struct mm_gk20a *mm = &g->mm; 389 struct mm_gk20a *mm = &g->mm;
389 struct vm_gk20a *vm = &mm->pmu.vm; 390 struct vm_gk20a *vm = &mm->pmu.vm;
390 struct wpr_carveout_info wpr_inf; 391 struct wpr_carveout_info wpr_inf;
391 struct page *page; 392 struct page **pages;
392 393
393 if (g->acr.ucode_blob.cpu_va) { 394 if (g->acr.ucode_blob.cpu_va) {
394 /*Recovery case, we do not need to form 395 /*Recovery case, we do not need to form
@@ -412,8 +413,17 @@ int prepare_ucode_blob(struct gk20a *g)
412 gm20b_dbg_pmu("wpr carveout base:%llx\n", wpr_inf.wpr_base); 413 gm20b_dbg_pmu("wpr carveout base:%llx\n", wpr_inf.wpr_base);
413 gm20b_dbg_pmu("wpr carveout size :%x\n", wprsize); 414 gm20b_dbg_pmu("wpr carveout size :%x\n", wprsize);
414 415
415 page = phys_to_page(wpr_addr); 416 pages = nvgpu_kmalloc(g, sizeof(struct page *) * (wprsize / PAGE_SIZE));
416 __nvgpu_mem_create_from_pages(g, &g->pmu.wpr_buf, &page, 1); 417 if (!pages)
418 return -ENOMEM;
419
420 wpr_page = wpr_addr;
421 for (i = 0; wpr_page < (wpr_addr + wprsize); i++, wpr_page += PAGE_SIZE)
422 pages[i] = phys_to_page(wpr_page);
423 __nvgpu_mem_create_from_pages(g, &g->pmu.wpr_buf, pages,
424 wprsize / PAGE_SIZE);
425 nvgpu_kfree(g, pages);
426
417 g->pmu.wpr_buf.gpu_va = nvgpu_gmmu_map(vm, &g->pmu.wpr_buf, 427 g->pmu.wpr_buf.gpu_va = nvgpu_gmmu_map(vm, &g->pmu.wpr_buf,
418 wprsize, 0, gk20a_mem_flag_none, 428 wprsize, 0, gk20a_mem_flag_none,
419 false, APERTURE_SYSMEM); 429 false, APERTURE_SYSMEM);