diff options
-rw-r--r-- | drivers/gpu/nvgpu/common/linux/dma.c | 6 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/common/mm/gmmu.c | 13 |
2 files changed, 17 insertions, 2 deletions
diff --git a/drivers/gpu/nvgpu/common/linux/dma.c b/drivers/gpu/nvgpu/common/linux/dma.c index 6473aed9..ea5b2837 100644 --- a/drivers/gpu/nvgpu/common/linux/dma.c +++ b/drivers/gpu/nvgpu/common/linux/dma.c | |||
@@ -77,9 +77,13 @@ int nvgpu_dma_alloc_flags(struct gk20a *g, unsigned long flags, size_t size, | |||
77 | * the lack of it for vidmem - the user should not care when | 77 | * the lack of it for vidmem - the user should not care when |
78 | * using nvgpu_gmmu_alloc_map and it's vidmem, or if there's a | 78 | * using nvgpu_gmmu_alloc_map and it's vidmem, or if there's a |
79 | * difference, the user should use the flag explicitly anyway. | 79 | * difference, the user should use the flag explicitly anyway. |
80 | * | ||
81 | * Incoming flags are ignored here, since bits other than the | ||
82 | * no-kernel-mapping flag are ignored by the vidmem mapping | ||
83 | * functions anyway. | ||
80 | */ | 84 | */ |
81 | int err = nvgpu_dma_alloc_flags_vid(g, | 85 | int err = nvgpu_dma_alloc_flags_vid(g, |
82 | flags | NVGPU_DMA_NO_KERNEL_MAPPING, | 86 | NVGPU_DMA_NO_KERNEL_MAPPING, |
83 | size, mem); | 87 | size, mem); |
84 | 88 | ||
85 | if (!err) | 89 | if (!err) |
diff --git a/drivers/gpu/nvgpu/common/mm/gmmu.c b/drivers/gpu/nvgpu/common/mm/gmmu.c index 2b579bdd..1be87c85 100644 --- a/drivers/gpu/nvgpu/common/mm/gmmu.c +++ b/drivers/gpu/nvgpu/common/mm/gmmu.c | |||
@@ -637,6 +637,8 @@ static int __nvgpu_gmmu_update_page_table(struct vm_gk20a *vm, | |||
637 | struct nvgpu_gmmu_attrs *attrs) | 637 | struct nvgpu_gmmu_attrs *attrs) |
638 | { | 638 | { |
639 | struct gk20a *g = gk20a_from_vm(vm); | 639 | struct gk20a *g = gk20a_from_vm(vm); |
640 | struct nvgpu_page_alloc *alloc; | ||
641 | u64 phys_addr = 0; | ||
640 | u32 page_size; | 642 | u32 page_size; |
641 | int err; | 643 | int err; |
642 | 644 | ||
@@ -662,6 +664,15 @@ static int __nvgpu_gmmu_update_page_table(struct vm_gk20a *vm, | |||
662 | return err; | 664 | return err; |
663 | } | 665 | } |
664 | 666 | ||
667 | if (sgt) { | ||
668 | if (attrs->aperture == APERTURE_VIDMEM) { | ||
669 | alloc = get_vidmem_page_alloc(sgt->sgl); | ||
670 | |||
671 | phys_addr = alloc->base; | ||
672 | } else | ||
673 | phys_addr = g->ops.mm.get_iova_addr(g, sgt->sgl, 0); | ||
674 | } | ||
675 | |||
665 | __gmmu_dbg(g, attrs, | 676 | __gmmu_dbg(g, attrs, |
666 | "vm=%s " | 677 | "vm=%s " |
667 | "%-5s GPU virt %#-12llx +%#-9llx phys %#-12llx " | 678 | "%-5s GPU virt %#-12llx +%#-9llx phys %#-12llx " |
@@ -671,7 +682,7 @@ static int __nvgpu_gmmu_update_page_table(struct vm_gk20a *vm, | |||
671 | sgt ? "MAP" : "UNMAP", | 682 | sgt ? "MAP" : "UNMAP", |
672 | virt_addr, | 683 | virt_addr, |
673 | length, | 684 | length, |
674 | sgt ? g->ops.mm.get_iova_addr(g, sgt->sgl, 0) : 0ULL, | 685 | phys_addr, |
675 | space_to_skip, | 686 | space_to_skip, |
676 | page_size >> 10, | 687 | page_size >> 10, |
677 | nvgpu_gmmu_perm_str(attrs->rw_flag), | 688 | nvgpu_gmmu_perm_str(attrs->rw_flag), |