diff options
author | Thomas Fleury <tfleury@nvidia.com> | 2018-03-07 12:23:53 -0500 |
---|---|---|
committer | mobile promotions <svcmobile_promotions@nvidia.com> | 2018-03-13 03:04:16 -0400 |
commit | 6c33a010d8e3983cc3504e073cd552f952440aa1 (patch) | |
tree | c86e364d468320c8b347b58b6a711f773b97ae42 /drivers/gpu/nvgpu/common/linux | |
parent | f94c9d19c19883ca2b60acb8a000b34b32da0aa7 (diff) |
gpu: nvgpu: add placeholder for IPA to PA
Add __nvgpu_sgl_phys function that can be used to implement IPA
to PA translation in a subsequent change.
Adapt existing function prototypes to add pointer to gpu context,
as we will need to check if IPA to PA translation is needed.
JIRA EVLR-2442
Bug 200392719
Change-Id: I5a734c958c8277d1bf673c020dafb31263f142d6
Signed-off-by: Thomas Fleury <tfleury@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1673142
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/common/linux')
-rw-r--r-- | drivers/gpu/nvgpu/common/linux/nvgpu_mem.c | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/drivers/gpu/nvgpu/common/linux/nvgpu_mem.c b/drivers/gpu/nvgpu/common/linux/nvgpu_mem.c index d4549e1b..63a14f40 100644 --- a/drivers/gpu/nvgpu/common/linux/nvgpu_mem.c +++ b/drivers/gpu/nvgpu/common/linux/nvgpu_mem.c | |||
@@ -34,6 +34,11 @@ | |||
34 | #include "gk20a/gk20a.h" | 34 | #include "gk20a/gk20a.h" |
35 | #include "gk20a/mm_gk20a.h" | 35 | #include "gk20a/mm_gk20a.h" |
36 | 36 | ||
37 | static inline u64 __nvgpu_sgl_phys(struct gk20a *g, struct nvgpu_sgl *sgl) | ||
38 | { | ||
39 | return sg_phys((struct scatterlist *)sgl); | ||
40 | } | ||
41 | |||
37 | int nvgpu_mem_begin(struct gk20a *g, struct nvgpu_mem *mem) | 42 | int nvgpu_mem_begin(struct gk20a *g, struct nvgpu_mem *mem) |
38 | { | 43 | { |
39 | void *cpu_va; | 44 | void *cpu_va; |
@@ -309,10 +314,12 @@ u64 nvgpu_mem_get_addr_sgl(struct gk20a *g, struct scatterlist *sgl) | |||
309 | { | 314 | { |
310 | if (nvgpu_is_enabled(g, NVGPU_MM_USE_PHYSICAL_SG) || | 315 | if (nvgpu_is_enabled(g, NVGPU_MM_USE_PHYSICAL_SG) || |
311 | !nvgpu_iommuable(g)) | 316 | !nvgpu_iommuable(g)) |
312 | return g->ops.mm.gpu_phys_addr(g, NULL, sg_phys(sgl)); | 317 | return g->ops.mm.gpu_phys_addr(g, NULL, |
318 | __nvgpu_sgl_phys(g, (struct nvgpu_sgl *)sgl)); | ||
313 | 319 | ||
314 | if (sg_dma_address(sgl) == 0) | 320 | if (sg_dma_address(sgl) == 0) |
315 | return g->ops.mm.gpu_phys_addr(g, NULL, sg_phys(sgl)); | 321 | return g->ops.mm.gpu_phys_addr(g, NULL, |
322 | __nvgpu_sgl_phys(g, (struct nvgpu_sgl *)sgl)); | ||
316 | 323 | ||
317 | if (sg_dma_address(sgl) == DMA_ERROR_CODE) | 324 | if (sg_dma_address(sgl) == DMA_ERROR_CODE) |
318 | return 0; | 325 | return 0; |
@@ -376,7 +383,7 @@ u64 nvgpu_mem_get_phys_addr(struct gk20a *g, struct nvgpu_mem *mem) | |||
376 | if (mem->aperture == APERTURE_VIDMEM) | 383 | if (mem->aperture == APERTURE_VIDMEM) |
377 | return nvgpu_mem_get_addr(g, mem); | 384 | return nvgpu_mem_get_addr(g, mem); |
378 | 385 | ||
379 | return sg_phys(mem->priv.sgt->sgl); | 386 | return __nvgpu_sgl_phys(g, (struct nvgpu_sgl *)mem->priv.sgt->sgl); |
380 | } | 387 | } |
381 | 388 | ||
382 | /* | 389 | /* |
@@ -501,9 +508,9 @@ static struct nvgpu_sgl *nvgpu_mem_linux_sgl_next(struct nvgpu_sgl *sgl) | |||
501 | return (struct nvgpu_sgl *)sg_next((struct scatterlist *)sgl); | 508 | return (struct nvgpu_sgl *)sg_next((struct scatterlist *)sgl); |
502 | } | 509 | } |
503 | 510 | ||
504 | static u64 nvgpu_mem_linux_sgl_phys(struct nvgpu_sgl *sgl) | 511 | static u64 nvgpu_mem_linux_sgl_phys(struct gk20a *g, struct nvgpu_sgl *sgl) |
505 | { | 512 | { |
506 | return (u64)sg_phys((struct scatterlist *)sgl); | 513 | return (u64)__nvgpu_sgl_phys(g, sgl); |
507 | } | 514 | } |
508 | 515 | ||
509 | static u64 nvgpu_mem_linux_sgl_dma(struct nvgpu_sgl *sgl) | 516 | static u64 nvgpu_mem_linux_sgl_dma(struct nvgpu_sgl *sgl) |
@@ -522,7 +529,7 @@ static u64 nvgpu_mem_linux_sgl_gpu_addr(struct gk20a *g, | |||
522 | { | 529 | { |
523 | if (sg_dma_address((struct scatterlist *)sgl) == 0) | 530 | if (sg_dma_address((struct scatterlist *)sgl) == 0) |
524 | return g->ops.mm.gpu_phys_addr(g, attrs, | 531 | return g->ops.mm.gpu_phys_addr(g, attrs, |
525 | sg_phys((struct scatterlist *)sgl)); | 532 | __nvgpu_sgl_phys(g, sgl)); |
526 | 533 | ||
527 | if (sg_dma_address((struct scatterlist *)sgl) == DMA_ERROR_CODE) | 534 | if (sg_dma_address((struct scatterlist *)sgl) == DMA_ERROR_CODE) |
528 | return 0; | 535 | return 0; |