diff options
author | Alex Waterman <alexw@nvidia.com> | 2017-04-06 18:30:01 -0400 |
---|---|---|
committer | mobile promotions <svcmobile_promotions@nvidia.com> | 2017-04-20 19:14:32 -0400 |
commit | e32f62fadfcde413bcd9b5af61ad884e27ba2bf1 (patch) | |
tree | eff606a0826841eae6ade5906acd9da589d1179a /drivers/gpu/nvgpu/gk20a/gr_gk20a.c | |
parent | 52bd58b560d0b3b49c03ef5c2637b67adeac8193 (diff) |
gpu: nvgpu: Move Linux nvgpu_mem fields
Hide the Linux specific nvgpu_mem fields so that in subsequent patches
core code can instead of using struct sg_table it can use mem_desc.
Routines for accessing system specific fields will be added as needed.
This is the first step in a fairly major overhaul of the GMMU mapping
routines. There are numerous issues with the current design (or lack
there of): massively coupled code, system dependencies, disorganization,
etc.
JIRA NVGPU-12
JIRA NVGPU-30
Change-Id: I2e7d3ae3a07468cfc17c1c642d28ed1b0952474d
Signed-off-by: Alex Waterman <alexw@nvidia.com>
Reviewed-on: http://git-master/r/1464076
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/gk20a/gr_gk20a.c')
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/gr_gk20a.c | 33 |
1 files changed, 18 insertions, 15 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/gr_gk20a.c b/drivers/gpu/nvgpu/gk20a/gr_gk20a.c index 22093a34..f47d3b12 100644 --- a/drivers/gpu/nvgpu/gk20a/gr_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/gr_gk20a.c | |||
@@ -1943,7 +1943,7 @@ int gr_gk20a_update_hwpm_ctxsw_mode(struct gk20a *g, | |||
1943 | } | 1943 | } |
1944 | 1944 | ||
1945 | pm_ctx->mem.gpu_va = gk20a_gmmu_map(c->vm, | 1945 | pm_ctx->mem.gpu_va = gk20a_gmmu_map(c->vm, |
1946 | &pm_ctx->mem.sgt, | 1946 | &pm_ctx->mem.priv.sgt, |
1947 | pm_ctx->mem.size, | 1947 | pm_ctx->mem.size, |
1948 | NVGPU_MAP_BUFFER_FLAGS_CACHEABLE_TRUE, | 1948 | NVGPU_MAP_BUFFER_FLAGS_CACHEABLE_TRUE, |
1949 | gk20a_mem_flag_none, true, | 1949 | gk20a_mem_flag_none, true, |
@@ -2205,7 +2205,7 @@ static int gr_gk20a_init_ctxsw_ucode_vaspace(struct gk20a *g) | |||
2205 | 2205 | ||
2206 | /* Map ucode surface to GMMU */ | 2206 | /* Map ucode surface to GMMU */ |
2207 | ucode_info->surface_desc.gpu_va = gk20a_gmmu_map(vm, | 2207 | ucode_info->surface_desc.gpu_va = gk20a_gmmu_map(vm, |
2208 | &ucode_info->surface_desc.sgt, | 2208 | &ucode_info->surface_desc.priv.sgt, |
2209 | ucode_info->surface_desc.size, | 2209 | ucode_info->surface_desc.size, |
2210 | 0, /* flags */ | 2210 | 0, /* flags */ |
2211 | gk20a_mem_flag_read_only, | 2211 | gk20a_mem_flag_read_only, |
@@ -2823,13 +2823,14 @@ static int gr_gk20a_map_global_ctx_buffers(struct gk20a *g, | |||
2823 | gk20a_dbg_fn(""); | 2823 | gk20a_dbg_fn(""); |
2824 | 2824 | ||
2825 | /* Circular Buffer */ | 2825 | /* Circular Buffer */ |
2826 | if (!c->vpr || (gr->global_ctx_buffer[CIRCULAR_VPR].mem.sgt == NULL)) { | 2826 | if (!c->vpr || |
2827 | (gr->global_ctx_buffer[CIRCULAR_VPR].mem.priv.sgt == NULL)) { | ||
2827 | mem = &gr->global_ctx_buffer[CIRCULAR].mem; | 2828 | mem = &gr->global_ctx_buffer[CIRCULAR].mem; |
2828 | } else { | 2829 | } else { |
2829 | mem = &gr->global_ctx_buffer[CIRCULAR_VPR].mem; | 2830 | mem = &gr->global_ctx_buffer[CIRCULAR_VPR].mem; |
2830 | } | 2831 | } |
2831 | 2832 | ||
2832 | gpu_va = gk20a_gmmu_map(ch_vm, &mem->sgt, mem->size, | 2833 | gpu_va = gk20a_gmmu_map(ch_vm, &mem->priv.sgt, mem->size, |
2833 | NVGPU_MAP_BUFFER_FLAGS_CACHEABLE_TRUE, | 2834 | NVGPU_MAP_BUFFER_FLAGS_CACHEABLE_TRUE, |
2834 | gk20a_mem_flag_none, true, mem->aperture); | 2835 | gk20a_mem_flag_none, true, mem->aperture); |
2835 | if (!gpu_va) | 2836 | if (!gpu_va) |
@@ -2838,13 +2839,14 @@ static int gr_gk20a_map_global_ctx_buffers(struct gk20a *g, | |||
2838 | g_bfr_size[CIRCULAR_VA] = mem->size; | 2839 | g_bfr_size[CIRCULAR_VA] = mem->size; |
2839 | 2840 | ||
2840 | /* Attribute Buffer */ | 2841 | /* Attribute Buffer */ |
2841 | if (!c->vpr || (gr->global_ctx_buffer[ATTRIBUTE_VPR].mem.sgt == NULL)) { | 2842 | if (!c->vpr || |
2843 | (gr->global_ctx_buffer[ATTRIBUTE_VPR].mem.priv.sgt == NULL)) { | ||
2842 | mem = &gr->global_ctx_buffer[ATTRIBUTE].mem; | 2844 | mem = &gr->global_ctx_buffer[ATTRIBUTE].mem; |
2843 | } else { | 2845 | } else { |
2844 | mem = &gr->global_ctx_buffer[ATTRIBUTE_VPR].mem; | 2846 | mem = &gr->global_ctx_buffer[ATTRIBUTE_VPR].mem; |
2845 | } | 2847 | } |
2846 | 2848 | ||
2847 | gpu_va = gk20a_gmmu_map(ch_vm, &mem->sgt, mem->size, | 2849 | gpu_va = gk20a_gmmu_map(ch_vm, &mem->priv.sgt, mem->size, |
2848 | NVGPU_MAP_BUFFER_FLAGS_CACHEABLE_TRUE, | 2850 | NVGPU_MAP_BUFFER_FLAGS_CACHEABLE_TRUE, |
2849 | gk20a_mem_flag_none, false, mem->aperture); | 2851 | gk20a_mem_flag_none, false, mem->aperture); |
2850 | if (!gpu_va) | 2852 | if (!gpu_va) |
@@ -2853,13 +2855,14 @@ static int gr_gk20a_map_global_ctx_buffers(struct gk20a *g, | |||
2853 | g_bfr_size[ATTRIBUTE_VA] = mem->size; | 2855 | g_bfr_size[ATTRIBUTE_VA] = mem->size; |
2854 | 2856 | ||
2855 | /* Page Pool */ | 2857 | /* Page Pool */ |
2856 | if (!c->vpr || (gr->global_ctx_buffer[PAGEPOOL_VPR].mem.sgt == NULL)) { | 2858 | if (!c->vpr || |
2859 | (gr->global_ctx_buffer[PAGEPOOL_VPR].mem.priv.sgt == NULL)) { | ||
2857 | mem = &gr->global_ctx_buffer[PAGEPOOL].mem; | 2860 | mem = &gr->global_ctx_buffer[PAGEPOOL].mem; |
2858 | } else { | 2861 | } else { |
2859 | mem = &gr->global_ctx_buffer[PAGEPOOL_VPR].mem; | 2862 | mem = &gr->global_ctx_buffer[PAGEPOOL_VPR].mem; |
2860 | } | 2863 | } |
2861 | 2864 | ||
2862 | gpu_va = gk20a_gmmu_map(ch_vm, &mem->sgt, mem->size, | 2865 | gpu_va = gk20a_gmmu_map(ch_vm, &mem->priv.sgt, mem->size, |
2863 | NVGPU_MAP_BUFFER_FLAGS_CACHEABLE_TRUE, | 2866 | NVGPU_MAP_BUFFER_FLAGS_CACHEABLE_TRUE, |
2864 | gk20a_mem_flag_none, true, mem->aperture); | 2867 | gk20a_mem_flag_none, true, mem->aperture); |
2865 | if (!gpu_va) | 2868 | if (!gpu_va) |
@@ -2869,7 +2872,7 @@ static int gr_gk20a_map_global_ctx_buffers(struct gk20a *g, | |||
2869 | 2872 | ||
2870 | /* Golden Image */ | 2873 | /* Golden Image */ |
2871 | mem = &gr->global_ctx_buffer[GOLDEN_CTX].mem; | 2874 | mem = &gr->global_ctx_buffer[GOLDEN_CTX].mem; |
2872 | gpu_va = gk20a_gmmu_map(ch_vm, &mem->sgt, mem->size, 0, | 2875 | gpu_va = gk20a_gmmu_map(ch_vm, &mem->priv.sgt, mem->size, 0, |
2873 | gk20a_mem_flag_none, true, mem->aperture); | 2876 | gk20a_mem_flag_none, true, mem->aperture); |
2874 | if (!gpu_va) | 2877 | if (!gpu_va) |
2875 | goto clean_up; | 2878 | goto clean_up; |
@@ -2878,7 +2881,7 @@ static int gr_gk20a_map_global_ctx_buffers(struct gk20a *g, | |||
2878 | 2881 | ||
2879 | /* Priv register Access Map */ | 2882 | /* Priv register Access Map */ |
2880 | mem = &gr->global_ctx_buffer[PRIV_ACCESS_MAP].mem; | 2883 | mem = &gr->global_ctx_buffer[PRIV_ACCESS_MAP].mem; |
2881 | gpu_va = gk20a_gmmu_map(ch_vm, &mem->sgt, mem->size, 0, | 2884 | gpu_va = gk20a_gmmu_map(ch_vm, &mem->priv.sgt, mem->size, 0, |
2882 | gk20a_mem_flag_none, true, mem->aperture); | 2885 | gk20a_mem_flag_none, true, mem->aperture); |
2883 | if (!gpu_va) | 2886 | if (!gpu_va) |
2884 | goto clean_up; | 2887 | goto clean_up; |
@@ -2950,7 +2953,7 @@ int gr_gk20a_alloc_gr_ctx(struct gk20a *g, | |||
2950 | goto err_free_ctx; | 2953 | goto err_free_ctx; |
2951 | 2954 | ||
2952 | gr_ctx->mem.gpu_va = gk20a_gmmu_map(vm, | 2955 | gr_ctx->mem.gpu_va = gk20a_gmmu_map(vm, |
2953 | &gr_ctx->mem.sgt, | 2956 | &gr_ctx->mem.priv.sgt, |
2954 | gr_ctx->mem.size, | 2957 | gr_ctx->mem.size, |
2955 | NVGPU_MAP_BUFFER_FLAGS_CACHEABLE_FALSE, | 2958 | NVGPU_MAP_BUFFER_FLAGS_CACHEABLE_FALSE, |
2956 | gk20a_mem_flag_none, true, | 2959 | gk20a_mem_flag_none, true, |
@@ -3196,7 +3199,7 @@ int gk20a_alloc_obj_ctx(struct channel_gk20a *c, | |||
3196 | } | 3199 | } |
3197 | 3200 | ||
3198 | /* allocate patch buffer */ | 3201 | /* allocate patch buffer */ |
3199 | if (ch_ctx->patch_ctx.mem.sgt == NULL) { | 3202 | if (ch_ctx->patch_ctx.mem.priv.sgt == NULL) { |
3200 | err = gr_gk20a_alloc_channel_patch_ctx(g, c); | 3203 | err = gr_gk20a_alloc_channel_patch_ctx(g, c); |
3201 | if (err) { | 3204 | if (err) { |
3202 | nvgpu_err(g, | 3205 | nvgpu_err(g, |
@@ -4735,7 +4738,7 @@ static int gk20a_init_gr_setup_hw(struct gk20a *g) | |||
4735 | gk20a_dbg_fn(""); | 4738 | gk20a_dbg_fn(""); |
4736 | 4739 | ||
4737 | /* init mmu debug buffer */ | 4740 | /* init mmu debug buffer */ |
4738 | addr = g->ops.mm.get_iova_addr(g, gr->mmu_wr_mem.sgt->sgl, 0); | 4741 | addr = g->ops.mm.get_iova_addr(g, gr->mmu_wr_mem.priv.sgt->sgl, 0); |
4739 | addr >>= fb_mmu_debug_wr_addr_alignment_v(); | 4742 | addr >>= fb_mmu_debug_wr_addr_alignment_v(); |
4740 | 4743 | ||
4741 | gk20a_writel(g, fb_mmu_debug_wr_r(), | 4744 | gk20a_writel(g, fb_mmu_debug_wr_r(), |
@@ -4745,7 +4748,7 @@ static int gk20a_init_gr_setup_hw(struct gk20a *g) | |||
4745 | fb_mmu_debug_wr_vol_false_f() | | 4748 | fb_mmu_debug_wr_vol_false_f() | |
4746 | fb_mmu_debug_wr_addr_f(addr)); | 4749 | fb_mmu_debug_wr_addr_f(addr)); |
4747 | 4750 | ||
4748 | addr = g->ops.mm.get_iova_addr(g, gr->mmu_rd_mem.sgt->sgl, 0); | 4751 | addr = g->ops.mm.get_iova_addr(g, gr->mmu_rd_mem.priv.sgt->sgl, 0); |
4749 | addr >>= fb_mmu_debug_rd_addr_alignment_v(); | 4752 | addr >>= fb_mmu_debug_rd_addr_alignment_v(); |
4750 | 4753 | ||
4751 | gk20a_writel(g, fb_mmu_debug_rd_r(), | 4754 | gk20a_writel(g, fb_mmu_debug_rd_r(), |
@@ -8405,7 +8408,7 @@ int gr_gk20a_exec_ctx_ops(struct channel_gk20a *ch, | |||
8405 | } | 8408 | } |
8406 | if (!pm_ctx_ready) { | 8409 | if (!pm_ctx_ready) { |
8407 | /* Make sure ctx buffer was initialized */ | 8410 | /* Make sure ctx buffer was initialized */ |
8408 | if (!ch_ctx->pm_ctx.mem.pages) { | 8411 | if (!ch_ctx->pm_ctx.mem.priv.pages) { |
8409 | nvgpu_err(g, | 8412 | nvgpu_err(g, |
8410 | "Invalid ctx buffer"); | 8413 | "Invalid ctx buffer"); |
8411 | err = -EINVAL; | 8414 | err = -EINVAL; |