diff options
Diffstat (limited to 'drivers/gpu/nvgpu')
-rw-r--r-- | drivers/gpu/nvgpu/common/linux/nvgpu_mem.c | 25 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/common/mm/gmmu.c | 2 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/include/nvgpu/nvgpu_mem.h | 1 |
3 files changed, 27 insertions, 1 deletions
diff --git a/drivers/gpu/nvgpu/common/linux/nvgpu_mem.c b/drivers/gpu/nvgpu/common/linux/nvgpu_mem.c index 8d8909dd..8cf3011e 100644 --- a/drivers/gpu/nvgpu/common/linux/nvgpu_mem.c +++ b/drivers/gpu/nvgpu/common/linux/nvgpu_mem.c | |||
@@ -284,6 +284,14 @@ static u64 nvgpu_mem_get_addr_sysmem(struct gk20a *g, struct nvgpu_mem *mem) | |||
284 | * Return the base address of %mem. Handles whether this is a VIDMEM or SYSMEM | 284 | * Return the base address of %mem. Handles whether this is a VIDMEM or SYSMEM |
285 | * allocation. | 285 | * allocation. |
286 | * | 286 | * |
287 | * Note: this API does not make sense to use for _VIDMEM_ buffers with greater | ||
288 | * than one scatterlist chunk. If there's more than one scatterlist chunk then | ||
289 | * the buffer will not be contiguous. As such the base address probably isn't | ||
290 | * very useful. This is true for SYSMEM as well, if there's no IOMMU. | ||
291 | * | ||
292 | * However! It _is_ OK to use this on discontiguous sysmem buffers _if_ there's | ||
293 | * an IOMMU present and enabled for the GPU. | ||
294 | * | ||
287 | * %attrs can be NULL. If it is not NULL then it may be inspected to determine | 295 | * %attrs can be NULL. If it is not NULL then it may be inspected to determine |
288 | * if the address needs to be modified before writing into a PTE. | 296 | * if the address needs to be modified before writing into a PTE. |
289 | */ | 297 | */ |
@@ -306,6 +314,23 @@ u64 nvgpu_mem_get_addr(struct gk20a *g, struct nvgpu_mem *mem) | |||
306 | } | 314 | } |
307 | 315 | ||
308 | /* | 316 | /* |
317 | * This should only be used on contiguous buffers regardless of whether | ||
318 | * there's an IOMMU present/enabled. This applies to both SYSMEM and | ||
319 | * VIDMEM. | ||
320 | */ | ||
321 | u64 nvgpu_mem_get_phys_addr(struct gk20a *g, struct nvgpu_mem *mem) | ||
322 | { | ||
323 | /* | ||
324 | * For a VIDMEM buf, this is identical to simply get_addr() so just fall | ||
325 | * back to that. | ||
326 | */ | ||
327 | if (mem->aperture == APERTURE_VIDMEM) | ||
328 | return nvgpu_mem_get_addr(g, mem); | ||
329 | |||
330 | return sg_phys(mem->priv.sgt->sgl); | ||
331 | } | ||
332 | |||
333 | /* | ||
309 | * Be careful how you use this! You are responsible for correctly freeing this | 334 | * Be careful how you use this! You are responsible for correctly freeing this |
310 | * memory. | 335 | * memory. |
311 | */ | 336 | */ |
diff --git a/drivers/gpu/nvgpu/common/mm/gmmu.c b/drivers/gpu/nvgpu/common/mm/gmmu.c index f68dfc0a..ab9d0d41 100644 --- a/drivers/gpu/nvgpu/common/mm/gmmu.c +++ b/drivers/gpu/nvgpu/common/mm/gmmu.c | |||
@@ -212,7 +212,7 @@ u64 nvgpu_pde_phys_addr(struct gk20a *g, struct nvgpu_gmmu_pd *pd) | |||
212 | u64 page_addr; | 212 | u64 page_addr; |
213 | 213 | ||
214 | if (g->mm.has_physical_mode) | 214 | if (g->mm.has_physical_mode) |
215 | page_addr = sg_phys(pd->mem->priv.sgt->sgl); | 215 | page_addr = nvgpu_mem_get_phys_addr(g, pd->mem); |
216 | else | 216 | else |
217 | page_addr = nvgpu_mem_get_addr(g, pd->mem); | 217 | page_addr = nvgpu_mem_get_addr(g, pd->mem); |
218 | 218 | ||
diff --git a/drivers/gpu/nvgpu/include/nvgpu/nvgpu_mem.h b/drivers/gpu/nvgpu/include/nvgpu/nvgpu_mem.h index 15414278..b939cc33 100644 --- a/drivers/gpu/nvgpu/include/nvgpu/nvgpu_mem.h +++ b/drivers/gpu/nvgpu/include/nvgpu/nvgpu_mem.h | |||
@@ -291,6 +291,7 @@ void nvgpu_memset(struct gk20a *g, struct nvgpu_mem *mem, u32 offset, | |||
291 | u32 c, u32 size); | 291 | u32 c, u32 size); |
292 | 292 | ||
293 | u64 nvgpu_mem_get_addr(struct gk20a *g, struct nvgpu_mem *mem); | 293 | u64 nvgpu_mem_get_addr(struct gk20a *g, struct nvgpu_mem *mem); |
294 | u64 nvgpu_mem_get_phys_addr(struct gk20a *g, struct nvgpu_mem *mem); | ||
294 | 295 | ||
295 | u32 __nvgpu_aperture_mask(struct gk20a *g, enum nvgpu_aperture aperture, | 296 | u32 __nvgpu_aperture_mask(struct gk20a *g, enum nvgpu_aperture aperture, |
296 | u32 sysmem_mask, u32 vidmem_mask); | 297 | u32 sysmem_mask, u32 vidmem_mask); |