Commit f12ad83d authored by Chaoting Liu's avatar Chaoting Liu
Browse files

nvidia: update to 378.13

parent 2227a6cc
Section "OutputClass"
Identifier "nvidia"
MatchDriver "nvidia-drm"
Driver "nvidia"
EndSection
pkgbase=nvidia-utils
pkgname=('nvidia-utils' 'nvidia-libgl' 'opencl-nvidia' 'libcl')
pkgname=('nvidia-utils' 'opencl-nvidia')
# Edit chakra-hardware-detection/hooks/hwdetect_7_graphics on version jump from 3xx.xx
# Update nvidia-settings too
pkgver=370.28
pkgrel=6
pkgver=378.13
pkgrel=1
arch=('x86_64')
url="http://www.nvidia.com/"
license=('custom')
......@@ -12,11 +12,11 @@ options=('!strip')
_pkg="NVIDIA-Linux-x86_64-${pkgver}-no-compat32"
#_pkg="NVIDIA-Linux-x86_64-${pkgver}"
source=("ftp://download.nvidia.com/XFree86/Linux-x86_64/${pkgver}/NVIDIA-Linux-x86_64-${pkgver}-no-compat32.run")
source=("ftp://download.nvidia.com/XFree86/Linux-x86_64/${pkgver}/NVIDIA-Linux-x86_64-${pkgver}-no-compat32.run"
'nvidia-drm-outputclass.conf')
#source=("NVIDIA-Linux-x86_64-${pkgver}.run::https://developer.nvidia.com/linux64bit")
source+=('10-nvidia-drm-outputclass.conf')
sha1sums=('29b710d7aee6aa7624f87789a71fe17498184337'
'4ca2fbb2389d0bcb7a2c6f614860522d9ddf58ab')
sha1sums=('fd93f18a38e7213295078bfdfd51cf9e87db0289'
'04c92e577ff6501c817f5bb2d16398d7b9f47395')
create_links() {
# create soname links
......@@ -34,20 +34,11 @@ prepare() {
bsdtar -xf nvidia-persistenced-init.tar.bz2
}
package_libcl() {
pkgdesc="OpenCL library and ICD loader from NVIDIA"
cd "${srcdir}/${_pkg}"
install -D -m755 libOpenCL.so.1.0.0 "${pkgdir}/usr/lib/libOpenCL.so.1.0.0"
ln -s /usr/lib/libOpenCL.so.1.0.0 "${pkgdir}/usr/lib/libOpenCL.so.1"
ln -s /usr/lib/libOpenCL.so.1 "${pkgdir}/usr/lib/libOpenCL.so"
}
package_opencl-nvidia() {
pkgdesc="OpenCL implemention for NVIDIA"
depends=('libcl' 'zlib')
depends=('zlib')
optdepends=('opencl-headers: headers necessary for OpenCL development')
provides=('opencl-driver')
cd "${_pkg}"
# OpenCL
......@@ -61,45 +52,16 @@ package_opencl-nvidia() {
ln -s nvidia "${pkgdir}/usr/share/licenses/opencl-nvidia"
}
package_nvidia-libgl() {
pkgdesc="NVIDIA drivers libraries symlinks"
depends=('nvidia-utils')
conflicts=('libgl')
provides=('libgl')
cd "${_pkg}"
mkdir -p "${pkgdir}/usr/lib/xorg/modules/extensions"
ln -s "/usr/lib/nvidia/xorg/modules/extensions/libglx.so.${pkgver}" "${pkgdir}/usr/lib/xorg/modules/extensions/libglx.so.${pkgver}"
ln -s "libglx.so.${pkgver}" "${pkgdir}/usr/lib/xorg/modules/extensions/libglx.so.1"
ln -s "libglx.so.${pkgver}" "${pkgdir}/usr/lib/xorg/modules/extensions/libglx.so"
ln -s "/usr/lib/nvidia/libGL.so.1" "${pkgdir}/usr/lib/libGL.so.1"
ln -s "libGL.so.1" "${pkgdir}/usr/lib/libGL.so"
ln -s "/usr/lib/nvidia/libEGL.so.1" "${pkgdir}/usr/lib/libEGL.so.1"
ln -s "libEGL.so.1" "${pkgdir}/usr/lib/libEGL.so"
ln -s "/usr/lib/nvidia/libGLESv1_CM.so.1" "${pkgdir}/usr/lib/libGLESv1_CM.so.1"
ln -s "libGLESv1_CM.so.1" "${pkgdir}/usr/lib/libGLESv1_CM.so"
ln -s "/usr/lib/nvidia/libGLESv2.so.2" "${pkgdir}/usr/lib/libGLESv2.so.2"
ln -s "libGLESv2.so.2" "${pkgdir}/usr/lib/libGLESv2.so"
mkdir -p "${pkgdir}/usr/share/licenses"
ln -s nvidia "${pkgdir}/usr/share/licenses/nvidia-libgl"
}
package_nvidia-utils() {
pkgdesc="NVIDIA drivers utilities"
depends=('xorg-server' 'libglvnd')
optdepends=('gtk2: nvidia-settings'
optdepends=('nvidia-settings: configuration tool'
'xorg-server-devel: nvidia-xconfig'
'opencl-nvidia: OpenCL support'
'nvidia-settings: Gtk GUI')
'opencl-nvidia: OpenCL support')
conflicts=('nvidia-libgl')
provides=('vulkan-driver' 'opengl-driver' 'nvidia-libgl')
replaces=('nvidia-libgl')
install="${pkgname}.install"
conficts=('nvidia-utils-bumblebee')
replaces=('nvidia-utils-bumblebee')
provides=('nvidia-utils-bumblebee')
cd "${_pkg}"
......@@ -107,29 +69,36 @@ package_nvidia-utils() {
install -D -m755 nvidia_drv.so "${pkgdir}/usr/lib/xorg/modules/drivers/nvidia_drv.so"
# GLX extension module for X
install -D -m755 "libglx.so.${pkgver}" "${pkgdir}/usr/lib/nvidia/xorg/modules/extensions/libglx.so.${pkgver}"
ln -s "libglx.so.${pkgver}" "${pkgdir}/usr/lib/nvidia/xorg/modules/extensions/libglx.so" # X doesn't find glx otherwise
install -D -m755 "libglx.so.${pkgver}" "${pkgdir}/usr/lib/nvidia/xorg/libglx.so.${pkgver}"
ln -s "libglx.so.${pkgver}" "${pkgdir}/usr/lib/nvidia/xorg/libglx.so.1" # X doesn't find glx otherwise
ln -s "libglx.so.${pkgver}" "${pkgdir}/usr/lib/nvidia/xorg/libglx.so" # X doesn't find glx otherwise
install -D -m755 "libGLX_nvidia.so.${pkgver}" "${pkgdir}/usr/lib/libGLX_nvidia.so.${pkgver}"
ln -s "libGLX_nvidia.so.${pkgver}" "${pkgdir}/usr/lib/libGLX_indirect.so.0"
# now in mesa driver
#ln -s "libGLX_nvidia.so.${pkgver}" "${pkgdir}/usr/lib/libGLX_indirect.so.0"
# Wayland stuff
install -D -m755 "libnvidia-egl-wayland.so.1.0.1" "${pkgdir}/usr/lib/libnvidia-egl-wayland.so.1.0.1"
ln -s "libnvidia-egl-wayland.so.1.0.1" "${pkgdir}/usr/lib/libnvidia-egl-wayland.so.1"
install -D -m644 "10_nvidia_wayland.json" "${pkgdir}/usr/share/egl/egl_external_platform.d/10_nvidia_wayland.json"
# OpenGL libraries
install -D -m755 "libEGL.so.1" "${pkgdir}/usr/lib/nvidia/libEGL.so.1"
install -D -m755 "libEGL_nvidia.so.$pkgver" "${pkgdir}/usr/lib/libEGL_nvidia.so.0"
install -D -m755 "libGLESv1_CM_nvidia.so.${pkgver}" "${pkgdir}/usr/lib/libGLESv1_CM_nvidia.so.${pkgver}"
install -D -m755 "libGLESv2_nvidia.so.${pkgver}" "${pkgdir}/usr/lib/libGLESv2_nvidia.so.${pkgver}"
install -D -m755 "libEGL_nvidia.so.${pkgver}" "${pkgdir}/usr/lib/libEGL_nvidia.so.${pkgver}"
install -D -m755 "libGLESv1_CM_nvidia.so.${pkgver}" "${pkgdir}/usr/lib/libGLESv1_CM_nvidia.so.${pkgver}"
install -D -m755 "libGLESv2_nvidia.so.${pkgver}" "${pkgdir}/usr/lib/libGLESv2_nvidia.so.${pkgver}"
install -D -m644 "10_nvidia.json" "${pkgdir}/usr/share/glvnd/egl_vendor.d/10_nvidia.json"
# OpenGL core library
install -D -m755 "libnvidia-glcore.so.${pkgver}" "${pkgdir}/usr/lib/libnvidia-glcore.so.${pkgver}"
install -D -m755 "libnvidia-glcore.so.${pkgver}" "${pkgdir}/usr/lib/libnvidia-glcore.so.${pkgver}"
install -D -m755 "libnvidia-eglcore.so.${pkgver}" "${pkgdir}/usr/lib/libnvidia-eglcore.so.${pkgver}"
install -D -m755 "libnvidia-glsi.so.${pkgver}" "${pkgdir}/usr/lib/libnvidia-glsi.so.${pkgver}"
install -D -m755 "libnvidia-egl-wayland.so.${pkgver}" "${pkgdir}/usr/lib/libnvidia-egl-wayland.so.${pkgver}"
install -D -m755 "libnvidia-glsi.so.${pkgver}" "${pkgdir}/usr/lib/libnvidia-glsi.so.${pkgver}"
# misc
install -D -m755 "libnvidia-ifr.so.${pkgver}" "${pkgdir}/usr/lib/libnvidia-ifr.so.${pkgver}"
install -D -m755 "libnvidia-fbc.so.${pkgver}" "${pkgdir}/usr/lib/libnvidia-fbc.so.${pkgver}"
install -D -m755 "libnvidia-ifr.so.${pkgver}" "${pkgdir}/usr/lib/libnvidia-ifr.so.${pkgver}"
install -D -m755 "libnvidia-fbc.so.${pkgver}" "${pkgdir}/usr/lib/libnvidia-fbc.so.${pkgver}"
install -D -m755 "libnvidia-encode.so.${pkgver}" "${pkgdir}/usr/lib/libnvidia-encode.so.${pkgver}"
install -D -m755 "libnvidia-cfg.so.${pkgver}" "${pkgdir}/usr/lib/libnvidia-cfg.so.${pkgver}"
install -D -m755 "libnvidia-ml.so.${pkgver}" "${pkgdir}/usr/lib/libnvidia-ml.so.${pkgver}"
install -D -m755 "libnvidia-cfg.so.${pkgver}" "${pkgdir}/usr/lib/libnvidia-cfg.so.${pkgver}"
install -D -m755 "libnvidia-ml.so.${pkgver}" "${pkgdir}/usr/lib/libnvidia-ml.so.${pkgver}"
# Vulkan ICD
install -D -m644 "nvidia_icd.json" "${pkgdir}/usr/share/vulkan/icd.d/nvidia_icd.json"
......@@ -138,11 +107,11 @@ package_nvidia-utils() {
install -D -m755 "libvdpau_nvidia.so.${pkgver}" "${pkgdir}/usr/lib/vdpau/libvdpau_nvidia.so.${pkgver}"
# nvidia-tls library
install -D -m755 "libnvidia-tls.so.${pkgver}" "${pkgdir}/usr/lib/libnvidia-tls.so.${pkgver}"
install -D -m755 "tls/libnvidia-tls.so.${pkgver}" "${pkgdir}/usr/lib/libnvidia-tls.so.${pkgver}"
install -D -m755 "libnvidia-tls.so.${pkgver}" "${pkgdir}/usr/lib/libnvidia-tls.so.${pkgver}"
install -D -m755 "tls/libnvidia-tls.so.${pkgver}" "${pkgdir}/usr/lib/tls/libnvidia-tls.so.${pkgver}"
# CUDA
install -D -m755 "libcuda.so.${pkgver}" "${pkgdir}/usr/lib/libcuda.so.${pkgver}"
install -D -m755 "libcuda.so.${pkgver}" "${pkgdir}/usr/lib/libcuda.so.${pkgver}"
install -D -m755 "libnvcuvid.so.${pkgver}" "${pkgdir}/usr/lib/libnvcuvid.so.${pkgver}"
# PTX JIT Compiler (Parallel Thread Execution (PTX) is a pseudo-assembly language for CUDA)
......@@ -155,28 +124,28 @@ package_nvidia-utils() {
install -D -m755 nvidia-debugdump "${pkgdir}/usr/bin/nvidia-debugdump"
# nvidia-xconfig
install -D -m755 nvidia-xconfig "${pkgdir}/usr/bin/nvidia-xconfig"
install -D -m755 nvidia-xconfig "${pkgdir}/usr/bin/nvidia-xconfig"
install -D -m644 nvidia-xconfig.1.gz "${pkgdir}/usr/share/man/man1/nvidia-xconfig.1.gz"
# nvidia-bug-report
install -D -m755 nvidia-bug-report.sh "${pkgdir}/usr/bin/nvidia-bug-report.sh"
# nvidia-smi
install -D -m755 nvidia-smi "${pkgdir}/usr/bin/nvidia-smi"
install -D -m755 nvidia-smi "${pkgdir}/usr/bin/nvidia-smi"
install -D -m644 nvidia-smi.1.gz "${pkgdir}/usr/share/man/man1/nvidia-smi.1.gz"
# nvidia-cuda-mps
install -D -m755 nvidia-cuda-mps-server "${pkgdir}/usr/bin/nvidia-cuda-mps-server"
install -D -m755 nvidia-cuda-mps-control "${pkgdir}/usr/bin/nvidia-cuda-mps-control"
install -D -m755 nvidia-cuda-mps-server "${pkgdir}/usr/bin/nvidia-cuda-mps-server"
install -D -m755 nvidia-cuda-mps-control "${pkgdir}/usr/bin/nvidia-cuda-mps-control"
install -D -m644 nvidia-cuda-mps-control.1.gz "${pkgdir}/usr/share/man/man1/nvidia-cuda-mps-control.1.gz"
# nvidia-modprobe
# This should be removed if nvidia fixed their uvm module!
install -D -m4755 nvidia-modprobe "${pkgdir}/usr/bin/nvidia-modprobe"
install -D -m644 nvidia-modprobe.1.gz "${pkgdir}/usr/share/man/man1/nvidia-modprobe.1.gz"
install -D -m4755 nvidia-modprobe "${pkgdir}/usr/bin/nvidia-modprobe"
install -D -m644 nvidia-modprobe.1.gz "${pkgdir}/usr/share/man/man1/nvidia-modprobe.1.gz"
# nvidia-persistenced
install -D -m755 nvidia-persistenced "${pkgdir}/usr/bin/nvidia-persistenced"
install -D -m755 nvidia-persistenced "${pkgdir}/usr/bin/nvidia-persistenced"
install -D -m644 nvidia-persistenced.1.gz "${pkgdir}/usr/share/man/man1/nvidia-persistenced.1.gz"
install -D -m644 nvidia-persistenced-init/systemd/nvidia-persistenced.service.template "${pkgdir}/usr/lib/systemd/system/nvidia-persistenced.service"
sed -i 's/__USER__/nvidia-persistenced/' "${pkgdir}/usr/lib/systemd/system/nvidia-persistenced.service"
......@@ -193,8 +162,7 @@ package_nvidia-utils() {
ln -s nvidia "${pkgdir}/usr/share/doc/nvidia-utils"
# distro specific files must be installed in /usr/share/X11/xorg.conf.d
install -D -m644 "${srcdir}/10-nvidia-drm-outputclass.conf" "${pkgdir}/usr/share/X11/xorg.conf.d/10-nvidia-drm-outputclass.conf"
install -D -m644 "${srcdir}/nvidia-drm-outputclass.conf" "${pkgdir}/usr/share/X11/xorg.conf.d/10-nvidia-drm-outputclass.conf"
create_links
}
Section "OutputClass"
Identifier "intel"
MatchDriver "i915"
Driver "modesetting"
EndSection
Section "OutputClass"
Identifier "nvidia"
MatchDriver "nvidia-drm"
Driver "nvidia"
Option "AllowEmptyInitialConfiguration"
Option "PrimaryGPU" "yes"
ModulePath "/usr/lib/nvidia/xorg"
EndSection
......@@ -2,14 +2,15 @@
source ../linux.conf
pkgname=('nvidia' 'chd-nvidia') # 'nvidia-dkms') # Maybe we don't need dkms module
pkgver=370.28
pkgrel=5
pkgver=378.13
pkgrel=1
arch=('x86_64')
url="http://www.nvidia.com/"
makedepends=("linux-headers=${_kernelver}" "nvidia-utils=${pkgver}")
license=('custom')
options=('!strip')
source=("https://chakralinux.org/code/chakra-hardware-detection.git/plain/hwdb/nvidia_supported_new")
source=("https://chakralinux.org/code/chakra-hardware-detection.git/plain/hwdb/nvidia_supported_new"
'kernel_4.10.patch')
_pkg="NVIDIA-Linux-x86_64-${pkgver}-no-compat32"
#_pkg="NVIDIA-Linux-x86_64-${pkgver}"
......@@ -17,13 +18,16 @@ _pkg="NVIDIA-Linux-x86_64-${pkgver}-no-compat32"
source+=("ftp://download.nvidia.com/XFree86/Linux-x86_64/${pkgver}/NVIDIA-Linux-x86_64-${pkgver}-no-compat32.run")
#source+=("NVIDIA-Linux-x86_64-${pkgver}.run::https://developer.nvidia.com/linux64bit")
sha1sums=('bdb063bbd03eed9fa718664ef2023fd759efe4a3'
'29b710d7aee6aa7624f87789a71fe17498184337')
'ef2748a39d071ef8000640c1db8d13f57610da42'
'fd93f18a38e7213295078bfdfd51cf9e87db0289')
prepare() {
sh "${_pkg}.run" --extract-only
cd "${_pkg}"
# patches here
patch -Np1 -i ../kernel_4.10.patch
# cp -a kernel kernel-dkms
# cd kernel-dkms
# sed -i "s/__VERSION_STRING/${pkgver}/" dkms.conf
......
From ca8b106738521823707f3567cedb41ca158792a3 Mon Sep 17 00:00:00 2001
From: Alberto Milone <alberto.milone@canonical.com>
Date: Wed, 15 Feb 2017 10:53:42 +0100
Subject: [PATCH 1/1] Add support for Linux 4.10
---
common/inc/nv-mm.h | 9 ++++--
nvidia-drm/nvidia-drm-fence.c | 72 +++++++++++++++++++++++++++++++++++++++++++
nvidia-drm/nvidia-drm-gem.h | 6 ++++
nvidia-drm/nvidia-drm-priv.h | 7 +++++
nvidia/nv-pat.c | 40 ++++++++++++++++++++++++
5 files changed, 132 insertions(+), 2 deletions(-)
diff --git a/kernel/common/inc/nv-mm.h b/kernel/common/inc/nv-mm.h
index 06d7da4..e5cc56a 100644
--- a/kernel/common/inc/nv-mm.h
+++ b/kernel/common/inc/nv-mm.h
@@ -46,6 +46,8 @@
* 2016 Dec 14:5b56d49fc31dbb0487e14ead790fc81ca9fb2c99
*/
+#include <linux/version.h>
+
#if defined(NV_GET_USER_PAGES_REMOTE_PRESENT)
#if defined(NV_GET_USER_PAGES_HAS_WRITE_AND_FORCE_ARGS)
#define NV_GET_USER_PAGES get_user_pages
@@ -92,10 +94,13 @@
pages, vmas, NULL);
#else
-
+#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0)
return get_user_pages_remote(tsk, mm, start, nr_pages, flags,
pages, vmas);
-
+#else
+ return get_user_pages_remote(tsk, mm, start, nr_pages, flags,
+ pages, vmas, NULL);
+#endif
#endif
}
diff --git a/kernel/nvidia-drm/nvidia-drm-fence.c b/kernel/nvidia-drm/nvidia-drm-fence.c
index 5e98c5f..fa2c508 100644
--- a/kernel/nvidia-drm/nvidia-drm-fence.c
+++ b/kernel/nvidia-drm/nvidia-drm-fence.c
@@ -31,7 +31,11 @@
#if defined(NV_DRM_DRIVER_HAS_GEM_PRIME_RES_OBJ)
struct nv_fence {
+#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0)
struct fence base;
+#else
+ struct dma_fence base;
+#endif
spinlock_t lock;
struct nvidia_drm_device *nv_dev;
@@ -51,7 +55,11 @@ nv_fence_ready_to_signal(struct nv_fence *nv_fence)
static const char *nvidia_drm_gem_prime_fence_op_get_driver_name
(
+#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0)
struct fence *fence
+#else
+ struct dma_fence *fence
+#endif
)
{
return "NVIDIA";
@@ -59,7 +67,11 @@ static const char *nvidia_drm_gem_prime_fence_op_get_driver_name
static const char *nvidia_drm_gem_prime_fence_op_get_timeline_name
(
+#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0)
struct fence *fence
+#else
+ struct dma_fence *fence
+#endif
)
{
return "nvidia.prime";
@@ -67,7 +79,11 @@ static const char *nvidia_drm_gem_prime_fence_op_get_timeline_name
static bool nvidia_drm_gem_prime_fence_op_signaled
(
+#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0)
struct fence *fence
+#else
+ struct dma_fence *fence
+#endif
)
{
struct nv_fence *nv_fence = container_of(fence, struct nv_fence, base);
@@ -99,7 +115,11 @@ unlock_struct_mutex:
static bool nvidia_drm_gem_prime_fence_op_enable_signaling
(
+#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0)
struct fence *fence
+#else
+ struct dma_fence *fence
+#endif
)
{
bool ret = true;
@@ -107,7 +127,11 @@ static bool nvidia_drm_gem_prime_fence_op_enable_signaling
struct nvidia_drm_gem_object *nv_gem = nv_fence->nv_gem;
struct nvidia_drm_device *nv_dev = nv_fence->nv_dev;
+#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0)
if (fence_is_signaled(fence))
+#else
+ if (dma_fence_is_signaled(fence))
+#endif
{
return false;
}
@@ -136,7 +160,11 @@ static bool nvidia_drm_gem_prime_fence_op_enable_signaling
}
nv_gem->fenceContext.softFence = fence;
+#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0)
fence_get(fence);
+#else
+ dma_fence_get(fence);
+#endif
unlock_struct_mutex:
mutex_unlock(&nv_dev->dev->struct_mutex);
@@ -146,7 +174,11 @@ unlock_struct_mutex:
static void nvidia_drm_gem_prime_fence_op_release
(
+#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0)
struct fence *fence
+#else
+ struct dma_fence *fence
+#endif
)
{
struct nv_fence *nv_fence = container_of(fence, struct nv_fence, base);
@@ -155,7 +187,11 @@ static void nvidia_drm_gem_prime_fence_op_release
static signed long nvidia_drm_gem_prime_fence_op_wait
(
+#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0)
struct fence *fence,
+#else
+ struct dma_fence *fence,
+#endif
bool intr,
signed long timeout
)
@@ -170,12 +206,20 @@ static signed long nvidia_drm_gem_prime_fence_op_wait
* that it should never get hit during normal operation, but not so long
* that the system becomes unresponsive.
*/
+#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0)
return fence_default_wait(fence, intr,
+#else
+ return dma_fence_default_wait(fence, intr,
+#endif
(timeout == MAX_SCHEDULE_TIMEOUT) ?
msecs_to_jiffies(96) : timeout);
}
+#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0)
static const struct fence_ops nvidia_drm_gem_prime_fence_ops = {
+#else
+static const struct dma_fence_ops nvidia_drm_gem_prime_fence_ops = {
+#endif
.get_driver_name = nvidia_drm_gem_prime_fence_op_get_driver_name,
.get_timeline_name = nvidia_drm_gem_prime_fence_op_get_timeline_name,
.signaled = nvidia_drm_gem_prime_fence_op_signaled,
@@ -285,7 +329,11 @@ static void nvidia_drm_gem_prime_fence_signal
bool force
)
{
+#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0)
struct fence *fence = nv_gem->fenceContext.softFence;
+#else
+ struct dma_fence *fence = nv_gem->fenceContext.softFence;
+#endif
WARN_ON(!mutex_is_locked(&nv_dev->dev->struct_mutex));
@@ -301,10 +349,18 @@ static void nvidia_drm_gem_prime_fence_signal
if (force || nv_fence_ready_to_signal(nv_fence))
{
+#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0)
fence_signal(&nv_fence->base);
+#else
+ dma_fence_signal(&nv_fence->base);
+#endif
nv_gem->fenceContext.softFence = NULL;
+#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0)
fence_put(&nv_fence->base);
+#else
+ dma_fence_put(&nv_fence->base);
+#endif
nvKms->disableChannelEvent(nv_dev->pDevice,
nv_gem->fenceContext.cb);
@@ -320,7 +376,11 @@ static void nvidia_drm_gem_prime_fence_signal
nv_fence = container_of(fence, struct nv_fence, base);
+#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0)
fence_signal(&nv_fence->base);
+#else
+ dma_fence_signal(&nv_fence->base);
+#endif
}
}
@@ -513,7 +573,11 @@ int nvidia_drm_gem_prime_fence_init
* fence_context_alloc() cannot fail, so we do not need to check a return
* value.
*/
+#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0)
nv_gem->fenceContext.context = fence_context_alloc(1);
+#else
+ nv_gem->fenceContext.context = dma_fence_context_alloc(1);
+#endif
ret = nvidia_drm_gem_prime_fence_import_semaphore(
nv_dev, nv_gem, p->index,
@@ -670,7 +734,11 @@ int nvidia_drm_gem_prime_fence_attach
nv_fence->nv_gem = nv_gem;
spin_lock_init(&nv_fence->lock);
+#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0)
fence_init(&nv_fence->base, &nvidia_drm_gem_prime_fence_ops,
+#else
+ dma_fence_init(&nv_fence->base, &nvidia_drm_gem_prime_fence_ops,
+#endif
&nv_fence->lock, nv_gem->fenceContext.context,
p->sem_thresh);
@@ -680,7 +748,11 @@ int nvidia_drm_gem_prime_fence_attach
reservation_object_add_excl_fence(&nv_gem->fenceContext.resv,
&nv_fence->base);
+#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0)
fence_put(&nv_fence->base); /* Reservation object has reference */
+#else
+ dma_fence_put(&nv_fence->base);
+#endif
ret = 0;
diff --git a/kernel/nvidia-drm/nvidia-drm-gem.h b/kernel/nvidia-drm/nvidia-drm-gem.h
index 4ff45e8..394576b 100644
--- a/kernel/nvidia-drm/nvidia-drm-gem.h
+++ b/kernel/nvidia-drm/nvidia-drm-gem.h
@@ -29,6 +29,8 @@
#include "nvidia-drm-priv.h"
+#include <linux/version.h>
+
#include <drm/drmP.h>
#include "nvkms-kapi.h"
@@ -98,7 +100,11 @@ struct nvidia_drm_gem_object
/* Software signaling structures */
struct NvKmsKapiChannelEvent *cb;
struct nvidia_drm_gem_prime_soft_fence_event_args *cbArgs;
+#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0)
struct fence *softFence; /* Fence for software signaling */
+#else
+ struct dma_fence *softFence;
+#endif
} fenceContext;
#endif
};
diff --git a/kernel/nvidia-drm/nvidia-drm-priv.h b/kernel/nvidia-drm/nvidia-drm-priv.h
index 1e9b9f9..ae171e7 100644
--- a/kernel/nvidia-drm/nvidia-drm-priv.h
+++ b/kernel/nvidia-drm/nvidia-drm-priv.h
@@ -25,6 +25,8 @@
#include "conftest.h" /* NV_DRM_AVAILABLE */
+#include <linux/version.h>
+
#if defined(NV_DRM_AVAILABLE)
#include <drm/drmP.h>
@@ -34,7 +36,12 @@
#endif
#if defined(NV_DRM_DRIVER_HAS_GEM_PRIME_RES_OBJ)
+#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0)
#include <linux/fence.h>
+#else
+#include <linux/dma-fence.h>
+#endif
+
#include <linux/reservation.h>
#endif
diff --git a/kernel/nvidia/nv-pat.c b/kernel/nvidia/nv-pat.c
index df78020..0af7d47 100644
--- a/kernel/nvidia/nv-pat.c
+++ b/kernel/nvidia/nv-pat.c
@@ -203,6 +203,7 @@ void nv_disable_pat_support(void)
}
#if defined(NV_ENABLE_PAT_SUPPORT) && defined(NV_ENABLE_HOTPLUG_CPU)
+#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0)
static int
nvidia_cpu_callback(struct notifier_block *nfb, unsigned long action, void *hcpu)
{
@@ -234,6 +235,34 @@ static struct notifier_block nv_hotcpu_nfb = {
.notifier_call = nvidia_cpu_callback,
.priority = 0
};
+#else
+static int nvidia_cpu_online(unsigned int hcpu)
+{
+ unsigned int cpu = get_cpu();
+ if (cpu == hcpu)
+ nv_setup_pat_entries(NULL);
+ else
+ NV_SMP_CALL_FUNCTION(nv_setup_pat_entries, (void *)(long int)hcpu, 1);
+
+ put_cpu();
+
+ return 0;
+}
+
+static int nvidia_cpu_down_prep(unsigned int hcpu)
+{
+ unsigned int cpu = get_cpu();
+ if (cpu == hcpu)
+ nv_restore_pat_entries(NULL);
+ else
+ NV_SMP_CALL_FUNCTION(nv_restore_pat_entries, (void *)(long int)hcpu, 1);
+
+ put_cpu();
+
+ return 0;
+}
+#endif
+
#endif