diff options
author | Konsta Holtta <kholtta@nvidia.com> | 2016-05-12 02:32:05 -0400 |
---|---|---|
committer | Ken Adams <kadams@nvidia.com> | 2016-05-13 10:11:33 -0400 |
commit | 6eebc87d99f9f04b2b68e0bc0142c161ab3e669d (patch) | |
tree | 08e437890869d76072f291ea66f709f05ea07c8a /drivers/gpu/nvgpu/gm20b/mm_gm20b.c | |
parent | 14ef0dacc94077bc3dae4c942ff8c279cc4c92ba (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/gm20b/mm_gm20b.c')
-rw-r--r-- | drivers/gpu/nvgpu/gm20b/mm_gm20b.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/gpu/nvgpu/gm20b/mm_gm20b.c b/drivers/gpu/nvgpu/gm20b/mm_gm20b.c index ac73b5c8..726d73ed 100644 --- a/drivers/gpu/nvgpu/gm20b/mm_gm20b.c +++ b/drivers/gpu/nvgpu/gm20b/mm_gm20b.c | |||
@@ -106,14 +106,14 @@ static void gm20b_mm_mmu_set_debug_mode(struct gk20a *g, bool enable) | |||
106 | } | 106 | } |
107 | 107 | ||
108 | static void gm20b_mm_set_big_page_size(struct gk20a *g, | 108 | static void gm20b_mm_set_big_page_size(struct gk20a *g, |
109 | void *inst_ptr, int size) | 109 | struct mem_desc *mem, int size) |
110 | { | 110 | { |
111 | u32 val; | 111 | u32 val; |
112 | 112 | ||
113 | gk20a_dbg_fn(""); | 113 | gk20a_dbg_fn(""); |
114 | 114 | ||
115 | gk20a_dbg_info("big page size %d\n", size); | 115 | gk20a_dbg_info("big page size %d\n", size); |
116 | val = gk20a_mem_rd32(inst_ptr, ram_in_big_page_size_w()); | 116 | val = gk20a_mem_rd32(g, mem, ram_in_big_page_size_w()); |
117 | val &= ~ram_in_big_page_size_m(); | 117 | val &= ~ram_in_big_page_size_m(); |
118 | 118 | ||
119 | if (size == SZ_64K) | 119 | if (size == SZ_64K) |
@@ -121,7 +121,7 @@ static void gm20b_mm_set_big_page_size(struct gk20a *g, | |||
121 | else | 121 | else |
122 | val |= ram_in_big_page_size_128kb_f(); | 122 | val |= ram_in_big_page_size_128kb_f(); |
123 | 123 | ||
124 | gk20a_mem_wr32(inst_ptr, ram_in_big_page_size_w(), val); | 124 | gk20a_mem_wr32(g, mem, ram_in_big_page_size_w(), val); |
125 | gk20a_dbg_fn("done"); | 125 | gk20a_dbg_fn("done"); |
126 | } | 126 | } |
127 | 127 | ||