commit 21aa249d95c31c79a353f30a08cbf3cd8bdb63bc
Author: Leigh Scott <leigh123linux(a)googlemail.com>
Date: Thu Jan 17 12:22:08 2019 +0000
Patch for 5.0rc kernel
5.0_kernel.patch | 258 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
nvidia-kmod.spec | 7 +-
2 files changed, 264 insertions(+), 1 deletion(-)
---
diff --git a/5.0_kernel.patch b/5.0_kernel.patch
new file mode 100644
index 0000000..f82c66b
--- /dev/null
+++ b/5.0_kernel.patch
@@ -0,0 +1,258 @@
+--- a/kernel/nvidia-drm/nvidia-drm-gem.h
++++ b/kernel/nvidia-drm/nvidia-drm-gem.h
+@@ -23,6 +23,7 @@
+ #ifndef __NVIDIA_DRM_GEM_H__
+ #define __NVIDIA_DRM_GEM_H__
+
++#include <linux/version.h>
+ #include "nvidia-drm-conftest.h"
+
+ #if defined(NV_DRM_AVAILABLE)
+@@ -78,9 +79,11 @@
+ int ret = drm_gem_handle_create(file_priv, &nv_gem->base, handle);
+
+ /* drop reference from allocate - handle holds it now */
+-
++#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 0, 0)
+ drm_gem_object_unreference_unlocked(&nv_gem->base);
+-
++#else
++ drm_gem_object_put_unlocked(&nv_gem->base);
++#endif
+ return ret;
+ }
+
+@@ -148,13 +151,21 @@
+ static inline void
+ nv_drm_gem_object_unreference_unlocked(struct nv_drm_gem_object *nv_gem)
+ {
++#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 0, 0)
+ drm_gem_object_unreference_unlocked(&nv_gem->base);
++#else
++ drm_gem_object_put_unlocked(&nv_gem->base);
++#endif
+ }
+
+ static inline void
+ nv_drm_gem_object_unreference(struct nv_drm_gem_object *nv_gem)
+ {
++#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 0, 0)
+ drm_gem_object_unreference(&nv_gem->base);
++#else
++ drm_gem_object_put(&nv_gem->base);
++#endif
+ }
+
+ static inline int nv_drm_gem_handle_create(struct drm_file *filp,
+
+--- a/kernel/nvidia-drm/nvidia-drm-helper.h
++++ b/kernel/nvidia-drm/nvidia-drm-helper.h
+@@ -23,6 +23,7 @@
+ #ifndef __NVIDIA_DRM_HELPER_H__
+ #define __NVIDIA_DRM_HELPER_H__
+
++#include <linux/version.h>
+ #include "nvidia-drm-conftest.h"
+
+ #if defined(NV_DRM_AVAILABLE)
+@@ -39,7 +40,11 @@
+ #if defined(NV_DRM_DEV_UNREF_PRESENT)
+ drm_dev_unref(dev);
+ #else
++#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 0, 0)
+ drm_dev_free(dev);
++#else
++ drm_dev_put(dev);
++#endif
+ #endif
+ }
+
+
+--- a/kernel/nvidia-drm/nvidia-drm-helper.c
++++ b/kernel/nvidia-drm/nvidia-drm-helper.c
+@@ -27,6 +27,7 @@
+ * present simplifies nvidia-drm.ko source.
+ */
+
++#include <linux/version.h>
+ #include "nvidia-drm-helper.h"
+
+ #if defined(NV_DRM_ATOMIC_MODESET_AVAILABLE)
+@@ -149,12 +150,21 @@
+ if (ret == 0) {
+ struct drm_framebuffer *new_fb = plane->state->fb;
+ if (new_fb)
++#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 0, 0)
+ drm_framebuffer_reference(new_fb);
+ plane->fb = new_fb;
+ plane->crtc = plane->state->crtc;
+
+ if (plane->old_fb)
+ drm_framebuffer_unreference(plane->old_fb);
++#else
++ drm_framebuffer_get(new_fb);
++ plane->fb = new_fb;
++ plane->crtc = plane->state->crtc;
++
++ if (plane->old_fb)
++ drm_framebuffer_put(plane->old_fb);
++#endif
+ }
+ plane->old_fb = NULL;
+ }
+
+--- a/kernel/nvidia/os-interface.c
++++ b/kernel/nvidia/os-interface.c
+@@ -11,6 +11,7 @@
+ #define __NO_VERSION__
+ #include "nv-misc.h"
+
++#include <linux/version.h>
+ #include "os-interface.h"
+ #include "nv-linux.h"
+
+@@ -19,6 +20,19 @@
+ nv_spinlock_t nv_error_string_lock;
+
+ extern nv_linux_state_t nv_ctl_device;
++
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 0, 0)
++static void
++do_gettimeofday(struct timeval *tm)
++{
++ struct timespec64 ts;
++
++ ktime_get_real_ts64(&ts);
++
++ tm->tv_sec = ts.tv_sec;
++ tm->tv_usec = ts.tv_nsec/1000;
++}
++#endif
+
+ NV_STATUS NV_API_CALL os_disable_console_access(void)
+ {
+
+--- a/kernel/nvidia/nvlink_linux.c
++++ b/kernel/nvidia/nvlink_linux.c
+@@ -30,6 +30,7 @@
+ #include "nv-linux.h"
+ #include "nv-procfs.h"
+
++#include <linux/version.h>
+ #include <linux/module.h>
+ #include <linux/major.h>
+ #include <linux/cdev.h>
+@@ -541,6 +542,19 @@
+ result->tv_usec += 1000000;
+ }
+ }
++
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 0, 0)
++static void
++do_gettimeofday(struct timeval *tm)
++{
++ struct timespec64 ts;
++
++ ktime_get_real_ts64(&ts);
++
++ tm->tv_sec = ts.tv_sec;
++ tm->tv_usec = ts.tv_nsec/1000;
++}
++#endif
+
+ /*
+ * Sleep for specified milliseconds. Yields the CPU to scheduler.
+
+--- a/kernel/nvidia-drm/nvidia-drm-linux.c
++++ b/kernel/nvidia-drm/nvidia-drm-linux.c
+@@ -20,6 +20,7 @@
+ * DEALINGS IN THE SOFTWARE.
+ */
+
++#include <linux/version.h>
+ #include <linux/module.h>
+ #include <linux/slab.h>
+ #include <linux/err.h>
+@@ -149,6 +150,19 @@
+ vunmap(address);
+ }
+
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 0, 0)
++static void
++do_gettimeofday(struct timeval *tm)
++{
++ struct timespec64 ts;
++
++ ktime_get_real_ts64(&ts);
++
++ tm->tv_sec = ts.tv_sec;
++ tm->tv_usec = ts.tv_nsec/1000;
++}
++#endif
++
+ uint64_t nv_drm_get_time_usec(void)
+ {
+ struct timeval tv;
+
+--- a/kernel/nvidia-modeset/nvidia-modeset-linux.c
++++ b/kernel/nvidia-modeset/nvidia-modeset-linux.c
+@@ -8,6 +8,7 @@
+ * _NVRM_COPYRIGHT_END_
+ */
+
++#include <linux/version.h>
+ #include <linux/module.h>
+ #include <linux/kernel.h>
+ #include <linux/slab.h>
+@@ -207,6 +208,19 @@
+ msleep(msec);
+ }
+ }
++
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 0, 0)
++static void
++do_gettimeofday(struct timeval *tm)
++{
++ struct timespec64 ts;
++
++ ktime_get_real_ts64(&ts);
++
++ tm->tv_sec = ts.tv_sec;
++ tm->tv_usec = ts.tv_nsec/1000;
++}
++#endif
+
+ NvU64 NVKMS_API_CALL nvkms_get_usec(void)
+ {
+
+--- a/kernel/nvidia-uvm/uvm_linux.h
++++ b/kernel/nvidia-uvm/uvm_linux.h
+@@ -32,6 +32,7 @@
+ #ifndef _UVM_LINUX_H
+ #define _UVM_LINUX_H
+
++#include <linux/version.h>
+ #include "nv-misc.h"
+ #include "nvtypes.h"
+
+@@ -332,11 +333,19 @@
+ * available non-GPL symbols. */
+ static inline NvU64 NV_GETTIME(void)
+ {
++#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 0, 0)
+ struct timeval tv = {0};
+
+ do_gettimeofday(&tv);
+
+ return (tv.tv_sec * 1000000000ULL + tv.tv_usec * 1000ULL);
++#else
++ struct timespec64 tv;
++
++ ktime_get_real_ts64(&tv);
++
++ return (tv.tv_sec * 1000000000ULL + tv.tv_nsec);
++#endif
+ }
+ #endif
+
+
diff --git a/nvidia-kmod.spec b/nvidia-kmod.spec
index 8ed721a..9b85a57 100644
--- a/nvidia-kmod.spec
+++ b/nvidia-kmod.spec
@@ -10,12 +10,13 @@ Name: nvidia-kmod
Epoch: 3
Version: 415.27
# Taken over by kmodtool
-Release: 1%{?dist}
+Release: 3%{?dist}
Summary: NVIDIA display driver kernel module
License: Redistributable, no modification permitted
URL:
http://www.nvidia.com/
Source11: nvidia-kmodtool-excludekernel-filterfile
+Patch0: 5.0_kernel.patch
# needed for plague to make sure it builds for i586 and i686
ExclusiveArch: x86_64
@@ -39,6 +40,7 @@ kmodtool --target %{_target_cpu} --repo rpmfusion --kmodname %{name}
--filterf
%setup -T -c
tar --use-compress-program xz -xf
%{_datadir}/%{name}-%{version}/%{name}-%{version}-%{_target_cpu}.tar.xz
# patch loop
+%patch0 -p1
for kernel_version in %{?kernel_versions} ; do
cp -a kernel _kmod_build_${kernel_version%%___*}
@@ -66,6 +68,9 @@ done
%changelog
+* Thu Jan 17 2019 Leigh Scott <leigh123linux(a)googlemail.com> - 3:415.27-3
+- Patch for 5.0rc kernel
+
* Wed Jan 16 2019 Leigh Scott <leigh123linux(a)googlemail.com> - 3:415.27-1
- Update to 415.27 release