void-packages/srcpkgs/nvidia340/files/kernel-5.0.patch

90 lines
2.5 KiB
Diff

--- kernel/os-interface.c 2019-03-05 22:53:13.298064826 +0100
+++ kernel/os-interface.c 2019-03-05 23:04:09.064902532 +0100
@@ -14,6 +14,19 @@
#include "os-interface.h"
#include "nv-linux.h"
+#include <linux/version.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
+
+
RM_STATUS NV_API_CALL os_disable_console_access(void)
{
NV_ACQUIRE_CONSOLE_SEM();
--- kernel/nv-drm.c 2019-03-05 22:37:07.015611635 +0100
+++ kernel/nv-drm.c 2019-03-05 22:54:46.448761250 +0100
@@ -13,6 +13,7 @@
#include "nv-misc.h"
#include "os-interface.h"
#include "nv-linux.h"
+#include <linux/version.h>
#if defined(NV_DRM_AVAILABLE)
@@ -251,8 +252,11 @@
status = RM_ERR_OPERATING_SYSTEM;
goto done;
}
-
+#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 0, 0)
drm_gem_object_unreference_unlocked(&nv_obj->base);
+#else
+ drm_gem_object_put_unlocked(&nv_obj->base);
+#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;