diff options
author | Alex Waterman <alexw@nvidia.com> | 2017-05-25 19:56:50 -0400 |
---|---|---|
committer | mobile promotions <svcmobile_promotions@nvidia.com> | 2017-09-22 15:52:48 -0400 |
commit | 0090ee5aca268a3c359f34c74b8c521df3bd8593 (patch) | |
tree | 2779dc64554cdb38b717ce09c0e3dcbf36107ed3 /drivers/gpu/nvgpu/gk20a/mm_gk20a.h | |
parent | e32cc0108cf2ef5de7a17f0f6c0aa9af7faf23ed (diff) |
gpu: nvgpu: nvgpu SGL implementation
The last major item preventing the core MM code in the nvgpu
driver from being platform agnostic is the usage of Linux
scattergather tables and scattergather lists. These data
structures are used throughout the mapping code to handle
discontiguous DMA allocations and also overloaded to represent
VIDMEM allocs.
The notion of a scatter gather table is crucial to a HW device
that can handle discontiguous DMA. The GPU has a MMU which
allows the GPU to do page gathering and present a virtually
contiguous buffer to the GPU HW. As a result it makes sense
for the GPU driver to use some sort of scatter gather concept
so maximize memory usage efficiency.
To that end this patch keeps the notion of a scatter gather
list but implements it in the nvgpu common code. It is based
heavily on the Linux SGL concept. It is a singly linked list
of blocks - each representing a chunk of memory. To map or
use a DMA allocation SW must iterate over each block in the
SGL.
This patch implements the most basic level of support for this
data structure. There are certainly easy optimizations that
could be done to speed up the current implementation. However,
this patches' goal is to simply divest the core MM code from
any last Linux'isms. Speed and efficiency come next.
Change-Id: Icf44641db22d87fa1d003debbd9f71b605258e42
Signed-off-by: Alex Waterman <alexw@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1530867
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/gk20a/mm_gk20a.h')
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/mm_gk20a.h | 43 |
1 files changed, 21 insertions, 22 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/mm_gk20a.h b/drivers/gpu/nvgpu/gk20a/mm_gk20a.h index c77bebf8..2fdc1729 100644 --- a/drivers/gpu/nvgpu/gk20a/mm_gk20a.h +++ b/drivers/gpu/nvgpu/gk20a/mm_gk20a.h | |||
@@ -336,7 +336,6 @@ void gk20a_mm_dump_vm(struct vm_gk20a *vm, | |||
336 | 336 | ||
337 | int gk20a_mm_suspend(struct gk20a *g); | 337 | int gk20a_mm_suspend(struct gk20a *g); |
338 | 338 | ||
339 | u64 gk20a_mm_gpu_phys_addr(struct gk20a *g, u64 phys, u32 flags); | ||
340 | u64 gk20a_mm_smmu_vaddr_translate(struct gk20a *g, dma_addr_t iova); | 339 | u64 gk20a_mm_smmu_vaddr_translate(struct gk20a *g, dma_addr_t iova); |
341 | 340 | ||
342 | void gk20a_mm_ltc_isr(struct gk20a *g); | 341 | void gk20a_mm_ltc_isr(struct gk20a *g); |
@@ -361,29 +360,29 @@ static inline phys_addr_t gk20a_mem_phys(struct nvgpu_mem *mem) | |||
361 | } | 360 | } |
362 | 361 | ||
363 | u64 gk20a_locked_gmmu_map(struct vm_gk20a *vm, | 362 | u64 gk20a_locked_gmmu_map(struct vm_gk20a *vm, |
364 | u64 map_offset, | 363 | u64 map_offset, |
365 | struct sg_table *sgt, | 364 | struct nvgpu_mem_sgl *sgl, |
366 | u64 buffer_offset, | 365 | u64 buffer_offset, |
367 | u64 size, | 366 | u64 size, |
368 | int pgsz_idx, | 367 | int pgsz_idx, |
369 | u8 kind_v, | 368 | u8 kind_v, |
370 | u32 ctag_offset, | 369 | u32 ctag_offset, |
371 | u32 flags, | 370 | u32 flags, |
372 | int rw_flag, | 371 | int rw_flag, |
373 | bool clear_ctags, | 372 | bool clear_ctags, |
374 | bool sparse, | 373 | bool sparse, |
375 | bool priv, | 374 | bool priv, |
376 | struct vm_gk20a_mapping_batch *batch, | 375 | struct vm_gk20a_mapping_batch *batch, |
377 | enum nvgpu_aperture aperture); | 376 | enum nvgpu_aperture aperture); |
378 | 377 | ||
379 | void gk20a_locked_gmmu_unmap(struct vm_gk20a *vm, | 378 | void gk20a_locked_gmmu_unmap(struct vm_gk20a *vm, |
380 | u64 vaddr, | 379 | u64 vaddr, |
381 | u64 size, | 380 | u64 size, |
382 | int pgsz_idx, | 381 | int pgsz_idx, |
383 | bool va_allocated, | 382 | bool va_allocated, |
384 | int rw_flag, | 383 | int rw_flag, |
385 | bool sparse, | 384 | bool sparse, |
386 | struct vm_gk20a_mapping_batch *batch); | 385 | struct vm_gk20a_mapping_batch *batch); |
387 | 386 | ||
388 | struct sg_table *gk20a_mm_pin(struct device *dev, struct dma_buf *dmabuf); | 387 | struct sg_table *gk20a_mm_pin(struct device *dev, struct dma_buf *dmabuf); |
389 | void gk20a_mm_unpin(struct device *dev, struct dma_buf *dmabuf, | 388 | void gk20a_mm_unpin(struct device *dev, struct dma_buf *dmabuf, |