From eb15c0f8cf2425122ece2413985409a8141ad6dd Mon Sep 17 00:00:00 2001 From: Jon Hunter Date: Tue, 28 Feb 2023 17:43:14 +0000 Subject: [PATCH] video: tegra: nvmap: Fix build for Linux v6.3 Upstream Linux commit bc292ab00f6c ("(HEAD) mm: introduce vma->vm_flags wrapper functions") breaking building the NVMAP driver because the vm_flags variable is made a const and can no longer be set directly. Fix the build for Linux v6.3 by using the helper functions for setting the flags. Bug 4014315 Change-Id: I52a323a995f5f9ffa8c3356a134c4cf2542e967f Signed-off-by: Jon Hunter Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2867138 Reviewed-by: Puneet Saxena Reviewed-by: Sachin Nikam Reviewed-by: Ketan Patil Reviewed-by: svc_kernel_abi GVS: Gerrit_Virtual_Submit --- drivers/video/tegra/nvmap/nvmap_dmabuf.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/video/tegra/nvmap/nvmap_dmabuf.c b/drivers/video/tegra/nvmap/nvmap_dmabuf.c index 4bef7699..880cce9b 100644 --- a/drivers/video/tegra/nvmap/nvmap_dmabuf.c +++ b/drivers/video/tegra/nvmap/nvmap_dmabuf.c @@ -360,9 +360,15 @@ int __nvmap_map(struct nvmap_handle *h, struct vm_area_struct *vma) } priv->handle = h; +#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 3, 0) + vm_flags_set(vma, VM_SHARED | VM_DONTEXPAND | + VM_DONTDUMP | VM_DONTCOPY | + (h->heap_pgalloc ? 0 : VM_PFNMAP)); +#else vma->vm_flags |= VM_SHARED | VM_DONTEXPAND | VM_DONTDUMP | VM_DONTCOPY | (h->heap_pgalloc ? 0 : VM_PFNMAP); +#endif vma->vm_ops = &nvmap_vma_ops; BUG_ON(vma->vm_private_data != NULL); vma->vm_private_data = priv;