diff --git a/.SRCINFO b/.SRCINFO index 99870f6..b40b48e 100644 --- a/.SRCINFO +++ b/.SRCINFO @@ -1,10 +1,10 @@ pkgbase = nvidia-340xx-lts pkgdesc = NVIDIA drivers for linux-lts, 340xx legacy branch pkgver = 340.108 - pkgrel = 6 + pkgrel = 7 url = https://www.nvidia.com/ arch = x86_64 - license = custom + license = custom:nvidia makedepends = nvidia-340xx-utils=340.108 makedepends = linux-lts>=6.1.14 makedepends = linux-lts-headers>=6.1.14 @@ -23,6 +23,10 @@ pkgbase = nvidia-340xx-lts source = 0009-kernel-5.17.patch source = 0010-kernel-5.18.patch source = 0011-kernel-6.0.patch + source = 0012-kernel-6.2.patch + source = 0013-kernel-6.3.patch + source = 0014-kernel-6.5.patch + source = 0015-kernel-6.6.patch sha256sums = 995d44fef587ff5284497a47a95d71adbee0c13020d615e940ac928f180f5b77 sha256sums = 5b4cb7620abc1729a13c78a2fb33ccaeb7d92f42936d929885324c81f2b7c985 sha256sums = c8bda5fb238fbebc5bf6ae4b7646e48b30a96b9060ced20d93c53c14ac3161f6 @@ -36,6 +40,10 @@ pkgbase = nvidia-340xx-lts sha256sums = e9970b3ab78f34bdfa29f5dc4f6772aa35026d14d14a0e35bd9744187583edc9 sha256sums = ebb3c5f9b41d0d5081b27a6335ffa6114d65dbcb98f935158167877c394ccb89 sha256sums = b741790983e2bfba1c7d1842af73a353fbe0de987bec3ee05385d20f244226b9 + sha256sums = 84373dd6280ae2358017a23a1ee30a570990a7d5087ab67037dd1a5076a176b1 + sha256sums = 20a60e305c3228ace56ba0e1846aa6000fefbf0a07b7b18007e10cc2f183ea29 + sha256sums = b2687197a42b02f4886f43284a8c45fc6610f5e0ed515a5c132f8803165ebebf + sha256sums = e6269d4ffd22ddfb3dd436e02d4b6b3cac8c7779795ab4f30917673152e862fd pkgname = nvidia-340xx-lts pkgdesc = NVIDIA drivers for linux-lts, 340xx legacy branch. diff --git a/0012-kernel-6.2.patch b/0012-kernel-6.2.patch new file mode 100644 index 0000000..ed95d74 --- /dev/null +++ b/0012-kernel-6.2.patch @@ -0,0 +1,61 @@ +--- a/kernel/conftest.sh 2023-02-24 10:35:02.633467500 +0100 ++++ b/kernel/conftest.sh 2023-02-24 11:13:02.892079164 +0100 +@@ -794,12 +794,19 @@ + + echo "$CONFTEST_PREAMBLE + #include ++ #include + + acpi_op_remove conftest_op_remove_routine; + ++ #if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 2, 0) ++ void conftest_acpi_device_ops_remove(struct acpi_device *device) { ++ conftest_op_remove_routine(device); ++ } ++ #else + int conftest_acpi_device_ops_remove(struct acpi_device *device) { + return conftest_op_remove_routine(device); +- }" > conftest$$.c ++ } ++ #endif" > conftest$$.c + + $CC $CFLAGS -c conftest$$.c > /dev/null 2>&1 + rm -f conftest$$.c +--- a/kernel/nv-acpi.c 2023-02-24 10:35:02.643467765 +0100 ++++ b/kernel/nv-acpi.c 2023-02-24 11:09:14.821580592 +0100 +@@ -26,8 +26,12 @@ + #if !defined(NV_ACPI_DEVICE_OPS_REMOVE_ARGUMENT_COUNT) || (NV_ACPI_DEVICE_OPS_REMOVE_ARGUMENT_COUNT == 2) + static int nv_acpi_remove_two_args(struct acpi_device *device, int type); + #else ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 2, 0) ++static void nv_acpi_remove_one_arg(struct acpi_device *device); ++#else + static int nv_acpi_remove_one_arg(struct acpi_device *device); + #endif ++#endif + + static void nv_acpi_event (acpi_handle, u32, void *); + static acpi_status nv_acpi_find_methods (acpi_handle, u32, void *, void **); +@@ -356,8 +360,12 @@ + #if !defined(NV_ACPI_DEVICE_OPS_REMOVE_ARGUMENT_COUNT) || (NV_ACPI_DEVICE_OPS_REMOVE_ARGUMENT_COUNT == 2) + static int nv_acpi_remove_two_args(struct acpi_device *device, int type) + #else ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 2, 0) ++static void nv_acpi_remove_one_arg(struct acpi_device *device) ++#else + static int nv_acpi_remove_one_arg(struct acpi_device *device) + #endif ++#endif + { + /* + * This function will cause RM to relinquish control of the VGA ACPI device. +@@ -407,7 +415,9 @@ + device->driver_data = NULL; + } + ++#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 2, 0) + return status; ++#endif + } + + static void nv_acpi_event(acpi_handle handle, u32 event_type, void *data) diff --git a/0013-kernel-6.3.patch b/0013-kernel-6.3.patch new file mode 100644 index 0000000..86bdc01 --- /dev/null +++ b/0013-kernel-6.3.patch @@ -0,0 +1,106 @@ +--- a/kernel/nv-mmap.c 2023-05-03 11:48:48.481814709 +0200 ++++ b/kernel/nv-mmap.c 2023-05-03 11:51:39.220313386 +0200 +@@ -312,7 +312,11 @@ + goto done; + } + ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 3, 0) ++ vm_flags_set(vma, VM_IO); ++#else + vma->vm_flags |= VM_IO; ++#endif + } + else + { +@@ -363,8 +367,13 @@ + + NV_PRINT_AT(NV_DBG_MEMINFO, at); + ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 3, 0) ++ vm_flags_set(vma, VM_IO | VM_LOCKED | VM_RESERVED); ++ vm_flags_set(vma, VM_DONTEXPAND | VM_DONTDUMP); ++#else + vma->vm_flags |= (VM_IO | VM_LOCKED | VM_RESERVED); + vma->vm_flags |= (VM_DONTEXPAND | VM_DONTDUMP); ++#endif + } + + if (status == 0) +@@ -374,8 +383,13 @@ + if ((prot & NV_PROTECT_WRITEABLE) == 0) + { + vma->vm_page_prot = NV_PGPROT_READ_ONLY(vma->vm_page_prot); ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 3, 0) ++ vm_flags_clear(vma, VM_WRITE); ++ vm_flags_clear(vma, VM_MAYWRITE); ++#else + vma->vm_flags &= ~VM_WRITE; + vma->vm_flags &= ~VM_MAYWRITE; ++#endif + } + + vma->vm_ops = &nv_vm_ops; +--- a/kernel/uvm/nvidia_uvm_lite.c 2023-05-03 12:00:17.508256190 +0200 ++++ b/kernel/uvm/nvidia_uvm_lite.c 2023-05-03 12:03:59.160897071 +0200 +@@ -1524,10 +1524,17 @@ + + vma->vm_ops = &uvmlite_vma_ops; + ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 3, 0) ++ // Prohibit copying the vma on fork(). ++ vm_flags_set(vma, VM_DONTCOPY); ++ // Prohibt mremap() that would expand the vma. ++ vm_flags_set(vma, VM_DONTEXPAND); ++#else + // Prohibit copying the vma on fork(). + vma->vm_flags |= VM_DONTCOPY; + // Prohibt mremap() that would expand the vma. + vma->vm_flags |= VM_DONTEXPAND; ++#endif + + // Other cases of vma modification are detected in _mmap_open(). + +@@ -1546,9 +1553,15 @@ + return -EINVAL; + + vma->vm_ops = &counters_vma_ops; ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 3, 0) ++ vm_flags_clear(vma, VM_MAYWRITE); ++ // prevent vm_insert_page from modifying the vma's flags: ++ vm_flags_set(vma, VM_MIXEDMAP); ++#else + vma->vm_flags &= ~VM_MAYWRITE; + // prevent vm_insert_page from modifying the vma's flags: + vma->vm_flags |= VM_MIXEDMAP; ++#endif + ret = 0; + } + UVM_DBG_PRINT_RL("vma 0x%p [0x%p, 0x%p) ret %d pgoff" +@@ -2527,8 +2540,13 @@ + // Subsequent access from userspace after the pages are unmapped will cause + // a SIGSEGV. + // ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 3, 0) ++ vm_flags_clear(vma, VM_READ|VM_MAYREAD); ++ vm_flags_clear(vma, VM_WRITE|VM_MAYWRITE); ++#else + vma->vm_flags &= ~(VM_READ|VM_MAYREAD); + vma->vm_flags &= ~(VM_WRITE|VM_MAYWRITE); ++#endif + } + + // +@@ -2536,8 +2554,13 @@ + // + static void _set_vma_accessible(struct vm_area_struct * vma) + { ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 3, 0) ++ vm_flags_set(vma, VM_READ|VM_MAYREAD); ++ vm_flags_set(vma, VM_WRITE|VM_MAYWRITE); ++#else + vma->vm_flags |= (VM_READ|VM_MAYREAD); + vma->vm_flags |= (VM_WRITE|VM_MAYWRITE); ++#endif + } + + // diff --git a/0014-kernel-6.5.patch b/0014-kernel-6.5.patch new file mode 100644 index 0000000..811afdd --- /dev/null +++ b/0014-kernel-6.5.patch @@ -0,0 +1,75 @@ +diff -Naur a/kernel/conftest.sh b/kernel/conftest.sh +--- a/kernel/conftest.sh 2023-09-09 04:19:11.170064889 +0000 ++++ b/kernel/conftest.sh 2023-09-09 04:21:10.593482047 +0000 +@@ -1977,6 +1977,30 @@ + return + fi + ++ # Conftest #4: check if vma arg was dropped ++ # Return if available. ++ # Fall through to default case if absent. ++ ++ echo "$CONFTEST_PREAMBLE ++ #include ++ long get_user_pages(unsigned long start, ++ unsigned long nr_pages, ++ unsigned int gup_flags, ++ struct page **pages) { ++ return 0; ++ }" > conftest$$.c ++ ++ $CC $CFLAGS -c conftest$$.c > /dev/null 2>&1 ++ rm -f conftest$$.c ++ ++ if [ -f conftest$$.o ]; then ++ echo "#define NV_GET_USER_PAGES_DROPPED_VMA" | append_conftest "functions" ++ echo "#undef NV_GET_USER_PAGES_HAS_WRITE_AND_FORCE_ARGS" | append_conftest "functions" ++ echo "#undef NV_GET_USER_PAGES_HAS_TASK_STRUCT" | append_conftest "functions" ++ rm -f conftest$$.o ++ return ++ fi ++ + + echo "#define NV_GET_USER_PAGES_HAS_WRITE_AND_FORCE_ARGS" | append_conftest "functions" + echo "#define NV_GET_USER_PAGES_HAS_TASK_STRUCT" | append_conftest "functions" +@@ -1985,6 +2009,8 @@ + ;; + + get_user_pages_remote) ++ echo "#define NV_GET_USER_PAGES_REMOTE_UNUSED" | append_conftest "functions" ++ return + # + # Determine if the function get_user_pages_remote() is + # present and has write/force parameters. +diff -Naur a/kernel/nv-linux.h b/kernel/nv-linux.h +--- a/kernel/nv-linux.h 2023-09-09 04:19:11.163398218 +0000 ++++ b/kernel/nv-linux.h 2023-09-09 04:21:36.163499676 +0000 +@@ -2205,7 +2205,11 @@ + if (force) + flags |= FOLL_FORCE; + +- return get_user_pages(start, nr_pages, flags, pages, vmas); ++ #if defined(NV_GET_USER_PAGES_DROPPED_VMA) ++ return get_user_pages(start, nr_pages, flags, pages); ++ #else ++ return get_user_pages(start, nr_pages, flags, pages, vmas); ++ #endif + } + #endif + #endif +@@ -2231,6 +2235,8 @@ + * 2016 Dec 14:5b56d49fc31dbb0487e14ead790fc81ca9fb2c99 + */ + ++#if defined(NV_GET_USER_PAGES_REMOTE_UNUSED) ++#else + #if defined(NV_GET_USER_PAGES_REMOTE_PRESENT) + #if defined (NV_GET_USER_PAGES_REMOTE_HAS_WRITE_AND_FORCE_ARGS) + #define NV_GET_USER_PAGES_REMOTE get_user_pages_remote +@@ -2295,5 +2301,6 @@ + } + #endif + #endif ++#endif + + #endif /* _NV_LINUX_H_ */ diff --git a/0015-kernel-6.6.patch b/0015-kernel-6.6.patch new file mode 100644 index 0000000..11ac6b2 --- /dev/null +++ b/0015-kernel-6.6.patch @@ -0,0 +1,14 @@ +diff -Naur a/kernel/nv-drm.c b/kernel/nv-drm.c +--- a/kernel/nv-drm.c 2023-11-05 03:19:26.555143512 +0000 ++++ b/kernel/nv-drm.c 2023-11-05 03:19:26.555143512 +0000 +@@ -520,8 +520,9 @@ + #elif LINUX_VERSION_CODE <= KERNEL_VERSION(5, 10, 0) + .gem_free_object_unlocked = nv_gem_free, + #endif +- ++#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 6, 0) + .prime_handle_to_fd = drm_gem_prime_handle_to_fd, ++#endif + #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, diff --git a/PKGBUILD b/PKGBUILD index 43d96fa..d3bf0a1 100644 --- a/PKGBUILD +++ b/PKGBUILD @@ -6,13 +6,13 @@ pkgbase=nvidia-340xx-lts pkgname=(nvidia-340xx-lts nvidia-340xx-lts-dkms) pkgver=340.108 -pkgrel=6 +pkgrel=7 pkgdesc="NVIDIA drivers for linux-lts, 340xx legacy branch" arch=('x86_64') url="https://www.nvidia.com/" makedepends=("nvidia-340xx-utils=${pkgver}" 'linux-lts>=6.1.14' 'linux-lts-headers>=6.1.14') conflicts=('nvidia-lts') -license=('custom') +license=('custom:nvidia') options=(!strip) # seems manjaro is keeping this current # https://gitlab.manjaro.org/packages?utf8=%E2%9C%93&filter=nvidia-340xx @@ -29,6 +29,10 @@ source=("https://us.download.nvidia.com/XFree86/Linux-x86_64/${pkgver}/NVIDIA-Li 0009-kernel-5.17.patch 0010-kernel-5.18.patch 0011-kernel-6.0.patch + 0012-kernel-6.2.patch + 0013-kernel-6.3.patch + 0014-kernel-6.5.patch + 0015-kernel-6.6.patch ) sha256sums=('995d44fef587ff5284497a47a95d71adbee0c13020d615e940ac928f180f5b77' '5b4cb7620abc1729a13c78a2fb33ccaeb7d92f42936d929885324c81f2b7c985' @@ -42,7 +46,11 @@ sha256sums=('995d44fef587ff5284497a47a95d71adbee0c13020d615e940ac928f180f5b77' 'ad663464d7f57f0f7136bd727ed088d733b087be10cd944ba7d089c421536717' 'e9970b3ab78f34bdfa29f5dc4f6772aa35026d14d14a0e35bd9744187583edc9' 'ebb3c5f9b41d0d5081b27a6335ffa6114d65dbcb98f935158167877c394ccb89' - 'b741790983e2bfba1c7d1842af73a353fbe0de987bec3ee05385d20f244226b9') + 'b741790983e2bfba1c7d1842af73a353fbe0de987bec3ee05385d20f244226b9' + '84373dd6280ae2358017a23a1ee30a570990a7d5087ab67037dd1a5076a176b1' + '20a60e305c3228ace56ba0e1846aa6000fefbf0a07b7b18007e10cc2f183ea29' + 'b2687197a42b02f4886f43284a8c45fc6610f5e0ed515a5c132f8803165ebebf' + 'e6269d4ffd22ddfb3dd436e02d4b6b3cac8c7779795ab4f30917673152e862fd') _pkg="NVIDIA-Linux-x86_64-${pkgver}-no-compat32" # default is 'linux' substitute custom name here