linuxPackages.nvidia_x11_legacy340: Fix build on 6.1

This uses the patchset of a popular AUR package.
This commit is contained in:
Zhaofeng Li 2023-01-18 22:16:47 -07:00 committed by Maciej Krüger
parent a7d4c1713c
commit 7159363f51
No known key found for this signature in database
GPG key ID: 0D948CE19CF49C5F
2 changed files with 25 additions and 35 deletions

View file

@ -1,4 +1,4 @@
{ lib, callPackage, fetchpatch, fetchurl, stdenv, pkgsi686Linux }:
{ lib, callPackage, fetchFromGitHub, fetchurl, fetchpatch, stdenv, pkgsi686Linux }:
let
generic = args: let
@ -98,7 +98,28 @@ rec {
persistencedSha256 = "sha256-NuqUQbVt80gYTXgIcu0crAORfsj9BCRooyH3Gp1y1ns=";
};
legacy_340 = generic {
legacy_340 = let
# Source cooresponding to https://aur.archlinux.org/packages/nvidia-340xx-dkms
aurPatches = fetchFromGitHub {
owner = "archlinux-jerry";
repo = "nvidia-340xx";
rev = "fe2b38e66f2199777bcede6eb35c5df0210f15dc";
hash = "sha256-hPFfzWGo2jF/DLm1OkP+BBnRY69N8kKUZ1EGkoHJlKA=";
};
patchset = [
"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"
"0007-kernel-5.15.patch"
"0008-kernel-5.16.patch"
"0009-kernel-5.17.patch"
"0010-kernel-5.18.patch"
"0011-kernel-6.0.patch"
];
in generic {
version = "340.108";
sha256_32bit = "1jkwa1phf0x4sgw8pvr9d6krmmr3wkgwyygrxhdazwyr2bbalci0";
sha256_64bit = "06xp6c0sa7v1b82gf0pq0i5p0vdhmm3v964v0ypw36y0nzqx8wf6";
@ -106,7 +127,7 @@ rec {
persistencedSha256 = "1ax4xn3nmxg1y6immq933cqzw6cj04x93saiasdc0kjlv0pvvnkn";
useGLVND = false;
broken = kernel.kernelAtLeast "5.5";
patches = [ ./vm_operations_struct-fault.patch ];
broken = kernel.kernelAtLeast "6.2";
patches = map (patch: "${aurPatches}/${patch}") patchset;
};
}

View file

@ -1,31 +0,0 @@
https://devtalk.nvidia.com/default/topic/1025051/fully-working-patches-2-of-them-for-nvidia-driver-340-104-compiler-installer-file-and-linux-kernels-4-13-amp-4-14/?offset=5
--- a/kernel/uvm/nvidia_uvm_lite.c
+++ b/kernel/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;