[packages/xorg-driver-video-nvidia-legacy-390xx] fix build with kernel 6.3; rel 3
atler
atler at pld-linux.org
Sat May 27 21:42:42 CEST 2023
commit b9d30c02ab18fea079889efdff057eda2ca2bfff
Author: Jan Palus <jpalus at fastmail.com>
Date: Sat May 27 21:41:48 2023 +0200
fix build with kernel 6.3; rel 3
based on 530.41.03
kernel-6.3.patch | 130 +++++++++++++++++++++++++++++
xorg-driver-video-nvidia-legacy-390xx.spec | 4 +-
2 files changed, 133 insertions(+), 1 deletion(-)
---
diff --git a/xorg-driver-video-nvidia-legacy-390xx.spec b/xorg-driver-video-nvidia-legacy-390xx.spec
index 7c27da5..9f9d08e 100644
--- a/xorg-driver-video-nvidia-legacy-390xx.spec
+++ b/xorg-driver-video-nvidia-legacy-390xx.spec
@@ -29,7 +29,7 @@ exit 1
%define no_install_post_check_so 1
-%define rel 2
+%define rel 3
%define pname xorg-driver-video-nvidia-legacy-390xx
Summary: Linux Drivers for nVidia GeForce/Quadro Chips
Summary(hu.UTF-8): Linux meghajtók nVidia GeForce/Quadro chipekhez
@@ -52,6 +52,7 @@ Source5: 10-nvidia-modules.conf
Patch0: X11-driver-nvidia-GL.patch
Patch1: X11-driver-nvidia-desktop.patch
Patch2: kenrel-6.2.patch
+Patch3: kernel-6.3.patch
URL: https://www.nvidia.com/en-us/drivers/unix/
BuildRequires: rpm-build >= 4.6
BuildRequires: rpmbuild(macros) >= 1.752
@@ -313,6 +314,7 @@ rm -rf NVIDIA-Linux-x86*-%{version}*
%patch0 -p1
%patch1 -p1
%patch2 -p1
+%patch3 -p1
echo 'EXTRA_CFLAGS += -Wno-pointer-arith -Wno-sign-compare -Wno-unused' >> kernel/Makefile.kbuild
%build
diff --git a/kernel-6.3.patch b/kernel-6.3.patch
new file mode 100644
index 0000000..bf67b5e
--- /dev/null
+++ b/kernel-6.3.patch
@@ -0,0 +1,130 @@
+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 @@
+ #endif
+ }
+
++static inline void nv_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)
++{
++#if defined(NV_VM_AREA_STRUCT_HAS_CONST_VM_FLAGS)
++ vm_flags_clear(vma, flags);
++#else
++ vma->vm_flags &= ~flags;
++#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
+ }
+
+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
+
+ 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 @@
+ 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);
+
+ for (j = 0; j < pages; j++)
+ {
+@@ -471,7 +471,7 @@
+ }
+ }
+
+- vma->vm_flags |= VM_IO;
++ nv_vm_flags_set(vma, VM_IO | VM_PFNMAP | VM_DONTEXPAND);
+ }
+ else
+ {
+@@ -533,15 +533,15 @@
+
+ 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);
+ }
+
+ 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;
++ nv_vm_flags_clear(vma, VM_WRITE);
++ nv_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>
+
+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 @@
+ // 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);
+
+ vma->vm_ops = &uvm_vm_ops_managed;
+
================================================================
---- gitweb:
http://git.pld-linux.org/gitweb.cgi/packages/xorg-driver-video-nvidia-legacy-390xx.git/commitdiff/b9d30c02ab18fea079889efdff057eda2ca2bfff
More information about the pld-cvs-commit
mailing list