nvidia340: fix building for x86_64 for kernel versions >=5.0

fixes #14273
This commit is contained in:
Helmut Pozimski 2019-09-10 16:36:40 +02:00
parent 9861370eef
commit 260354b548
2 changed files with 46 additions and 2 deletions

View file

@ -42,4 +42,48 @@
+#endif
status = RM_OK;
--- kernel/uvm/nvidia_uvm_lite.c 2019-09-10 16:26:28.674315544 +0200
+++ kernel/uvm/nvidia_uvm_lite.c 2019-09-10 16:28:05.224054277 +0200
@@ -30,6 +30,16 @@
#include "nvidia_uvm_lite_counters.h"
#include "ctrl2080mc.h"
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 0, 0)
+static inline void do_gettimeofday(struct timeval *tv) {
+ struct timespec64 now;
+
+ ktime_get_real_ts64(&now);
+ tv->tv_sec = now.tv_sec;
+ tv->tv_usec = now.tv_nsec/1000;
+}
+#endif
+
//
// nvidia_uvm_lite.c
// This file contains code that is specific to the UVM-Lite mode of operation.
@@ -820,8 +830,10 @@
#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)
+#elif LINUX_VERSION_CODE < KERNEL_VERSION(5, 0, 0)
+int _fault(struct vm_fault *vmf)
+#else
+unsigned int _fault(struct vm_fault *vmf)
#endif
{
#if defined(NV_VM_FAULT_HAS_ADDRESS)
@@ -876,8 +888,10 @@
#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
+#elif LINUX_VERSION_CODE < KERNEL_VERSION(5, 0, 0)
int _sigbus_fault(struct vm_fault *vmf)
+#else
+unsigned int _sigbus_fault(struct vm_fault *vmf)
#endif
{
vmf->page = NULL;

View file

@ -4,7 +4,7 @@ _desc="NVIDIA drivers (GeForce 8, 9, 9M, 100, 100M, 200, 300 series)"
pkgname=nvidia340
version=340.107
revision=3
revision=4
maintainer="Orphaned <orphan@voidlinux.org>"
license="Proprietary NVIDIA license"
homepage="http://www.nvidia.com"
@ -38,7 +38,7 @@ do_extract() {
rm -f ${_pkg}.run
}
do_configure() {
do_patch() {
cd ${_pkg}
patch -p0 < ${FILESDIR}/kernel-4.11.patch
patch -p0 < ${FILESDIR}/kernel-5.0.patch