summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/gk20a/pmu_gk20a.c
diff options
context:
space:
mode:
authorKonsta Holtta <kholtta@nvidia.com>2016-05-12 02:32:05 -0400
committerKen Adams <kadams@nvidia.com>2016-05-13 10:11:33 -0400
commit6eebc87d99f9f04b2b68e0bc0142c161ab3e669d (patch)
tree08e437890869d76072f291ea66f709f05ea07c8a /drivers/gpu/nvgpu/gk20a/pmu_gk20a.c
parent14ef0dacc94077bc3dae4c942ff8c279cc4c92ba (diff)
gpu: nvgpu: refactor gk20a_mem_{wr,rd} for vidmem
To support vidmem, pass g and mem_desc to the buffer memory accessor functions. This allows the functions to select the memory access method based on the buffer aperture instead of using the cpu pointer directly (like until now). The selection and aperture support will be in another patch; this patch only refactors these accessors, but keeps the underlying functionality as-is. gk20a_mem_{rd,wr}32() work as previously; add also gk20a_mem_{rd,wr}() for byte-indexed accesses, gk20a_mem_{rd,wr}_n() for memcpy()-like functionality, and gk20a_memset() for filling buffers with a constant. The 8 and 16 bit accessor functions are removed. vmap()/vunmap() pairs are abstracted to gk20a_mem_{begin,end}() to support other types of mappings or conditions where mapping the buffer is unnecessary or different. Several function arguments that would access these buffers are also changed to take a mem_desc instead of a plain cpu pointer. Some relevant occasions are changed to use the accessor functions instead of cpu pointers without them (e.g., memcpying to and from), but the majority of direct accesses will be adjusted later, when the buffers are moved to support vidmem. JIRA DNVGPU-23 Change-Id: I3dd22e14290c4ab742d42e2dd327ebeb5cd3f25a Signed-off-by: Konsta Holtta <kholtta@nvidia.com> Reviewed-on: http://git-master/r/1121143 Reviewed-by: Ken Adams <kadams@nvidia.com> Tested-by: Ken Adams <kadams@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/gk20a/pmu_gk20a.c')
-rw-r--r--drivers/gpu/nvgpu/gk20a/pmu_gk20a.c10
1 files changed, 3 insertions, 7 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/pmu_gk20a.c b/drivers/gpu/nvgpu/gk20a/pmu_gk20a.c
index 56ad0c2a..54b2eef4 100644
--- a/drivers/gpu/nvgpu/gk20a/pmu_gk20a.c
+++ b/drivers/gpu/nvgpu/gk20a/pmu_gk20a.c
@@ -2421,11 +2421,10 @@ static int gk20a_init_pmu_reset_enable_hw(struct gk20a *g)
2421static int gk20a_prepare_ucode(struct gk20a *g) 2421static int gk20a_prepare_ucode(struct gk20a *g)
2422{ 2422{
2423 struct pmu_gk20a *pmu = &g->pmu; 2423 struct pmu_gk20a *pmu = &g->pmu;
2424 int i, err = 0; 2424 int err = 0;
2425 struct device *d = dev_from_gk20a(g); 2425 struct device *d = dev_from_gk20a(g);
2426 struct mm_gk20a *mm = &g->mm; 2426 struct mm_gk20a *mm = &g->mm;
2427 struct vm_gk20a *vm = &mm->pmu.vm; 2427 struct vm_gk20a *vm = &mm->pmu.vm;
2428 void *ucode_ptr;
2429 2428
2430 if (g->pmu_fw) { 2429 if (g->pmu_fw) {
2431 gk20a_init_pmu(pmu); 2430 gk20a_init_pmu(pmu);
@@ -2449,11 +2448,8 @@ static int gk20a_prepare_ucode(struct gk20a *g)
2449 if (err) 2448 if (err)
2450 goto err_release_fw; 2449 goto err_release_fw;
2451 2450
2452 ucode_ptr = pmu->ucode.cpu_va; 2451 gk20a_mem_wr_n(g, &pmu->ucode, 0, pmu->ucode_image,
2453 2452 pmu->desc->app_start_offset + pmu->desc->app_size);
2454 for (i = 0; i < (pmu->desc->app_start_offset +
2455 pmu->desc->app_size) >> 2; i++)
2456 gk20a_mem_wr32(ucode_ptr, i, pmu->ucode_image[i]);
2457 2453
2458 gk20a_init_pmu(pmu); 2454 gk20a_init_pmu(pmu);
2459 2455