You are not logged in.
I read somewhere on this forum that each nvidia driver version is bound to a specific kernel version. How is that done? And can I bind, per say, 515.57 to kernel 6.1 LTS and to all future kernel versions, including 7.0+ LTS?
515.57 was the last driver that performed flawlessly and considering all drivers after that are simply updates for the RTX series (which I don't have and won't have in the next at least 10 years), I'd very much like to go back to the last driver actually intended for my video card, not to mention that on 515.57 NVENC used to work the way it's supposed to, whereas with the current 525.89.02 there are always unhealthy fluctuations. Unhealthy for the output quality. I had to freeze the nvidia driver at that particular version bc all versions from 530 caused weird desktop problems. There is a workaround for those problems with 530 but I don't wanna have to resort to workarounds, I prefer having a decent driver version.
Last edited by rado84 (2023-06-26 15:23:42)
Core i7-4770, GTX 1660 Ti, 32 GB RAM, Arch 6.x LTS, Cinnamon 5.2.7, GDM
Offline
I read somewhere on this forum that each nvidia driver version is bound to a specific kernel version. How is that done?
When the module is built it is bound to the kernel it is built against.
And can I bind, per say, 515.57 to kernel 6.1 LTS and to all future kernel versions, including 7.0+ LTS?
You would need to backport compatibility fixes for changes in newer kernels.
Offline
Hmmm, IDK how to do that. I guess it will be easier to check https://archive.archlinux.org/packages/ for kernels released at the same date or shortly before the release date of the driver in question for Arch. Usually when a new kernel arrives, a day or two after that a new rebuild of the nvidia driver is released, built against the latest kernel. That should ensure I've downloaded a compatible kernel.
Core i7-4770, GTX 1660 Ti, 32 GB RAM, Arch 6.x LTS, Cinnamon 5.2.7, GDM
Offline
Personally, I would just use nvidia-dkms of the specific version you want, then pay close attention when updating to make sure everything builds correctly.
Offline
Hmmm, IDK how to do that. I guess it will be easier to check https://archive.archlinux.org/packages/ for kernels released at the same date or shortly before the release date of the driver in question for Arch. Usually when a new kernel arrives, a day or two after that a new rebuild of the nvidia driver is released, built against the latest kernel. That should ensure I've downloaded a compatible kernel.
The rebuild of the nvidia package for the new linux release ensures they are compatible. As you want to use 515.57 instead of 535.54.03 you would need to backport changes from the newer nvidia release to make it compatible with the new kernel release.
Edit:
The pacth below converts https://aur.archlinux.org/packages/nvidia-525xx to 515xx and patches for linux 6.3 and 6.4:
diff --git a/PKGBUILD b/PKGBUILD
index 2929a16..f95194f 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -4,11 +4,11 @@
# Contributor: James Rayner <iphitus@gmail.com>
_pkgmainbranch=nvidia-utils
-pkgbase=nvidia-525xx-utils
-pkgname=('nvidia-525xx-utils' 'opencl-nvidia-525xx' 'nvidia-525xx-dkms')
-pkgver=525.116.04
+pkgbase=nvidia-515xx-utils
+pkgname=('nvidia-515xx-utils' 'opencl-nvidia-515xx' 'nvidia-515xx-dkms')
+pkgver=515.105.01
pkgrel=1
-pkgdesc="NVIDIA drivers for Linux, 525 branch, dkms"
+pkgdesc="NVIDIA drivers for Linux, 515 branch, dkms"
arch=('x86_64')
url="http://www.nvidia.com/"
license=('custom')
@@ -18,11 +18,15 @@ _pkg="NVIDIA-Linux-x86_64-${pkgver}"
source=('nvidia-drm-outputclass.conf'
'nvidia-utils.sysusers'
'nvidia.rules'
- "https://us.download.nvidia.com/XFree86/Linux-x86_64/${pkgver}/${_pkg}.run")
+ "https://us.download.nvidia.com/XFree86/Linux-x86_64/${pkgver}/${_pkg}.run"
+ nvidia-515xx-linux-6.3.patch
+ nvidia-515xx-linux-6.4.patch)
sha512sums=('de7116c09f282a27920a1382df84aa86f559e537664bb30689605177ce37dc5067748acf9afd66a3269a6e323461356592fdfc624c86523bf105ff8fe47d3770'
'4b3ad73f5076ba90fe0b3a2e712ac9cde76f469cd8070280f960c3ce7dc502d1927f525ae18d008075c8f08ea432f7be0a6c3a7a6b49c361126dcf42f97ec499'
'a0ceb0a6c240cf97b21a2e46c5c212250d3ee24fecef16aca3dffb04b8350c445b9f4398274abccdb745dd0ba5132a17942c9508ce165d4f97f41ece02b0b989'
- '8e511e4965f11c849ae0bb3f399bc79eb004bb3a15612b35e6c7b9ec236a73085b58cc4e8cb37b5ffde7e7fe202928a08618b5dd3328235795bb942bde339195')
+ '9b9e820754254c70aeab2bcc1cfdae396d3b30fb948198e378f764a6f0d89ad6f6687afffa2d6f48072ab726c6d180dc3c83891eef61f273c0b11f7bc2c9bd67'
+ '69d3c8158f7ee5dc2d8be13e31306687225e487b47767f968713ac794bf0c956f791ebda7ae0aa62ef6f5d706e35efcf131e505b71a7877399196a91758d48fb'
+ '8e58c9010dcbed3232d9794cfbb07974e06deedc17b30dac147be3549bafc85172bc4b27f3315cb84816bcc057218f2eb6973d40b6ba99346e5addef3526369b')
create_links() {
@@ -38,6 +42,8 @@ create_links() {
prepare() {
sh "${_pkg}.run" --extract-only
cd "${_pkg}"
+ patch -Np1 -i ../nvidia-515xx-linux-6.3.patch
+ patch -Np1 -i ../nvidia-515xx-linux-6.4.patch
bsdtar -xf nvidia-persistenced-init.tar.bz2
cd kernel
@@ -60,8 +66,8 @@ DEST_MODULE_LOCATION[4]="/kernel/drivers/video"' dkms.conf
sed -i 's/NV_EXCLUDE_BUILD_MODULES/IGNORE_PREEMPT_RT_PRESENCE=1 NV_EXCLUDE_BUILD_MODULES/' dkms.conf
}
-package_opencl-nvidia-525xx() {
- pkgdesc="OpenCL implemention for NVIDIA, 525 branch"
+package_opencl-nvidia-515xx() {
+ pkgdesc="OpenCL implemention for NVIDIA, 515 branch"
depends=('zlib')
optdepends=('opencl-headers: headers necessary for OpenCL development')
conflicts=('opencl-nvidia')
@@ -79,9 +85,9 @@ package_opencl-nvidia-525xx() {
ln -s nvidia-utils "${pkgdir}/usr/share/licenses/opencl-nvidia"
}
-package_nvidia-525xx-dkms() {
+package_nvidia-515xx-dkms() {
_pkgmainbranch=nvidia-dkms
- pkgdesc="NVIDIA drivers - module sources, 525 branch"
+ pkgdesc="NVIDIA drivers - module sources, 515 branch"
depends=('dkms' "nvidia-utils=${pkgver}" 'libglvnd')
provides=("nvidia-dkms=${pkgver}" 'NVIDIA-MODULE' 'nvidia')
conflicts=('nvidia-dkms' 'NVIDIA-MODULE' 'nvidia')
@@ -95,8 +101,8 @@ package_nvidia-525xx-dkms() {
ln -s "${pkgname}" "${pkgdir}/usr/share/licenses/${_pkgmainbranch}"
}
-package_nvidia-525xx-utils() {
- pkgdesc="NVIDIA drivers utilities, 525 branch"
+package_nvidia-515xx-utils() {
+ pkgdesc="NVIDIA drivers utilities, 515 branch"
depends=('xorg-server' 'libglvnd' 'egl-wayland')
optdepends=('nvidia-settings: configuration tool'
'xorg-server-devel: nvidia-xconfig'
@@ -143,7 +149,6 @@ package_nvidia-525xx-utils() {
install -Dm755 "libnvidia-glsi.so.${pkgver}" "${pkgdir}/usr/lib/libnvidia-glsi.so.${pkgver}"
# misc
- install -Dm755 "libnvidia-api.so.1" "${pkgdir}/usr/lib/libnvidia-api.so.1"
install -Dm755 "libnvidia-fbc.so.${pkgver}" "${pkgdir}/usr/lib/libnvidia-fbc.so.${pkgver}"
install -Dm755 "libnvidia-encode.so.${pkgver}" "${pkgdir}/usr/lib/libnvidia-encode.so.${pkgver}"
install -Dm755 "libnvidia-cfg.so.${pkgver}" "${pkgdir}/usr/lib/libnvidia-cfg.so.${pkgver}"
@@ -167,7 +172,6 @@ package_nvidia-525xx-utils() {
# CUDA
install -Dm755 "libcuda.so.${pkgver}" "${pkgdir}/usr/lib/libcuda.so.${pkgver}"
install -Dm755 "libnvcuvid.so.${pkgver}" "${pkgdir}/usr/lib/libnvcuvid.so.${pkgver}"
- install -Dm755 "libcudadebugger.so.${pkgver}" "${pkgdir}/usr/lib/libcudadebugger.so.${pkgver}"
# NVVM Compiler library loaded by the CUDA driver to do JIT link-time-optimization
install -Dm644 "libnvidia-nvvm.so.${pkgver}" "${pkgdir}/usr/lib/libnvidia-nvvm.so.${pkgver}"
diff --git a/nvidia-515xx-linux-6.3.patch b/nvidia-515xx-linux-6.3.patch
new file mode 100644
index 0000000..94eb4ca
--- /dev/null
+++ b/nvidia-515xx-linux-6.3.patch
@@ -0,0 +1,141 @@
+diff --git a/kernel/common/inc/nv-mm.h b/kernel/common/inc/nv-mm.h
+index 0b70f30..9ca6572 100644
+--- a/kernel/common/inc/nv-mm.h
++++ b/kernel/common/inc/nv-mm.h
+@@ -270,4 +270,22 @@ 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 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 --git a/kernel/conftest.sh b/kernel/conftest.sh
+index cd9ae6c..21c3adb 100755
+--- a/kernel/conftest.sh
++++ b/kernel/conftest.sh
+@@ -5327,6 +5327,25 @@ compile_test() {
+ compile_check_conftest "$CODE" "NV_DRM_CONNECTOR_HAS_OVERRIDE_EDID" "" "types"
+ ;;
+
++ 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"
++ ;;
++
+ # When adding a new conftest entry, please use the correct format for
+ # specifying the relevant upstream Linux kernel commit.
+ #
+diff --git a/kernel/nvidia-drm/nvidia-drm-gem-user-memory.c b/kernel/nvidia-drm/nvidia-drm-gem-user-memory.c
+index 8824daa..6de9dd9 100644
+--- a/kernel/nvidia-drm/nvidia-drm-gem-user-memory.c
++++ b/kernel/nvidia-drm/nvidia-drm-gem-user-memory.c
+@@ -92,9 +92,9 @@ static int __nv_drm_gem_user_memory_mmap(struct nv_drm_gem_object *nv_gem,
+ return -EINVAL;
+ }
+
+- vma->vm_flags &= ~VM_PFNMAP;
+- vma->vm_flags &= ~VM_IO;
+- vma->vm_flags |= VM_MIXEDMAP;
++ nv_vm_flags_clear(vma, VM_PFNMAP);
++ nv_vm_flags_clear(vma, VM_IO);
++ nv_vm_flags_set(vma, VM_MIXEDMAP);
+
+ return 0;
+ }
+diff --git a/kernel/nvidia-uvm/uvm.c b/kernel/nvidia-uvm/uvm.c
+index 44ac74a..954cf77 100644
+--- a/kernel/nvidia-uvm/uvm.c
++++ b/kernel/nvidia-uvm/uvm.c
+@@ -814,7 +814,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);
+
+ vma->vm_ops = &uvm_vm_ops_managed;
+
+diff --git a/kernel/nvidia/nv-mmap.c b/kernel/nvidia/nv-mmap.c
+index 85f6fae..89d5aef 100644
+--- a/kernel/nvidia/nv-mmap.c
++++ b/kernel/nvidia/nv-mmap.c
+@@ -460,7 +460,7 @@ static int nvidia_mmap_numa(
+ }
+
+ // Needed for the linux kernel for mapping compound pages
+- vma->vm_flags |= VM_MIXEDMAP;
++ nv_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)
+@@ -608,7 +608,7 @@ int nvidia_mmap_helper(
+ }
+ up(&nvl->mmap_lock);
+
+- vma->vm_flags |= VM_IO | VM_PFNMAP | VM_DONTEXPAND;
++ nv_vm_flags_set(vma, VM_IO | VM_PFNMAP | VM_DONTEXPAND);
+ }
+ else
+ {
+@@ -675,15 +675,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);
+ }
+
+ 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 --git a/kernel/nvidia/nvidia.Kbuild b/kernel/nvidia/nvidia.Kbuild
+index 6ca6aba..394683c 100644
+--- a/kernel/nvidia/nvidia.Kbuild
++++ b/kernel/nvidia/nvidia.Kbuild
+@@ -246,6 +246,7 @@ NV_CONFTEST_TYPE_COMPILE_TESTS += pci_dev_has_ats_enabled
+ NV_CONFTEST_TYPE_COMPILE_TESTS += remove_memory_has_nid_arg
+ NV_CONFTEST_TYPE_COMPILE_TESTS += add_memory_driver_managed_has_mhp_flags_arg
+ NV_CONFTEST_TYPE_COMPILE_TESTS += num_registered_fb
++NV_CONFTEST_TYPE_COMPILE_TESTS += vm_area_struct_has_const_vm_flags
+
+ NV_CONFTEST_GENERIC_COMPILE_TESTS += dom0_kernel_present
+ NV_CONFTEST_GENERIC_COMPILE_TESTS += nvidia_vgpu_kvm_build
diff --git a/nvidia-515xx-linux-6.4.patch b/nvidia-515xx-linux-6.4.patch
new file mode 100644
index 0000000..5741104
--- /dev/null
+++ b/nvidia-515xx-linux-6.4.patch
@@ -0,0 +1,90 @@
+diff --git a/kernel/conftest.sh b/kernel/conftest.sh
+index 21c3adb..6ff5cb0 100755
+--- a/kernel/conftest.sh
++++ b/kernel/conftest.sh
+@@ -5346,6 +5346,28 @@ compile_test() {
+ compile_check_conftest "$CODE" "NV_VM_AREA_STRUCT_HAS_CONST_VM_FLAGS" "" "types"
+ ;;
+
++ drm_driver_has_dumb_destroy)
++ #
++ # Determine if the 'drm_driver' structure has a 'dumb_destroy'
++ # function pointer.
++ #
++ # Removed by commit 96a7b60f6ddb2 ("drm: remove dumb_destroy
++ # callback") in v6.3 linux-next (2023-02-10).
++ #
++ CODE="
++ #if defined(NV_DRM_DRMP_H_PRESENT)
++ #include <drm/drmP.h>
++ #endif
++ #if defined(NV_DRM_DRM_DRV_H_PRESENT)
++ #include <drm/drm_drv.h>
++ #endif
++ int conftest_drm_driver_has_dumb_destroy(void) {
++ return offsetof(struct drm_driver, dumb_destroy);
++ }"
++
++ compile_check_conftest "$CODE" "NV_DRM_DRIVER_HAS_DUMB_DESTROY" "" "types"
++ ;;
++
+ # When adding a new conftest entry, please use the correct format for
+ # specifying the relevant upstream Linux kernel commit.
+ #
+diff --git a/kernel/nvidia-drm/nvidia-drm-drv.c b/kernel/nvidia-drm/nvidia-drm-drv.c
+index 218983a..081d831 100644
+--- a/kernel/nvidia-drm/nvidia-drm-drv.c
++++ b/kernel/nvidia-drm/nvidia-drm-drv.c
+@@ -878,7 +878,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 defined(NV_DRM_DRIVER_HAS_DUMB_DESTROY)
+ nv_drm_driver.dumb_destroy = nv_drm_dumb_destroy;
++#endif /* NV_DRM_DRIVER_HAS_DUMB_DESTROY */
+ #endif /* NV_DRM_ATOMIC_MODESET_AVAILABLE */
+ }
+
+diff --git a/kernel/nvidia-drm/nvidia-drm-gem-nvkms-memory.c b/kernel/nvidia-drm/nvidia-drm-gem-nvkms-memory.c
+index 8d20c85..60da004 100644
+--- a/kernel/nvidia-drm/nvidia-drm-gem-nvkms-memory.c
++++ b/kernel/nvidia-drm/nvidia-drm-gem-nvkms-memory.c
+@@ -579,11 +579,13 @@ int nv_drm_dumb_map_offset(struct drm_file *file,
+ return ret;
+ }
+
++#if defined(NV_DRM_DRIVER_HAS_DUMB_DESTROY)
+ int nv_drm_dumb_destroy(struct drm_file *file,
+ struct drm_device *dev,
+ uint32_t handle)
+ {
+ return drm_gem_handle_delete(file, handle);
+ }
++#endif /* NV_DRM_DRIVER_HAS_DUMB_DESTROY */
+
+ #endif
+diff --git a/kernel/nvidia-drm/nvidia-drm-gem-nvkms-memory.h b/kernel/nvidia-drm/nvidia-drm-gem-nvkms-memory.h
+index 7ecbb94..ea218a0 100644
+--- a/kernel/nvidia-drm/nvidia-drm-gem-nvkms-memory.h
++++ b/kernel/nvidia-drm/nvidia-drm-gem-nvkms-memory.h
+@@ -97,9 +97,11 @@ int nv_drm_dumb_map_offset(struct drm_file *file,
+ struct drm_device *dev, uint32_t handle,
+ uint64_t *offset);
+
++#if defined(NV_DRM_DRIVER_HAS_DUMB_DESTROY)
+ int nv_drm_dumb_destroy(struct drm_file *file,
+ struct drm_device *dev,
+ uint32_t handle);
++#endif /* NV_DRM_DRIVER_HAS_DUMB_DESTROY */
+
+ struct drm_gem_object *nv_drm_gem_nvkms_prime_import(
+ struct drm_device *dev,
+diff --git a/kernel/nvidia-drm/nvidia-drm.Kbuild b/kernel/nvidia-drm/nvidia-drm.Kbuild
+index 6e1c3dc..762c535 100644
+--- a/kernel/nvidia-drm/nvidia-drm.Kbuild
++++ b/kernel/nvidia-drm/nvidia-drm.Kbuild
+@@ -119,3 +119,4 @@ NV_CONFTEST_TYPE_COMPILE_TESTS += dma_resv_add_fence
+ NV_CONFTEST_TYPE_COMPILE_TESTS += dma_resv_reserve_fences
+ NV_CONFTEST_TYPE_COMPILE_TESTS += reservation_object_reserve_shared_has_num_fences_arg
+ NV_CONFTEST_TYPE_COMPILE_TESTS += drm_connector_has_override_edid
++NV_CONFTEST_TYPE_COMPILE_TESTS += drm_driver_has_dumb_destroy
diff --git a/nvidia-525xx-utils.install b/nvidia-515xx-utils.install
similarity index 100%
rename from nvidia-525xx-utils.install
rename to nvidia-515xx-utils.installLast edited by loqs (2023-06-26 17:51:26)
Offline