diff options
Diffstat (limited to 'drivers/gpu/nvgpu/common/mm/vm.c')
-rw-r--r-- | drivers/gpu/nvgpu/common/mm/vm.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/drivers/gpu/nvgpu/common/mm/vm.c b/drivers/gpu/nvgpu/common/mm/vm.c index 637632e0..f85089d5 100644 --- a/drivers/gpu/nvgpu/common/mm/vm.c +++ b/drivers/gpu/nvgpu/common/mm/vm.c | |||
@@ -847,6 +847,29 @@ struct nvgpu_mapped_buf *nvgpu_vm_map(struct vm_gk20a *vm, | |||
847 | goto clean_up; | 847 | goto clean_up; |
848 | } | 848 | } |
849 | 849 | ||
850 | if ((binfo.compr_kind != NVGPU_KIND_INVALID) && | ||
851 | (flags & NVGPU_VM_MAP_FIXED_OFFSET)) { | ||
852 | /* | ||
853 | * Fixed-address compressible mapping is | ||
854 | * requested. Make sure we're respecting the alignment | ||
855 | * requirement for virtual addresses and buffer | ||
856 | * offsets. | ||
857 | * | ||
858 | * This check must be done before we may fall back to | ||
859 | * the incompressible kind. | ||
860 | */ | ||
861 | |||
862 | const u64 offset_mask = g->ops.fb.compression_align_mask(g); | ||
863 | |||
864 | if ((map_addr & offset_mask) != (phys_offset & offset_mask)) { | ||
865 | nvgpu_log(g, gpu_dbg_map, | ||
866 | "Misaligned compressible-kind fixed-address " | ||
867 | "mapping"); | ||
868 | err = -EINVAL; | ||
869 | goto clean_up; | ||
870 | } | ||
871 | } | ||
872 | |||
850 | if (binfo.compr_kind != NVGPU_KIND_INVALID) { | 873 | if (binfo.compr_kind != NVGPU_KIND_INVALID) { |
851 | struct gk20a_comptags comptags = { 0 }; | 874 | struct gk20a_comptags comptags = { 0 }; |
852 | 875 | ||