Skip to content

Instantly share code, notes, and snippets.

@gonsolo
Created May 24, 2023 16:52
Show Gist options
  • Save gonsolo/3232b9612dde6535658ec0ba2086bf30 to your computer and use it in GitHub Desktop.
Save gonsolo/3232b9612dde6535658ec0ba2086bf30 to your computer and use it in GitHub Desktop.
Run nvidia driver 530.30.02 on Linux 6.3.3
diff -u -r nvidia-530.30.02/nvidia/nv-mmap.c /home/gonsolo/nvidia-530.30.02/nvidia/nv-mmap.c
--- nvidia-530.30.02/nvidia/nv-mmap.c 2023-02-22 05:37:36.000000000 +0100
+++ /home/gonsolo/nvidia-530.30.02/nvidia/nv-mmap.c 2023-05-24 18:49:07.797789349 +0200
@@ -458,7 +458,7 @@
}
// Needed for the linux kernel for mapping compound pages
- vma->vm_flags |= VM_MIXEDMAP;
+ vm_flags_set(vma, VM_MIXEDMAP);
for (i = 0, addr = mmap_context->page_array[0]; i < pages;
addr = mmap_context->page_array[++i], start += PAGE_SIZE)
@@ -603,7 +603,7 @@
}
up(&nvl->mmap_lock);
- vma->vm_flags |= VM_IO | VM_PFNMAP | VM_DONTEXPAND;
+ vm_flags_set(vma, VM_IO | VM_PFNMAP | VM_DONTEXPAND);
}
else
{
@@ -670,15 +670,15 @@
NV_PRINT_AT(NV_DBG_MEMINFO, at);
- vma->vm_flags |= (VM_IO | VM_LOCKED | VM_RESERVED);
- vma->vm_flags |= (VM_DONTEXPAND | VM_DONTDUMP);
+ vm_flags_set(vma, VM_IO | VM_LOCKED | VM_RESERVED);
+ vm_flags_set(vma, VM_DONTEXPAND | VM_DONTDUMP);
}
if ((prot & NV_PROTECT_WRITEABLE) == 0)
{
vma->vm_page_prot = NV_PGPROT_READ_ONLY(vma->vm_page_prot);
- vma->vm_flags &= ~VM_WRITE;
- vma->vm_flags &= ~VM_MAYWRITE;
+ vm_flags_clear(vma, VM_WRITE);
+ vm_flags_clear(vma, VM_MAYWRITE);
}
vma->vm_ops = &nv_vm_ops;
diff -u -r nvidia-530.30.02/nvidia-drm/nvidia-drm-gem-user-memory.c /home/gonsolo/nvidia-530.30.02/nvidia-drm/nvidia-drm-gem-user-memory.c
--- nvidia-530.30.02/nvidia-drm/nvidia-drm-gem-user-memory.c 2023-02-22 04:45:19.000000000 +0100
+++ /home/gonsolo/nvidia-530.30.02/nvidia-drm/nvidia-drm-gem-user-memory.c 2023-05-24 18:44:12.963686845 +0200
@@ -92,9 +92,9 @@
return -EINVAL;
}
- vma->vm_flags &= ~VM_PFNMAP;
- vma->vm_flags &= ~VM_IO;
- vma->vm_flags |= VM_MIXEDMAP;
+ vm_flags_clear(vma, VM_PFNMAP);
+ vm_flags_clear(vma, VM_IO);
+ vm_flags_set(vma, VM_MIXEDMAP);
return 0;
}
diff -u -r nvidia-530.30.02/nvidia-uvm/uvm.c /home/gonsolo/nvidia-530.30.02/nvidia-uvm/uvm.c
--- nvidia-530.30.02/nvidia-uvm/uvm.c 2023-02-22 05:37:20.000000000 +0100
+++ /home/gonsolo/nvidia-530.30.02/nvidia-uvm/uvm.c 2023-05-24 18:44:17.044188625 +0200
@@ -696,7 +696,7 @@
// of removing CPU mappings in the parent on fork()+exec(). Users can call
// madvise(MDV_DOFORK) if the child process requires access to the
// allocation.
- vma->vm_flags |= VM_MIXEDMAP | VM_DONTEXPAND | VM_DONTCOPY;
+ vm_flags_set(vma, VM_MIXEDMAP | VM_DONTEXPAND | VM_DONTCOPY);
vma->vm_ops = &uvm_vm_ops_managed;
@tufei
Copy link

tufei commented Jun 3, 2023

Thank you for posting on Nvidia forum. Works for latest kernel update in Fedora 37.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment