diff --git a/kernel/drivers/module-nvidia340/actions.py b/kernel/drivers/module-nvidia340/actions.py index 288abf4ef9..524f85e866 100644 --- a/kernel/drivers/module-nvidia340/actions.py +++ b/kernel/drivers/module-nvidia340/actions.py @@ -27,15 +27,15 @@ def setup(): shelltools.move("tmp/*", ".") - #5.5 patch icin + #5.5 patch shelltools.move("tmp/.manifest", ".") - #shelltools.system("patch -p1 < kernel-5.5.patch") - #shelltools.system("patch -p1 < kernel-5.6.patch") - #shelltools.system("patch -p1 < unfuck-340.108-build-fix.patch") shelltools.system("patch -p1 < kernel-5.7.patch") shelltools.system("patch -p1 < kernel-5.8.patch") shelltools.system("patch -p1 < kernel-5.9.patch") shelltools.system("patch -p1 < kernel-5.10.patch") + shelltools.system("patch -p1 < kernel-5.11.patch") + shelltools.system("patch -p1 < kernel-5.14.patch") + shelltools.system("patch -p1 < kernel-5.15.patch") # Our libc is TLS enabled so use TLS library diff --git a/kernel/drivers/module-nvidia340/files/NVIDIA-Linux-x86_64-340.108-kernel-5.7.patch b/kernel/drivers/module-nvidia340/files/0001-kernel-5.7.patch similarity index 96% rename from kernel/drivers/module-nvidia340/files/NVIDIA-Linux-x86_64-340.108-kernel-5.7.patch rename to kernel/drivers/module-nvidia340/files/0001-kernel-5.7.patch index 3917f38352..938ca0f76a 100644 --- a/kernel/drivers/module-nvidia340/files/NVIDIA-Linux-x86_64-340.108-kernel-5.7.patch +++ b/kernel/drivers/module-nvidia340/files/0001-kernel-5.7.patch @@ -1,3 +1,24 @@ +From 2154cc447a2377cfd60a7b7c5b619e689ebf71b1 Mon Sep 17 00:00:00 2001 +From: graysky +Date: Thu, 22 Oct 2020 06:58:53 -0400 +Subject: [PATCH 1/3] kernel-5.7 + +credit: https://gitlab.manjaro.org/packages?utf8=%E2%9C%93&filter=nvidia-340xx +--- + kernel/Makefile | 5 + + kernel/conftest.sh | 81 +++++++++++++ + kernel/dkms.conf | 8 +- + kernel/nv-drm.c | 229 ++++++++++++++++++++++++++++++++++- + kernel/nv-linux.h | 49 ++++++++ + kernel/nv-procfs.c | 20 +++ + kernel/nv-time.h | 9 +- + kernel/nv.c | 2 +- + kernel/os-interface.c | 8 +- + kernel/uvm/Makefile | 1 + + kernel/uvm/conftest.sh | 4 + + kernel/uvm/nvidia_uvm_lite.c | 29 ++++- + 12 files changed, 431 insertions(+), 14 deletions(-) + diff --git a/kernel/Makefile b/kernel/Makefile index 125a690..2597080 100644 --- a/kernel/Makefile @@ -754,3 +775,6 @@ index 6943e7c..9a7e3b6 100644 NvBool bEccErrorTimeout = NV_FALSE; NvBool bEccIncomingError = NV_FALSE; unsigned rmInterruptSet = 0; +-- +2.29.0 + diff --git a/kernel/drivers/module-nvidia340/files/NVIDIA-Linux-x86_64-340.108-kernel-5.8.patch b/kernel/drivers/module-nvidia340/files/0002-kernel-5.8.patch similarity index 57% rename from kernel/drivers/module-nvidia340/files/NVIDIA-Linux-x86_64-340.108-kernel-5.8.patch rename to kernel/drivers/module-nvidia340/files/0002-kernel-5.8.patch index 8df44adf9d..1d8b1a40e1 100644 --- a/kernel/drivers/module-nvidia340/files/NVIDIA-Linux-x86_64-340.108-kernel-5.8.patch +++ b/kernel/drivers/module-nvidia340/files/0002-kernel-5.8.patch @@ -1,16 +1,22 @@ ---- a/kernel/nvidia-modules-common.mk -+++ b/kernel/nvidia-modules-common.mk -@@ -222,6 +222,7 @@ - define BUILD_MODULE_RULE - $(1): build-sanity-checks $(3) - @echo "NVIDIA: calling KBUILD..."; \ -+ touch .nv-kernel.o.cmd; \ - $$(MAKE) "CC=$$(CC)" NV_MODULE_SUFFIX=$$(strip $(2)) $$(KBUILD_PARAMS) modules; \ - echo "NVIDIA: left KBUILD."; \ - if ! [ -f $(1) ]; then \ ---- a/kernel/nv-linux.h 2020-08-08 03:48:46.894783237 +0300 -+++ b/kernel/nv-linux.h 2020-08-08 15:43:05.252047541 +0300 -@@ -669,11 +669,19 @@ +From 2cc3342b4b3c96bcc4062513011d35c079b009a2 Mon Sep 17 00:00:00 2001 +From: graysky +Date: Thu, 22 Oct 2020 06:59:59 -0400 +Subject: [PATCH 2/3] kernel-5.8 + +credit: https://launchpad.net/~kelebek333/+archive/ubuntu/nvidia-legacy/+packages +extracted from: https://launchpadlibrarian.net/492468557/nvidia-graphics-drivers-340_340.108-1lmtrfocal3_340.108-2lmtrfocal.diff.gz +--- + kernel/nv-linux.h | 8 ++++++++ + kernel/nvidia-modules-common.mk | 1 + + kernel/os-mlock.c | 8 ++++++++ + kernel/uvm/nvidia_uvm_lite_api.c | 4 ++++ + 4 files changed, 21 insertions(+) + +diff --git a/kernel/nv-linux.h b/kernel/nv-linux.h +index 83e6433..d055552 100644 +--- a/kernel/nv-linux.h ++++ b/kernel/nv-linux.h +@@ -669,11 +669,19 @@ extern nv_spinlock_t km_lock; # define KM_FREE_RECORD(a,b,c) #endif @@ -30,9 +36,23 @@ #define NV_VFREE(ptr, size) \ { \ ---- a/kernel/os-mlock.c 2020-04-16 15:37:41.000000000 +0300 -+++ b/kernel/os-mlock.c 2020-08-08 15:47:44.793311179 +0300 -@@ -44,11 +44,19 @@ +diff --git a/kernel/nvidia-modules-common.mk b/kernel/nvidia-modules-common.mk +index b94591b..0e4c228 100644 +--- a/kernel/nvidia-modules-common.mk ++++ b/kernel/nvidia-modules-common.mk +@@ -222,6 +222,7 @@ build-sanity-checks: + define BUILD_MODULE_RULE + $(1): build-sanity-checks $(3) + @echo "NVIDIA: calling KBUILD..."; \ ++ touch .nv-kernel.o.cmd; \ + $$(MAKE) "CC=$$(CC)" NV_MODULE_SUFFIX=$$(strip $(2)) $$(KBUILD_PARAMS) modules; \ + echo "NVIDIA: left KBUILD."; \ + if ! [ -f $(1) ]; then \ +diff --git a/kernel/os-mlock.c b/kernel/os-mlock.c +index 8a1fa2f..fc50543 100644 +--- a/kernel/os-mlock.c ++++ b/kernel/os-mlock.c +@@ -44,11 +44,19 @@ RM_STATUS NV_API_CALL os_lock_user_pages( return rmStatus; } @@ -52,8 +72,10 @@ if (ret < 0) { ---- a/kernel/uvm/nvidia_uvm_lite_api.c 2020-04-16 15:37:41.000000000 +0300 -+++ b/kernel/uvm/nvidia_uvm_lite_api.c 2020-08-08 15:28:40.110186418 +0300 +diff --git a/kernel/uvm/nvidia_uvm_lite_api.c b/kernel/uvm/nvidia_uvm_lite_api.c +index 8448eb6..97a4818 100644 +--- a/kernel/uvm/nvidia_uvm_lite_api.c ++++ b/kernel/uvm/nvidia_uvm_lite_api.c @@ -30,6 +30,10 @@ #include "uvm_gpu_ops_tests.h" #endif @@ -65,3 +87,6 @@ // // nvidia_uvm_lite_api.c // +-- +2.29.0 + diff --git a/kernel/drivers/module-nvidia340/files/0005-kernel-5.11.patch b/kernel/drivers/module-nvidia340/files/0005-kernel-5.11.patch new file mode 100644 index 0000000000..382d7d3b5a --- /dev/null +++ b/kernel/drivers/module-nvidia340/files/0005-kernel-5.11.patch @@ -0,0 +1,174 @@ +diff -Naur NVIDIA-Linux-x86_64-340.108-old/kernel/conftest.sh NVIDIA-Linux-x86_64-340.108-new/kernel/conftest.sh +--- NVIDIA-Linux-x86_64-340.108-old/kernel/conftest.sh 2021-05-24 20:08:18.743742335 +0200 ++++ NVIDIA-Linux-x86_64-340.108-new/kernel/conftest.sh 2021-05-24 20:13:18.019314390 +0200 +@@ -1578,21 +1578,21 @@ + #include + #endif + +- #if defined(NV_DRM_DRM_PRIME_H_PRESENT) +- #include +- #endif +- + #if !defined(CONFIG_DRM) && !defined(CONFIG_DRM_MODULE) + #error DRM not enabled + #endif ++ + void conftest_drm_available(void) { + struct drm_driver drv; +- drv.gem_prime_pin = 0; +- drv.gem_prime_get_sg_table = 0; +- drv.gem_prime_vmap = 0; +- drv.gem_prime_vunmap = 0; +- (void)drm_gem_prime_import; +- (void)drm_gem_prime_export; ++ ++ /* 2013-10-02 1bb72532ac260a2d3982b40bdd4c936d779d0d16 */ ++ (void)drm_dev_alloc; ++ ++ /* 2013-10-02 c22f0ace1926da399d9a16dfaf09174c1b03594c */ ++ (void)drm_dev_register; ++ ++ /* 2013-10-02 c3a49737ef7db0bdd4fcf6cf0b7140a883e32b2a */ ++ (void)drm_dev_unregister; + }" + + compile_check_conftest "$CODE" "NV_DRM_AVAILABLE" "" "generic" +diff -Naur NVIDIA-Linux-x86_64-340.108-old/kernel/nv-drm.c NVIDIA-Linux-x86_64-340.108-new/kernel/nv-drm.c +--- NVIDIA-Linux-x86_64-340.108-old/kernel/nv-drm.c 2021-05-24 20:08:18.779739237 +0200 ++++ NVIDIA-Linux-x86_64-340.108-new/kernel/nv-drm.c 2021-05-24 20:42:13.443288819 +0200 +@@ -60,6 +60,8 @@ + #else + #include + ++#include "linux/dma-buf.h" ++ + struct nv_drm_agp_head { + struct agp_kern_info agp_info; + struct list_head memory; +@@ -210,8 +212,10 @@ + + /* No locking needed since shadow-attach is single-threaded since it may + * only be called from the per-driver module init hook. */ ++#if LINUX_VERSION_CODE <= KERNEL_VERSION(5, 10, 0) + if (drm_core_check_feature(dev, DRIVER_LEGACY)) + list_add_tail(&dev->legacy_dev_list, &driver->legacy_dev_list); ++#endif + + return 0; + +@@ -239,8 +243,10 @@ + if (WARN_ON(!(driver->driver_features & DRIVER_LEGACY))) + return -EINVAL; + ++#if LINUX_VERSION_CODE <= KERNEL_VERSION(5, 10, 0) + /* If not using KMS, fall back to stealth mode manual scanning. */ + INIT_LIST_HEAD(&driver->legacy_dev_list); ++#endif + for (i = 0; pdriver->id_table[i].vendor != 0; i++) { + pid = &pdriver->id_table[i]; + +@@ -273,11 +279,13 @@ + if (!(driver->driver_features & DRIVER_LEGACY)) { + WARN_ON(1); + } else { ++#if LINUX_VERSION_CODE <= KERNEL_VERSION(5, 10, 0) + list_for_each_entry_safe(dev, tmp, &driver->legacy_dev_list, + legacy_dev_list) { + list_del(&dev->legacy_dev_list); + drm_put_dev(dev); + } ++#endif + } + DRM_INFO("Module unloaded\n"); + } +@@ -402,6 +410,39 @@ + .llseek = noop_llseek, + }; + ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 11, 0) ++struct sg_table *nv_drm_gem_prime_get_sg_table(struct drm_gem_object *gem) ++{ ++ return nv_gem_prime_get_sg_table(gem); ++} ++ ++static int nv_drm_gem_vmap(struct drm_gem_object *gem, ++ struct dma_buf_map *map) ++{ ++ map->vaddr = nv_gem_prime_vmap(gem); ++ if (map->vaddr == NULL) { ++ return -ENOMEM; ++ } ++ map->is_iomem = true; ++ return 0; ++} ++ ++static void nv_drm_gem_vunmap(struct drm_gem_object *gem, ++ struct dma_buf_map *map) ++{ ++ nv_gem_prime_vunmap(gem, map->vaddr); ++ map->vaddr = NULL; ++} ++ ++static struct drm_gem_object_funcs nv_drm_gem_object_funcs = { ++ .free = nv_gem_free, ++ .export = drm_gem_prime_export, ++ .get_sg_table = nv_drm_gem_prime_get_sg_table, ++ .vmap = nv_drm_gem_vmap, ++ .vunmap = nv_drm_gem_vunmap, ++}; ++#endif ++ + static struct drm_driver nv_drm_driver = { + + .driver_features = DRIVER_GEM +@@ -420,17 +461,19 @@ + .set_busid = drm_pci_set_busid, + #endif + +-#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 9, 0) +- .gem_free_object_unlocked = nv_gem_free, +-#else ++#if LINUX_VERSION_CODE <= KERNEL_VERSION(5, 8, 0) + .gem_free_object = nv_gem_free, ++#elif LINUX_VERSION_CODE <= KERNEL_VERSION(5, 10, 0) ++ .gem_free_object_unlocked = nv_gem_free, + #endif + + .prime_handle_to_fd = drm_gem_prime_handle_to_fd, ++#if LINUX_VERSION_CODE <= KERNEL_VERSION(5, 10, 0) + .gem_prime_export = drm_gem_prime_export, + .gem_prime_get_sg_table = nv_gem_prime_get_sg_table, + .gem_prime_vmap = nv_gem_prime_vmap, + .gem_prime_vunmap = nv_gem_prime_vunmap, ++#endif + + .name = "nvidia-drm", + .desc = "NVIDIA DRM driver", +diff -Naur NVIDIA-Linux-x86_64-340.108-old/kernel/nv-linux.h NVIDIA-Linux-x86_64-340.108-new/kernel/nv-linux.h +--- NVIDIA-Linux-x86_64-340.108-old/kernel/nv-linux.h 2021-05-24 20:08:18.775739581 +0200 ++++ NVIDIA-Linux-x86_64-340.108-new/kernel/nv-linux.h 2021-05-24 20:09:18.748287771 +0200 +@@ -119,7 +119,9 @@ + #include /* flush_tlb(), flush_tlb_all() */ + #include /* CPU hotplug support */ + #endif +-#include /* page table entry lookup */ ++#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 11, 0) ++ #include /* page table entry lookup */ ++#endif + + #include /* pci_find_class, etc */ + #include /* tasklets, interrupt helpers */ +diff -Naur NVIDIA-Linux-x86_64-340.108-old/kernel/uvm/nvidia_uvm_linux.h NVIDIA-Linux-x86_64-340.108-new/kernel/uvm/nvidia_uvm_linux.h +--- NVIDIA-Linux-x86_64-340.108-old/kernel/uvm/nvidia_uvm_linux.h 2021-05-24 20:08:18.775739581 +0200 ++++ NVIDIA-Linux-x86_64-340.108-new/kernel/uvm/nvidia_uvm_linux.h 2021-05-24 20:09:18.749287739 +0200 +@@ -141,7 +141,9 @@ + #if !defined(NV_VMWARE) + #include /* flush_tlb(), flush_tlb_all() */ + #endif +-#include /* page table entry lookup */ ++#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 11, 0) ++ #include /* page table entry lookup */ ++#endif + + #include /* tasklets, interrupt helpers */ + #include diff --git a/kernel/drivers/module-nvidia340/files/0006-kernel-5.14.patch b/kernel/drivers/module-nvidia340/files/0006-kernel-5.14.patch new file mode 100644 index 0000000000..56c8c45ddb --- /dev/null +++ b/kernel/drivers/module-nvidia340/files/0006-kernel-5.14.patch @@ -0,0 +1,213 @@ +diff -Naur NVIDIA-Linux-x86_64-340.108-no-compat32.5.13/kernel/nv-drm.c NVIDIA-Linux-x86_64-340.108-no-compat32.5.14/kernel/nv-drm.c +--- NVIDIA-Linux-x86_64-340.108-no-compat32.5.13/kernel/nv-drm.c 2021-07-25 10:29:29.336505688 +0200 ++++ NVIDIA-Linux-x86_64-340.108-no-compat32.5.14/kernel/nv-drm.c 2021-09-16 16:49:10.929858547 +0200 +@@ -57,8 +57,11 @@ + #if defined(NV_DRM_GET_PCI_DEV_PRESENT) + #define nv_drm_get_pci_dev drm_get_pci_dev + #else ++#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 14, 0) + #include +- ++#else ++#include ++#endif + #include "linux/dma-buf.h" + + struct nv_drm_agp_head { +@@ -82,6 +85,11 @@ + struct list_head head; + }; + ++struct nv_drm_extra_priv_data { ++ struct pci_dev *pdev; ++ struct drm_agp_head *agp; ++}; ++ + /* + * Code from drm_agp_init/nv_drm_{free,unbind}_agp + * Extracted from commit: 5b8b9d0c6d0e0f1993c6c56deaf9646942c49d94, file: drivers/gpu/drm/drm_agpsupport.c +@@ -89,13 +97,14 @@ + struct drm_agp_head *nv_drm_agp_init(struct drm_device *dev) + { + struct nv_drm_agp_head *head = NULL; ++ struct nv_drm_extra_priv_data *extra = dev->dev_private; + + head = kzalloc(sizeof(*head), GFP_KERNEL); + if (!head) + return NULL; +- head->bridge = agp_find_bridge(dev->pdev); ++ head->bridge = agp_find_bridge(extra->pdev); + if (!head->bridge) { +- head->bridge = agp_backend_acquire(dev->pdev); ++ head->bridge = agp_backend_acquire(extra->pdev); + if (!head->bridge) { + kfree(head); + return NULL; +@@ -133,48 +142,71 @@ + static void nv_drm_pci_agp_init(struct drm_device *dev) + { + if (drm_core_check_feature(dev, DRIVER_USE_AGP)) { +- if (pci_find_capability(dev->pdev, PCI_CAP_ID_AGP)) +- dev->agp = nv_drm_agp_init(dev); +- if (dev->agp) { +- dev->agp->agp_mtrr = arch_phys_wc_add( +- dev->agp->agp_info.aper_base, +- dev->agp->agp_info.aper_size * ++ struct nv_drm_extra_priv_data *extra = dev->dev_private; ++ ++ if (pci_find_capability(extra->pdev, PCI_CAP_ID_AGP)) ++ extra->agp = nv_drm_agp_init(dev); ++ if (extra->agp) { ++ extra->agp->agp_mtrr = arch_phys_wc_add( ++ extra->agp->agp_info.aper_base, ++ extra->agp->agp_info.aper_size * + 1024 * 1024); + } + } + } + ++#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 14, 0) ++ ++#else ++/* copied from v5.14.5 */ ++int nv_drm_legacy_agp_release(struct drm_device *dev) ++{ ++ struct nv_drm_extra_priv_data *extra = dev->dev_private; ++ ++ if (!extra->agp || !extra->agp->acquired) ++ return -EINVAL; ++ agp_backend_release(extra->agp->bridge); ++ extra->agp->acquired = 0; ++ return 0; ++} ++#endif ++ + void nv_drm_legacy_agp_clear(struct drm_device *dev) + { + struct nv_drm_agp_mem *entry, *tempe; ++ struct nv_drm_extra_priv_data *extra = dev->dev_private; + +- if (!dev->agp) ++ if (!extra->agp) + return; + if (!drm_core_check_feature(dev, DRIVER_LEGACY)) + return; + +- list_for_each_entry_safe(entry, tempe, &dev->agp->memory, head) { ++ list_for_each_entry_safe(entry, tempe, &extra->agp->memory, head) { + if (entry->bound) + nv_drm_unbind_agp(entry->memory); + nv_drm_free_agp(entry->memory, entry->pages); + kfree(entry); + } +- INIT_LIST_HEAD(&dev->agp->memory); ++ INIT_LIST_HEAD(&extra->agp->memory); + +- if (dev->agp->acquired) ++ if (extra->agp->acquired) ++#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 14, 0) + drm_agp_release(dev); +- +- dev->agp->acquired = 0; +- dev->agp->enabled = 0; ++#else ++ nv_drm_legacy_agp_release(dev); ++#endif ++ extra->agp->acquired = 0; ++ extra->agp->enabled = 0; + } + + void nv_drm_pci_agp_destroy(struct drm_device *dev) + { +- if (dev->agp) { +- arch_phys_wc_del(dev->agp->agp_mtrr); ++ struct nv_drm_extra_priv_data *extra = dev->dev_private; ++ if (extra->agp) { ++ arch_phys_wc_del(extra->agp->agp_mtrr); + nv_drm_legacy_agp_clear(dev); +- kfree(dev->agp); +- dev->agp = NULL; ++ kfree(extra->agp); ++ extra->agp = NULL; + } + } + +@@ -183,6 +215,7 @@ + struct drm_driver *driver) + { + struct drm_device *dev; ++ struct nv_drm_extra_priv_data *extra; + int ret; + + DRM_DEBUG("\n"); +@@ -191,11 +224,18 @@ + if (IS_ERR(dev)) + return PTR_ERR(dev); + ++ extra = kzalloc(sizeof(*extra), GFP_KERNEL); ++ if (IS_ERR(extra)) ++ goto err_free; ++ ++ extra->pdev = pdev; ++ + ret = pci_enable_device(pdev); + if (ret) +- goto err_free; ++ goto err_free2; + +- dev->pdev = pdev; ++ /* use the not used (i hope) dev_private to store deprecated/legacy pointers */ ++ dev->dev_private = extra; + #ifdef __alpha__ + dev->hose = pdev->sysdata; + #endif +@@ -221,6 +261,8 @@ + err_agp: + nv_drm_pci_agp_destroy(dev); + pci_disable_device(pdev); ++err_free2: ++ kfree(extra); + err_free: + drm_dev_put(dev); + return ret; +@@ -303,10 +345,11 @@ + ) + { + nv_linux_state_t *nvl; ++ struct nv_drm_extra_priv_data *extra = dev->dev_private; + + for (nvl = nv_linux_devices; nvl != NULL; nvl = nvl->next) + { +- if (nvl->dev == dev->pdev) ++ if (nvl->dev == extra->pdev) + { + nvl->drm = dev; + return 0; +@@ -327,10 +370,11 @@ + ) + { + nv_linux_state_t *nvl; ++ struct nv_drm_extra_priv_data *extra = dev->dev_private; + + for (nvl = nv_linux_devices; nvl != NULL; nvl = nvl->next) + { +- if (nvl->dev == dev->pdev) ++ if (nvl->dev == extra->pdev) + { + BUG_ON(nvl->drm != dev); + nvl->drm = NULL; +diff -Naur NVIDIA-Linux-x86_64-340.108-no-compat32.5.13/kernel/os-interface.c NVIDIA-Linux-x86_64-340.108-no-compat32.5.14/kernel/os-interface.c +--- NVIDIA-Linux-x86_64-340.108-no-compat32.5.13/kernel/os-interface.c 2021-07-25 10:29:29.083168593 +0200 ++++ NVIDIA-Linux-x86_64-340.108-no-compat32.5.14/kernel/os-interface.c 2021-09-16 13:17:43.345906445 +0200 +@@ -549,7 +549,11 @@ + // the requested timeout has expired, loop until less + // than a jiffie of the desired delay remains. + // ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 14, 0) ++ current->__state = TASK_INTERRUPTIBLE; ++#else + current->state = TASK_INTERRUPTIBLE; ++#endif + do + { + schedule_timeout(jiffies); diff --git a/kernel/drivers/module-nvidia340/files/0008-fix-5.15.patch b/kernel/drivers/module-nvidia340/files/0008-fix-5.15.patch new file mode 100644 index 0000000000..dd367186f9 --- /dev/null +++ b/kernel/drivers/module-nvidia340/files/0008-fix-5.15.patch @@ -0,0 +1,14 @@ +diff -Naur NVIDIA-Linux-x86_64-340.108-old/kernel/nv-drm.c NVIDIA-Linux-x86_64-340.108-new/kernel/nv-drm.c +--- NVIDIA-Linux-x86_64-340.108-old/kernel/nv-drm.c 2021-11-06 20:08:18.779739237 +0200 ++++ NVIDIA-Linux-x86_64-340.108-new/kernel/nv-drm.c 2021-11-06 20:42:13.443288819 +0200 +@@ -529,7 +529,9 @@ RM_STATUS NV_API_CALL nv_alloc_os_descri + #if defined(NV_DRM_GEM_OBJECT_PUT_UNLOCKED_PRESENT) + drm_gem_object_put_unlocked(&nv_obj->base); + #else +-#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 9, 0) ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 15, 0) ++ drm_gem_object_put(&nv_obj->base); ++#elif LINUX_VERSION_CODE >= KERNEL_VERSION(5, 9, 0) + drm_gem_object_put_locked(&nv_obj->base); + #else + drm_gem_object_unreference_unlocked(&nv_obj->base); diff --git a/kernel/drivers/module-nvidia340/files/NVIDIA-Linux-x86_64-340.108-kernel-5.5.patch b/kernel/drivers/module-nvidia340/files/NVIDIA-Linux-x86_64-340.108-kernel-5.5.patch deleted file mode 100644 index ea9e4dd47b..0000000000 --- a/kernel/drivers/module-nvidia340/files/NVIDIA-Linux-x86_64-340.108-kernel-5.5.patch +++ /dev/null @@ -1,15 +0,0 @@ - - kernel/uvm/Makefile | 1 + - 1 file changed, 1 insertion(+) - -diff -Nurp NVIDIA-Linux-x86_64-340.108.orig/kernel/uvm/Makefile NVIDIA-Linux-x86_64-340.108/kernel/uvm/Makefile ---- NVIDIA-Linux-x86_64-340.108.orig/kernel/uvm/Makefile 2019-12-12 00:04:24.000000000 +0200 -+++ NVIDIA-Linux-x86_64-340.108/kernel/uvm/Makefile 2020-02-09 22:55:54.018263069 +0200 -@@ -207,6 +207,7 @@ ccflags-y += $(EXTRA_CFLAGS) - - RM_MODULE_SYMVERS:= $(RM_OUT_DIR)/Module.symvers - UVM_MODULE_SYMVERS:= $(obj)/Module.symvers -+KBUILD_EXTRA_SYMBOLS:= $(UVM_MODULE_SYMVERS) - - module $(MODULE_NAME).ko: $(UVM_MODULE_SYMVERS) debug_diagnostics_printing - diff --git a/kernel/drivers/module-nvidia340/files/NVIDIA-Linux-x86_64-340.108-kernel-5.6.patch b/kernel/drivers/module-nvidia340/files/NVIDIA-Linux-x86_64-340.108-kernel-5.6.patch deleted file mode 100644 index dfe4e7cb18..0000000000 --- a/kernel/drivers/module-nvidia340/files/NVIDIA-Linux-x86_64-340.108-kernel-5.6.patch +++ /dev/null @@ -1,336 +0,0 @@ -diff -Nurp NVIDIA-Linux-x86_64-340.108.orig/kernel/conftest.sh NVIDIA-Linux-x86_64-340.108/kernel/conftest.sh ---- NVIDIA-Linux-x86_64-340.108.orig/kernel/conftest.sh 2019-12-12 00:04:24.000000000 +0200 -+++ NVIDIA-Linux-x86_64-340.108/kernel/conftest.sh 2020-04-11 02:17:40.154699782 +0300 -@@ -1188,6 +1188,19 @@ compile_test() { - compile_check_conftest "$CODE" "NV_IOREMAP_CACHE_PRESENT" "" "functions" - ;; - -+ ioremap_nocache) -+ # -+ # Determine if the ioremap_nocache() function is present. -+ # -+ CODE=" -+ #include -+ void conftest_ioremap_nocache(void) { -+ ioremap_nocache(); -+ }" -+ -+ compile_check_conftest "$CODE" "NV_IOREMAP_NOCACHE_PRESENT" "" "functions" -+ ;; -+ - ioremap_wc) - # - # Determine if the ioremap_wc() function is present. -@@ -1607,6 +1620,19 @@ compile_test() { - compile_check_conftest "$CODE" "NV_PROC_REMOVE_PRESENT" "" "functions" - ;; - -+ proc_ops) -+ # -+ # Determine if struct proc_ops is present. -+ # -+ CODE=" -+ #include -+ void conftest_proc_ops(void) { -+ struct proc_ops pops; -+ }" -+ -+ compile_check_conftest "$CODE" "NV_PROC_OPS_PRESENT" "" "types" -+ ;; -+ - vm_operations_struct) - # - # Determine if the 'vm_operations_struct' structure has -@@ -2066,6 +2092,28 @@ compile_test() { - compile_check_conftest "$CODE" "NV_DRM_LEGACY_PCI_INIT_PRESENT" "" "functions" - ;; - -+ drm_pci_init) -+ # -+ # Determine if drm_pci_init() is present. drm_pci_init() was -+ # deprecated and renamed to drm_legacy_pci_init by: -+ # -+ # 2017-05-24 10631d724deff712343d96dd3017cd323349f761 -+ # -+ CODE=" -+ #if defined(NV_DRM_DRMP_H_PRESENT) -+ #include -+ #endif -+ -+ #if defined(NV_DRM_DRM_PCI_H_PRESENT) -+ #include -+ #endif -+ void conftest_drm_pci_init(void) { -+ drm_pci_init(); -+ }" -+ -+ compile_check_conftest "$CODE" "NV_DRM_PCI_INIT_PRESENT" "" "functions" -+ ;; -+ - timer_setup) - # - # Determine if the function timer_setup() is present. -@@ -2109,6 +2157,22 @@ compile_test() { - compile_check_conftest "$CODE" "NV_DO_GETTIMEOFDAY_PRESENT" "" "functions" - ;; - -+ timeval) -+ # -+ # Determine if timeval is present. -+ # -+ CODE=" -+ #include -+ #if defined(NV_LINUX_KTIME_H_PRESENT) -+ #include -+ #endif -+ void conftest_timeval(void) { -+ struct timeval tv; -+ }" -+ -+ compile_check_conftest "$CODE" "NV_TIMEVAL_PRESENT" "" "types" -+ ;; -+ - drm_gem_object_put_unlocked) - # - # Determine if the function drm_gem_object_put_unlocked() is present. -diff -Nurp NVIDIA-Linux-x86_64-340.108.orig/kernel/Makefile NVIDIA-Linux-x86_64-340.108/kernel/Makefile ---- NVIDIA-Linux-x86_64-340.108.orig/kernel/Makefile 2019-12-12 00:04:24.000000000 +0200 -+++ NVIDIA-Linux-x86_64-340.108/kernel/Makefile 2020-04-11 02:17:40.154699782 +0300 -@@ -114,6 +114,7 @@ COMPILE_TESTS = \ - nvmap_support \ - acpi_evaluate_integer \ - ioremap_cache \ -+ ioremap_nocache \ - ioremap_wc \ - proc_dir_entry \ - INIT_WORK \ -@@ -132,6 +133,7 @@ COMPILE_TESTS = \ - proc_create_data \ - pde_data \ - proc_remove \ -+ proc_ops \ - sg_table \ - pm_vt_switch_required \ - pci_save_state \ -@@ -148,8 +150,10 @@ COMPILE_TESTS = \ - vm_fault_has_address \ - drm_driver_unload_has_int_return_type \ - drm_legacy_pci_init \ -+ drm_pci_init \ - timer_setup \ - do_gettimeofday \ -+ timeval \ - drm_gem_object_put_unlocked \ - drm_driver_legacy_feature_bit_present \ - drm_driver_prime_flag_present -diff -Nurp NVIDIA-Linux-x86_64-340.108.orig/kernel/nv-drm.c NVIDIA-Linux-x86_64-340.108/kernel/nv-drm.c ---- NVIDIA-Linux-x86_64-340.108.orig/kernel/nv-drm.c 2019-12-12 00:04:24.000000000 +0200 -+++ NVIDIA-Linux-x86_64-340.108/kernel/nv-drm.c 2020-04-11 02:17:40.154699782 +0300 -@@ -47,7 +47,61 @@ - #include - #endif - --#if defined(NV_DRM_LEGACY_PCI_INIT_PRESENT) -+#if !defined(NV_DRM_LEGACY_PCI_INIT_PRESENT) && !defined(NV_DRM_PCI_INIT_PRESENT) -+static int nv_drm_pci_init(struct drm_driver *driver, struct pci_driver *pdriver) -+{ -+ struct pci_dev *pdev = NULL; -+ const struct pci_device_id *pid; -+ int i; -+ -+ DRM_DEBUG("\n"); -+ -+ if (WARN_ON(!(driver->driver_features & DRIVER_LEGACY))) -+ return -EINVAL; -+ -+ /* If not using KMS, fall back to stealth mode manual scanning. */ -+ INIT_LIST_HEAD(&driver->legacy_dev_list); -+ for (i = 0; pdriver->id_table[i].vendor != 0; i++) { -+ pid = &pdriver->id_table[i]; -+ -+ /* Loop around setting up a DRM device for each PCI device -+ * matching our ID and device class. If we had the internal -+ * function that pci_get_subsys and pci_get_class used, we'd -+ * be able to just pass pid in instead of doing a two-stage -+ * thing. -+ */ -+ pdev = NULL; -+ while ((pdev = -+ pci_get_subsys(pid->vendor, pid->device, pid->subvendor, -+ pid->subdevice, pdev)) != NULL) { -+ if ((pdev->class & pid->class_mask) != pid->class) -+ continue; -+ -+ /* stealth mode requires a manual probe */ -+ pci_dev_get(pdev); -+ drm_get_pci_dev(pdev, pid, driver); -+ } -+ } -+ return 0; -+} -+ -+static void nv_drm_pci_exit(struct drm_driver *driver, struct pci_driver *pdriver) -+{ -+ struct drm_device *dev, *tmp; -+ DRM_DEBUG("\n"); -+ -+ if (!(driver->driver_features & DRIVER_LEGACY)) { -+ WARN_ON(1); -+ } else { -+ list_for_each_entry_safe(dev, tmp, &driver->legacy_dev_list, -+ legacy_dev_list) { -+ list_del(&dev->legacy_dev_list); -+ drm_put_dev(dev); -+ } -+ } -+ DRM_INFO("Module unloaded\n"); -+} -+#elif defined(NV_DRM_LEGACY_PCI_INIT_PRESENT) - #define nv_drm_pci_init drm_legacy_pci_init - #define nv_drm_pci_exit drm_legacy_pci_exit - #else -diff -Nurp NVIDIA-Linux-x86_64-340.108.orig/kernel/nv-linux.h NVIDIA-Linux-x86_64-340.108/kernel/nv-linux.h ---- NVIDIA-Linux-x86_64-340.108.orig/kernel/nv-linux.h 2019-12-12 00:04:24.000000000 +0200 -+++ NVIDIA-Linux-x86_64-340.108/kernel/nv-linux.h 2020-04-11 02:17:40.155699830 +0300 -@@ -688,11 +688,15 @@ extern nv_spinlock_t km_lock; - VM_ALLOC_RECORD(ptr, size, "vm_ioremap"); \ - } - -+#if defined(NV_IOREMAP_NOCACHE_PRESENT) - #define NV_IOREMAP_NOCACHE(ptr, physaddr, size) \ - { \ - (ptr) = ioremap_nocache(physaddr, size); \ - VM_ALLOC_RECORD(ptr, size, "vm_ioremap_nocache"); \ - } -+#else -+#define NV_IOREMAP_NOCACHE NV_IOREMAP -+#endif - - #if defined(NV_IOREMAP_CACHE_PRESENT) - #define NV_IOREMAP_CACHE(ptr, physaddr, size) \ -@@ -1971,6 +1975,19 @@ extern NvU32 nv_assign_gpu_count; - }) - #endif - -+#if defined(NV_PROC_OPS_PRESENT) -+#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 = NV_CREATE_PROC_ENTRY(filename, mode, parent, fops, \ -+ __data); \ -+ __entry; \ -+ }) -+#else - #define NV_CREATE_PROC_FILE(filename,parent,__name,__data) \ - ({ \ - struct proc_dir_entry *__entry; \ -@@ -1982,6 +1999,7 @@ extern NvU32 nv_assign_gpu_count; - __data); \ - __entry; \ - }) -+#endif - - /* - * proc_mkdir_mode exists in Linux 2.6.9, but isn't exported until Linux 3.0. -@@ -2023,6 +2041,24 @@ extern NvU32 nv_assign_gpu_count; - remove_proc_entry(entry->name, entry->parent); - #endif - -+#if defined(NV_PROC_OPS_PRESENT) -+#define NV_DEFINE_PROCFS_SINGLE_FILE(__name) \ -+ static int nv_procfs_open_##__name( \ -+ struct inode *inode, \ -+ struct file *filep \ -+ ) \ -+ { \ -+ return single_open(filep, nv_procfs_read_##__name, \ -+ NV_PDE_DATA(inode)); \ -+ } \ -+ \ -+ 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 = single_release, \ -+ }; -+#else - #define NV_DEFINE_PROCFS_SINGLE_FILE(__name) \ - static int nv_procfs_open_##__name( \ - struct inode *inode, \ -@@ -2040,6 +2076,7 @@ extern NvU32 nv_assign_gpu_count; - .llseek = seq_lseek, \ - .release = single_release, \ - }; -+#endif - - #endif /* CONFIG_PROC_FS */ - -diff -Nurp NVIDIA-Linux-x86_64-340.108.orig/kernel/nv-procfs.c NVIDIA-Linux-x86_64-340.108/kernel/nv-procfs.c ---- NVIDIA-Linux-x86_64-340.108.orig/kernel/nv-procfs.c 2019-12-12 00:04:24.000000000 +0200 -+++ NVIDIA-Linux-x86_64-340.108/kernel/nv-procfs.c 2020-04-11 02:17:40.155699830 +0300 -@@ -409,6 +409,15 @@ done: - return ((status < 0) ? status : (int)count); - } - -+#if defined(NV_PROC_OPS_PRESENT) -+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, -@@ -417,6 +426,7 @@ static struct file_operations nv_procfs_ - .llseek = seq_lseek, - .release = nv_procfs_close_registry, - }; -+#endif - - static int - nv_procfs_read_unbind_lock( -@@ -538,6 +548,15 @@ done: - return rc; - } - -+#if defined(NV_PROC_OPS_PRESENT) -+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, -@@ -546,6 +565,7 @@ static struct file_operations nv_procfs_ - .llseek = seq_lseek, - .release = nv_procfs_close_unbind_lock, - }; -+#endif - - static int - nv_procfs_read_text_file( -diff -Nurp NVIDIA-Linux-x86_64-340.108.orig/kernel/nv-time.h NVIDIA-Linux-x86_64-340.108/kernel/nv-time.h ---- NVIDIA-Linux-x86_64-340.108.orig/kernel/nv-time.h 2019-12-12 00:04:24.000000000 +0200 -+++ NVIDIA-Linux-x86_64-340.108/kernel/nv-time.h 2020-04-11 02:17:40.155699830 +0300 -@@ -28,6 +28,10 @@ - #include - #endif - -+#if !defined(NV_TIMEVAL_PRESENT) -+#define timeval __kernel_old_timeval -+#endif -+ - static inline void nv_gettimeofday(struct timeval *tv) - { - #ifdef NV_DO_GETTIMEOFDAY_PRESENT diff --git a/kernel/drivers/module-nvidia340/files/nv_patch_340.107_linux_kernel_5.0 b/kernel/drivers/module-nvidia340/files/nv_patch_340.107_linux_kernel_5.0 deleted file mode 100644 index 1d26e5027f..0000000000 --- a/kernel/drivers/module-nvidia340/files/nv_patch_340.107_linux_kernel_5.0 +++ /dev/null @@ -1,199 +0,0 @@ ---- kernel/conftest.sh -+++ kernel/conftest.sh -@@ -168,6 +168,7 @@ test_headers() { - FILES="$FILES linux/sched/task.h" - FILES="$FILES xen/ioemu.h" - FILES="$FILES linux/fence.h" -+ FILES="$FILES linux/ktime.h" - - FILES_ARCH="$FILES_ARCH asm/set_memory.h" - -@@ -1971,6 +1972,38 @@ compile_test() { - compile_check_conftest "$CODE" "NV_DRM_DRIVER_UNLOAD_HAS_INT_RETURN_TYPE" "" "types" - ;; - -+ drm_gem_object_get) -+ # -+ # Determine if the function drm_gem_object_get() is present. -+ # -+ CODE=" -+ #include -+ #if defined(NV_DRM_DRM_GEM_H_PRESENT) -+ #include -+ #endif -+ void conftest_drm_gem_object_get(void) { -+ drm_gem_object_get(); -+ }" -+ -+ compile_check_conftest "$CODE" "NV_DRM_GEM_OBJECT_GET_PRESENT" "" "functions" -+ ;; -+ -+ do_gettimeofday) -+ # -+ # Determine if the function do_gettimeofday() is present. -+ # -+ CODE=" -+ #include -+ #if defined(NV_LINUX_KTIME_H_PRESENT) -+ #include -+ #endif -+ void conftest_do_gettimeofday(void) { -+ do_gettimeofday(); -+ }" -+ -+ compile_check_conftest "$CODE" "NV_DO_GETTIMEOFDAY_PRESENT" "" "functions" -+ ;; -+ - drm_legacy_pci_init) - # - # Determine if drm_legacy_pci_init() is present. drm_pci_init() was ---- kernel/nv-drm.c -+++ kernel/nv-drm.c -@@ -37,6 +37,16 @@ struct nv_gem_object { - struct page **pages; - }; - -+static inline void -+nv_drm_gem_object_unreference_unlocked(struct nv_gem_object *nv_gem) -+{ -+#if defined(NV_DRM_GEM_OBJECT_GET_PRESENT) -+ drm_gem_object_put_unlocked(&nv_gem->base); -+#else -+ drm_gem_object_unreference_unlocked(&nv_gem->base); -+#endif -+} -+ - static int nv_drm_load( - struct drm_device *dev, - unsigned long flags -@@ -252,7 +262,7 @@ RM_STATUS NV_API_CALL nv_alloc_os_descriptor_handle( - goto done; - } - -- drm_gem_object_unreference_unlocked(&nv_obj->base); -+ nv_drm_gem_object_unreference_unlocked(nv_obj); - - status = RM_OK; - ---- /dev/null -+++ kernel/nv-time.h -@@ -0,0 +1,24 @@ -+#ifndef __NV_TIME_H__ -+#define __NV_TIME_H__ -+ -+#include "conftest.h" -+#include -+ -+#if defined(NV_LINUX_KTIME_H_PRESENT) -+#include -+#endif -+ -+static inline void nv_gettimeofday(struct timeval *tv) -+{ -+#ifdef NV_DO_GETTIMEOFDAY_PRESENT -+ do_gettimeofday(tv); -+#else -+ struct timespec64 now; -+ -+ ktime_get_real_ts64(&now); -+ tv->tv_sec = now.tv_sec; -+ tv->tv_usec = now.tv_nsec/1000; -+#endif -+} -+ -+#endif ---- kernel/os-interface.c -+++ kernel/os-interface.c -@@ -13,6 +13,7 @@ - - #include "os-interface.h" - #include "nv-linux.h" -+#include "nv-time.h" - - RM_STATUS NV_API_CALL os_disable_console_access(void) - { -@@ -440,7 +441,7 @@ RM_STATUS NV_API_CALL os_get_current_time( - { - struct timeval tm; - -- do_gettimeofday(&tm); -+ nv_gettimeofday(&tm); - - *seconds = tm.tv_sec; - *useconds = tm.tv_usec; -@@ -475,7 +476,7 @@ RM_STATUS NV_API_CALL os_delay_us(NvU32 MicroSeconds) - #ifdef NV_CHECK_DELAY_ACCURACY - struct timeval tm1, tm2; - -- do_gettimeofday(&tm1); -+ nv_gettimeofday(&tm1); - #endif - - if (in_irq() && (MicroSeconds > NV_MAX_ISR_DELAY_US)) -@@ -490,7 +491,7 @@ RM_STATUS NV_API_CALL os_delay_us(NvU32 MicroSeconds) - udelay(usec); - - #ifdef NV_CHECK_DELAY_ACCURACY -- do_gettimeofday(&tm2); -+ nv_gettimeofday(&tm2); - nv_printf(NV_DBG_ERRORS, "NVRM: osDelayUs %d: 0x%x 0x%x\n", - MicroSeconds, tm2.tv_sec - tm1.tv_sec, tm2.tv_usec - tm1.tv_usec); - #endif -@@ -518,7 +519,7 @@ RM_STATUS NV_API_CALL os_delay(NvU32 MilliSeconds) - struct timeval tm_start; - #endif - -- do_gettimeofday(&tm_aux); -+ nv_gettimeofday(&tm_aux); - #ifdef NV_CHECK_DELAY_ACCURACY - tm_start = tm_aux; - #endif -@@ -552,7 +553,7 @@ RM_STATUS NV_API_CALL os_delay(NvU32 MilliSeconds) - do - { - schedule_timeout(jiffies); -- do_gettimeofday(&tm_aux); -+ nv_gettimeofday(&tm_aux); - if (NV_TIMERCMP(&tm_aux, &tm_end, <)) - { - NV_TIMERSUB(&tm_end, &tm_aux, &tm_aux); -@@ -574,7 +575,7 @@ RM_STATUS NV_API_CALL os_delay(NvU32 MilliSeconds) - udelay(MicroSeconds); - } - #ifdef NV_CHECK_DELAY_ACCURACY -- do_gettimeofday(&tm_aux); -+ nv_gettimeofday(&tm_aux); - timersub(&tm_aux, &tm_start, &tm_aux); - nv_printf(NV_DBG_ERRORS, "NVRM: osDelay %dmsec: %d.%06dsec\n", - MilliSeconds, tm_aux.tv_sec, tm_aux.tv_usec); ---- kernel/uvm/nvidia_uvm_linux.h -+++ kernel/uvm/nvidia_uvm_linux.h -@@ -146,6 +146,7 @@ - #include /* tasklets, interrupt helpers */ - #include - #include /* do_gettimeofday()*/ -+#include "nv-time.h" - - #include /* do_div() */ - #if defined(NV_ASM_SYSTEM_H_PRESENT) ---- kernel/uvm/nvidia_uvm_lite.c -+++ kernel/uvm/nvidia_uvm_lite.c -@@ -2019,7 +2019,7 @@ static RM_STATUS _check_ecc_errors(UvmGpuMigrationTracking *pMigTracker, - { - if (!!(rmInterruptSet) && !bEccIncomingError) - { -- do_gettimeofday(&eccErrorStartTime); -+ nv_gettimeofday(&eccErrorStartTime); - _set_timeout_in_usec(&eccErrorStartTime, &eccTimeout, - UVM_ECC_ERR_TIMEOUT_USEC); - -@@ -2051,7 +2051,7 @@ static RM_STATUS _check_ecc_errors(UvmGpuMigrationTracking *pMigTracker, - // - if (!!(rmInterruptSet) && (eccErrorStartTime.tv_usec != 0)) - { -- do_gettimeofday(&eccErrorCurrentTime); -+ nv_gettimeofday(&eccErrorCurrentTime); - if ((eccErrorCurrentTime.tv_sec > eccTimeout.tv_sec) || - ((eccErrorCurrentTime.tv_sec == eccTimeout.tv_sec) && - (eccErrorCurrentTime.tv_usec >= eccTimeout.tv_usec))) - diff --git a/kernel/drivers/module-nvidia340/files/unfuck-340.108-build-fix.patch b/kernel/drivers/module-nvidia340/files/unfuck-340.108-build-fix.patch deleted file mode 100644 index 645e45f6cb..0000000000 --- a/kernel/drivers/module-nvidia340/files/unfuck-340.108-build-fix.patch +++ /dev/null @@ -1,48 +0,0 @@ -diff --git a/uvm/nvidia_uvm_lite.c b/uvm/nvidia_uvm_lite.c -index 6943e7c..c5d232c 100644 ---- a/kernel/uvm/nvidia_uvm_lite.c -+++ b/kernel/uvm/nvidia_uvm_lite.c -@@ -820,7 +820,13 @@ done: - } - - #if defined(NV_VM_OPERATIONS_STRUCT_HAS_FAULT) -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 17, 0) -+vm_fault_t _fault(struct vm_fault *vmf) -+#elif LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0) -+int _fault(struct vm_fault *vmf) -+#else - int _fault(struct vm_area_struct *vma, struct vm_fault *vmf) -+#endif - { - #if defined(NV_VM_FAULT_HAS_ADDRESS) - unsigned long vaddr = vmf->address; -@@ -828,8 +834,15 @@ int _fault(struct vm_area_struct *vma, struct vm_fault *vmf) - unsigned long vaddr = (unsigned long)vmf->virtual_address; - #endif - struct page *page = NULL; -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 17, 0) -+ vm_fault_t retval; -+#else - int retval; - -+#endif -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0) -+ struct vm_area_struct *vma = vmf->vma; -+#endif - retval = _fault_common(vma, vaddr, &page, vmf->flags); - - vmf->page = page; -@@ -868,7 +881,13 @@ static struct vm_operations_struct uvmlite_vma_ops = - // it's dealing with anonymous mapping (see handle_pte_fault). - // - #if defined(NV_VM_OPERATIONS_STRUCT_HAS_FAULT) -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 17, 0) -+vm_fault_t _sigbus_fault(struct vm_fault *vmf) -+#elif LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0) -+int _sigbus_fault(struct vm_fault *vmf) -+#else - int _sigbus_fault(struct vm_area_struct *vma, struct vm_fault *vmf) -+#endif - { - vmf->page = NULL; - return VM_FAULT_SIGBUS; diff --git a/kernel/drivers/module-nvidia340/files/unregister_procfs_on_failure.patch b/kernel/drivers/module-nvidia340/files/unregister_procfs_on_failure.patch deleted file mode 100644 index d220cb3efc..0000000000 --- a/kernel/drivers/module-nvidia340/files/unregister_procfs_on_failure.patch +++ /dev/null @@ -1,28 +0,0 @@ -Author: Andreas Beckmann -Description: unregister procfs upon module load failure - the nvidia module may leave stale proc entries if it refuses to be - loaded becase nouveau is already loaded and has claimed the device - . - the error unwinding in nvidia_init_module() is insane - (375.26 looks much better) - . - this patch is probably not correct in all cases, but the unwinding is - not reverse linear in creation and the gotos are all across everything - . - leaving stale proc entries prevents the nvidia module from loading again - . - accessing the stale proc entries results in - BUG: unable to handle kernel paging request at ... -Bug-Debian: #764639 - ---- a/kernel/nv.c -+++ b/kernel/nv.c -@@ -1038,6 +1038,8 @@ failed3: - - pci_unregister_driver(&nv_pci_driver); - -+ nv_unregister_procfs(); -+ - failed5: - rm_shutdown_rm(sp); - diff --git a/kernel/drivers/module-nvidia340/pspec.xml b/kernel/drivers/module-nvidia340/pspec.xml index 559e9b82b5..691fa2ca5b 100644 --- a/kernel/drivers/module-nvidia340/pspec.xml +++ b/kernel/drivers/module-nvidia340/pspec.xml @@ -14,16 +14,17 @@ http://http.download.nvidia.com/XFree86/Linux-x86/340.108/NVIDIA-Linux-x86-340.108.run http://http.download.nvidia.com/XFree86/Linux-x86_64/340.108/NVIDIA-Linux-x86_64-340.108.run - unfuck-340.108-build-fix.patch dkms.conf - unfuck-340.108-build-fix.patch - NVIDIA-Linux-x86_64-340.108-kernel-5.7.patch - NVIDIA-Linux-x86_64-340.108-kernel-5.8.patch + 0001-kernel-5.7.patch + 0002-kernel-5.8.patch 0003-kernel-5.9.patch 0004-kernel-5.10.patch + 0005-kernel-5.11.patch + 0006-kernel-5.14.patch + 0008-fix-5.15.patch - kernel-module-headers + kernel-module-headers @@ -32,7 +33,7 @@ driver Kernel module for NVIDIA driver 340.xx releases - kernel + kernel /lib/modules @@ -158,7 +159,7 @@ - 2021-11-09 + 2021-11-12 340.108 Rebuild. Mustafa Cinasal