diff --git a/drivers/gpu/nvgpu/os/linux/debug_gr.c b/drivers/gpu/nvgpu/os/linux/debug_gr.c index 80705710b..1ebb865ff 100644 --- a/drivers/gpu/nvgpu/os/linux/debug_gr.c +++ b/drivers/gpu/nvgpu/os/linux/debug_gr.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2022, NVIDIA CORPORATION. All rights reserved. + * Copyright (c) 2017-2023, NVIDIA CORPORATION. All rights reserved. * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, @@ -27,6 +27,7 @@ #include #include #include +#include #ifdef CONFIG_NVGPU_COMPRESSION static int cbc_status_debug_show(struct seq_file *s, void *unused) @@ -245,9 +246,15 @@ static int cbc_ctrl_debug_mmap_cbc_store(struct file *f, struct vm_area_struct * err = -EINVAL; goto done; } +#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 3, 0) + vm_flags_set(vma, VM_DONTCOPY | VM_DONTEXPAND | VM_NORESERVE | + VM_DONTDUMP | VM_PFNMAP); + vm_flags_clear(vma, VM_MAYWRITE); +#else vma->vm_flags |= VM_DONTCOPY | VM_DONTEXPAND | VM_NORESERVE | VM_DONTDUMP | VM_PFNMAP; vma->vm_flags &= ~VM_MAYWRITE; +#endif cbc_store_pa = nvgpu_mem_get_addr(g, &cbc->compbit_store.mem); err = remap_pfn_range(vma, vma->vm_start, cbc_store_pa >> PAGE_SHIFT, mapping_size, prot); diff --git a/drivers/gpu/nvgpu/os/linux/dmabuf_nvs.c b/drivers/gpu/nvgpu/os/linux/dmabuf_nvs.c index 8fed4f292..fc24fef21 100644 --- a/drivers/gpu/nvgpu/os/linux/dmabuf_nvs.c +++ b/drivers/gpu/nvgpu/os/linux/dmabuf_nvs.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, NVIDIA CORPORATION. All rights reserved. + * Copyright (c) 2022-2023, NVIDIA CORPORATION. All rights reserved. * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, @@ -144,11 +144,20 @@ static int nvgpu_nvs_buf_mmap(struct dma_buf *dmabuf, struct vm_area_struct *vma nvgpu_nvs_ctrl_fifo_lock_queues(g); +#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 3, 0) + vm_flags_set(vma, VM_DONTCOPY | VM_DONTEXPAND | VM_NORESERVE | + VM_DONTDUMP); +#else vma->vm_flags |= VM_DONTCOPY | VM_DONTEXPAND | VM_NORESERVE | VM_DONTDUMP; +#endif if (buf->mask == NVGPU_NVS_CTRL_FIFO_QUEUE_CLIENT_EVENTS_READ) { +#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 3, 0) + vm_flags_set(vma, VM_SHARED); +#else vma->vm_flags |= VM_SHARED; +#endif } vm_ops_old = vma->vm_ops; diff --git a/drivers/gpu/nvgpu/os/linux/ioctl_ctrl.c b/drivers/gpu/nvgpu/os/linux/ioctl_ctrl.c index f63c4ca01..0be9c2c69 100644 --- a/drivers/gpu/nvgpu/os/linux/ioctl_ctrl.c +++ b/drivers/gpu/nvgpu/os/linux/ioctl_ctrl.c @@ -14,6 +14,7 @@ * along with this program. If not, see . */ +#include #include #include #include @@ -2723,8 +2724,13 @@ int gk20a_ctrl_dev_mmap(struct file *filp, struct vm_area_struct *vma) nvgpu_mutex_acquire(&l->ctrl_privs_lock); +#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 3, 0) + vm_flags_set(vma, VM_IO | VM_DONTCOPY | VM_DONTEXPAND | VM_NORESERVE | + VM_DONTDUMP | VM_PFNMAP); +#else vma->vm_flags |= VM_IO | VM_DONTCOPY | VM_DONTEXPAND | VM_NORESERVE | VM_DONTDUMP | VM_PFNMAP; +#endif vma->vm_ops = &usermode_vma_ops; vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);