commit a4c848a64f5bb96ddc15647676cdaf33b75d57d8
Author: Nicolas Viéville <nicolas.vieville(a)uphf.fr>
Date: Thu Jun 1 17:45:28 2023 +0200
Fix patch for kernel >= 6.2
Add patch for kernel >= 6.3
Add patch for kernel >= 6.4
SPEC file - Fix patchN macro is deprecated
nvidia-390xx-kmod-0024-kernel-6.2-adaptation.patch | 19 ++++-
nvidia-390xx-kmod-0025-kernel-6.3-adaptation.patch | 84 ++++++++++++++++++++++
nvidia-390xx-kmod-0026-kernel-6.4-adaptation.patch | 27 +++++++
nvidia-390xx-kmod.spec | 48 ++++++++-----
4 files changed, 156 insertions(+), 22 deletions(-)
---
diff --git a/nvidia-390xx-kmod-0024-kernel-6.2-adaptation.patch
b/nvidia-390xx-kmod-0024-kernel-6.2-adaptation.patch
index 4f8e6fc..478492e 100644
--- a/nvidia-390xx-kmod-0024-kernel-6.2-adaptation.patch
+++ b/nvidia-390xx-kmod-0024-kernel-6.2-adaptation.patch
@@ -1,4 +1,4 @@
-From 051a24b3b4e6e6a617dea98184b598e3039e7db9 Mon Sep 17 00:00:00 2001
+From bf78b6170c83d556d318efa7197398c2442d776b Mon Sep 17 00:00:00 2001
From: NVieville <nicolas.vieville(a)uphf.fr>
Date: Wed, 12 Apr 2023 12:14:39 +0200
Subject: [PATCH] Fix build for kernel 6.2.x
@@ -7,8 +7,9 @@ Signed-off-by: NVieville <nicolas.vieville(a)uphf.fr>
---
kernel/nvidia-drm/nvidia-drm-connector.c | 21 +++++++++++++++++++++
kernel/nvidia-drm/nvidia-drm-drv.c | 4 ++++
+ kernel/nvidia-drm/nvidia-drm-fb.c | 1 +
kernel/nvidia/nv-acpi.c | 19 +++++++++++++++++++
- 3 files changed, 44 insertions(+)
+ 4 files changed, 45 insertions(+)
diff --git a/kernel/nvidia-drm/nvidia-drm-connector.c
b/kernel/nvidia-drm/nvidia-drm-connector.c
index 54167a7..9585840 100644
@@ -81,6 +82,18 @@ index 1289cb3..ca03978 100644
dev->mode_config.async_page_flip = false;
+diff --git a/kernel/nvidia-drm/nvidia-drm-fb.c b/kernel/nvidia-drm/nvidia-drm-fb.c
+index 725164a..e0b94f2 100644
+--- a/kernel/nvidia-drm/nvidia-drm-fb.c
++++ b/kernel/nvidia-drm/nvidia-drm-fb.c
+@@ -31,6 +31,7 @@
+ #include "nvidia-drm-gem.h"
+
+ #include <drm/drm_crtc_helper.h>
++#include <drm/drm_modeset_helper.h>
+
+ static void nv_drm_framebuffer_destroy(struct drm_framebuffer *fb)
+ {
diff --git a/kernel/nvidia/nv-acpi.c b/kernel/nvidia/nv-acpi.c
index b37c9f3..06056a4 100644
--- a/kernel/nvidia/nv-acpi.c
@@ -156,5 +169,5 @@ index b37c9f3..06056a4 100644
static void nv_acpi_event(acpi_handle handle, u32 event_type, void *data)
--
-2.39.2
+2.40.1
diff --git a/nvidia-390xx-kmod-0025-kernel-6.3-adaptation.patch
b/nvidia-390xx-kmod-0025-kernel-6.3-adaptation.patch
new file mode 100644
index 0000000..d6c0b54
--- /dev/null
+++ b/nvidia-390xx-kmod-0025-kernel-6.3-adaptation.patch
@@ -0,0 +1,84 @@
+From d524cf3215aed8872558f21bd6b2c49c21b3d694 Mon Sep 17 00:00:00 2001
+From: NVieville <nicolas.vieville(a)uphf.fr>
+Date: Tue, 9 May 2023 12:37:27 +0200
+Subject: [PATCH] Fix build for kernel 6.3.x
+
+Signed-off-by: NVieville <nicolas.vieville(a)uphf.fr>
+---
+ 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
+
diff --git a/nvidia-390xx-kmod-0026-kernel-6.4-adaptation.patch
b/nvidia-390xx-kmod-0026-kernel-6.4-adaptation.patch
new file mode 100644
index 0000000..ce48052
--- /dev/null
+++ b/nvidia-390xx-kmod-0026-kernel-6.4-adaptation.patch
@@ -0,0 +1,27 @@
+From e0ee9313f0b7400ae64dd83fc433c2e2d650b3c8 Mon Sep 17 00:00:00 2001
+From: NVieville <nicolas.vieville(a)uphf.fr>
+Date: Wed, 10 May 2023 14:41:09 +0200
+Subject: [PATCH] Fix build for kernel 6.4.x
+
+Signed-off-by: NVieville <nicolas.vieville(a)uphf.fr>
+---
+ kernel/nvidia-drm/nvidia-drm-drv.c | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/kernel/nvidia-drm/nvidia-drm-drv.c b/kernel/nvidia-drm/nvidia-drm-drv.c
+index ca03978..36fa536 100644
+--- a/kernel/nvidia-drm/nvidia-drm-drv.c
++++ b/kernel/nvidia-drm/nvidia-drm-drv.c
+@@ -766,7 +766,9 @@ static void nv_drm_update_drm_driver_features(void)
+
+ nv_drm_driver.dumb_create = nv_drm_dumb_create;
+ nv_drm_driver.dumb_map_offset = nv_drm_dumb_map_offset;
++#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 4, 0)
+ nv_drm_driver.dumb_destroy = nv_drm_dumb_destroy;
++#endif
+
+ #if defined(NV_DRM_DRIVER_HAS_GEM_PRIME_CALLBACKS)
+ nv_drm_driver.gem_vm_ops = &nv_drm_gem_vma_ops;
+--
+2.40.1
+
diff --git a/nvidia-390xx-kmod.spec b/nvidia-390xx-kmod.spec
index 4c31b3d..fd1c592 100644
--- a/nvidia-390xx-kmod.spec
+++ b/nvidia-390xx-kmod.spec
@@ -18,7 +18,7 @@ Name: nvidia-390xx-kmod
Epoch: 3
Version: 390.157
# Taken over by kmodtool
-Release: 2%{?dist}
+Release: 3%{?dist}
Summary: NVIDIA 390xx display driver kernel module
Group: System Environment/Kernel
License: Redistributable, no modification permitted
@@ -43,6 +43,8 @@ Patch13: 0018-backport-nv_install_notifier-changes-from-418.30.patch
#Copied from Arch
Patch19: kernel-4.16+-memory-encryption.patch
Patch20: nvidia-390xx-kmod-0024-kernel-6.2-adaptation.patch
+Patch21: nvidia-390xx-kmod-0025-kernel-6.3-adaptation.patch
+Patch22: nvidia-390xx-kmod-0026-kernel-6.4-adaptation.patch
# build system updates
Patch30: use-kbuild-compiler.patch
@@ -78,25 +80,27 @@ kmodtool --target %{_target_cpu} --repo rpmfusion --kmodname %{name}
--filterf
%setup -T -c
tar --use-compress-program xz -xf
%{_datadir}/%{name}-%{version}/%{name}-%{version}-%{_target_cpu}.tar.xz
# Apply patches
-%patch12 -p1 -b 12 -d kernel
-%patch13 -p1 -b 13 -d kernel
-#patch14 -p1 -b 14 -d kernel
-#patch15 -p1 -b 15 -d kernel
-#patch16 -p1 -b 16 -d kernel
-#patch17 -p1 -b 17 -d kernel
-#patch18 -p1 -b 18 -d kernel
-%patch19 -p1 -b 19
-%patch20 -p1 -b 20
-
-%patch30 -p1 -b 30 -d kernel
-%patch31 -p1 -b 31 -d kernel
-%patch32 -p1 -b 32 -d kernel
-%patch33 -p1 -b 33 -d kernel
+%patch -P 12 -p1 -b 12 -d kernel
+%patch -P 13 -p1 -b 13 -d kernel
+#patch -P 14 -p1 -b 14 -d kernel
+#patch -P 15 -p1 -b 15 -d kernel
+#patch -P 16 -p1 -b 16 -d kernel
+#patch -P 17 -p1 -b 17 -d kernel
+#patch -P 18 -p1 -b 18 -d kernel
+%patch -P 19 -p1 -b 19
+%patch -P 20 -p1 -b 20
+%patch -P 21 -p1 -b 21
+%patch -P 22 -p1 -b 22
+
+%patch -P 30 -p1 -b 30 -d kernel
+%patch -P 31 -p1 -b 31 -d kernel
+%patch -P 32 -p1 -b 32 -d kernel
+%patch -P 33 -p1 -b 33 -d kernel
%ifarch armv7hl
-%patch40 -p1 -b 40 -d kernel
-%patch41 -p1 -b 41 -d kernel
-%patch42 -p1 -b 42 -d kernel
-%patch43 -p1 -b 43 -d kernel
+%patch -P 40 -p1 -b 40 -d kernel
+%patch -P 41 -p1 -b 41 -d kernel
+%patch -P 42 -p1 -b 42 -d kernel
+%patch -P 43 -p1 -b 43 -d kernel
%endif
for kernel_version in %{?kernel_versions} ; do
@@ -124,6 +128,12 @@ done
%changelog
+* Thu Jun 01 2023 Nicolas Viéville <nicolas.vieville(a)uphf.fr> - 3:390.157-3
+- Fix patch for kernel >= 6.2
+- Add patch for kernel >= 6.3
+- Add patch for kernel >= 6.4
+- SPEC file - Fix patchN macro is deprecated
+
* Wed Apr 12 2023 Nicolas Viéville <nicolas.vieville(a)uphf.fr> - 3:390.157-2
- Add patch for kernel >= 6.2