diff --git a/.SRCINFO b/.SRCINFO index 990fb5a..06f405f 100644 --- a/.SRCINFO +++ b/.SRCINFO @@ -1,41 +1,33 @@ pkgbase = nvidia-340xx pkgdesc = NVIDIA drivers for linux, 340xx legacy branch - pkgver = 340.107 - pkgrel = 94 + pkgver = 340.108 + pkgrel = 1 url = https://www.nvidia.com/ arch = x86_64 license = custom - makedepends = nvidia-340xx-utils=340.107 + makedepends = nvidia-340xx-utils=340.108 makedepends = linux>=5.4 makedepends = linux-headers>=5.4 conflicts = nvidia options = !strip - source = https://us.download.nvidia.com/XFree86/Linux-x86_64/340.107/NVIDIA-Linux-x86_64-340.107-no-compat32.run - source = kernel-4.11.patch - source = kernel-5.0.patch - source = kernel-5.2.patch - source = kernel-5.3.patch - source = kernel-5.4.patch - sha256sums = 6dc6f183c69c414670d8adef0286a2362eedd6e16ec6dfae811e48ea4a4505dc - sha256sums = 8bbb99a5be38520793b9898f7a82116595260bfe667708957fb0bdabaa570dfb - sha256sums = b1e539b507dfbffda831de2c7145b62f9fc28e9df2c39cb7c22754e74057886e - sha256sums = f5f28225a621484286b2830c777db82065ff299536e6c2c851e68c326d2d0b73 - sha256sums = 5ebfdad300029d41c5bc2b8cca4d661abf8f0aa1de8c0f9e7e03de1580e6395e - sha256sums = 6bb80349d980b48a7fc62cec4d6f36b408b51263d461b4b9935fac729dd701b6 + source = https://us.download.nvidia.com/XFree86/Linux-x86_64/340.108/NVIDIA-Linux-x86_64-340.108-no-compat32.run + source = unfuck-340.108-build-fix.patch + sha256sums = 995d44fef587ff5284497a47a95d71adbee0c13020d615e940ac928f180f5b77 + sha256sums = 2b7e3ef24846a40f4492e749be946e4f7f70ebed054bc2c9079f6cbdcbfabe57 pkgname = nvidia-340xx pkgdesc = NVIDIA drivers for linux, 340xx legacy branch depends = linux>=5.3.6 - depends = nvidia-340xx-utils=340.107 + depends = nvidia-340xx-utils=340.108 depends = libgl pkgname = nvidia-340xx-dkms pkgdesc = NVIDIA driver sources for linux, 340xx legacy branch depends = dkms - depends = nvidia-340xx-utils=340.107 + depends = nvidia-340xx-utils=340.108 depends = libgl optdepends = linux-headers: Build the module for Arch kernel - provides = nvidia-340xx=340.107 + provides = nvidia-340xx=340.108 conflicts = nvidia conflicts = nvidia-340xx diff --git a/PKGBUILD b/PKGBUILD index c6da095..7d3a2b8 100644 --- a/PKGBUILD +++ b/PKGBUILD @@ -5,8 +5,8 @@ pkgbase=nvidia-340xx pkgname=(nvidia-340xx nvidia-340xx-dkms) -pkgver=340.107 -pkgrel=94 +pkgver=340.108 +pkgrel=1 pkgdesc="NVIDIA drivers for linux, 340xx legacy branch" arch=('x86_64') url="https://www.nvidia.com/" @@ -17,14 +17,10 @@ options=(!strip) # seems manjaro is keeping this current # https://gitlab.manjaro.org/packages?utf8=%E2%9C%93&filter=nvidia-340xx source=("https://us.download.nvidia.com/XFree86/Linux-x86_64/${pkgver}/NVIDIA-Linux-x86_64-${pkgver}-no-compat32.run" - 'kernel-4.11.patch' 'kernel-5.0.patch' 'kernel-5.2.patch' 'kernel-5.3.patch' 'kernel-5.4.patch' + unfuck-340.108-build-fix.patch ) -sha256sums=('6dc6f183c69c414670d8adef0286a2362eedd6e16ec6dfae811e48ea4a4505dc' - '8bbb99a5be38520793b9898f7a82116595260bfe667708957fb0bdabaa570dfb' - 'b1e539b507dfbffda831de2c7145b62f9fc28e9df2c39cb7c22754e74057886e' - 'f5f28225a621484286b2830c777db82065ff299536e6c2c851e68c326d2d0b73' - '5ebfdad300029d41c5bc2b8cca4d661abf8f0aa1de8c0f9e7e03de1580e6395e' - '6bb80349d980b48a7fc62cec4d6f36b408b51263d461b4b9935fac729dd701b6') +sha256sums=('995d44fef587ff5284497a47a95d71adbee0c13020d615e940ac928f180f5b77' + '2b7e3ef24846a40f4492e749be946e4f7f70ebed054bc2c9079f6cbdcbfabe57') _pkg="NVIDIA-Linux-x86_64-${pkgver}-no-compat32" # default is 'linux' substitute custom name here diff --git a/kernel-4.11.patch b/kernel-4.11.patch deleted file mode 100644 index c832ff4..0000000 --- a/kernel-4.11.patch +++ /dev/null @@ -1,45 +0,0 @@ -From 53d65b3781b7b2cf25368efd5382ed5bbda19bd9 Mon Sep 17 00:00:00 2001 -From: Alberto Milone -Date: Thu, 21 Sep 2017 15:16:41 +0200 -Subject: [PATCH 1/1] Add support for Linux 4.11 -This only contains the last few bits that didn't make it into -the 340 driver. -Credit goes to Michael Marley for spotting the problem. ---- - uvm/nvidia_uvm_lite.c | 11 +++++++++++ - 1 file changed, 11 insertions(+) -diff --git a/uvm/nvidia_uvm_lite.c b/uvm/nvidia_uvm_lite.c -index 246ed04..119c93a 100644 ---- a/uvm/nvidia_uvm_lite.c -+++ b/uvm/nvidia_uvm_lite.c -@@ -818,8 +818,15 @@ done: - } - - #if defined(NV_VM_OPERATIONS_STRUCT_HAS_FAULT) -+#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 11, 0) - int _fault(struct vm_area_struct *vma, struct vm_fault *vmf) -+#else -+int _fault(struct vm_fault *vmf) -+#endif - { -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0) -+ struct vm_area_struct *vma = vmf->vma; -+#endif - #if defined(NV_VM_FAULT_HAS_ADDRESS) - unsigned long vaddr = vmf->address; - #else -@@ -866,7 +873,11 @@ 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, 11, 0) - int _sigbus_fault(struct vm_area_struct *vma, struct vm_fault *vmf) -+#else -+int _sigbus_fault(struct vm_fault *vmf) -+#endif - { - vmf->page = NULL; - return VM_FAULT_SIGBUS; --- -2.7.4 - diff --git a/kernel-5.0.patch b/kernel-5.0.patch deleted file mode 100644 index 9ae00f7..0000000 --- a/kernel-5.0.patch +++ /dev/null @@ -1,256 +0,0 @@ -From 0b4e74ba61c50aefa16a4bafac3a60799eab7a20 Mon Sep 17 00:00:00 2001 -From: Alberto Milone -Date: Fri, 15 Feb 2019 14:43:21 +0100 -Subject: [PATCH 1/1] Add support for Linux 5.0 - ---- - Makefile | 2 ++ - conftest.sh | 33 +++++++++++++++++++++++++++++++++ - nv-drm.c | 12 +++++++++++- - nv-time.h | 24 ++++++++++++++++++++++++ - os-interface.c | 13 +++++++------ - uvm/Makefile | 1 + - uvm/nvidia_uvm_linux.h | 1 + - uvm/nvidia_uvm_lite.c | 4 ++-- - 8 files changed, 81 insertions(+), 9 deletions(-) - create mode 100644 nv-time.h - -diff --git a/Makefile b/Makefile -index 8ac3c1a..1959dce 100644 ---- a/Makefile -+++ b/Makefile -@@ -147,6 +147,8 @@ COMPILE_TESTS = \ - vm_fault_present \ - vm_fault_has_address \ - drm_driver_unload_has_int_return_type \ -+ drm_gem_object_get \ -+ do_gettimeofday \ - drm_legacy_pci_init \ - timer_setup - # -diff --git a/conftest.sh b/conftest.sh -index 64d75a1..fb0bf60 100755 ---- a/conftest.sh -+++ b/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 -diff --git a/nv-drm.c b/nv-drm.c -index 0eb72e4..1c968de 100644 ---- a/nv-drm.c -+++ b/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; - -diff --git a/nv-time.h b/nv-time.h -new file mode 100644 -index 0000000..cc828aa ---- /dev/null -+++ b/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 -diff --git a/os-interface.c b/os-interface.c -index 7e3d362..7190b26 100644 ---- a/os-interface.c -+++ b/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); -diff --git a/uvm/Makefile b/uvm/Makefile -index 42ad927..5c7b466 100644 ---- a/uvm/Makefile -+++ b/uvm/Makefile -@@ -171,6 +171,7 @@ COMPILE_TESTS = \ - kbasename \ - fatal_signal_pending \ - kuid_t \ -+ do_gettimeofday \ - vm_fault_has_address - - MODULE_NAME:= nvidia-uvm -diff --git a/uvm/nvidia_uvm_linux.h b/uvm/nvidia_uvm_linux.h -index 1625209..1edb620 100644 ---- a/uvm/nvidia_uvm_linux.h -+++ b/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) -diff --git a/uvm/nvidia_uvm_lite.c b/uvm/nvidia_uvm_lite.c -index 119c93a..33b8d4b 100644 ---- a/uvm/nvidia_uvm_lite.c -+++ b/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))) --- -2.19.1 - diff --git a/kernel-5.2.patch b/kernel-5.2.patch deleted file mode 100644 index 923e508..0000000 --- a/kernel-5.2.patch +++ /dev/null @@ -1,77 +0,0 @@ -From d48c28c8f690cd1b7f1a252f3a33c9b536096054 Mon Sep 17 00:00:00 2001 -From: Alberto Milone -Date: Mon, 10 Jun 2019 13:08:10 +0200 -Subject: [PATCH 1/1] Add support for Linux 5.2 -V2: make sure to force DRIVER_LEGACY for Linux >= 5.1 ---- - nv-drm.c | 2 +- - uvm/nvidia_uvm_lite.c | 20 ++++++++++++++++++++ - 2 files changed, 21 insertions(+), 1 deletion(-) -diff --git a/nv-drm.c b/nv-drm.c -index 1c968de..76719bb 100644 ---- a/nv-drm.c -+++ b/nv-drm.c -@@ -156,7 +156,7 @@ static const struct file_operations nv_drm_fops = { - }; - - static struct drm_driver nv_drm_driver = { --#if defined(DRIVER_LEGACY) -+#if defined(DRIVER_LEGACY) || LINUX_VERSION_CODE >= KERNEL_VERSION(5, 1, 0) - .driver_features = DRIVER_GEM | DRIVER_PRIME | DRIVER_LEGACY, - #else - .driver_features = DRIVER_GEM | DRIVER_PRIME, -diff --git a/uvm/nvidia_uvm_lite.c b/uvm/nvidia_uvm_lite.c -index 33b8d4b..8dbe050 100644 ---- a/uvm/nvidia_uvm_lite.c -+++ b/uvm/nvidia_uvm_lite.c -@@ -689,7 +689,11 @@ static UvmGpuMigrationTracking * _get_mig_tracker(UvmCommitRecord * pRecord) - // return SIGBUS. - // 3. Otherwise, map in a page from the cache, and allow access. - // -+#ifdef VM_FAULT_OOM - int _fault_common(struct vm_area_struct *vma, unsigned long vaddr, -+#else -+unsigned int _fault_common(struct vm_area_struct *vma, unsigned long vaddr, -+#endif - struct page **ppage, unsigned vmfFlags) - { - int retValue = VM_FAULT_SIGBUS; -@@ -819,9 +823,17 @@ done: - - #if defined(NV_VM_OPERATIONS_STRUCT_HAS_FAULT) - #if LINUX_VERSION_CODE < KERNEL_VERSION(4, 11, 0) -+#ifdef VM_FAULT_OOM - int _fault(struct vm_area_struct *vma, struct vm_fault *vmf) - #else -+unsigned int _fault(struct vm_area_struct *vma, struct vm_fault *vmf) -+#endif -+#else -+#ifdef VM_FAULT_OOM - int _fault(struct vm_fault *vmf) -+#else -+unsigned int _fault(struct vm_fault *vmf) -+#endif - #endif - { - #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0) -@@ -874,9 +886,17 @@ static struct vm_operations_struct uvmlite_vma_ops = - // - #if defined(NV_VM_OPERATIONS_STRUCT_HAS_FAULT) - #if LINUX_VERSION_CODE < KERNEL_VERSION(4, 11, 0) -+#ifdef VM_FAULT_OOM - int _sigbus_fault(struct vm_area_struct *vma, struct vm_fault *vmf) - #else -+unsigned int _sigbus_fault(struct vm_area_struct *vma, struct vm_fault *vmf) -+#endif -+#else -+#ifdef VM_FAULT_OOM - int _sigbus_fault(struct vm_fault *vmf) -+#else -+unsigned int _sigbus_fault(struct vm_fault *vmf) -+#endif - #endif - { - vmf->page = NULL; --- -2.20.1 - diff --git a/kernel-5.3.patch b/kernel-5.3.patch deleted file mode 100644 index a1cecd6..0000000 --- a/kernel-5.3.patch +++ /dev/null @@ -1,60 +0,0 @@ -From df6b6227e19b46cf23abca790570804872cbf87c Mon Sep 17 00:00:00 2001 -From: Alberto Milone -Date: Tue, 13 Aug 2019 11:20:39 +0200 -Subject: [PATCH 1/1] Add support for Linux 5.3 -smp_call_function() and on_each_cpu() no longer have return values -as per commit caa759323c73676b3e48c8d9c86093c88b4aba97 ---- - nv-linux.h | 18 ++++++++++++++++++ - 1 file changed, 18 insertions(+) -diff --git a/nv-linux.h b/nv-linux.h -index 4043bf1..62f0874 100644 ---- a/nv-linux.h -+++ b/nv-linux.h -@@ -877,12 +877,21 @@ extern void *nv_stack_t_cache; - __ret; \ - }) - #elif (NV_SMP_CALL_FUNCTION_ARGUMENT_COUNT == 3) -+#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 3, 0) - #define NV_SMP_CALL_FUNCTION(func, info, wait) \ - ({ \ - int __ret = smp_call_function(func, info, wait); \ - __ret; \ - }) - #else -+#define NV_SMP_CALL_FUNCTION(func, info, wait) \ -+ ({ \ -+ int __ret = 0; \ -+ smp_call_function(func, info, wait); \ -+ __ret; \ -+ }) -+#endif -+#else - #error "NV_SMP_CALL_FUNCTION_ARGUMENT_COUNT value unrecognized!" - #endif - #elif defined(CONFIG_SMP) -@@ -897,12 +906,21 @@ extern void *nv_stack_t_cache; - __ret; \ - }) - #elif (NV_ON_EACH_CPU_ARGUMENT_COUNT == 3) -+#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 3, 0) - #define NV_ON_EACH_CPU(func, info, wait) \ - ({ \ - int __ret = on_each_cpu(func, info, wait); \ - __ret; \ - }) - #else -+#define NV_ON_EACH_CPU(func, info, wait) \ -+ ({ \ -+ int __ret = 0; \ -+ on_each_cpu(func, info, wait); \ -+ __ret; \ -+ }) -+#endif -+#else - #error "NV_ON_EACH_CPU_ARGUMENT_COUNT value unrecognized!" - #endif - #elif defined(CONFIG_SMP) --- -2.20.1 - diff --git a/kernel-5.4.patch b/kernel-5.4.patch deleted file mode 100644 index be73f9a..0000000 --- a/kernel-5.4.patch +++ /dev/null @@ -1,111 +0,0 @@ -From f90c388c755a6bd9b72cb51c712a0ae686e0b377 Mon Sep 17 00:00:00 2001 -From: Alberto Milone -Date: Wed, 27 Nov 2019 13:01:18 +0100 -Subject: [PATCH 1/1] Add support for Linux 5.4 ---- - conftest.sh | 46 ++++++++++++++++++++++++++++++++++++++++ - nv-drm.c | 9 +++++--- - nvidia-modules-common.mk | 2 +- - 3 files changed, 53 insertions(+), 4 deletions(-) -diff --git a/conftest.sh b/conftest.sh -index fb0bf60..babbb50 100755 ---- a/conftest.sh -+++ b/conftest.sh -@@ -265,6 +265,23 @@ build_cflags() { - if [ -n "$BUILD_PARAMS" ]; then - CFLAGS="$CFLAGS -D$BUILD_PARAMS" - fi -+ -+ # Check if gcc supports asm goto and set CC_HAVE_ASM_GOTO if it does. -+ # Older kernels perform this check and set this flag in Kbuild, and since -+ # conftest.sh runs outside of Kbuild it ends up building without this flag. -+ # Starting with commit e9666d10a5677a494260d60d1fa0b73cc7646eb3 this test -+ # is done within Kconfig, and the preprocessor flag is no longer needed. -+ -+ GCC_GOTO_SH="$SOURCES/build/gcc-goto.sh" -+ -+ if [ -f "$GCC_GOTO_SH" ]; then -+ # Newer versions of gcc-goto.sh don't print anything on success, but -+ # this is okay, since it's no longer necessary to set CC_HAVE_ASM_GOTO -+ # based on the output of those versions of gcc-goto.sh. -+ if [ `/bin/sh "$GCC_GOTO_SH" "$CC"` = "y" ]; then -+ CFLAGS="$CFLAGS -DCC_HAVE_ASM_GOTO" -+ fi -+ fi - } - - CONFTEST_PREAMBLE="#include \"conftest.h\" -@@ -1521,6 +1538,35 @@ compile_test() { - compile_check_conftest "$CODE" "NV_DRM_AVAILABLE" "" "generic" - ;; - -+ drm_driver_prime_flag_present) -+ # -+ # Determine whether driver feature flag DRIVER_PRIME is present. -+ # -+ # The DRIVER_PRIME flag was added by commit 3248877ea179 (drm: -+ # base prime/dma-buf support (v5)) in v3.4 (2011-11-25) and is -+ # removed by commit 0424fdaf883a (drm/prime: Actually remove -+ # DRIVER_PRIME everywhere) on 2019-06-17. -+ # -+ # DRIVER_PRIME definition moved from drmP.h to drm_drv.h by -+ # commit 85e634bce01a (drm: Extract drm_drv.h) in v4.10 -+ # (2016-11-14). -+ # -+ # DRIVER_PRIME define is changed to enum value by commit -+ # 0e2a933b02c9 (drm: Switch DRIVER_ flags to an enum) in v5.1 -+ # (2019-01-29). -+ # -+ CODE=" -+ #include -+ #if defined(NV_DRM_DRM_DRV_H_PRESENT) -+ #include -+ #endif -+ unsigned int drm_driver_prime_flag_present_conftest(void) { -+ return DRIVER_PRIME; -+ }" -+ -+ compile_check_conftest "$CODE" "NV_DRM_DRIVER_PRIME_FLAG_PRESENT" "" "types" -+ ;; -+ - proc_create_data) - # - # Determine if the proc_create_data() function is present. -diff --git a/nv-drm.c b/nv-drm.c -index 76719bb..12f7029 100644 ---- a/nv-drm.c -+++ b/nv-drm.c -@@ -156,11 +156,14 @@ static const struct file_operations nv_drm_fops = { - }; - - static struct drm_driver nv_drm_driver = { -+ .driver_features = -+#if defined(NV_DRM_DRIVER_PRIME_FLAG_PRESENT) -+ DRIVER_PRIME | -+#endif - #if defined(DRIVER_LEGACY) || LINUX_VERSION_CODE >= KERNEL_VERSION(5, 1, 0) -- .driver_features = DRIVER_GEM | DRIVER_PRIME | DRIVER_LEGACY, --#else -- .driver_features = DRIVER_GEM | DRIVER_PRIME, -+ DRIVER_LEGACY | - #endif -+ DRIVER_GEM, - .load = nv_drm_load, - .unload = nv_drm_unload, - .fops = &nv_drm_fops, -diff --git a/nvidia-modules-common.mk b/nvidia-modules-common.mk -index 8ac7058..7418005 100644 ---- a/nvidia-modules-common.mk -+++ b/nvidia-modules-common.mk -@@ -180,7 +180,7 @@ ifndef NV_VERBOSE - endif - - KBUILD_PARAMS += KBUILD_VERBOSE=$(NV_VERBOSE) --KBUILD_PARAMS += -C $(KERNEL_SOURCES) SUBDIRS=$(PWD) -+KBUILD_PARAMS += -C $(KERNEL_SOURCES) M=$(PWD) - KBUILD_PARAMS += ARCH=$(ARCH) - - # --- -2.20.1 - diff --git a/unfuck-340.108-build-fix.patch b/unfuck-340.108-build-fix.patch new file mode 100644 index 0000000..7a786de --- /dev/null +++ b/unfuck-340.108-build-fix.patch @@ -0,0 +1,48 @@ +diff --git a/uvm/nvidia_uvm_lite.c b/uvm/nvidia_uvm_lite.c +index 6943e7c..c5d232c 100644 +--- a/uvm/nvidia_uvm_lite.c ++++ b/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;