-
Notifications
You must be signed in to change notification settings - Fork 1
/
nvidia-390xx-kmod-0025-kernel-6.3-adaptation.patch
84 lines (72 loc) · 2.55 KB
/
nvidia-390xx-kmod-0025-kernel-6.3-adaptation.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
From d524cf3215aed8872558f21bd6b2c49c21b3d694 Mon Sep 17 00:00:00 2001
From: NVieville <[email protected]>
Date: Tue, 9 May 2023 12:37:27 +0200
Subject: [PATCH] Fix build for kernel 6.3.x
Signed-off-by: NVieville <[email protected]>
---
kernel/nvidia-uvm/uvm8.c | 4 ++++
kernel/nvidia/nv-mmap.c | 18 ++++++++++++++++++
2 files changed, 22 insertions(+)
diff --git a/kernel/nvidia-uvm/uvm8.c b/kernel/nvidia-uvm/uvm8.c
index 11cb373..c68d471 100644
--- a/kernel/nvidia-uvm/uvm8.c
+++ b/kernel/nvidia-uvm/uvm8.c
@@ -658,7 +658,11 @@ static int uvm_mmap(struct file *filp, struct vm_area_struct *vma)
// Using VM_DONTCOPY would be nice, but madvise(MADV_DOFORK) can reset that
// so we have to handle vm_open on fork anyway. We could disable MADV_DOFORK
// with VM_IO, but that causes other mapping issues.
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 3, 0)
vma->vm_flags |= VM_MIXEDMAP | VM_DONTEXPAND;
+#else
+ vm_flags_set(vma, VM_MIXEDMAP | VM_DONTEXPAND);
+#endif
vma->vm_ops = &uvm_vm_ops_managed;
diff --git a/kernel/nvidia/nv-mmap.c b/kernel/nvidia/nv-mmap.c
index 0b0a6f2..dcb8b89 100644
--- a/kernel/nvidia/nv-mmap.c
+++ b/kernel/nvidia/nv-mmap.c
@@ -447,7 +447,11 @@ int nvidia_mmap_helper(
addr = mmap_start;
// Needed for the linux kernel for mapping compound pages
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 3, 0)
vma->vm_flags |= VM_MIXEDMAP;
+#else
+ vm_flags_set(vma, VM_MIXEDMAP);
+#endif
for (j = 0; j < pages; j++)
{
@@ -471,7 +475,11 @@ int nvidia_mmap_helper(
}
}
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 3, 0)
vma->vm_flags |= VM_IO;
+#else
+ vm_flags_set(vma, VM_IO);
+#endif
}
else
{
@@ -533,15 +541,25 @@ int nvidia_mmap_helper(
NV_PRINT_AT(NV_DBG_MEMINFO, at);
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 3, 0)
vma->vm_flags |= (VM_IO | VM_LOCKED | VM_RESERVED);
vma->vm_flags |= (VM_DONTEXPAND | VM_DONTDUMP);
+#else
+ vm_flags_set(vma, VM_IO | VM_LOCKED | VM_RESERVED);
+ vm_flags_set(vma, VM_DONTEXPAND | VM_DONTDUMP);
+#endif
}
if ((prot & NV_PROTECT_WRITEABLE) == 0)
{
vma->vm_page_prot = NV_PGPROT_READ_ONLY(vma->vm_page_prot);
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 3, 0)
vma->vm_flags &= ~VM_WRITE;
vma->vm_flags &= ~VM_MAYWRITE;
+#else
+ vm_flags_clear(vma, VM_WRITE);
+ vm_flags_clear(vma, VM_MAYWRITE);
+#endif
}
vma->vm_ops = &nv_vm_ops;
--
2.40.1