summarylogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.SRCINFO31
-rw-r--r--PKGBUILD63
-rw-r--r--kernel-5.1.patch258
-rw-r--r--kernel-5.11.patch355
-rw-r--r--kernel-5.12.patch30
-rw-r--r--kernel-5.16-std.diff172
-rw-r--r--kernel-5.17.patch35
-rw-r--r--kernel-5.6.patch503
-rw-r--r--nvidia-drm-outputclass.conf7
-rw-r--r--nvidia.rules6
10 files changed, 1149 insertions, 311 deletions
diff --git a/.SRCINFO b/.SRCINFO
index 0f36eb7403c3..f9e9ef81241c 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -1,6 +1,6 @@
pkgbase = nvidia-vulkan
pkgdesc = NVIDIA drivers for linux (vulkan developer branch)
- pkgver = 440.58.01
+ pkgver = 535.43.09
pkgrel = 1
url = https://developer.nvidia.com/vulkan-driver
arch = x86_64
@@ -9,29 +9,31 @@ pkgbase = nvidia-vulkan
makedepends = linux
makedepends = linux-headers
options = !strip
- source = NVIDIA-Linux-x86_64-440.58.01.run::https://developer.nvidia.com/vulkan-beta-4405801-linux
+ source = NVIDIA-Linux-x86_64-535.43.09.run::https://developer.nvidia.com/downloads/vulkan-beta-5354309-linux
source = nvidia-drm-outputclass.conf
source = nvidia-vulkan-utils.sysusers
- sha512sums = 0cf9d70b90f82d8700a595fb0b03c5efb349479cce24e8a911068192408e4cbdb95bafc3bb69f5d554ff04107776b53cd4e1e37417b0decde3c5742f5811129f
- sha512sums = c49d246a519731bfab9d22afa5c2dd2d366db06d80182738b84881e93cd697c783f16ee04819275c05597bb063451a5d6102fbc562cd078d2a374533a23cea48
+ source = nvidia.rules
+ sha512sums = 790ad0f39f5f34ba28ee028601d60e28d1e17a8cc0ef64e06e5b3570d661d15404bce7a835e75464023e3b8a8154a9f22de592518016bfc5e137b6d09215f7ba
+ sha512sums = de7116c09f282a27920a1382df84aa86f559e537664bb30689605177ce37dc5067748acf9afd66a3269a6e323461356592fdfc624c86523bf105ff8fe47d3770
sha512sums = 4b3ad73f5076ba90fe0b3a2e712ac9cde76f469cd8070280f960c3ce7dc502d1927f525ae18d008075c8f08ea432f7be0a6c3a7a6b49c361126dcf42f97ec499
+ sha512sums = 68c9ac6444cdb3c637eee4135cf1a5a137a233ab12e682e3dbe5b3db6e704907b2759567e99f13026f1e33d8ccc78f3dad12d471cc2ddf9c3d4370697dc169e9
pkgname = nvidia-vulkan
pkgdesc = NVIDIA drivers for linux (vulkan developer branch)
depends = linux
- depends = nvidia-vulkan-utils=440.58.01
+ depends = nvidia-vulkan-utils=535.43.09
depends = libglvnd
- provides = nvidia=440.58.01
+ provides = NVIDIA-MODULE
+ provides = nvidia=535.43.09
conflicts = nvidia
pkgname = nvidia-vulkan-dkms
pkgdesc = NVIDIA driver sources for linux (vulkan developer branch)
depends = dkms
- depends = nvidia-vulkan-utils=440.58.01
+ depends = nvidia-vulkan-utils=535.43.09
depends = libglvnd
- optdepends = linux-headers: Build the module for Arch kernel
- optdepends = linux-lts-headers: Build the module for LTS Arch kernel
- provides = nvidia=440.58.01
+ provides = NVIDIA-MODULE
+ provides = nvidia=535.43.09
conflicts = nvidia
pkgname = nvidia-vulkan-utils
@@ -44,7 +46,7 @@ pkgname = nvidia-vulkan-utils
optdepends = gtk3: nvidia-settings (GTK+ v3)
optdepends = xorg-server-devel: nvidia-xconfig
optdepends = opencl-nvidia-vulkan: OpenCL support
- provides = nvidia-utils=440.58.01
+ provides = nvidia-utils=535.43.09
provides = vulkan-driver
provides = opengl-driver
provides = nvidia-libgl
@@ -59,7 +61,7 @@ pkgname = opencl-nvidia-vulkan
depends = zlib
optdepends = opencl-headers: headers necessary for OpenCL development
provides = opencl-driver
- provides = opencl-nvidia=440.58.01
+ provides = opencl-nvidia=535.43.09
conflicts = opencl-nvidia
pkgname = lib32-nvidia-vulkan-utils
@@ -69,7 +71,7 @@ pkgname = lib32-nvidia-vulkan-utils
depends = lib32-libglvnd
depends = nvidia-vulkan-utils
optdepends = lib32-opencl-nvidia-vulkan
- provides = lib32-nvidia-utils=440.58.01
+ provides = lib32-nvidia-utils=535.43.09
provides = lib32-vulkan-driver
provides = lib32-opengl-driver
provides = lib32-nvidia-libgl
@@ -83,7 +85,6 @@ pkgname = lib32-opencl-nvidia-vulkan
depends = lib32-gcc-libs
optdepends = opencl-headers: headers necessary for OpenCL development
provides = lib32-opencl-driver
- provides = lib32-opencl-nvidia=440.58.01
+ provides = lib32-opencl-nvidia=535.43.09
conflicts = lib32-opencl-nvidia
conflicts = lib32-opencl-nvidia-390xx
-
diff --git a/PKGBUILD b/PKGBUILD
index 2aeb43aa094b..071abfb5ce1a 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -1,5 +1,5 @@
# $Id$
-# Maintainer: jcstryker <inbox at jasonstryker dot com>
+# Maintainer: jcstryker <public at jasonstryker dot com>
# Contributor: Sven-Hendrik Haase <sh@lutzhaase.com>
# Contributor: Felix Yan <felixonmars@archlinux.org>
# Contributor: Thomas Baechler <thomas@archlinux.org>
@@ -8,7 +8,7 @@
pkgbase=nvidia-vulkan
pkgname=('nvidia-vulkan' 'nvidia-vulkan-dkms' 'nvidia-vulkan-utils' 'opencl-nvidia-vulkan' 'lib32-nvidia-vulkan-utils' 'lib32-opencl-nvidia-vulkan')
-pkgver=440.58.01
+pkgver=535.43.09
pkgrel=1
pkgdesc="NVIDIA drivers for linux (vulkan developer branch)"
arch=('x86_64')
@@ -17,12 +17,14 @@ makedepends=('libglvnd' 'linux' 'linux-headers')
license=('custom')
options=('!strip')
_pkg="NVIDIA-Linux-x86_64-${pkgver}"
-source=("${_pkg}.run::https://developer.nvidia.com/vulkan-beta-${pkgver//.}-linux"
+source=("${_pkg}.run::https://developer.nvidia.com/downloads/vulkan-beta-${pkgver//.}-linux"
'nvidia-drm-outputclass.conf'
- 'nvidia-vulkan-utils.sysusers')
-sha512sums=('0cf9d70b90f82d8700a595fb0b03c5efb349479cce24e8a911068192408e4cbdb95bafc3bb69f5d554ff04107776b53cd4e1e37417b0decde3c5742f5811129f'
- 'c49d246a519731bfab9d22afa5c2dd2d366db06d80182738b84881e93cd697c783f16ee04819275c05597bb063451a5d6102fbc562cd078d2a374533a23cea48'
- '4b3ad73f5076ba90fe0b3a2e712ac9cde76f469cd8070280f960c3ce7dc502d1927f525ae18d008075c8f08ea432f7be0a6c3a7a6b49c361126dcf42f97ec499')
+ 'nvidia-vulkan-utils.sysusers'
+ 'nvidia.rules')
+sha512sums=('790ad0f39f5f34ba28ee028601d60e28d1e17a8cc0ef64e06e5b3570d661d15404bce7a835e75464023e3b8a8154a9f22de592518016bfc5e137b6d09215f7ba'
+ 'de7116c09f282a27920a1382df84aa86f559e537664bb30689605177ce37dc5067748acf9afd66a3269a6e323461356592fdfc624c86523bf105ff8fe47d3770'
+ '4b3ad73f5076ba90fe0b3a2e712ac9cde76f469cd8070280f960c3ce7dc502d1927f525ae18d008075c8f08ea432f7be0a6c3a7a6b49c361126dcf42f97ec499'
+ '68c9ac6444cdb3c637eee4135cf1a5a137a233ab12e682e3dbe5b3db6e704907b2759567e99f13026f1e33d8ccc78f3dad12d471cc2ddf9c3d4370697dc169e9')
create_links() {
# create soname links
@@ -37,9 +39,12 @@ create_links() {
prepare() {
sh "${_pkg}.run" --extract-only
cd "${_pkg}"
-
bsdtar -xf nvidia-persistenced-init.tar.bz2
+ # Thanks frogs - https://github.com/Frogging-Family/nvidia-all/blob/master/patches
+ #patch -Np1 -i ../kernel-5.16-std.diff
+ #patch -Np1 -i ../kernel-5.17.patch
+
# Fixing regex pattern for Module.symvers
sed -i "s/${TAB}vmlinux/${TAB}*vmlinux/g" kernel/conftest.sh
sed -i "s/TAB=' '/TAB='\\\t'/g" kernel/conftest.sh
@@ -72,7 +77,7 @@ build() {
package_nvidia-vulkan() {
pkgdesc="NVIDIA drivers for linux (vulkan developer branch)"
depends=('linux' "nvidia-vulkan-utils=${pkgver}" 'libglvnd')
- provides=("nvidia=$pkgver")
+ provides=("NVIDIA-MODULE" "nvidia=$pkgver")
conflicts+=('nvidia')
_extradir="/usr/lib/modules/$(</usr/src/linux/version)/extramodules"
@@ -81,8 +86,8 @@ package_nvidia-vulkan() {
find "${pkgdir}" -name '*.ko' -exec gzip -n {} +
- echo "blacklist nouveau" |
- install -Dm644 /dev/stdin "${pkgdir}/usr/lib/modprobe.d/${pkgname}.conf"
+ echo "blacklist nouveau" | install -Dm644 /dev/stdin "${pkgdir}/usr/lib/modprobe.d/${pkgname}.conf"
+ echo "nvidia-uvm" | install -Dm644 /dev/stdin "${pkgdir}/usr/lib/modules-load.d/${pkgname}.conf"
install -Dt "${pkgdir}/usr/share/licenses/${pkgname}" -m644 "${srcdir}/${_pkg}/LICENSE"
}
@@ -90,9 +95,7 @@ package_nvidia-vulkan() {
package_nvidia-vulkan-dkms() {
pkgdesc="NVIDIA driver sources for linux (vulkan developer branch)"
depends=('dkms' "nvidia-vulkan-utils=${pkgver}" 'libglvnd')
- optdepends=('linux-headers: Build the module for Arch kernel'
- 'linux-lts-headers: Build the module for LTS Arch kernel')
- provides=("nvidia=$pkgver")
+ provides=("NVIDIA-MODULE" "nvidia=$pkgver")
conflicts+=('nvidia')
cd ${_pkg}
@@ -116,7 +119,6 @@ package_opencl-nvidia-vulkan() {
# OpenCL
install -D -m644 nvidia.icd "${pkgdir}/etc/OpenCL/vendors/nvidia.icd"
- install -D -m755 "libnvidia-compiler.so.${pkgver}" "${pkgdir}/usr/lib/libnvidia-compiler.so.${pkgver}"
install -D -m755 "libnvidia-opencl.so.${pkgver}" "${pkgdir}/usr/lib/libnvidia-opencl.so.${pkgver}"
create_links
@@ -162,15 +164,17 @@ package_nvidia-vulkan-utils() {
install -D -m755 "libnvidia-glsi.so.${pkgver}" "${pkgdir}/usr/lib/libnvidia-glsi.so.${pkgver}"
# misc
- install -D -m755 "libnvidia-ifr.so.${pkgver}" "${pkgdir}/usr/lib/libnvidia-ifr.so.${pkgver}"
install -D -m755 "libnvidia-fbc.so.${pkgver}" "${pkgdir}/usr/lib/libnvidia-fbc.so.${pkgver}"
install -D -m755 "libnvidia-encode.so.${pkgver}" "${pkgdir}/usr/lib/libnvidia-encode.so.${pkgver}"
install -D -m755 "libnvidia-cfg.so.${pkgver}" "${pkgdir}/usr/lib/libnvidia-cfg.so.${pkgver}"
install -D -m755 "libnvidia-ml.so.${pkgver}" "${pkgdir}/usr/lib/libnvidia-ml.so.${pkgver}"
install -D -m755 "libnvidia-glvkspirv.so.${pkgver}" "${pkgdir}/usr/lib/libnvidia-glvkspirv.so.${pkgver}"
+ install -D -m755 "libnvidia-allocator.so.${pkgver}" "${pkgdir}/usr/lib/libnvidia-allocator.so.${pkgver}"
+
# Vulkan ICD
install -D -m644 "nvidia_icd.json" "${pkgdir}/usr/share/vulkan/icd.d/nvidia_icd.json"
+ install -D -m644 "nvidia_layers.json" "${pkgdir}/usr/share/vulkan/implicit_layer.d/nvidia_layers.json"
# VDPAU
install -D -m755 "libvdpau_nvidia.so.${pkgver}" "${pkgdir}/usr/lib/vdpau/libvdpau_nvidia.so.${pkgver}"
@@ -185,13 +189,10 @@ package_nvidia-vulkan-utils() {
# PTX JIT Compiler (Parallel Thread Execution (PTX) is a pseudo-assembly language for CUDA)
install -D -m755 "libnvidia-ptxjitcompiler.so.${pkgver}" "${pkgdir}/usr/lib/libnvidia-ptxjitcompiler.so.${pkgver}"
- # Fat (multiarchitecture) binary loader
- install -D -m755 "libnvidia-fatbinaryloader.so.${pkgver}" "${pkgdir}/usr/lib/libnvidia-fatbinaryloader.so.${pkgver}"
-
# raytracing
install -D -m755 "libnvoptix.so.${pkgver}" "${pkgdir}/usr/lib/libnvoptix.so.${pkgver}"
install -D -m755 "libnvidia-rtcore.so.${pkgver}" "${pkgdir}/usr/lib/libnvidia-rtcore.so.${pkgver}"
- install -D -m755 "libnvidia-cbl.so.${pkgver}" "${pkgdir}/usr/lib/libnvidia-cbl.so.${pkgver}"
+ #install -D -m755 "libnvidia-cbl.so.${pkgver}" "${pkgdir}/usr/lib/libnvidia-cbl.so.${pkgver}"
# Optical Flow
install -D -m755 "libnvidia-opticalflow.so.${pkgver}" -t "${pkgdir}/usr/lib"
@@ -250,17 +251,19 @@ package_nvidia-vulkan-utils() {
ln -s nvidia "${pkgdir}/usr/share/doc/nvidia-vulkan-utils"
# new power management support
- install -D -m644 nvidia-suspend.service "${pkgdir}/usr/lib/systemd/system/nvidia-suspend.service"
- install -D -m644 nvidia-hibernate.service "${pkgdir}/usr/lib/systemd/system/nvidia-hibernate.service"
- install -D -m644 nvidia-resume.service "${pkgdir}/usr/lib/systemd/system/nvidia-resume.service"
- install -D -m755 nvidia "${pkgdir}/usr/lib/systemd/system-sleep/nvidia"
- install -D -m755 nvidia-sleep.sh "${pkgdir}/usr/bin/nvidia-sleep.sh"
+ install -D -m644 systemd/system/nvidia-suspend.service "${pkgdir}/usr/lib/systemd/system/nvidia-suspend.service"
+ install -D -m644 systemd/system/nvidia-hibernate.service "${pkgdir}/usr/lib/systemd/system/nvidia-hibernate.service"
+ install -D -m644 systemd/system/nvidia-resume.service "${pkgdir}/usr/lib/systemd/system/nvidia-resume.service"
+ install -D -m755 systemd/system-sleep/nvidia "${pkgdir}/usr/lib/systemd/system-sleep/nvidia"
+ install -D -m755 systemd/nvidia-sleep.sh "${pkgdir}/usr/bin/nvidia-sleep.sh"
# distro specific files must be installed in /usr/share/X11/xorg.conf.d
install -D -m644 "${srcdir}/nvidia-drm-outputclass.conf" "${pkgdir}/usr/share/X11/xorg.conf.d/10-nvidia-drm-outputclass.conf"
install -Dm644 "${srcdir}/nvidia-vulkan-utils.sysusers" "${pkgdir}/usr/lib/sysusers.d/$pkgname.conf"
+ install -Dm644 "${srcdir}/nvidia.rules" "$pkgdir"/usr/lib/udev/rules.d/60-nvidia.rules
+
create_links
}
@@ -274,7 +277,6 @@ package_lib32-opencl-nvidia-vulkan() {
cd "${_pkg}"/32
# OpenCL
- install -D -m755 "libnvidia-compiler.so.${pkgver}" "${pkgdir}/usr/lib32/libnvidia-compiler.so.${pkgver}"
install -D -m755 "libnvidia-opencl.so.${pkgver}" "${pkgdir}/usr/lib32/libnvidia-opencl.so.${pkgver}"
create_links
@@ -306,11 +308,13 @@ package_lib32-nvidia-vulkan-utils() {
install -D -m755 "libnvidia-glsi.so.${pkgver}" "${pkgdir}/usr/lib32/libnvidia-glsi.so.${pkgver}"
# misc
- install -D -m755 "libnvidia-ifr.so.${pkgver}" "${pkgdir}/usr/lib32/libnvidia-ifr.so.${pkgver}"
+ # install -D -m755 "libnvidia-ifr.so.${pkgver}" "${pkgdir}/usr/lib32/libnvidia-ifr.so.${pkgver}"
install -D -m755 "libnvidia-fbc.so.${pkgver}" "${pkgdir}/usr/lib32/libnvidia-fbc.so.${pkgver}"
install -D -m755 "libnvidia-encode.so.${pkgver}" "${pkgdir}/usr/lib32/libnvidia-encode.so.${pkgver}"
install -D -m755 "libnvidia-ml.so.${pkgver}" "${pkgdir}/usr/lib32/libnvidia-ml.so.${pkgver}"
+ #install -D -m755 "libnvidia-ngx.so.${pkgver}" "${pkgdir}/usr/lib/libnvidia-ngx.so.${pkgver}"
install -D -m755 "libnvidia-glvkspirv.so.${pkgver}" "${pkgdir}/usr/lib32/libnvidia-glvkspirv.so.${pkgver}"
+ install -D -m755 "libnvidia-allocator.so.${pkgver}" "${pkgdir}/usr/lib/libnvidia-allocator.so.${pkgver}"
# Optical Flow
install -D -m755 "libnvidia-opticalflow.so.${pkgver}" -t "${pkgdir}/usr/lib32"
@@ -327,10 +331,7 @@ package_lib32-nvidia-vulkan-utils() {
# PTX JIT Compiler (Parallel Thread Execution (PTX) is a pseudo-assembly language for CUDA)
install -D -m755 "libnvidia-ptxjitcompiler.so.${pkgver}" "${pkgdir}/usr/lib32/libnvidia-ptxjitcompiler.so.${pkgver}"
-
- # Fat (multiarchitecture) binary loader
- install -D -m755 "libnvidia-fatbinaryloader.so.${pkgver}" "${pkgdir}/usr/lib32/libnvidia-fatbinaryloader.so.${pkgver}"
-
+
create_links
rm -rf "${pkgdir}"/usr/{include,share,bin}
diff --git a/kernel-5.1.patch b/kernel-5.1.patch
deleted file mode 100644
index 0a51ea695827..000000000000
--- a/kernel-5.1.patch
+++ /dev/null
@@ -1,258 +0,0 @@
-diff --git a/kernel/nvidia-drm/nvidia-drm-gem-nvkms-memory.c b/kernel/nvidia-drm/nvidia-drm-gem-nvkms-memory.c
-index 1db7777..863bb77 100644
---- a/kernel/nvidia-drm/nvidia-drm-gem-nvkms-memory.c
-+++ b/kernel/nvidia-drm/nvidia-drm-gem-nvkms-memory.c
-@@ -20,6 +20,8 @@
- * DEALINGS IN THE SOFTWARE.
- */
-
-+#include <linux/version.h>
-+
- #include "nvidia-drm-conftest.h"
-
- #if defined(NV_DRM_ATOMIC_MODESET_AVAILABLE)
-
-diff --git a/kernel/nvidia-drm/nvidia-drm-encoder.c b/kernel/nvidia-drm/nvidia-drm-encoder.c
-index f66bbd7c9..4de87a271 100644
---- a/kernel/nvidia-drm/nvidia-drm-encoder.c
-+++ b/kernel/nvidia-drm/nvidia-drm-encoder.c
-@@ -20,6 +20,8 @@
- * DEALINGS IN THE SOFTWARE.
- */
-
-+#include <linux/version.h>
-+
- #include "nvidia-drm-conftest.h" /* NV_DRM_ATOMIC_MODESET_AVAILABLE */
-
- #if defined(NV_DRM_ATOMIC_MODESET_AVAILABLE)
-
-diff --git a/kernel/nvidia-drm/nvidia-drm-drv.c b/kernel/nvidia-drm/nvidia-drm-drv.c
-index 58fd2724a..fc9169a96 100644
---- a/kernel/nvidia-drm/nvidia-drm-drv.c
-+++ b/kernel/nvidia-drm/nvidia-drm-drv.c
-@@ -20,6 +20,8 @@
- * DEALINGS IN THE SOFTWARE.
- */
-
-+#include <linux/version.h>
-+
- #include "nvidia-drm-conftest.h" /* NV_DRM_AVAILABLE and NV_DRM_DRM_GEM_H_PRESENT */
-
- #include "nvidia-drm-priv.h"
-
-diff --git a/kernel/nvidia-drm/nvidia-drm-connector.c b/kernel/nvidia-drm/nvidia-drm-connector.c
-index 4dd12d112..44c9d8ed3 100644
---- a/kernel/nvidia-drm/nvidia-drm-connector.c
-+++ b/kernel/nvidia-drm/nvidia-drm-connector.c
-@@ -20,6 +20,8 @@
- * DEALINGS IN THE SOFTWARE.
- */
-
-+#include <linux/version.h>
-+
- #include "nvidia-drm-conftest.h" /* NV_DRM_ATOMIC_MODESET_AVAILABLE */
-
- #if defined(NV_DRM_ATOMIC_MODESET_AVAILABLE)
-
-diff --git a/kernel/common/inc/nv.h b/kernel/common/inc/nv.h
-index d52c2a1ef..f6dc2dc32 100644
---- a/kernel/common/inc/nv.h
-+++ b/kernel/common/inc/nv.h
-@@ -18,6 +18,8 @@
- #include <stdarg.h>
- #include <nv-kernel-interface-api.h>
-
-+#include <linux/version.h>
-+
- #if !defined(NV_MIN)
- #define NV_MIN(_a,_b) ((_a) < (_b) ? (_a) : (_b))
- #endif
-
-diff --git a/kernel/nvidia-drm/nvidia-drm-gem.h b/kernel/nvidia-drm/nvidia-drm-gem.h
-index f276588db..7cbdbe632 100644
---- a/kernel/nvidia-drm/nvidia-drm-gem.h
-+++ b/kernel/nvidia-drm/nvidia-drm-gem.h
-@@ -38,6 +38,8 @@
-
- #endif
-
-+#include <linux/version.h>
-+
- struct nv_drm_gem_object;
-
- struct nv_drm_gem_object_funcs {
-
-diff --git a/kernel/nvidia-drm/nvidia-drm-helper.c b/kernel/nvidia-drm/nvidia-drm-helper.c
-index 4ccf81929..7fb59bbb3 100644
---- a/kernel/nvidia-drm/nvidia-drm-helper.c
-+++ b/kernel/nvidia-drm/nvidia-drm-helper.c
-@@ -29,6 +29,8 @@
-
- #include "nvidia-drm-helper.h"
-
-+#include <linux/version.h>
-+
- #if defined(NV_DRM_ATOMIC_MODESET_AVAILABLE)
-
- #include <drm/drmP.h>
-
-diff --git a/kernel/nvidia-drm/nvidia-drm-linux.c b/kernel/nvidia-drm/nvidia-drm-linux.c
-index 5a2bbc18c..133d8fe64 100644
---- a/kernel/nvidia-drm/nvidia-drm-linux.c
-+++ b/kernel/nvidia-drm/nvidia-drm-linux.c
-@@ -20,6 +20,8 @@
- * DEALINGS IN THE SOFTWARE.
- */
-
-+#include <linux/version.h>
-+
- #include <linux/module.h>
- #include <linux/slab.h>
- #include <linux/err.h>
-
-diff --git a/kernel/nvidia-uvm/uvm_linux.h b/kernel/nvidia-uvm/uvm_linux.h
-index 8707ac070..990cefbd4 100644
---- a/kernel/nvidia-uvm/uvm_linux.h
-+++ b/kernel/nvidia-uvm/uvm_linux.h
-@@ -29,6 +29,8 @@
- //
- //
-
-+#include <linux/version.h>
-+
- #ifndef _UVM_LINUX_H
- #define _UVM_LINUX_H
-
-diff --git a/kernel/nvidia/nvlink_linux.c b/kernel/nvidia/nvlink_linux.c
-index c13b72515..db691679c 100644
---- a/kernel/nvidia/nvlink_linux.c
-+++ b/kernel/nvidia/nvlink_linux.c
-@@ -37,6 +37,8 @@
- #include <linux/string.h>
- #include <linux/mutex.h>
-
-+#include <linux/version.h>
-+
- #define MAX_ERROR_STRING 512
-
- #define NV_MAX_ISR_DELAY_US 20000
-
-diff --git a/kernel/nvidia/os-interface.c b/kernel/nvidia/os-interface.c
-index d1c889f69..88c57b2da 100644
---- a/kernel/nvidia/os-interface.c
-+++ b/kernel/nvidia/os-interface.c
-@@ -14,6 +14,8 @@
- #include "os-interface.h"
- #include "nv-linux.h"
-
-+#include <linux/version.h>
-+
- #define MAX_ERROR_STRING 512
- static char nv_error_string[MAX_ERROR_STRING];
- nv_spinlock_t nv_error_string_lock;
-
-diff --git a/kernel/nvidia-modeset/nvidia-modeset-linux.c b/kernel/nvidia-modeset/nvidia-modeset-linux.c
-index 1b9148ee7..4c1bd3617 100644
---- a/kernel/nvidia-modeset/nvidia-modeset-linux.c
-+++ b/kernel/nvidia-modeset/nvidia-modeset-linux.c
-@@ -8,6 +8,8 @@
- * _NVRM_COPYRIGHT_END_
- */
-
-+#include <linux/version.h>
-+
- #include <linux/module.h>
- #include <linux/kernel.h>
- #include <linux/slab.h>
-
-diff --git a/kernel/nvidia-drm/nvidia-drm-connector.c b/kernel/nvidia-drm/nvidia-drm-connector.c
-index 4dd12d112..44c9d8ed3 100644
---- a/kernel/nvidia-drm/nvidia-drm-connector.c
-+++ b/kernel/nvidia-drm/nvidia-drm-connector.c
-@@ -201,6 +203,12 @@ nv_drm_connector_detect(struct drm_connector *connector, bool force)
- return __nv_drm_connector_detect_internal(connector);
- }
-
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 1, 0)
-+int drm_helper_probe_single_connector_modes(struct drm_connector
-+ *connector, uint32_t maxX,
-+ uint32_t maxY);
-+#endif
-+
- static struct drm_connector_funcs nv_connector_funcs = {
- #if defined NV_DRM_ATOMIC_HELPER_CONNECTOR_DPMS_PRESENT
- .dpms = drm_atomic_helper_connector_dpms,
-diff --git a/kernel/nvidia-drm/nvidia-drm-drv.c b/kernel/nvidia-drm/nvidia-drm-drv.c
-index 58fd2724a..fc9169a96 100644
---- a/kernel/nvidia-drm/nvidia-drm-drv.c
-+++ b/kernel/nvidia-drm/nvidia-drm-drv.c
-@@ -35,6 +37,13 @@
- #include "nvidia-drm-gem-nvkms-memory.h"
- #include "nvidia-drm-gem-user-memory.h"
-
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 1, 0)
-+void drm_kms_helper_poll_init(struct drm_device *dev);
-+void drm_kms_helper_poll_fini(struct drm_device *dev);
-+bool drm_helper_hpd_irq_event(struct drm_device *dev);
-+void drm_kms_helper_poll_disable(struct drm_device *dev);
-+#endif
-+
- #if defined(NV_DRM_AVAILABLE)
-
- #include "nvidia-drm-ioctl.h"
-diff --git a/kernel/nvidia-drm/nvidia-drm-encoder.c b/kernel/nvidia-drm/nvidia-drm-encoder.c
-index f66bbd7c9..4de87a271 100644
---- a/kernel/nvidia-drm/nvidia-drm-encoder.c
-+++ b/kernel/nvidia-drm/nvidia-drm-encoder.c
-@@ -36,6 +38,10 @@
- #include <drm/drm_atomic.h>
- #include <drm/drm_atomic_helper.h>
-
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 1, 0)
-+void drm_kms_helper_hotplug_event(struct drm_device *dev);
-+#endif
-+
- static void nv_drm_encoder_destroy(struct drm_encoder *encoder)
- {
- struct nv_drm_encoder *nv_encoder = to_nv_encoder(encoder);
-@@ -152,6 +158,12 @@ nv_drm_encoder_new(struct drm_device *dev,
- return &nv_encoder->base;
- }
-
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 1, 0)
-+int drm_helper_probe_single_connector_modes(struct drm_connector
-+ *connector, uint32_t maxX,
-+ uint32_t maxY);
-+#endif
-+
- /*
- * Add encoder for given NvKmsKapiDisplay
- */
-diff --git a/kernel/nvidia-uvm/uvm8.c b/kernel/nvidia-uvm/uvm8.c
-index 44467988e..4cba5dc33 100644
---- a/kernel/nvidia-uvm/uvm8.c
-+++ b/kernel/nvidia-uvm/uvm8.c
-@@ -172,7 +172,11 @@ static int uvm_vm_fault_sigbus(struct vm_area_struct *vma, struct vm_fault *vmf)
- return VM_FAULT_SIGBUS;
- }
-
-+#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 1, 0)
- static int uvm_vm_fault_sigbus_wrapper(struct vm_fault *vmf)
-+#else
-+static vm_fault_t uvm_vm_fault_sigbus_wrapper(struct vm_fault *vmf)
-+#endif
- {
- #if defined(NV_VM_OPS_FAULT_REMOVED_VMA_ARG)
- return uvm_vm_fault_sigbus(vmf->vma, vmf);
-@@ -507,7 +511,11 @@ convert_error:
- }
- }
-
-+#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 1, 0)
- static int uvm_vm_fault_wrapper(struct vm_fault *vmf)
-+#else
-+static vm_fault_t uvm_vm_fault_wrapper(struct vm_fault *vmf)
-+#endif
- {
- #if defined(NV_VM_OPS_FAULT_REMOVED_VMA_ARG)
- return uvm_vm_fault(vmf->vma, vmf);
diff --git a/kernel-5.11.patch b/kernel-5.11.patch
new file mode 100644
index 000000000000..259267007a0e
--- /dev/null
+++ b/kernel-5.11.patch
@@ -0,0 +1,355 @@
+diff --git a/kernel/common/inc/nv-linux.h b/kernel/common/inc/nv-linux.h
+index db9706d..3ee157e 100644
+--- a/kernel/common/inc/nv-linux.h
++++ b/kernel/common/inc/nv-linux.h
+@@ -117,7 +117,9 @@
+
+ #include <linux/moduleparam.h> /* module_param() */
+ #include <asm/tlbflush.h> /* flush_tlb(), flush_tlb_all() */
++#if defined(NV_ASM_KMAP_TYPES_H_PRESENT)
+ #include <asm/kmap_types.h> /* page table entry lookup */
++#endif
+
+ #include <linux/pci.h> /* pci_find_class, etc */
+ #include <linux/interrupt.h> /* tasklets, interrupt helpers */
+diff --git a/kernel/conftest.sh b/kernel/conftest.sh
+index 282a911..c2d0fc3 100755
+--- a/kernel/conftest.sh
++++ b/kernel/conftest.sh
+@@ -159,6 +159,7 @@ test_headers() {
+ FILES="$FILES asm/pgtable_types.h"
+ FILES="$FILES linux/stringhash.h"
+ FILES="$FILES linux/dma-map-ops.h"
++ FILES="$FILES asm/kmap_types.h"
+
+ translate_and_preprocess_header_files $FILES
+ }
+@@ -1265,6 +1266,8 @@ compile_test() {
+ drm_available)
+ # Determine if the DRM subsystem is usable
+ CODE="
++ #include <linux/version.h>
++
+ #if defined(NV_DRM_DRMP_H_PRESENT)
+ #include <drm/drmP.h>
+ #endif
+@@ -1273,6 +1276,10 @@ compile_test() {
+ #include <drm/drm_drv.h>
+ #endif
+
++ #if defined(NV_DRM_DRM_GEM_H_PRESENT)
++ #include <drm/drm_gem.h>
++ #endif
++
+ #if defined(NV_DRM_DRM_PRIME_H_PRESENT)
+ #include <drm/drm_prime.h>
+ #endif
+@@ -1282,6 +1289,7 @@ compile_test() {
+ #endif
+
+ void conftest_drm_available(void) {
++#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 11, 0))
+ struct drm_driver drv;
+
+ /* 2013-01-15 89177644a7b6306e6084a89eab7e290f4bfef397 */
+@@ -1291,6 +1299,13 @@ compile_test() {
+ drv.gem_prime_vunmap = 0;
+ (void)drm_gem_prime_import;
+ (void)drm_gem_prime_export;
++#else
++ struct drm_gem_object_funcs gem;
++ gem.pin = 0;
++ gem.get_sg_table = 0;
++ gem.vmap = 0;
++ gem.vunmap = 0;
++#endif
+
+ /* 2013-10-02 1bb72532ac260a2d3982b40bdd4c936d779d0d16 */
+ (void)drm_dev_alloc;
+diff --git a/kernel/nvidia-drm/nvidia-drm-crtc.c b/kernel/nvidia-drm/nvidia-drm-crtc.c
+index b966bb2..b104d13 100644
+--- a/kernel/nvidia-drm/nvidia-drm-crtc.c
++++ b/kernel/nvidia-drm/nvidia-drm-crtc.c
+@@ -42,6 +42,8 @@
+ #include <drm/drm_atomic.h>
+ #include <drm/drm_atomic_helper.h>
+
++#include <linux/version.h>
++
+ static void nv_drm_plane_destroy(struct drm_plane *plane)
+ {
+ /* plane->state gets freed here */
+@@ -460,8 +462,14 @@ static int head_modeset_config_attach_connector(
+ * will be discarded if ->atomic_check() fails.
+ */
+ static int nv_drm_crtc_atomic_check(struct drm_crtc *crtc,
++#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 11, 0)
+ struct drm_crtc_state *crtc_state)
+ {
++#else
++ struct drm_atomic_state *state)
++{
++ struct drm_crtc_state *crtc_state = drm_atomic_get_new_crtc_state(state,crtc);
++#endif
+ struct nv_drm_crtc_state *nv_crtc_state = to_nv_crtc_state(crtc_state);
+ struct NvKmsKapiHeadRequestedConfig *req_config =
+ &nv_crtc_state->req_config;
+@@ -532,7 +540,11 @@ static void nv_drm_crtc_disable(struct drm_crtc *crtc)
+
+ #ifdef NV_DRM_CRTC_HELPER_FUNCS_HAS_ATOMIC_ENABLE
+ static void nv_drm_crtc_atomic_enable(struct drm_crtc *crtc,
++#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 11, 0)
+ struct drm_crtc_state *old_crtc_state)
++#else
++ struct drm_atomic_state *state)
++#endif
+ {
+
+ }
+diff --git a/kernel/nvidia-drm/nvidia-drm-drv.c b/kernel/nvidia-drm/nvidia-drm-drv.c
+index ebfb5cd..e816f26 100644
+--- a/kernel/nvidia-drm/nvidia-drm-drv.c
++++ b/kernel/nvidia-drm/nvidia-drm-drv.c
+@@ -20,6 +20,7 @@
+ * DEALINGS IN THE SOFTWARE.
+ */
+
++#include <linux/version.h>
+ #include "nvidia-drm-conftest.h" /* NV_DRM_AVAILABLE and NV_DRM_DRM_GEM_H_PRESENT */
+
+ #include "nvidia-drm-priv.h"
+@@ -755,12 +756,21 @@ static struct drm_driver nv_drm_driver = {
+
+ .prime_handle_to_fd = drm_gem_prime_handle_to_fd,
+ .prime_fd_to_handle = drm_gem_prime_fd_to_handle,
++#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 11, 0))
++ // Deprecated in favour of equivalent in drm_get_object in torvalds/linux commit d693def4fd1c23f1ca5aed1afb9993b3a2069ad2
+ .gem_prime_export = drm_gem_prime_export,
++#endif
+ .gem_prime_import = nv_drm_gem_prime_import,
++#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 11, 0))
++ // Deprecated in favour of equivalent in drm_get_object in torvalds/linux commit d693def4fd1c23f1ca5aed1afb9993b3a2069ad2
+ .gem_prime_get_sg_table = nv_drm_gem_prime_get_sg_table,
++#endif
+ .gem_prime_import_sg_table = nv_drm_gem_prime_import_sg_table,
++#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 11, 0))
++ // Deprecated in favour of equivalent in drm_get_object in torvalds/linux commit d693def4fd1c23f1ca5aed1afb9993b3a2069ad2
+ .gem_prime_vmap = nv_drm_gem_prime_vmap,
+ .gem_prime_vunmap = nv_drm_gem_prime_vunmap,
++#endif
+
+ #if defined(NV_DRM_DRIVER_HAS_GEM_PRIME_RES_OBJ)
+ .gem_prime_res_obj = nv_drm_gem_prime_res_obj,
+@@ -784,12 +794,16 @@ static struct drm_driver nv_drm_driver = {
+ .desc = "NVIDIA DRM driver",
+ .date = "20160202",
+
++#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 11, 0))
++ // This is now behind a CONFIG_DRM_LEGACY Kconfig flag.(torvalds/linux commit 57bb1ee6034046be70aed33fd6d447bb2b7261fa)
++ // (Was this used anyway? Just remove it entirely for now)
+ #if defined(NV_DRM_DRIVER_HAS_LEGACY_DEV_LIST)
+ .legacy_dev_list = LIST_HEAD_INIT(nv_drm_driver.legacy_dev_list),
+ #else
+ .device_list = LIST_HEAD_INIT(nv_drm_driver.device_list),
+ #endif
+ .gem_vm_ops = &nv_drm_gem_vma_ops,
++#endif
+ };
+
+
+diff --git a/kernel/nvidia-drm/nvidia-drm-gem-user-memory.c b/kernel/nvidia-drm/nvidia-drm-gem-user-memory.c
+index e554adc..4aa082b 100644
+--- a/kernel/nvidia-drm/nvidia-drm-gem-user-memory.c
++++ b/kernel/nvidia-drm/nvidia-drm-gem-user-memory.c
+@@ -20,6 +20,7 @@
+ * DEALINGS IN THE SOFTWARE.
+ */
+
++#include <linux/version.h>
+ #include "nvidia-drm-conftest.h"
+
+ #if defined(NV_DRM_AVAILABLE)
+@@ -58,6 +59,7 @@ static struct sg_table *__nv_drm_gem_user_memory_prime_get_sg_table(
+ nv_user_memory->pages_count);
+ }
+
++#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 11, 0))
+ static void *__nv_drm_gem_user_memory_prime_vmap(
+ struct nv_drm_gem_object *nv_gem)
+ {
+@@ -73,6 +75,28 @@ static void __nv_drm_gem_user_memory_prime_vunmap(
+ {
+ nv_drm_vunmap(address);
+ }
++#else
++// Updated vmap/vunmap operations to use struct dma_buf_map instead of raw pointers
++// See torvalds/linux commits ccc22d41bd9acec58cdc7c3b012e1887aba40af4, 6619ccf1bb1d0ebb071f758111efa83918b216fc
++static int __nv_drm_gem_user_memory_prime_vmap(
++ struct nv_drm_gem_object *nv_gem,
++ struct dma_buf_map *map)
++{
++ struct nv_drm_gem_user_memory *nv_user_memory = to_nv_user_memory(nv_gem);
++
++ map->vaddr = nv_drm_vmap(nv_user_memory->pages,
++ nv_user_memory->pages_count);
++ map->is_iomem = false;
++ return 0;
++}
++
++static void __nv_drm_gem_user_memory_prime_vunmap(
++ struct nv_drm_gem_object *gem,
++ struct dma_buf_map *map)
++{
++ nv_drm_vunmap(map->vaddr);
++}
++#endif
+
+ static int __nv_drm_gem_user_memory_mmap(struct nv_drm_gem_object *nv_gem,
+ struct vm_area_struct *vma)
+diff --git a/kernel/nvidia-drm/nvidia-drm-gem.c b/kernel/nvidia-drm/nvidia-drm-gem.c
+index a6b54f0..ca45362 100644
+--- a/kernel/nvidia-drm/nvidia-drm-gem.c
++++ b/kernel/nvidia-drm/nvidia-drm-gem.c
+@@ -20,6 +20,7 @@
+ * DEALINGS IN THE SOFTWARE.
+ */
+
++#include <linux/version.h>
+ #include "nvidia-drm-conftest.h"
+
+ #if defined(NV_DRM_AVAILABLE)
+@@ -67,6 +68,13 @@ void nv_drm_gem_free(struct drm_gem_object *gem)
+ static struct drm_gem_object_funcs nv_drm_gem_funcs = {
+ .free = nv_drm_gem_free,
+ .get_sg_table = nv_drm_gem_prime_get_sg_table,
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 11, 0))
++ // New functions moved from drm_driver because of torvalds/linux commit d693def4fd1c23f1ca5aed1afb9993b3a2069ad2
++ .export = drm_gem_prime_export,
++ .vmap = nv_drm_gem_prime_vmap,
++ .vunmap = nv_drm_gem_prime_vunmap,
++ .vm_ops = &nv_drm_gem_vma_ops,
++#endif
+ };
+ #endif
+
+@@ -141,6 +149,7 @@ struct sg_table *nv_drm_gem_prime_get_sg_table(struct drm_gem_object *gem)
+ return ERR_PTR(-ENOTSUPP);
+ }
+
++#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 11, 0))
+ void *nv_drm_gem_prime_vmap(struct drm_gem_object *gem)
+ {
+ struct nv_drm_gem_object *nv_gem = to_nv_gem_object(gem);
+@@ -160,6 +169,29 @@ void nv_drm_gem_prime_vunmap(struct drm_gem_object *gem, void *address)
+ nv_gem->ops->prime_vunmap(nv_gem, address);
+ }
+ }
++#else
++// Updated vmap/vunmap operations to use struct dma_buf_map instead of raw pointers
++// See torvalds/linux commits ccc22d41bd9acec58cdc7c3b012e1887aba40af4, 6619ccf1bb1d0ebb071f758111efa83918b216fc
++int nv_drm_gem_prime_vmap(struct drm_gem_object *gem, struct dma_buf_map *map)
++{
++ struct nv_drm_gem_object *nv_gem = to_nv_gem_object(gem);
++
++ if (nv_gem->ops->prime_vmap != NULL) {
++ return nv_gem->ops->prime_vmap(nv_gem, map);
++ }
++
++ return -ENOTSUPP;
++}
++
++void nv_drm_gem_prime_vunmap(struct drm_gem_object *gem, struct dma_buf_map *map)
++{
++ struct nv_drm_gem_object *nv_gem = to_nv_gem_object(gem);
++
++ if (nv_gem->ops->prime_vunmap != NULL) {
++ nv_gem->ops->prime_vunmap(nv_gem, map);
++ }
++}
++#endif
+
+ #if defined(NV_DRM_DRIVER_HAS_GEM_PRIME_RES_OBJ)
+ nv_dma_resv_t* nv_drm_gem_prime_res_obj(struct drm_gem_object *obj)
+diff --git a/kernel/nvidia-drm/nvidia-drm-gem.h b/kernel/nvidia-drm/nvidia-drm-gem.h
+index 5c9f33d..24576e2 100644
+--- a/kernel/nvidia-drm/nvidia-drm-gem.h
++++ b/kernel/nvidia-drm/nvidia-drm-gem.h
+@@ -23,6 +23,7 @@
+ #ifndef __NVIDIA_DRM_GEM_H__
+ #define __NVIDIA_DRM_GEM_H__
+
++#include <linux/version.h>
+ #include "nvidia-drm-conftest.h"
+
+ #if defined(NV_DRM_AVAILABLE)
+@@ -50,8 +51,15 @@ struct nv_drm_gem_object;
+ struct nv_drm_gem_object_funcs {
+ void (*free)(struct nv_drm_gem_object *nv_gem);
+ struct sg_table *(*prime_get_sg_table)(struct nv_drm_gem_object *nv_gem);
++#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 11, 0))
+ void *(*prime_vmap)(struct nv_drm_gem_object *nv_gem);
+ void (*prime_vunmap)(struct nv_drm_gem_object *nv_gem, void *address);
++#else
++ // Updated vmap/vunmap operations to use struct dma_buf_map instead of raw pointers
++ // See torvalds/linux commits ccc22d41bd9acec58cdc7c3b012e1887aba40af4, 6619ccf1bb1d0ebb071f758111efa83918b216fc
++ int (*prime_vmap)(struct nv_drm_gem_object *nv_gem, struct dma_buf_map *map);
++ void (*prime_vunmap)(struct nv_drm_gem_object *nv_gem, struct dma_buf_map *map);
++#endif
+ struct drm_gem_object *(*prime_dup)(struct drm_device *dev,
+ const struct nv_drm_gem_object *nv_gem_src);
+ int (*mmap)(struct nv_drm_gem_object *nv_gem, struct vm_area_struct *vma);
+@@ -188,9 +196,17 @@ struct drm_gem_object *nv_drm_gem_prime_import(struct drm_device *dev,
+
+ struct sg_table *nv_drm_gem_prime_get_sg_table(struct drm_gem_object *gem);
+
++#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 11, 0))
+ void *nv_drm_gem_prime_vmap(struct drm_gem_object *gem);
+
+ void nv_drm_gem_prime_vunmap(struct drm_gem_object *gem, void *address);
++#else
++// Updated vmap/vunmap operations to use struct dma_buf_map instead of raw pointers
++// See torvalds/linux commits ccc22d41bd9acec58cdc7c3b012e1887aba40af4, 6619ccf1bb1d0ebb071f758111efa83918b216fc
++int nv_drm_gem_prime_vmap(struct drm_gem_object *gem, struct dma_buf_map *map);
++
++void nv_drm_gem_prime_vunmap(struct drm_gem_object *gem, struct dma_buf_map *map);
++#endif
+
+ #if defined(NV_DRM_DRIVER_HAS_GEM_PRIME_RES_OBJ)
+ nv_dma_resv_t* nv_drm_gem_prime_res_obj(struct drm_gem_object *obj);
+diff --git a/kernel/nvidia/nv-caps.c b/kernel/nvidia/nv-caps.c
+index 90e866f..5cde194 100644
+--- a/kernel/nvidia/nv-caps.c
++++ b/kernel/nvidia/nv-caps.c
+@@ -37,8 +37,12 @@ MODULE_PARM_DESC(nv_cap_enable_devfs, "Enable (1) or disable (0) nv-caps " \
+
+ extern int NVreg_ModifyDeviceFiles;
+
++#if NV_IS_EXPORT_SYMBOL_PRESENT_close_fd
++#include <linux/fdtable.h>
++#else
+ /* sys_close() or __close_fd() */
+ #include <linux/syscalls.h>
++#endif
+
+ #define NV_CAP_DRV_MINOR_COUNT 8192
+
+@@ -586,7 +590,9 @@ void NV_API_CALL nv_cap_close_fd(int fd)
+ * 2018-04-02 2ca2a09d6215 ("fs: add ksys_close() wrapper; remove in-kernel
+ * calls to sys_close()")
+ */
+-#if NV_IS_EXPORT_SYMBOL_PRESENT___close_fd
++#if NV_IS_EXPORT_SYMBOL_PRESENT_close_fd
++ close_fd(fd);
++#elif NV_IS_EXPORT_SYMBOL_PRESENT___close_fd
+ __close_fd(current->files, fd);
+ #else
+ sys_close(fd);
+diff --git a/kernel/nvidia/nvidia.Kbuild b/kernel/nvidia/nvidia.Kbuild
+index 90579de..c6f3614 100644
+--- a/kernel/nvidia/nvidia.Kbuild
++++ b/kernel/nvidia/nvidia.Kbuild
+@@ -172,3 +172,4 @@
++NV_CONFTEST_SYMBOL_COMPILE_TESTS += is_export_symbol_present_close_fd
+
+ NV_CONFTEST_TYPE_COMPILE_TESTS += acpi_op_remove
+ NV_CONFTEST_TYPE_COMPILE_TESTS += outer_flush_all
diff --git a/kernel-5.12.patch b/kernel-5.12.patch
new file mode 100644
index 000000000000..a9337f18fcc5
--- /dev/null
+++ b/kernel-5.12.patch
@@ -0,0 +1,30 @@
+diff --git a/kernel/nvidia-drm/nvidia-drm-drv.c b/kernel/nvidia-drm/nvidia-drm-drv.c
+index ef89513..7f0707d 100644
+--- a/kernel/nvidia-drm/nvidia-drm-drv.c
++++ b/kernel/nvidia-drm/nvidia-drm-drv.c
+@@ -855,7 +855,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(5, 12, 0))
+ nv_drm_driver.dumb_destroy = drm_gem_dumb_destroy;
++#endif
+ #endif /* NV_DRM_ATOMIC_MODESET_AVAILABLE */
+ }
+
+diff --git a/kernel/nvidia-drm/nvidia-drm-gem-user-memory.c b/kernel/nvidia-drm/nvidia-drm-gem-user-memory.c
+index 89ab321..f29b644 100644
+--- a/kernel/nvidia-drm/nvidia-drm-gem-user-memory.c
++++ b/kernel/nvidia-drm/nvidia-drm-gem-user-memory.c
+@@ -208,7 +208,11 @@ struct nv_drm_gem_user_memory *nv_drm_gem_user_memory_import_sg_table(
+ return NULL;
+ }
+
++#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 12, 0))
+ if (drm_prime_sg_to_page_addr_arrays(sgt, pages, NULL, pages_count) < 0) {
++#else
++ if (drm_prime_sg_to_page_array(sgt, pages, pages_count) < 0) {
++#endif
+ nv_drm_free(nv_user_memory);
+ nv_drm_free(pages);
+ return NULL;
diff --git a/kernel-5.16-std.diff b/kernel-5.16-std.diff
new file mode 100644
index 000000000000..a86e48defb12
--- /dev/null
+++ b/kernel-5.16-std.diff
@@ -0,0 +1,172 @@
+diff --git a/kernel/common/inc/nv.h a/kernel/common/inc/nv.h
+index 2ddaa25..40a3fd5 100644
+--- a/kernel/common/inc/nv.h
++++ a/kernel/common/inc/nv.h
+@@ -17,13 +17,15 @@
+ #include <nvlimits.h>
+
+ #if defined(NV_KERNEL_INTERFACE_LAYER) && defined(__FreeBSD__)
+- #include <sys/stddef.h> // NULL
++ #include <sys/stddef.h> // NULL
++#elif defined(NV_KERNEL_INTERFACE_LAYER) && defined(NV_LINUX)
++ #include <linux/stddef.h> // NULL
+ #else
+- #include <stddef.h> // NULL
++ #include <stddef.h> // NULL
+ #endif
+
+ #include <nvstatus.h>
+-#include <stdarg.h>
++#include "nv_stdarg.h"
+ #include <nv-caps.h>
+ #include <nv-ioctl.h>
+ #include <nvmisc.h>
+diff --git a/kernel/common/inc/nv_stdarg.h a/kernel/common/inc/nv_stdarg.h
+new file mode 100644
+index 0000000..4b63340
+--- /dev/null
++++ a/kernel/common/inc/nv_stdarg.h
+@@ -0,0 +1,39 @@
++/*
++ * SPDX-FileCopyrightText: Copyright (c) 2021 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
++ * SPDX-License-Identifier: MIT
++ *
++ * Permission is hereby granted, free of charge, to any person obtaining a
++ * copy of this software and associated documentation files (the "Software"),
++ * to deal in the Software without restriction, including without limitation
++ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
++ * and/or sell copies of the Software, and to permit persons to whom the
++ * Software is furnished to do so, subject to the following conditions:
++ *
++ * The above copyright notice and this permission notice shall be included in
++ * all copies or substantial portions of the Software.
++ *
++ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
++ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
++ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
++ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
++ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
++ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
++ * DEALINGS IN THE SOFTWARE.
++ */
++
++
++#ifndef _NV_STDARG_H_
++#define _NV_STDARG_H_
++
++#if defined(NV_KERNEL_INTERFACE_LAYER) && defined(NV_LINUX)
++ #include "conftest.h"
++ #if defined(NV_LINUX_STDARG_H_PRESENT)
++ #include <linux/stdarg.h>
++ #else
++ #include <stdarg.h>
++ #endif
++#else
++ #include <stdarg.h>
++#endif
++
++#endif // _NV_STDARG_H_
+diff --git a/kernel/common/inc/os-interface.h a/kernel/common/inc/os-interface.h
+index b615773..dd3e7a8 100644
+--- a/kernel/common/inc/os-interface.h
++++ a/kernel/common/inc/os-interface.h
+@@ -24,7 +24,7 @@
+
+ #include <nvtypes.h>
+ #include <nvstatus.h>
+-#include <stdarg.h>
++#include "nv_stdarg.h"
+ #include <nv-kernel-interface-api.h>
+ #include <os/nv_memory_type.h>
+
+diff --git a/kernel/common/inc/rm-gpu-ops.h a/kernel/common/inc/rm-gpu-ops.h
+index 67b252e..3302e72 100644
+--- a/kernel/common/inc/rm-gpu-ops.h
++++ a/kernel/common/inc/rm-gpu-ops.h
+@@ -16,7 +16,7 @@
+
+ #include <nvtypes.h>
+ #include <nvCpuUuid.h>
+-#include <stdarg.h>
++#include "nv_stdarg.h"
+ #include <nv-caps.h>
+ #include <nv-ioctl.h>
+ #include <nvmisc.h>
+diff --git a/kernel/conftest.sh a/kernel/conftest.sh
+index 1a1f89c..4ae52c7 100755
+--- a/kernel/conftest.sh
++++ a/kernel/conftest.sh
+@@ -163,6 +163,7 @@ test_headers() {
+ FILES="$FILES sound/hda_codec.h"
+ FILES="$FILES linux/dma-buf.h"
+ FILES="$FILES linux/time.h"
++ FILES="$FILES linux/stdarg.h"
+
+ translate_and_preprocess_header_files $FILES
+ }
+diff --git a/kernel/nvidia-modeset/nvidia-modeset-os-interface.h a/kernel/nvidia-modeset/nvidia-modeset-os-interface.h
+index 65130fd..720e0d2 100644
+--- a/kernel/nvidia-modeset/nvidia-modeset-os-interface.h
++++ a/kernel/nvidia-modeset/nvidia-modeset-os-interface.h
+@@ -16,8 +16,14 @@
+ #if !defined(_NVIDIA_MODESET_OS_INTERFACE_H_)
+ #define _NVIDIA_MODESET_OS_INTERFACE_H_
+
+-#include <stddef.h> /* size_t */
+-#include <stdarg.h> /* va_list */
++#if defined(NV_KERNEL_INTERFACE_LAYER) && defined(__FreeBSD__)
++ #include <sys/stddef.h> // NULL
++#elif defined(NV_KERNEL_INTERFACE_LAYER) && defined(NV_LINUX)
++ #include <linux/stddef.h> // NULL
++#else
++ #include <stddef.h> // NULL
++#endif
++#include "nv_stdarg.h" /* va_list */
+
+ #include "nvtypes.h" /* NvU8 */
+
+diff --git a/kernel/nvidia-modeset/nvkms.h a/kernel/nvidia-modeset/nvkms.h
+index d46f97d..4180ed6 100644
+--- a/kernel/nvidia-modeset/nvkms.h
++++ a/kernel/nvidia-modeset/nvkms.h
+@@ -9,7 +9,13 @@
+ #define __NV_KMS_H__
+
+ #include "nvtypes.h"
+-#include <stddef.h> /* size_t */
++#if defined(NV_KERNEL_INTERFACE_LAYER) && defined(__FreeBSD__)
++ #include <sys/stddef.h> // NULL
++#elif defined(NV_KERNEL_INTERFACE_LAYER) && defined(NV_LINUX)
++ #include <linux/stddef.h> // NULL
++#else
++ #include <stddef.h> // NULL
++#endif
+
+ #include "nvkms-kapi.h"
+
+diff --git a/kernel/nvidia-uvm/uvm_mmu.c a/kernel/nvidia-uvm/uvm_mmu.c
+index 68c77be..333da8b 100644
+--- a/kernel/nvidia-uvm/uvm_mmu.c
++++ a/kernel/nvidia-uvm/uvm_mmu.c
+@@ -32,7 +32,7 @@
+ #include "uvm_push.h"
+ #include "uvm_mem.h"
+ #include "uvm_va_space.h"
+-#include <stdarg.h>
++#include "nv_stdarg.h"
+
+
+
+diff --git a/kernel/nvidia/export_nvswitch.h a/kernel/nvidia/export_nvswitch.h
+index e45666c..618a3e7 100644
+--- a/kernel/nvidia/export_nvswitch.h
++++ a/kernel/nvidia/export_nvswitch.h
+@@ -28,7 +28,7 @@
+ extern "C" {
+ #endif
+
+-#include <stdarg.h>
++#include "nv_stdarg.h"
+ #include "nvlink_common.h"
+ #include "ioctl_common_nvswitch.h"
+
diff --git a/kernel-5.17.patch b/kernel-5.17.patch
new file mode 100644
index 000000000000..12da0fa9ac7f
--- /dev/null
+++ b/kernel-5.17.patch
@@ -0,0 +1,35 @@
+From 026a2a54a234cdb7bf78c17be7ea29d8dcf9f390 Mon Sep 17 00:00:00 2001
+From: Joan Bruguera <joanbrugueram@gmail.com>
+Date: Sun, 23 Jan 2022 16:28:18 +0100
+Subject: [PATCH] Tentative fix for NVIDIA 470.94 driver for Linux 5.17-rc1
+
+See also: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=359745d78351c6f5442435f81549f0207ece28aa
+
+---
+ common/inc/nv-procfs-utils.h | 3 +++
+ 1 file changed, 3 insertions(+)
+
+diff --git a/common/inc/nv-procfs-utils.h b/common/inc/nv-procfs-utils.h
+index 7c3e1a3..462eac1 100644
+--- a/kernel/common/inc/nv-procfs-utils.h
++++ b/kernel/common/inc/nv-procfs-utils.h
+@@ -10,6 +10,7 @@
+ #ifndef _NV_PROCFS_UTILS_H
+ #define _NV_PROCFS_UTILS_H
+
++#include <linux/version.h>
+ #include "conftest.h"
+
+ #ifdef CONFIG_PROC_FS
+@@ -87,6 +88,8 @@ typedef struct file_operations nv_proc_ops_t;
+
+ #if defined(NV_PDE_DATA_PRESENT)
+ # define NV_PDE_DATA(inode) PDE_DATA(inode)
++#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 17, 0))
++# define NV_PDE_DATA(inode) pde_data(inode)
+ #else
+ # define NV_PDE_DATA(inode) PDE(inode)->data
+ #endif
+--
+2.34.1
+
diff --git a/kernel-5.6.patch b/kernel-5.6.patch
new file mode 100644
index 000000000000..1fc5b31bd821
--- /dev/null
+++ b/kernel-5.6.patch
@@ -0,0 +1,503 @@
+diff --git a/kernel/common/inc/nv-procfs.h b/kernel/common/inc/nv-procfs.h
+index 8b53f86..4c5aceb 100644
+--- a/kernel/common/inc/nv-procfs.h
++++ b/kernel/common/inc/nv-procfs.h
+@@ -28,6 +28,18 @@
+
+ #define IS_EXERCISE_ERROR_FORWARDING_ENABLED() (EXERCISE_ERROR_FORWARDING)
+
++#if defined(NV_HAVE_PROC_OPS)
++#define NV_CREATE_PROC_FILE(filename,parent,__name,__data) \
++ ({ \
++ struct proc_dir_entry *__entry; \
++ int mode = (S_IFREG | S_IRUGO); \
++ const struct proc_ops *fops = &nv_procfs_##__name##_fops; \
++ if (fops->proc_write != 0) \
++ mode |= S_IWUSR; \
++ __entry = proc_create_data(filename, mode, parent, fops, __data);\
++ __entry; \
++ })
++#else
+ #define NV_CREATE_PROC_FILE(filename,parent,__name,__data) \
+ ({ \
+ struct proc_dir_entry *__entry; \
+@@ -38,6 +50,7 @@
+ __entry = proc_create_data(filename, mode, parent, fops, __data);\
+ __entry; \
+ })
++#endif
+
+ /*
+ * proc_mkdir_mode exists in Linux 2.6.9, but isn't exported until Linux 3.0.
+@@ -77,6 +90,44 @@
+ remove_proc_entry(entry->name, entry->parent);
+ #endif
+
++#if defined(NV_HAVE_PROC_OPS)
++#define NV_DEFINE_SINGLE_PROCFS_FILE(name, open_callback, close_callback) \
++ static int nv_procfs_open_##name( \
++ struct inode *inode, \
++ struct file *filep \
++ ) \
++ { \
++ int ret; \
++ ret = single_open(filep, nv_procfs_read_##name, \
++ NV_PDE_DATA(inode)); \
++ if (ret < 0) \
++ { \
++ return ret; \
++ } \
++ ret = open_callback(); \
++ if (ret < 0) \
++ { \
++ single_release(inode, filep); \
++ } \
++ return ret; \
++ } \
++ \
++ static int nv_procfs_release_##name( \
++ struct inode *inode, \
++ struct file *filep \
++ ) \
++ { \
++ close_callback(); \
++ return single_release(inode, filep); \
++ } \
++ \
++ static const struct proc_ops nv_procfs_##name##_fops = { \
++ .proc_open = nv_procfs_open_##name, \
++ .proc_read = seq_read, \
++ .proc_lseek = seq_lseek, \
++ .proc_release = nv_procfs_release_##name, \
++ };
++#else
+ #define NV_DEFINE_SINGLE_PROCFS_FILE(name, open_callback, close_callback) \
+ static int nv_procfs_open_##name( \
+ struct inode *inode, \
+@@ -114,6 +165,7 @@
+ .llseek = seq_lseek, \
+ .release = nv_procfs_release_##name, \
+ };
++#endif
+
+ #endif /* CONFIG_PROC_FS */
+
+diff --git a/kernel/common/inc/nv-time.h b/kernel/common/inc/nv-time.h
+index 968b873..f03c7b0 100644
+--- a/kernel/common/inc/nv-time.h
++++ b/kernel/common/inc/nv-time.h
+@@ -27,7 +27,12 @@
+
+ #include <linux/ktime.h>
+
+-static inline void nv_gettimeofday(struct timeval *tv)
++struct nv_timeval {
++ __kernel_long_t tv_sec;
++ __kernel_suseconds_t tv_usec;
++};
++
++static inline void nv_gettimeofday(struct nv_timeval *tv)
+ {
+ #ifdef NV_DO_GETTIMEOFDAY_PRESENT
+ do_gettimeofday(tv);
+@@ -36,7 +41,7 @@ static inline void nv_gettimeofday(struct timeval *tv)
+
+ ktime_get_real_ts64(&now);
+
+- *tv = (struct timeval) {
++ *tv = (struct nv_timeval) {
+ .tv_sec = now.tv_sec,
+ .tv_usec = now.tv_nsec/1000,
+ };
+diff --git a/kernel/conftest.sh b/kernel/conftest.sh
+index 57d85a4..4eb703f 100755
+--- a/kernel/conftest.sh
++++ b/kernel/conftest.sh
+@@ -806,6 +806,46 @@ compile_test() {
+ compile_check_conftest "$CODE" "NV_FILE_OPERATIONS_HAS_IOCTL" "" "types"
+ ;;
+
++ proc_ops)
++ CODE="
++ #include <linux/proc_fs.h>
++ int conftest_proc_ops(void) {
++ return offsetof(struct proc_ops, proc_open);
++ }"
++
++ compile_check_conftest "$CODE" "NV_HAVE_PROC_OPS" "" "types"
++ ;;
++
++ ktime_get_raw_ts64)
++ #
++ # Determine if the ktime_get_raw_ts64() function is present.
++ #
++ CODE="
++ #include <linux/ktime.h>
++ int conftest_ktime_get_raw_ts64(void) {
++ struct timespec64 ts = {0};
++
++ ktime_get_raw_ts64(&ts64);
++ }"
++
++ compile_check_conftest "$CODE" "NV_KTIME_GET_RAW_TS64_PRESENT" "" "functions"
++ ;;
++
++ ktime_get_real_ts64)
++ #
++ # Determine if the ktime_get_real_ts64() function is present.
++ #
++ CODE="
++ #include <linux/ktime.h>
++ int conftest_ktime_get_raw_ts64(void) {
++ struct timespec64 ts = {0};
++
++ ktime_get_real_ts64(&ts64);
++ }"
++
++ compile_check_conftest "$CODE" "NV_KTIME_GET_REAL_TS64_PRESENT" "" "functions"
++ ;;
++
+ sg_alloc_table)
+ #
+ # sg_alloc_table_from_pages added by commit efc42bc98058
+diff --git a/kernel/nvidia-modeset/nvidia-modeset-linux.c b/kernel/nvidia-modeset/nvidia-modeset-linux.c
+index 0ca2c7d..8902143 100644
+--- a/kernel/nvidia-modeset/nvidia-modeset-linux.c
++++ b/kernel/nvidia-modeset/nvidia-modeset-linux.c
+@@ -266,7 +266,7 @@ void NVKMS_API_CALL nvkms_usleep(NvU64 usec)
+
+ NvU64 NVKMS_API_CALL nvkms_get_usec(void)
+ {
+- struct timeval tv;
++ struct nv_timeval tv;
+
+ nv_gettimeofday(&tv);
+
+diff --git a/kernel/nvidia-uvm/uvm_linux.h b/kernel/nvidia-uvm/uvm_linux.h
+index 30a9dea..1a20eff 100644
+--- a/kernel/nvidia-uvm/uvm_linux.h
++++ b/kernel/nvidia-uvm/uvm_linux.h
+@@ -301,7 +301,16 @@ static inline uint64_t NV_DIV64(uint64_t dividend, uint64_t divisor, uint64_t *r
+ }
+ #endif
+
+-#if defined(CLOCK_MONOTONIC_RAW)
++#if defined(NV_KTIME_GET_RAW_TS64_PRESENT)
++static inline NvU64 NV_GETTIME(void)
++{
++ struct timespec64 ts;
++
++ ktime_get_raw_ts64(&ts);
++
++ return (ts.tv_sec * 1000000000ULL + ts.tv_nsec);
++}
++#elif defined(CLOCK_MONOTONIC_RAW)
+ /* Return a nanosecond-precise value */
+ static inline NvU64 NV_GETTIME(void)
+ {
+@@ -317,7 +326,7 @@ static inline NvU64 NV_GETTIME(void)
+ * available non-GPL symbols. */
+ static inline NvU64 NV_GETTIME(void)
+ {
+- struct timeval tv = {0};
++ struct nv_timeval tv = {0};
+
+ nv_gettimeofday(&tv);
+
+diff --git a/kernel/nvidia/linux_nvswitch.c b/kernel/nvidia/linux_nvswitch.c
+index 1d2c1bc..0a0b4e8 100644
+--- a/kernel/nvidia/linux_nvswitch.c
++++ b/kernel/nvidia/linux_nvswitch.c
+@@ -1578,10 +1578,17 @@ nvswitch_os_get_platform_time
+ void
+ )
+ {
++#if defined(NV_KTIME_GET_REAL_TS64_PRESENT)
++ struct timespec64 ts64;
++
++ ktime_get_real_ts64(&ts64);
++ return ((NvU64)(ts64.tv_sec * NSEC_PER_SEC) + ts64.tv_nsec);
++#else
+ struct timespec ts;
+
+ getnstimeofday(&ts);
+ return ((NvU64) timespec_to_ns(&ts));
++#endif
+ }
+
+ void
+diff --git a/kernel/nvidia/nv-procfs.c b/kernel/nvidia/nv-procfs.c
+index 064d727..a7308d3 100644
+--- a/kernel/nvidia/nv-procfs.c
++++ b/kernel/nvidia/nv-procfs.c
+@@ -452,6 +452,15 @@ done:
+ return ((status < 0) ? status : (int)count);
+ }
+
++#if defined(NV_HAVE_PROC_OPS)
++static struct proc_ops nv_procfs_registry_fops = {
++ .proc_open = nv_procfs_open_registry,
++ .proc_read = seq_read,
++ .proc_write = nv_procfs_write_file,
++ .proc_lseek = seq_lseek,
++ .proc_release = nv_procfs_close_registry,
++};
++#else
+ static struct file_operations nv_procfs_registry_fops = {
+ .owner = THIS_MODULE,
+ .open = nv_procfs_open_registry,
+@@ -460,6 +469,7 @@ static struct file_operations nv_procfs_registry_fops = {
+ .llseek = seq_lseek,
+ .release = nv_procfs_close_registry,
+ };
++#endif
+
+ #if defined(CONFIG_PM)
+ static int
+@@ -531,6 +541,15 @@ nv_procfs_open_suspend_depth(
+ return single_open(file, nv_procfs_show_suspend_depth, NULL);
+ }
+
++#if defined(NV_HAVE_PROC_OPS)
++static struct proc_ops nv_procfs_suspend_depth_fops = {
++ .proc_open = nv_procfs_open_suspend_depth,
++ .proc_read = seq_read,
++ .proc_write = nv_procfs_write_suspend_depth,
++ .proc_lseek = seq_lseek,
++ .proc_release = single_release
++};
++#else
+ static struct file_operations nv_procfs_suspend_depth_fops = {
+ .owner = THIS_MODULE,
+ .open = nv_procfs_open_suspend_depth,
+@@ -539,6 +558,7 @@ static struct file_operations nv_procfs_suspend_depth_fops = {
+ .llseek = seq_lseek,
+ .release = single_release
+ };
++#endif
+
+ static int
+ nv_procfs_show_suspend(
+@@ -613,6 +633,15 @@ nv_procfs_open_suspend(
+ return single_open(file, nv_procfs_show_suspend, NULL);
+ }
+
++#if defined(NV_HAVE_PROC_OPS)
++static struct proc_ops nv_procfs_suspend_fops = {
++ .proc_open = nv_procfs_open_suspend,
++ .proc_read = seq_read,
++ .proc_write = nv_procfs_write_suspend,
++ .proc_lseek = seq_lseek,
++ .proc_release = single_release
++};
++#else
+ static struct file_operations nv_procfs_suspend_fops = {
+ .owner = THIS_MODULE,
+ .open = nv_procfs_open_suspend,
+@@ -622,6 +651,7 @@ static struct file_operations nv_procfs_suspend_fops = {
+ .release = single_release
+ };
+ #endif
++#endif
+
+ /*
+ * Forwards error to nv_log_error which exposes data to vendor callback
+@@ -724,12 +754,20 @@ done:
+ return status;
+ }
+
++#if defined(NV_HAVE_PROC_OPS)
++static struct proc_ops nv_procfs_exercise_error_forwarding_fops = {
++ .proc_open = nv_procfs_open_exercise_error_forwarding,
++ .proc_write = nv_procfs_write_file,
++ .proc_release = nv_procfs_close_exercise_error_forwarding,
++};
++#else
+ static struct file_operations nv_procfs_exercise_error_forwarding_fops = {
+ .owner = THIS_MODULE,
+ .open = nv_procfs_open_exercise_error_forwarding,
+ .write = nv_procfs_write_file,
+ .release = nv_procfs_close_exercise_error_forwarding,
+ };
++#endif
+
+ static int
+ nv_procfs_read_unbind_lock(
+@@ -851,6 +889,15 @@ done:
+ return rc;
+ }
+
++#if defined(NV_HAVE_PROC_OPS)
++static struct proc_ops nv_procfs_unbind_lock_fops = {
++ .proc_open = nv_procfs_open_unbind_lock,
++ .proc_read = seq_read,
++ .proc_write = nv_procfs_write_file,
++ .proc_lseek = seq_lseek,
++ .proc_release = nv_procfs_close_unbind_lock,
++};
++#else
+ static struct file_operations nv_procfs_unbind_lock_fops = {
+ .owner = THIS_MODULE,
+ .open = nv_procfs_open_unbind_lock,
+@@ -859,6 +906,7 @@ static struct file_operations nv_procfs_unbind_lock_fops = {
+ .llseek = seq_lseek,
+ .release = nv_procfs_close_unbind_lock,
+ };
++#endif
+
+ static const char*
+ numa_status_describe(nv_numa_status_t state)
+@@ -1187,6 +1235,22 @@ done:
+ return retval;
+ }
+
++#if defined(NV_HAVE_PROC_OPS)
++static const struct proc_ops nv_procfs_numa_status_fops = {
++ .proc_open = nv_procfs_open_numa_status,
++ .proc_read = seq_read,
++ .proc_write = nv_procfs_write_file,
++ .proc_lseek = seq_lseek,
++ .proc_release = nv_procfs_close_numa_status,
++};
++
++static const struct proc_ops nv_procfs_offline_pages_fops = {
++ .proc_open = nv_procfs_open_offline_pages,
++ .proc_read = seq_read,
++ .proc_lseek = seq_lseek,
++ .proc_release = nv_procfs_close_offline_pages,
++};
++#else
+ static const struct file_operations nv_procfs_numa_status_fops = {
+ .owner = THIS_MODULE,
+ .open = nv_procfs_open_numa_status,
+@@ -1203,6 +1267,7 @@ static const struct file_operations nv_procfs_offline_pages_fops = {
+ .llseek = seq_lseek,
+ .release = nv_procfs_close_offline_pages,
+ };
++#endif
+
+ static int
+ nv_procfs_read_text_file(
+diff --git a/kernel/nvidia/nvidia.Kbuild b/kernel/nvidia/nvidia.Kbuild
+index 5ec3e65..339a757 100644
+--- a/kernel/nvidia/nvidia.Kbuild
++++ b/kernel/nvidia/nvidia.Kbuild
+@@ -150,6 +150,9 @@ NV_CONFTEST_SYMBOL_COMPILE_TESTS += is_export_symbol_present_swiotlb_dma_ops
+ NV_CONFTEST_TYPE_COMPILE_TESTS += acpi_op_remove
+ NV_CONFTEST_TYPE_COMPILE_TESTS += outer_flush_all
+ NV_CONFTEST_TYPE_COMPILE_TESTS += file_operations
++NV_CONFTEST_TYPE_COMPILE_TESTS += proc_ops
++NV_CONFTEST_TYPE_COMPILE_TESTS += ktime_get_raw_ts64
++NV_CONFTEST_TYPE_COMPILE_TESTS += ktime_get_real_ts64
+ NV_CONFTEST_TYPE_COMPILE_TESTS += file_inode
+ NV_CONFTEST_TYPE_COMPILE_TESTS += kuid_t
+ NV_CONFTEST_TYPE_COMPILE_TESTS += dma_ops
+diff --git a/kernel/nvidia/nvlink_linux.c b/kernel/nvidia/nvlink_linux.c
+index c84b36a..54fe244 100644
+--- a/kernel/nvidia/nvlink_linux.c
++++ b/kernel/nvidia/nvlink_linux.c
+@@ -513,8 +513,8 @@ int NVLINK_API_CALL nvlink_memcmp(const void *s1, const void *s2, NvLength size)
+
+ static NvBool nv_timer_less_than
+ (
+- const struct timeval *a,
+- const struct timeval *b
++ const struct nv_timeval *a,
++ const struct nv_timeval *b
+ )
+ {
+ return (a->tv_sec == b->tv_sec) ? (a->tv_usec < b->tv_usec)
+@@ -523,9 +523,9 @@ static NvBool nv_timer_less_than
+
+ static void nv_timeradd
+ (
+- const struct timeval *a,
+- const struct timeval *b,
+- struct timeval *result
++ const struct nv_timeval *a,
++ const struct nv_timeval *b,
++ struct nv_timeval *result
+ )
+ {
+ result->tv_sec = a->tv_sec + b->tv_sec;
+@@ -539,9 +539,9 @@ static void nv_timeradd
+
+ static void nv_timersub
+ (
+- const struct timeval *a,
+- const struct timeval *b,
+- struct timeval *result
++ const struct nv_timeval *a,
++ const struct nv_timeval *b,
++ struct nv_timeval *result
+ )
+ {
+ result->tv_sec = a->tv_sec - b->tv_sec;
+@@ -561,7 +561,7 @@ void NVLINK_API_CALL nvlink_sleep(unsigned int ms)
+ unsigned long us;
+ unsigned long jiffies;
+ unsigned long mdelay_safe_msec;
+- struct timeval tm_end, tm_aux;
++ struct nv_timeval tm_end, tm_aux;
+
+ nv_gettimeofday(&tm_aux);
+
+diff --git a/kernel/nvidia/os-interface.c b/kernel/nvidia/os-interface.c
+index 07f1b77..239be58 100644
+--- a/kernel/nvidia/os-interface.c
++++ b/kernel/nvidia/os-interface.c
+@@ -463,7 +463,7 @@ NV_STATUS NV_API_CALL os_get_current_time(
+ NvU32 *useconds
+ )
+ {
+- struct timeval tm;
++ struct nv_timeval tm;
+
+ nv_gettimeofday(&tm);
+
+@@ -477,9 +477,15 @@ NV_STATUS NV_API_CALL os_get_current_time(
+
+ void NV_API_CALL os_get_current_tick(NvU64 *nseconds)
+ {
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 5, 0)
++ struct timespec64 ts;
++
++ jiffies_to_timespec64(jiffies, &ts);
++#else
+ struct timespec ts;
+
+ jiffies_to_timespec(jiffies, &ts);
++#endif
+
+ *nseconds = ((NvU64)ts.tv_sec * NSEC_PER_SEC + (NvU64)ts.tv_nsec);
+ }
+@@ -549,7 +555,7 @@ NV_STATUS NV_API_CALL os_delay_us(NvU32 MicroSeconds)
+ unsigned long usec;
+
+ #ifdef NV_CHECK_DELAY_ACCURACY
+- struct timeval tm1, tm2;
++ struct nv_timeval tm1, tm2;
+
+ nv_gettimeofday(&tm1);
+ #endif
+@@ -589,9 +595,9 @@ NV_STATUS NV_API_CALL os_delay(NvU32 MilliSeconds)
+ unsigned long MicroSeconds;
+ unsigned long jiffies;
+ unsigned long mdelay_safe_msec;
+- struct timeval tm_end, tm_aux;
++ struct nv_timeval tm_end, tm_aux;
+ #ifdef NV_CHECK_DELAY_ACCURACY
+- struct timeval tm_start;
++ struct nv_timeval tm_start;
+ #endif
+
+ nv_gettimeofday(&tm_aux);
+@@ -1954,7 +1960,7 @@ static NV_STATUS NV_API_CALL _os_ipmi_receive_resp
+ {
+ struct ipmi_recv_msg *rx_msg;
+ int err_no;
+- struct timeval tv;
++ struct nv_timeval tv;
+ NvU64 start_time;
+
+ nv_gettimeofday(&tv);
diff --git a/nvidia-drm-outputclass.conf b/nvidia-drm-outputclass.conf
index dd2936cb5ebf..9c36f59b549e 100644
--- a/nvidia-drm-outputclass.conf
+++ b/nvidia-drm-outputclass.conf
@@ -1,15 +1,8 @@
Section "OutputClass"
- Identifier "intel"
- MatchDriver "i915"
- Driver "modesetting"
-EndSection
-
-Section "OutputClass"
Identifier "nvidia"
MatchDriver "nvidia-drm"
Driver "nvidia"
Option "AllowEmptyInitialConfiguration"
- Option "PrimaryGPU" "yes"
ModulePath "/usr/lib/nvidia/xorg"
ModulePath "/usr/lib/xorg/modules"
EndSection
diff --git a/nvidia.rules b/nvidia.rules
new file mode 100644
index 000000000000..557f69c21351
--- /dev/null
+++ b/nvidia.rules
@@ -0,0 +1,6 @@
+# Make sure device nodes are present even when the DDX is not started for the Wayland/EGLStream case
+KERNEL=="nvidia", RUN+="/usr/bin/bash -c '/usr/bin/mknod -Z -m 666 /dev/nvidiactl c $$(grep nvidia-frontend /proc/devices | cut -d \ -f 1) 255'"
+KERNEL=="nvidia", RUN+="/usr/bin/bash -c 'for i in $$(cat /proc/driver/nvidia/gpus/*/information | grep Minor | cut -d \ -f 4); do /usr/bin/mknod -Z -m 666 /dev/nvidia$${i} c $$(grep nvidia-frontend /proc/devices | cut -d \ -f 1) $${i}; done'"
+KERNEL=="nvidia_modeset", RUN+="/usr/bin/bash -c '/usr/bin/mknod -Z -m 666 /dev/nvidia-modeset c $$(grep nvidia-frontend /proc/devices | cut -d \ -f 1) 254'"
+KERNEL=="nvidia_uvm", RUN+="/usr/bin/bash -c '/usr/bin/mknod -Z -m 666 /dev/nvidia-uvm c $$(grep nvidia-uvm /proc/devices | cut -d \ -f 1) 0'"
+KERNEL=="nvidia_uvm", RUN+="/usr/bin/bash -c '/usr/bin/mknod -Z -m 666 /dev/nvidia-uvm-tools c $$(grep nvidia-uvm /proc/devices | cut -d \ -f 1) 1'" \ No newline at end of file