summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/common/mm/vm.c
diff options
context:
space:
mode:
authorSami Kiminki <skiminki@nvidia.com>2017-11-28 11:12:12 -0500
committermobile promotions <svcmobile_promotions@nvidia.com>2017-11-30 21:57:19 -0500
commitd73ad6c07da23636c00c60effeeb53ea35847ee8 (patch)
treefc92c533909c84af308b10eb91a87e455e82dae4 /drivers/gpu/nvgpu/common/mm/vm.c
parent86a94230c6d57803d572bfba726e1b02db0e3dc3 (diff)
gpu: nvgpu: Alignment check for compressible fixed-address mappings
Add an alignment check for compressible-kind fixed-address mappings. If we're using page size smaller than the comptag line coverage window, the GPU VA and the physical buffer offset must be aligned in respect to that window. Bug 1995897 Bug 2011640 Bug 2011668 Change-Id: If68043ee2828d54b9398d77553d10d35cc319236 Signed-off-by: Sami Kiminki <skiminki@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/1606439 Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com> Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/common/mm/vm.c')
-rw-r--r--drivers/gpu/nvgpu/common/mm/vm.c23
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