commit a95363f4758ad866841ffa1c434cf671952a7fdc
Author: Leigh Scott <leigh123linux(a)gmail.com>
Date: Thu Jan 30 17:59:47 2020 +0000
Add patch for kernel-5.4 prime issue
buildfix_kernel-5.5.patch | 6 +-
nvidia-kmod-prime.patch | 138 ++++++++++++++++++++++++++++++++++++++++++++++
nvidia-kmod.spec | 9 ++-
3 files changed, 150 insertions(+), 3 deletions(-)
---
diff --git a/buildfix_kernel-5.5.patch b/buildfix_kernel-5.5.patch
index 2cd11ce..39e34de 100644
--- a/buildfix_kernel-5.5.patch
+++ b/buildfix_kernel-5.5.patch
@@ -315,7 +315,8 @@ index b621969..326f810 100644
+#include "nv-drm.h"
#include "nvkms-kapi.h"
- #if defined(NV_DRM_DRIVER_HAS_GEM_PRIME_RES_OBJ)
+ #include <linux/version.h>
+
diff --git a/kernel/nvidia-drm/nvidia-drm-helper.c
b/kernel/nvidia-drm/nvidia-drm-helper.c
index da602ac..e5d6daa 100644
--- a/kernel/nvidia-drm/nvidia-drm-helper.c
@@ -379,8 +380,9 @@ index 20da923..f3cc2b4 100644
-#include <drm/drmP.h>
+#include "nv-drm.h"
- #if defined(NV_DRM_DRIVER_HAS_GEM_PRIME_RES_OBJ)
+ #include <linux/version.h>
+
diff --git a/kernel/nvidia-drm/nvidia-drm-priv.h b/kernel/nvidia-drm/nvidia-drm-priv.h
index 9076835..77a95f3 100644
--- a/kernel/nvidia-drm/nvidia-drm-priv.h
diff --git a/nvidia-kmod-prime.patch b/nvidia-kmod-prime.patch
new file mode 100644
index 0000000..30e6155
--- /dev/null
+++ b/nvidia-kmod-prime.patch
@@ -0,0 +1,138 @@
+diff --git a/kernel/conftest.sh b/kernel/conftest.sh
+index c9c2db3..6b677dd 100755
+--- a/kernel/conftest.sh
++++ b/kernel/conftest.sh
+@@ -130,6 +130,7 @@ test_headers() {
+ FILES="$FILES linux/sched/signal.h"
+ FILES="$FILES linux/sched/task.h"
+ FILES="$FILES linux/sched/task_stack.h"
++ FILES="$FILES linux/reservation.h"
+ FILES="$FILES xen/ioemu.h"
+ FILES="$FILES linux/fence.h"
+ FILES="$FILES soc/tegra/chip-id.h"
+diff --git a/kernel/nvidia-drm/nvidia-dma-fence-helper.h
b/kernel/nvidia-drm/nvidia-dma-fence-helper.h
+index 0aa5a4f..04e1ebe 100644
+--- a/kernel/nvidia-drm/nvidia-dma-fence-helper.h
++++ b/kernel/nvidia-drm/nvidia-dma-fence-helper.h
+@@ -25,7 +25,9 @@
+
+ #include "nvidia-drm-conftest.h"
+
+-#if defined(NV_DRM_DRIVER_HAS_GEM_PRIME_RES_OBJ)
++#include <linux/version.h>
++
++#if defined(NV_DRM_DRIVER_HAS_GEM_PRIME_RES_OBJ) || LINUX_VERSION_CODE >=
KERNEL_VERSION(5, 4, 0)
+
+ /*
+ * Fence headers are moved to file dma-fence.h and struct fence has
+@@ -40,7 +42,9 @@
+ #include <linux/dma-fence.h>
+ #endif
+
++#if defined(NV_LINUX_RESERVATION_H_PRESENT)
+ #include <linux/reservation.h>
++#endif
+
+ #if defined(NV_LINUX_FENCE_H_PRESENT)
+ typedef struct fence nv_dma_fence_t;
+diff --git a/kernel/nvidia-drm/nvidia-drm-drv.c b/kernel/nvidia-drm/nvidia-drm-drv.c
+index a66d3cc..1aeb807 100644
+--- a/kernel/nvidia-drm/nvidia-drm-drv.c
++++ b/kernel/nvidia-drm/nvidia-drm-drv.c
+@@ -634,7 +634,7 @@ static const struct drm_ioctl_desc nv_drm_ioctls[] = {
+ nv_drm_get_dev_info_ioctl,
+ DRM_RENDER_ALLOW|DRM_UNLOCKED),
+
+-#if defined(NV_DRM_DRIVER_HAS_GEM_PRIME_RES_OBJ)
++#if defined(NV_DRM_DRIVER_HAS_GEM_PRIME_RES_OBJ) || LINUX_VERSION_CODE >=
KERNEL_VERSION(5, 4, 0)
+ DRM_IOCTL_DEF_DRV(NVIDIA_FENCE_SUPPORTED,
+ nv_drm_fence_supported_ioctl,
+ DRM_RENDER_ALLOW|DRM_UNLOCKED),
+diff --git a/kernel/nvidia-drm/nvidia-drm-gem.c b/kernel/nvidia-drm/nvidia-drm-gem.c
+index 7201ade..0fb76e0 100644
+--- a/kernel/nvidia-drm/nvidia-drm-gem.c
++++ b/kernel/nvidia-drm/nvidia-drm-gem.c
+@@ -47,6 +47,8 @@ void nv_drm_gem_free(struct drm_gem_object *gem)
+
+ #if defined(NV_DRM_DRIVER_HAS_GEM_PRIME_RES_OBJ)
+ reservation_object_fini(&nv_gem->resv);
++#elif LINUX_VERSION_CODE >= KERNEL_VERSION(5, 4, 0)
++ dma_resv_fini(&nv_gem->resv);
+ #endif
+
+ nv_gem->ops->free(nv_gem);
+diff --git a/kernel/nvidia-drm/nvidia-drm-gem.h b/kernel/nvidia-drm/nvidia-drm-gem.h
+index b621969..9469f01 100644
+--- a/kernel/nvidia-drm/nvidia-drm-gem.h
++++ b/kernel/nvidia-drm/nvidia-drm-gem.h
+@@ -32,7 +32,9 @@
+ #include <drm/drmP.h>
+ #include "nvkms-kapi.h"
+
+-#if defined(NV_DRM_DRIVER_HAS_GEM_PRIME_RES_OBJ)
++#include <linux/version.h>
++
++#if defined(NV_DRM_DRIVER_HAS_GEM_PRIME_RES_OBJ) || LINUX_VERSION_CODE >=
KERNEL_VERSION(5, 4, 0)
+
+ #include "nvidia-dma-fence-helper.h"
+
+@@ -57,6 +59,8 @@ struct nv_drm_gem_object {
+
+ #if defined(NV_DRM_DRIVER_HAS_GEM_PRIME_RES_OBJ)
+ struct reservation_object resv;
++#elif LINUX_VERSION_CODE >= KERNEL_VERSION(5, 4, 0)
++ struct dma_resv resv;
+ #endif
+ };
+
+@@ -128,6 +132,8 @@ void nv_drm_gem_object_init(struct nv_drm_device *nv_dev,
+
+ #if defined(NV_DRM_DRIVER_HAS_GEM_PRIME_RES_OBJ)
+ reservation_object_init(&nv_gem->resv);
++#elif LINUX_VERSION_CODE >= KERNEL_VERSION(5, 4, 0)
++ dma_resv_init(&nv_gem->resv);
+ #endif
+ }
+
+diff --git a/kernel/nvidia-drm/nvidia-drm-prime-fence.c
b/kernel/nvidia-drm/nvidia-drm-prime-fence.c
+index 1f10940..c2cac7c 100644
+--- a/kernel/nvidia-drm/nvidia-drm-prime-fence.c
++++ b/kernel/nvidia-drm/nvidia-drm-prime-fence.c
+@@ -29,7 +29,9 @@
+ #include "nvidia-drm-gem.h"
+ #include "nvidia-drm-prime-fence.h"
+
+-#if defined(NV_DRM_DRIVER_HAS_GEM_PRIME_RES_OBJ)
++#include <linux/version.h>
++
++#if defined(NV_DRM_DRIVER_HAS_GEM_PRIME_RES_OBJ) || LINUX_VERSION_CODE >=
KERNEL_VERSION(5, 4, 0)
+
+ #include "nvidia-dma-fence-helper.h"
+
+@@ -518,7 +520,11 @@ int nv_drm_gem_fence_attach_ioctl(struct drm_device *dev,
+ goto fence_context_create_fence_failed;
+ }
+
++#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 4, 0)
+ reservation_object_add_excl_fence(&nv_gem->resv, fence);
++#else
++ dma_resv_add_excl_fence(&nv_gem->resv, fence);
++#endif
+
+ ret = 0;
+
+diff --git a/kernel/nvidia-drm/nvidia-drm-prime-fence.h
b/kernel/nvidia-drm/nvidia-drm-prime-fence.h
+index 20da923..afe2510 100644
+--- a/kernel/nvidia-drm/nvidia-drm-prime-fence.h
++++ b/kernel/nvidia-drm/nvidia-drm-prime-fence.h
+@@ -29,7 +29,9 @@
+
+ #include <drm/drmP.h>
+
+-#if defined(NV_DRM_DRIVER_HAS_GEM_PRIME_RES_OBJ)
++#include <linux/version.h>
++
++#if defined(NV_DRM_DRIVER_HAS_GEM_PRIME_RES_OBJ) || LINUX_VERSION_CODE >=
KERNEL_VERSION(5, 4, 0)
+
+ int nv_drm_fence_supported_ioctl(struct drm_device *dev,
+ void *data, struct drm_file *filep);
diff --git a/nvidia-kmod.spec b/nvidia-kmod.spec
index 63ac4c4..8eb907d 100644
--- a/nvidia-kmod.spec
+++ b/nvidia-kmod.spec
@@ -12,13 +12,16 @@ Name: nvidia-kmod
Epoch: 3
Version: 440.44
# Taken over by kmodtool
-Release: 2%{?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: buildfix_kernel-5.5.patch
+Patch1:
https://raw.githubusercontent.com/negativo17/%{name}/master/%{name}-prime...
+
+
# needed for plague to make sure it builds for i586 and i686
ExclusiveArch: x86_64
@@ -42,6 +45,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
+%patch1 -p1
%patch0 -p1
for kernel_version in %{?kernel_versions} ; do
@@ -70,6 +74,9 @@ done
%changelog
+* Thu Jan 30 2020 Leigh Scott <leigh123linux(a)gmail.com> - 3:440.44-3
+- Add patch for kernel-5.4 prime issue
+
* Mon Dec 30 2019 Leigh Scott <leigh123linux(a)googlemail.com> - 3:440.44-2
- Patch for 5.5rc kernel