[packages/xorg-driver-video-nvidia-legacy-390xx] - fixes for gcc 15 and kernel 6.15
baggins
baggins at pld-linux.org
Sat Jun 14 14:34:47 CEST 2025
commit 5b91a570bf575c0b2a8011461760498efd40ea45
Author: Jan Rękorajski <baggins at pld-linux.org>
Date: Sat Jun 14 15:49:07 2025 +0200
- fixes for gcc 15 and kernel 6.15
gcc14.patch | 30 ++--
gcc15.patch | 25 +++
kernel-6.12.patch | 2 +-
kernel-6.15-uvm.patch | 13 ++
kernel-6.15.patch | 262 +++++++++++++++++++++++++++++
kernel-6.3-uvm.patch | 11 +-
kernel-6.3.patch | 112 ++++--------
xorg-driver-video-nvidia-legacy-390xx.spec | 10 +-
8 files changed, 362 insertions(+), 103 deletions(-)
---
diff --git a/xorg-driver-video-nvidia-legacy-390xx.spec b/xorg-driver-video-nvidia-legacy-390xx.spec
index d25e087..91ce0db 100644
--- a/xorg-driver-video-nvidia-legacy-390xx.spec
+++ b/xorg-driver-video-nvidia-legacy-390xx.spec
@@ -65,6 +65,9 @@ Patch12: gcc14.patch
Patch13: kernel-6.12.patch
Patch14: kernel-6.13.patch
Patch15: kernel-6.14.patch
+Patch16: gcc15.patch
+Patch17: kernel-6.15.patch
+Patch18: kernel-6.15-uvm.patch
URL: https://www.nvidia.com/en-us/drivers/unix/
BuildRequires: rpm-build >= 4.6
BuildRequires: rpmbuild(macros) >= 1.752
@@ -308,7 +311,7 @@ sterownik nVidii dla Xorg/XFree86.\
%define build_kernel_pkg()\
cd kernel\
%{__make} SYSSRC=%{_kernelsrcdir} clean\
-%{__make} SYSSRC=%{_kernelsrcdir} IGNORE_CC_MISMATCH=1 NV_VERBOSE=1 CC=%{__cc} module\
+%{__make} SYSSRC=%{_kernelsrcdir} CONFIG_OBJTOOL_WERROR=n IGNORE_CC_MISMATCH=1 NV_VERBOSE=1 CC=%{__cc} module\
cd ..\
%install_kernel_modules -D installed -m kernel/nvidia,kernel/nvidia-drm,kernel/nvidia-modeset -d misc\
%ifarch %{x8664}\
@@ -348,6 +351,11 @@ rm -rf NVIDIA-Linux-x86*-%{version}*
%patch -P 13 -p1
%patch -P 14 -p1
%patch -P 15 -p1
+%patch -P 16 -p1
+%patch -P 17 -p1
+%ifarch %{x8664}
+%patch -P 18 -p1
+%endif
echo 'EXTRA_CFLAGS += -Wno-int-conversion' >> kernel/Kbuild
%build
diff --git a/gcc14.patch b/gcc14.patch
index 82839aa..110c3d6 100644
--- a/gcc14.patch
+++ b/gcc14.patch
@@ -1,22 +1,14 @@
---- NVIDIA-Linux-x86_64-390.157-no-compat32/kernel/conftest.sh~ 2024-08-14 16:28:37.000000000 +0200
-+++ NVIDIA-Linux-x86_64-390.157-no-compat32/kernel/conftest.sh 2024-08-14 16:33:51.584330342 +0200
-@@ -151,7 +151,7 @@
- }
-
+diff --git a/kernel/conftest.sh b/kernel/conftest.sh
+index 093704c..a9db899 100755
+--- a/kernel/conftest.sh
++++ b/kernel/conftest.sh
+@@ -153,7 +153,8 @@ test_headers() {
build_cflags() {
-- BASE_CFLAGS="-O2 -D__KERNEL__ \
-+ BASE_CFLAGS="-O2 -D__KERNEL__ -Wno-int-conversion -Wno-implicit-function-declaration \
+ BASE_CFLAGS="-O2 -D__KERNEL__ \
-DKBUILD_BASENAME=\"#conftest$$\" -DKBUILD_MODNAME=\"#conftest$$\" \
- -nostdinc -isystem $ISYSTEM"
-
-@@ -4345,8 +4345,8 @@
- CODE="
- #include <drm/drm_gem.h>
- int conftest_drm_gem_object_vmap_has_map_arg(
-- struct drm_gem_object *obj, struct dma_buf_map *map) {
-- return obj->funcs->vmap(obj, map);
-+ struct drm_gem_object *obj) {
-+ return obj->funcs->vmap(obj, NULL);
- }"
+--nostdinc -isystem $ISYSTEM"
++-nostdinc -isystem $ISYSTEM \
++-Wno-implicit-function-declaration -Wno-strict-prototypes -Wno-incompatible-pointer-types"
- compile_check_conftest "$CODE" "NV_DRM_GEM_OBJECT_VMAP_HAS_MAP_ARG" "" "types"
+ if [ "$OUTPUT" != "$SOURCES" ]; then
+ OUTPUT_CFLAGS="-I$OUTPUT/include2 -I$OUTPUT/include"
diff --git a/gcc15.patch b/gcc15.patch
new file mode 100644
index 0000000..bb7d3f4
--- /dev/null
+++ b/gcc15.patch
@@ -0,0 +1,25 @@
+diff --git a/kernel/Kbuild b/kernel/Kbuild
+index 85aa267..baa6986 100644
+--- a/kernel/Kbuild
++++ b/kernel/Kbuild
+@@ -61,6 +61,7 @@ $(foreach _module, $(NV_KERNEL_MODULES), \
+ # $(EXTRA_CFLAGS) to ccflags-y for compatibility.
+ #
+
++EXTRA_CFLAGS += -std=gnu17
+ EXTRA_CFLAGS += -I$(src)/common/inc
+ EXTRA_CFLAGS += -I$(src)
+ EXTRA_CFLAGS += -Wall -MD $(DEFINES) $(INCLUDES) -Wsign-compare -Wno-cast-qual -Wno-error
+diff --git a/kernel/conftest.sh b/kernel/conftest.sh
+index 4da7588..1106ea5 100755
+--- a/kernel/conftest.sh
++++ b/kernel/conftest.sh
+@@ -151,7 +151,7 @@ test_headers() {
+ }
+
+ build_cflags() {
+- BASE_CFLAGS="-O2 -D__KERNEL__ \
++ BASE_CFLAGS="-std=gnu17 -O2 -D__KERNEL__ \
+ -DKBUILD_BASENAME=\"#conftest$$\" -DKBUILD_MODNAME=\"#conftest$$\" \
+ -nostdinc -isystem $ISYSTEM \
+ -Wno-implicit-function-declaration -Wno-strict-prototypes -Wno-incompatible-pointer-types"
diff --git a/kernel-6.12.patch b/kernel-6.12.patch
index c0f854b..9660b88 100644
--- a/kernel-6.12.patch
+++ b/kernel-6.12.patch
@@ -3,7 +3,7 @@ diff -ur NVIDIA-Linux-x86_64-390.157-no-compat32.orig/kernel/conftest.sh NVIDIA-
+++ NVIDIA-Linux-x86_64-390.157-no-compat32/kernel/conftest.sh 2024-12-05 23:36:51.609889959 +0100
@@ -4559,6 +4559,29 @@
- compile_check_conftest "$CODE" "NV_VM_AREA_STRUCT_HAS_CONST_VM_FLAGS" "" "types"
+ compile_check_conftest "$CODE" "NV_ACPI_VIDEO_BACKLIGHT_USE_NATIVE" "" "functions"
;;
+
+ drm_output_poll_changed)
diff --git a/kernel-6.15-uvm.patch b/kernel-6.15-uvm.patch
new file mode 100644
index 0000000..3c82b5e
--- /dev/null
+++ b/kernel-6.15-uvm.patch
@@ -0,0 +1,13 @@
+diff --git a/kernel/nvidia-uvm/uvm8.c b/kernel/nvidia-uvm/uvm8.c
+index 49e1047..4e84bbd 100644
+--- a/kernel/nvidia-uvm/uvm8.c
++++ b/kernel/nvidia-uvm/uvm8.c
+@@ -658,7 +658,7 @@ 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.
+- vm_flags_set(vma, VM_MIXEDMAP | VM_DONTEXPAND);
++ nv_vm_flags_set(vma, VM_MIXEDMAP | VM_DONTEXPAND);
+
+ vma->vm_ops = &uvm_vm_ops_managed;
+
diff --git a/kernel-6.15.patch b/kernel-6.15.patch
new file mode 100644
index 0000000..aa0519f
--- /dev/null
+++ b/kernel-6.15.patch
@@ -0,0 +1,262 @@
+diff --git a/kernel/Kbuild b/kernel/Kbuild
+index baa6986..7324345 100644
+--- a/kernel/Kbuild
++++ b/kernel/Kbuild
+@@ -54,28 +54,21 @@ $(foreach _module, $(NV_KERNEL_MODULES), \
+ $(eval include $(src)/$(_module)/$(_module).Kbuild))
+
+
+-#
+-# Define CFLAGS that apply to all the NVIDIA kernel modules. EXTRA_CFLAGS
+-# is deprecated since 2.6.24 in favor of ccflags-y, but we need to support
+-# older kernels which do not have ccflags-y. Newer kernels append
+-# $(EXTRA_CFLAGS) to ccflags-y for compatibility.
+-#
+-
+-EXTRA_CFLAGS += -std=gnu17
+-EXTRA_CFLAGS += -I$(src)/common/inc
+-EXTRA_CFLAGS += -I$(src)
+-EXTRA_CFLAGS += -Wall -MD $(DEFINES) $(INCLUDES) -Wsign-compare -Wno-cast-qual -Wno-error
+-EXTRA_CFLAGS += -D__KERNEL__ -DMODULE -DNVRM -DNV_VERSION_STRING=\"390.157\" -Wno-unused-function -Wuninitialized -fno-strict-aliasing -mno-red-zone -mcmodel=kernel -DNV_UVM_ENABLE -Wno-sign-compare -Wno-format-extra-args
+-EXTRA_CFLAGS += $(call cc-option,-Werror=undef,)
+-EXTRA_CFLAGS += -DNV_SPECTRE_V2=$(NV_SPECTRE_V2)
+-EXTRA_CFLAGS += -DNV_KERNEL_INTERFACE_LAYER
++ccflags-y += -std=gnu17
++ccflags-y += -I$(src)/common/inc
++ccflags-y += -I$(src)
++ccflags-y += -Wall -MD $(DEFINES) $(INCLUDES) -Wno-cast-qual -Wno-error -Wno-format-extra-args
++ccflags-y += -D__KERNEL__ -DMODULE -DNVRM -DNV_VERSION_STRING=\"390.157\" -Wno-unused-function -Wuninitialized -fno-strict-aliasing -mno-red-zone -mcmodel=kernel -DNV_UVM_ENABLE
++ccflags-y += $(call cc-option,-Werror=undef,)
++ccflags-y += -DNV_SPECTRE_V2=$(NV_SPECTRE_V2)
++ccflags-y += -DNV_KERNEL_INTERFACE_LAYER
+
+ #
+ # Detect SGI UV systems and apply system-specific optimizations.
+ #
+
+ ifneq ($(wildcard /proc/sgi_uv),)
+- EXTRA_CFLAGS += -DNV_CONFIG_X86_UV
++ ccflags-y += -DNV_CONFIG_X86_UV
+ endif
+
+
+diff --git a/kernel/common/inc/nv-mm.h b/kernel/common/inc/nv-mm.h
+index acd396d..1e955a4 100644
+--- a/kernel/common/inc/nv-mm.h
++++ b/kernel/common/inc/nv-mm.h
+@@ -23,6 +23,7 @@
+ #ifndef __NV_MM_H__
+ #define __NV_MM_H__
+
++#include <linux/version.h>
+ #include "conftest.h"
+
+ #if !defined(NV_VM_FAULT_T_IS_PRESENT)
+@@ -323,4 +323,30 @@ static inline struct rw_semaphore *nv_mmap_get_lock(struct mm_struct *mm)
+ #endif
+ }
+
++static inline void nv_vm_flags_set(struct vm_area_struct *vma, vm_flags_t flags)
++{
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 15, 0)
++ // Rel. commit "mm: uninline the main body of vma_start_write()" (Suren Baghdasaryan, 13 Feb 2025)
++ // Since Linux 6.15, vm_flags_set and vm_flags_clear call a GPL-only symbol
++ // for locking (__vma_start_write), which can't be called from non-GPL code.
++ // However, it appears all uses on the driver are on VMAs being initially
++ // mapped / which are already locked, so we can use vm_flags_reset, which
++ // doesn't lock the VMA, but rather just asserts it is already write-locked.
++ vm_flags_reset(vma, vma->vm_flags | flags);
++#else
++ vm_flags_set(vma, flags);
++#endif
++}
++
++static inline void nv_vm_flags_clear(struct vm_area_struct *vma, vm_flags_t flags)
++{
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 15, 0)
++ // Rel. commit "mm: uninline the main body of vma_start_write()" (Suren Baghdasaryan, 13 Feb 2025)
++ // See above
++ vm_flags_reset(vma, vma->vm_flags & ~flags);
++#else
++ vm_flags_clear(vma, flags);
++#endif
++}
++
+ #endif // __NV_MM_H__
+diff --git a/kernel/common/inc/nv-timer.h b/kernel/common/inc/nv-timer.h
+index 18df6ea..396e121 100644
+--- a/kernel/common/inc/nv-timer.h
++++ b/kernel/common/inc/nv-timer.h
+@@ -25,6 +25,7 @@
+
+ #include <linux/timer.h>
+ #include <linux/kernel.h> // For container_of
++#include <linux/version.h>
+
+ #include "conftest.h"
+
+@@ -63,4 +64,13 @@ static inline void nv_timer_setup(struct nv_timer *nv_timer,
+ #endif
+ }
+
++#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 2, 0)
++// Rel. commit "treewide: Switch/rename to timer_delete[_sync]()" (Thomas Gleixner, 5 Apr 2025)
++// This provides a shim for ancient kernels before timer_delete_sync was introduced
++static inline int timer_delete_sync(struct timer_list *timer)
++{
++ return del_timer_sync(timer);
++}
++#endif
++
+ #endif // __NV_TIMER_H__
+diff --git a/kernel/nvidia-drm/nvidia-drm-connector.c b/kernel/nvidia-drm/nvidia-drm-connector.c
+index 0e9e976..5c62490 100644
+--- a/kernel/nvidia-drm/nvidia-drm-connector.c
++++ b/kernel/nvidia-drm/nvidia-drm-connector.c
+@@ -313,8 +313,14 @@ static int nv_drm_connector_get_modes(struct drm_connector *connector)
+ return count;
+ }
+
++// Rel. commit. "drm/connector: make mode_valid take a const struct drm_display_mode" (Dmitry Baryshkov, 14 Dec 2024)
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 15, 0)
++static int nv_drm_connector_mode_valid(struct drm_connector *connector,
++ const struct drm_display_mode *mode)
++#else
+ static int nv_drm_connector_mode_valid(struct drm_connector *connector,
+ struct drm_display_mode *mode)
++#endif
+ {
+ struct drm_device *dev = connector->dev;
+ struct nv_drm_device *nv_dev = to_nv_device(dev);
+diff --git a/kernel/nvidia-drm/nvidia-drm-linux.c b/kernel/nvidia-drm/nvidia-drm-linux.c
+index a4c5aeb..f8d56db 100644
+--- a/kernel/nvidia-drm/nvidia-drm-linux.c
++++ b/kernel/nvidia-drm/nvidia-drm-linux.c
+@@ -184,6 +184,7 @@ static void __exit nv_linux_drm_exit(void)
+ module_init(nv_linux_drm_init);
+ module_exit(nv_linux_drm_exit);
+
++MODULE_DESCRIPTION("NVIDIA GPU DRM kernel module");
+ #if defined(MODULE_LICENSE)
+ MODULE_LICENSE("MIT");
+ #endif
+diff --git a/kernel/nvidia-modeset/nvidia-modeset-linux.c b/kernel/nvidia-modeset/nvidia-modeset-linux.c
+index f7f1def..4042687 100644
+--- a/kernel/nvidia-modeset/nvidia-modeset-linux.c
++++ b/kernel/nvidia-modeset/nvidia-modeset-linux.c
+@@ -8,6 +8,7 @@
+ * _NVRM_COPYRIGHT_END_
+ */
+
++#include <linux/version.h>
+ #include <linux/module.h>
+ #include <linux/kernel.h>
+ #include <linux/slab.h>
+@@ -495,7 +496,13 @@ static void nvkms_kthread_q_callback(void *arg)
+ * pending timers and than waiting for workqueue callbacks.
+ */
+ if (timer->kernel_timer_created) {
++// Rel. commit "treewide: Switch/rename to timer_delete[_sync]()" (Thomas Gleixner, 5 Apr 2025)
++// This provides a shim for ancient kernels before timer_delete_sync was introduced
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 15, 0)
++ timer_delete_sync(&timer->kernel_timer);
++#else
+ del_timer_sync(&timer->kernel_timer);
++#endif
+ }
+
+ down(&nvkms_lock);
+@@ -1266,7 +1273,13 @@ restart:
+ * completion, and we wait for queue completion with
+ * nv_kthread_q_stop below.
+ */
++// Rel. commit "treewide: Switch/rename to timer_delete[_sync]()" (Thomas Gleixner, 5 Apr 2025)
++// This provides a shim for ancient kernels before timer_delete_sync was introduced
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 15, 0)
++ if (timer_delete_sync(&timer->kernel_timer) == 1) {
++#else
+ if (del_timer_sync(&timer->kernel_timer) == 1) {
++#endif
+ /* We've deactivated timer so we need to clean after it */
+ list_del(&timer->timers_list);
+
+@@ -1300,6 +1313,7 @@ restart:
+ module_init(nvkms_init);
+ module_exit(nvkms_exit);
+
++MODULE_DESCRIPTION("NVIDIA GPU modeset kernel module");
+ #if defined(MODULE_LICENSE)
+ MODULE_LICENSE("NVIDIA");
+ #endif
+diff --git a/kernel/nvidia/nv-frontend.c b/kernel/nvidia/nv-frontend.c
+index 59c69a0..157689a 100644
+--- a/kernel/nvidia/nv-frontend.c
++++ b/kernel/nvidia/nv-frontend.c
+@@ -14,6 +14,7 @@
+ #include "nv-reg.h"
+ #include "nv-frontend.h"
+
++MODULE_DESCRIPTION("NVIDIA GPU frontend kernel module");
+ #if defined(MODULE_LICENSE)
+ MODULE_LICENSE("NVIDIA");
+ #endif
+diff --git a/kernel/nvidia/nv-mmap.c b/kernel/nvidia/nv-mmap.c
+index da891ff..526391a 100644
+--- a/kernel/nvidia/nv-mmap.c
++++ b/kernel/nvidia/nv-mmap.c
+@@ -447,7 +447,7 @@ int nvidia_mmap_helper(
+ addr = mmap_start;
+
+ // Needed for the linux kernel for mapping compound pages
+- vm_flags_set(vma, VM_MIXEDMAP);
++ nv_vm_flags_set(vma, VM_MIXEDMAP);
+
+ for (j = 0; j < pages; j++)
+ {
+@@ -471,7 +471,7 @@ int nvidia_mmap_helper(
+ }
+ }
+
+- vm_flags_set(vma, VM_IO);
++ nv_vm_flags_set(vma, VM_IO);
+ }
+ else
+ {
+@@ -533,15 +533,15 @@ int nvidia_mmap_helper(
+
+ NV_PRINT_AT(NV_DBG_MEMINFO, at);
+
+- vm_flags_set(vma, VM_IO | VM_LOCKED | VM_RESERVED);
+- vm_flags_set(vma, VM_DONTEXPAND | VM_DONTDUMP);
++ nv_vm_flags_set(vma, VM_IO | VM_LOCKED | VM_RESERVED);
++ nv_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);
+- vm_flags_clear(vma, VM_WRITE);
+- vm_flags_clear(vma, VM_MAYWRITE);
++ nv_vm_flags_clear(vma, VM_WRITE);
++ nv_vm_flags_clear(vma, VM_MAYWRITE);
+ }
+
+ vma->vm_ops = &nv_vm_ops;
+diff --git a/kernel/nvidia/nv.c b/kernel/nvidia/nv.c
+index 4fa9c23..cf9ebbf 100644
+--- a/kernel/nvidia/nv.c
++++ b/kernel/nvidia/nv.c
+@@ -3514,7 +3514,13 @@ int NV_API_CALL nv_stop_rc_timer(
+
+ nv_printf(NV_DBG_INFO, "NVRM: stopping rc timer\n");
+ nv->rc_timer_enabled = 0;
++// Rel. commit "treewide: Switch/rename to timer_delete[_sync]()" (Thomas Gleixner, 5 Apr 2025)
++// This provides a shim for ancient kernels before timer_delete_sync was introduced
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 15, 0)
++ timer_delete_sync(&nvl->rc_timer.kernel_timer);
++#else
+ del_timer_sync(&nvl->rc_timer.kernel_timer);
++#endif
+ nv_printf(NV_DBG_INFO, "NVRM: rc timer stopped\n");
+
+ return 0;
diff --git a/kernel-6.3-uvm.patch b/kernel-6.3-uvm.patch
index 7156c9a..6967124 100644
--- a/kernel-6.3-uvm.patch
+++ b/kernel-6.3-uvm.patch
@@ -1,12 +1,13 @@
-diff --color -ur NVIDIA-Linux-x86_64-390.157-no-compat32.orig/kernel/nvidia-uvm/uvm8.c NVIDIA-Linux-x86_64-390.157-no-compat32/kernel/nvidia-uvm/uvm8.c
---- NVIDIA-Linux-x86_64-390.157-no-compat32.orig/kernel/nvidia-uvm/uvm8.c 2022-10-12 11:30:28.000000000 +0200
-+++ NVIDIA-Linux-x86_64-390.157-no-compat32/kernel/nvidia-uvm/uvm8.c 2023-05-27 21:31:28.027398157 +0200
-@@ -658,7 +658,7 @@
+diff --git a/kernel/nvidia-uvm/uvm8.c b/kernel/nvidia-uvm/uvm8.c
+index 11cb373..49e1047 100644
+--- a/kernel/nvidia-uvm/uvm8.c
++++ b/kernel/nvidia-uvm/uvm8.c
+@@ -658,7 +658,7 @@ 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.
- vma->vm_flags |= VM_MIXEDMAP | VM_DONTEXPAND;
-+ nv_vm_flags_set(vma, VM_MIXEDMAP | VM_DONTEXPAND | VM_DONTCOPY);
++ vm_flags_set(vma, VM_MIXEDMAP | VM_DONTEXPAND);
vma->vm_ops = &uvm_vm_ops_managed;
diff --git a/kernel-6.3.patch b/kernel-6.3.patch
index 2a6892b..57f0893 100644
--- a/kernel-6.3.patch
+++ b/kernel-6.3.patch
@@ -1,98 +1,67 @@
-diff --color -ur NVIDIA-Linux-x86_64-390.157-no-compat32.orig/kernel/common/inc/nv-mm.h NVIDIA-Linux-x86_64-390.157-no-compat32/kernel/common/inc/nv-mm.h
---- NVIDIA-Linux-x86_64-390.157-no-compat32.orig/kernel/common/inc/nv-mm.h 2022-10-12 11:30:26.000000000 +0200
-+++ NVIDIA-Linux-x86_64-390.157-no-compat32/kernel/common/inc/nv-mm.h 2023-05-27 21:34:28.310317019 +0200
-@@ -282,4 +282,22 @@
+diff --git a/kernel/common/inc/nv-linux.h b/kernel/common/inc/nv-linux.h
+index 2c4cb7b..f68fcf2 100644
+--- a/kernel/common/inc/nv-linux.h
++++ b/kernel/common/inc/nv-linux.h
+@@ -1996,4 +1996,17 @@ static inline NvU64 nv_expand_nvlink_addr(NvU64 addr47)
+ #include <linux/backlight.h>
#endif
- }
-+static inline void nv_vm_flags_set(struct vm_area_struct *vma, vm_flags_t flags)
++#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 3, 0)
++// Rel. commit "mm: introduce vma->vm_flags wrapper functions" (Suren Baghdasaryan, 26 Jan 2023)
++static inline void vm_flags_set(struct vm_area_struct *vma, vm_flags_t flags)
+{
-+#if defined(NV_VM_AREA_STRUCT_HAS_CONST_VM_FLAGS)
-+ vm_flags_set(vma, flags);
-+#else
+ vma->vm_flags |= flags;
-+#endif
+}
+
-+static inline void nv_vm_flags_clear(struct vm_area_struct *vma, vm_flags_t flags)
++static inline void vm_flags_clear(struct vm_area_struct *vma, vm_flags_t flags)
+{
-+#if defined(NV_VM_AREA_STRUCT_HAS_CONST_VM_FLAGS)
-+ vm_flags_clear(vma, flags);
-+#else
+ vma->vm_flags &= ~flags;
-+#endif
+}
++#endif
+
- #endif // __NV_MM_H__
-diff --color -ur NVIDIA-Linux-x86_64-390.157-no-compat32.orig/kernel/conftest.sh NVIDIA-Linux-x86_64-390.157-no-compat32/kernel/conftest.sh
---- NVIDIA-Linux-x86_64-390.157-no-compat32.orig/kernel/conftest.sh 2022-10-11 18:00:50.000000000 +0200
-+++ NVIDIA-Linux-x86_64-390.157-no-compat32/kernel/conftest.sh 2023-05-27 21:33:14.502405255 +0200
-@@ -4646,6 +4646,25 @@
-
- compile_check_conftest "$CODE" "NV_ACPI_VIDEO_BACKLIGHT_USE_NATIVE" "" "functions"
- ;;
-+
-+ vm_area_struct_has_const_vm_flags)
-+ #
-+ # Determine if the 'vm_area_struct' structure has
-+ # const 'vm_flags'.
-+ #
-+ # A union of '__vm_flags' and 'const vm_flags' was added
-+ # by commit bc292ab00f6c ("mm: introduce vma->vm_flags
-+ # wrapper functions") in mm-stable branch (2023-02-09)
-+ # of the akpm/mm maintainer tree.
-+ #
-+ CODE="
-+ #include <linux/mm_types.h>
-+ int conftest_vm_area_struct_has_const_vm_flags(void) {
-+ return offsetof(struct vm_area_struct, __vm_flags);
-+ }"
-+
-+ compile_check_conftest "$CODE" "NV_VM_AREA_STRUCT_HAS_CONST_VM_FLAGS" "" "types"
-+ ;;
- esac
- }
+ #endif /* _NV_LINUX_H_ */
+diff --git a/kernel/nvidia-drm/nvidia-drm-fb.c b/kernel/nvidia-drm/nvidia-drm-fb.c
+index 725164a..c35e0ee 100644
+--- a/kernel/nvidia-drm/nvidia-drm-fb.c
++++ b/kernel/nvidia-drm/nvidia-drm-fb.c
+@@ -29,6 +29,7 @@
+ #include "nvidia-drm-fb.h"
+ #include "nvidia-drm-utils.h"
+ #include "nvidia-drm-gem.h"
++#include "nvidia-drm-helper.h"
-diff --color -ur NVIDIA-Linux-x86_64-390.157-no-compat32.orig/kernel/nvidia/nvidia.Kbuild NVIDIA-Linux-x86_64-390.157-no-compat32/kernel/nvidia/nvidia.Kbuild
---- NVIDIA-Linux-x86_64-390.157-no-compat32.orig/kernel/nvidia/nvidia.Kbuild 2022-10-12 11:29:57.000000000 +0200
-+++ NVIDIA-Linux-x86_64-390.157-no-compat32/kernel/nvidia/nvidia.Kbuild 2023-05-27 21:33:16.565772516 +0200
-@@ -168,6 +168,7 @@
- NV_CONFTEST_FUNCTION_COMPILE_TESTS += unsafe_follow_pfn
- NV_CONFTEST_FUNCTION_COMPILE_TESTS += acpi_bus_get_device
- NV_CONFTEST_FUNCTION_COMPILE_TESTS += acpi_video_backlight_use_native
-+NV_CONFTEST_FUNCTION_COMPILE_TESTS += vm_area_struct_has_const_vm_flags
+ #include <drm/drm_crtc_helper.h>
- NV_CONFTEST_SYMBOL_COMPILE_TESTS += is_export_symbol_gpl_of_node_to_nid
- NV_CONFTEST_SYMBOL_COMPILE_TESTS += is_export_symbol_present_swiotlb_map_sg_attrs
-diff --color -ur NVIDIA-Linux-x86_64-390.157-no-compat32.orig/kernel/nvidia/nv-mmap.c NVIDIA-Linux-x86_64-390.157-no-compat32/kernel/nvidia/nv-mmap.c
---- NVIDIA-Linux-x86_64-390.157-no-compat32.orig/kernel/nvidia/nv-mmap.c 2022-10-12 11:30:26.000000000 +0200
-+++ NVIDIA-Linux-x86_64-390.157-no-compat32/kernel/nvidia/nv-mmap.c 2023-05-27 21:33:09.022315399 +0200
-@@ -447,7 +447,7 @@
+diff --git a/kernel/nvidia/nv-mmap.c b/kernel/nvidia/nv-mmap.c
+index 0b0a6f2..da891ff 100644
+--- a/kernel/nvidia/nv-mmap.c
++++ b/kernel/nvidia/nv-mmap.c
+@@ -447,7 +447,7 @@ int nvidia_mmap_helper(
addr = mmap_start;
// Needed for the linux kernel for mapping compound pages
- vma->vm_flags |= VM_MIXEDMAP;
-+ nv_vm_flags_set(vma, VM_MIXEDMAP | VM_PFNMAP | VM_DONTEXPAND);
++ vm_flags_set(vma, VM_MIXEDMAP);
for (j = 0; j < pages; j++)
{
-@@ -471,7 +471,7 @@
+@@ -471,7 +471,7 @@ int nvidia_mmap_helper(
}
}
- vma->vm_flags |= VM_IO;
-+ nv_vm_flags_set(vma, VM_IO | VM_PFNMAP | VM_DONTEXPAND);
++ vm_flags_set(vma, VM_IO);
}
else
{
-@@ -533,15 +533,15 @@
+@@ -533,15 +533,15 @@ int nvidia_mmap_helper(
NV_PRINT_AT(NV_DBG_MEMINFO, at);
- vma->vm_flags |= (VM_IO | VM_LOCKED | VM_RESERVED);
- vma->vm_flags |= (VM_DONTEXPAND | VM_DONTDUMP);
-+ nv_vm_flags_set(vma, VM_IO | VM_LOCKED | VM_RESERVED);
-+ nv_vm_flags_set(vma, 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)
@@ -100,19 +69,8 @@ diff --color -ur NVIDIA-Linux-x86_64-390.157-no-compat32.orig/kernel/nvidia/nv-m
vma->vm_page_prot = NV_PGPROT_READ_ONLY(vma->vm_page_prot);
- vma->vm_flags &= ~VM_WRITE;
- vma->vm_flags &= ~VM_MAYWRITE;
-+ nv_vm_flags_clear(vma, VM_WRITE);
-+ nv_vm_flags_clear(vma, VM_MAYWRITE);
++ vm_flags_clear(vma, VM_WRITE);
++ vm_flags_clear(vma, VM_MAYWRITE);
}
vma->vm_ops = &nv_vm_ops;
-diff --color -ur NVIDIA-Linux-x86_64-390.157-no-compat32.orig/kernel/nvidia-drm/nvidia-drm-fb.c NVIDIA-Linux-x86_64-390.157-no-compat32/kernel/nvidia-drm/nvidia-drm-fb.c
---- NVIDIA-Linux-x86_64-390.157-no-compat32.orig/kernel/nvidia-drm/nvidia-drm-fb.c 2022-10-12 11:30:31.000000000 +0200
-+++ NVIDIA-Linux-x86_64-390.157-no-compat32/kernel/nvidia-drm/nvidia-drm-fb.c 2023-05-27 21:29:24.045671732 +0200
-@@ -29,6 +29,7 @@
- #include "nvidia-drm-fb.h"
- #include "nvidia-drm-utils.h"
- #include "nvidia-drm-gem.h"
-+#include "nvidia-drm-helper.h"
-
- #include <drm/drm_crtc_helper.h>
-
================================================================
---- gitweb:
http://git.pld-linux.org/gitweb.cgi/packages/xorg-driver-video-nvidia-legacy-390xx.git/commitdiff/5b91a570bf575c0b2a8011461760498efd40ea45
More information about the pld-cvs-commit
mailing list