Date: Monday, May 1, 2017 @ 07:00:05 Author: tpowa Revision: 295129 db-move: moved nvidia from [testing] to [extra] (i686, x86_64)
Added: nvidia/repos/extra-i686/PKGBUILD (from rev 295128, nvidia/repos/testing-i686/PKGBUILD) nvidia/repos/extra-i686/fix-abi.patch (from rev 295128, nvidia/repos/testing-i686/fix-abi.patch) nvidia/repos/extra-i686/kernel_4.10.patch (from rev 295128, nvidia/repos/testing-i686/kernel_4.10.patch) nvidia/repos/extra-i686/nvidia.install (from rev 295128, nvidia/repos/testing-i686/nvidia.install) nvidia/repos/extra-x86_64/PKGBUILD (from rev 295128, nvidia/repos/testing-x86_64/PKGBUILD) nvidia/repos/extra-x86_64/fix-abi.patch (from rev 295128, nvidia/repos/testing-x86_64/fix-abi.patch) nvidia/repos/extra-x86_64/kernel_4.10.patch (from rev 295128, nvidia/repos/testing-x86_64/kernel_4.10.patch) nvidia/repos/extra-x86_64/nvidia.install (from rev 295128, nvidia/repos/testing-x86_64/nvidia.install) Deleted: nvidia/repos/extra-i686/PKGBUILD nvidia/repos/extra-i686/fix-abi.patch nvidia/repos/extra-i686/kernel_4.10.patch nvidia/repos/extra-i686/nvidia.install nvidia/repos/extra-x86_64/PKGBUILD nvidia/repos/extra-x86_64/fix-abi.patch nvidia/repos/extra-x86_64/kernel_4.10.patch nvidia/repos/extra-x86_64/nvidia.install nvidia/repos/testing-i686/ nvidia/repos/testing-x86_64/ --------------------------------+ /PKGBUILD | 176 ++++++++ /fix-abi.patch | 24 + /kernel_4.10.patch | 764 +++++++++++++++++++++++++++++++++++++++ /nvidia.install | 26 + extra-i686/PKGBUILD | 88 ---- extra-i686/fix-abi.patch | 12 extra-i686/kernel_4.10.patch | 382 ------------------- extra-i686/nvidia.install | 13 extra-x86_64/PKGBUILD | 88 ---- extra-x86_64/fix-abi.patch | 12 extra-x86_64/kernel_4.10.patch | 382 ------------------- extra-x86_64/nvidia.install | 13 12 files changed, 990 insertions(+), 990 deletions(-) Deleted: extra-i686/PKGBUILD =================================================================== --- extra-i686/PKGBUILD 2017-05-01 07:00:01 UTC (rev 295128) +++ extra-i686/PKGBUILD 2017-05-01 07:00:05 UTC (rev 295129) @@ -1,88 +0,0 @@ -# $Id$ -# Maintainer: Sven-Hendrik Haase <s...@lutzhaase.com> -# Maintainer: Felix Yan <felixonm...@archlinux.org> -# Contributor: Thomas Baechler <tho...@archlinux.org> - -pkgbase=nvidia -pkgname=(nvidia nvidia-dkms) -pkgver=378.13 -_extramodules=extramodules-4.10-ARCH -pkgrel=5 -pkgdesc="NVIDIA drivers for linux" -arch=('i686' 'x86_64') -url="http://www.nvidia.com/" -makedepends=('nvidia-libgl' "nvidia-utils=${pkgver}" 'linux' 'linux-headers>=4.10.8' 'linux-headers<4.11') -license=('custom') -options=('!strip') -source=('kernel_4.10.patch') -source_i686=("http://us.download.nvidia.com/XFree86/Linux-x86/${pkgver}/NVIDIA-Linux-x86-${pkgver}.run") -source_x86_64=("http://us.download.nvidia.com/XFree86/Linux-x86_64/${pkgver}/NVIDIA-Linux-x86_64-${pkgver}-no-compat32.run") -md5sums=('e81769b830b7a1e60c635e3bbe559f59') -md5sums_i686=('dd1077750af9a067739ec291fb24175f') -md5sums_x86_64=('fe4d25b19a780a690cafc8e3b7c0113f') - -[[ "$CARCH" = "i686" ]] && _pkg="NVIDIA-Linux-x86-${pkgver}" -[[ "$CARCH" = "x86_64" ]] && _pkg="NVIDIA-Linux-x86_64-${pkgver}-no-compat32" - -prepare() { - sh "${_pkg}.run" --extract-only - cd "${_pkg}" - - patch -Np1 --no-backup-if-mismatch -i ../kernel_4.10.patch - - cp -a kernel kernel-dkms - cd kernel-dkms - sed -i "s/__VERSION_STRING/${pkgver}/" dkms.conf - sed -i 's/__JOBS/`nproc`/' dkms.conf - sed -i 's/__DKMS_MODULES//' dkms.conf - sed -i '$iBUILT_MODULE_NAME[0]="nvidia"\ -DEST_MODULE_LOCATION[0]="/kernel/drivers/video"\ -BUILT_MODULE_NAME[1]="nvidia-uvm"\ -DEST_MODULE_LOCATION[1]="/kernel/drivers/video"\ -BUILT_MODULE_NAME[2]="nvidia-modeset"\ -DEST_MODULE_LOCATION[2]="/kernel/drivers/video"\ -BUILT_MODULE_NAME[3]="nvidia-drm"\ -DEST_MODULE_LOCATION[3]="/kernel/drivers/video"' dkms.conf -} - -build() { - _kernver="$(cat /usr/lib/modules/${_extramodules}/version)" - cd "${_pkg}"/kernel - make SYSSRC=/usr/lib/modules/"${_kernver}/build" module -} - -package_nvidia() { - pkgdesc="NVIDIA drivers for linux" - depends=('linux>=4.10.8' 'linux<4.11' "nvidia-utils=${pkgver}" 'libgl') - install=nvidia.install - - install -D -m644 "${srcdir}/${_pkg}/kernel/nvidia.ko" \ - "${pkgdir}/usr/lib/modules/${_extramodules}/nvidia.ko" - install -D -m644 "${srcdir}/${_pkg}/kernel/nvidia-modeset.ko" \ - "${pkgdir}/usr/lib/modules/${_extramodules}/nvidia-modeset.ko" - install -D -m644 "${srcdir}/${_pkg}/kernel/nvidia-drm.ko" \ - "${pkgdir}/usr/lib/modules/${_extramodules}/nvidia-drm.ko" - - if [[ "$CARCH" = "x86_64" ]]; then - install -D -m644 "${srcdir}/${_pkg}/kernel/nvidia-uvm.ko" \ - "${pkgdir}/usr/lib/modules/${_extramodules}/nvidia-uvm.ko" - fi - - gzip "${pkgdir}/usr/lib/modules/${_extramodules}/"*.ko - install -d -m755 "${pkgdir}/usr/lib/modprobe.d" - - echo "blacklist nouveau" >> "${pkgdir}/usr/lib/modprobe.d/nvidia.conf" -} - -package_nvidia-dkms() { - pkgdesc="NVIDIA driver sources for linux" - depends=('dkms' "nvidia-utils=$pkgver" 'libgl') - optdepends=('linux-headers: Build the module for Arch kernel' - 'linux-lts-headers: Build the module for LTS Arch kernel') - conflicts+=('nvidia') - - cd ${_pkg} - install -dm 755 "${pkgdir}"/usr/{lib/modprobe.d,src} - cp -dr --no-preserve='ownership' kernel-dkms "${pkgdir}/usr/src/nvidia-${pkgver}" - echo 'blacklist nouveau' > "${pkgdir}/usr/lib/modprobe.d/nvidia.conf" -} Copied: nvidia/repos/extra-i686/PKGBUILD (from rev 295128, nvidia/repos/testing-i686/PKGBUILD) =================================================================== --- extra-i686/PKGBUILD (rev 0) +++ extra-i686/PKGBUILD 2017-05-01 07:00:05 UTC (rev 295129) @@ -0,0 +1,88 @@ +# $Id$ +# Maintainer: Sven-Hendrik Haase <s...@lutzhaase.com> +# Maintainer: Felix Yan <felixonm...@archlinux.org> +# Contributor: Thomas Baechler <tho...@archlinux.org> + +pkgbase=nvidia +pkgname=(nvidia nvidia-dkms) +pkgver=378.13 +_extramodules=extramodules-4.10-ARCH +pkgrel=6 +pkgdesc="NVIDIA drivers for linux" +arch=('i686' 'x86_64') +url="http://www.nvidia.com/" +makedepends=('nvidia-libgl' "nvidia-utils=${pkgver}" 'linux' 'linux-headers>=4.10.8' 'linux-headers<4.11') +license=('custom') +options=('!strip') +source=('kernel_4.10.patch') +source_i686=("http://us.download.nvidia.com/XFree86/Linux-x86/${pkgver}/NVIDIA-Linux-x86-${pkgver}.run") +source_x86_64=("http://us.download.nvidia.com/XFree86/Linux-x86_64/${pkgver}/NVIDIA-Linux-x86_64-${pkgver}-no-compat32.run") +md5sums=('e81769b830b7a1e60c635e3bbe559f59') +md5sums_i686=('dd1077750af9a067739ec291fb24175f') +md5sums_x86_64=('fe4d25b19a780a690cafc8e3b7c0113f') + +[[ "$CARCH" = "i686" ]] && _pkg="NVIDIA-Linux-x86-${pkgver}" +[[ "$CARCH" = "x86_64" ]] && _pkg="NVIDIA-Linux-x86_64-${pkgver}-no-compat32" + +prepare() { + sh "${_pkg}.run" --extract-only + cd "${_pkg}" + + patch -Np1 --no-backup-if-mismatch -i ../kernel_4.10.patch + + cp -a kernel kernel-dkms + cd kernel-dkms + sed -i "s/__VERSION_STRING/${pkgver}/" dkms.conf + sed -i 's/__JOBS/`nproc`/' dkms.conf + sed -i 's/__DKMS_MODULES//' dkms.conf + sed -i '$iBUILT_MODULE_NAME[0]="nvidia"\ +DEST_MODULE_LOCATION[0]="/kernel/drivers/video"\ +BUILT_MODULE_NAME[1]="nvidia-uvm"\ +DEST_MODULE_LOCATION[1]="/kernel/drivers/video"\ +BUILT_MODULE_NAME[2]="nvidia-modeset"\ +DEST_MODULE_LOCATION[2]="/kernel/drivers/video"\ +BUILT_MODULE_NAME[3]="nvidia-drm"\ +DEST_MODULE_LOCATION[3]="/kernel/drivers/video"' dkms.conf +} + +build() { + _kernver="$(cat /usr/lib/modules/${_extramodules}/version)" + cd "${_pkg}"/kernel + make SYSSRC=/usr/lib/modules/"${_kernver}/build" module +} + +package_nvidia() { + pkgdesc="NVIDIA drivers for linux" + depends=('linux>=4.10.8' 'linux<4.11' "nvidia-utils=${pkgver}" 'libgl') + install=nvidia.install + + install -D -m644 "${srcdir}/${_pkg}/kernel/nvidia.ko" \ + "${pkgdir}/usr/lib/modules/${_extramodules}/nvidia.ko" + install -D -m644 "${srcdir}/${_pkg}/kernel/nvidia-modeset.ko" \ + "${pkgdir}/usr/lib/modules/${_extramodules}/nvidia-modeset.ko" + install -D -m644 "${srcdir}/${_pkg}/kernel/nvidia-drm.ko" \ + "${pkgdir}/usr/lib/modules/${_extramodules}/nvidia-drm.ko" + + if [[ "$CARCH" = "x86_64" ]]; then + install -D -m644 "${srcdir}/${_pkg}/kernel/nvidia-uvm.ko" \ + "${pkgdir}/usr/lib/modules/${_extramodules}/nvidia-uvm.ko" + fi + + gzip "${pkgdir}/usr/lib/modules/${_extramodules}/"*.ko + install -d -m755 "${pkgdir}/usr/lib/modprobe.d" + + echo "blacklist nouveau" >> "${pkgdir}/usr/lib/modprobe.d/nvidia.conf" +} + +package_nvidia-dkms() { + pkgdesc="NVIDIA driver sources for linux" + depends=('dkms' "nvidia-utils=$pkgver" 'libgl') + optdepends=('linux-headers: Build the module for Arch kernel' + 'linux-lts-headers: Build the module for LTS Arch kernel') + conflicts+=('nvidia') + + cd ${_pkg} + install -dm 755 "${pkgdir}"/usr/{lib/modprobe.d,src} + cp -dr --no-preserve='ownership' kernel-dkms "${pkgdir}/usr/src/nvidia-${pkgver}" + echo 'blacklist nouveau' > "${pkgdir}/usr/lib/modprobe.d/nvidia.conf" +} Deleted: extra-i686/fix-abi.patch =================================================================== --- extra-i686/fix-abi.patch 2017-05-01 07:00:01 UTC (rev 295128) +++ extra-i686/fix-abi.patch 2017-05-01 07:00:05 UTC (rev 295129) @@ -1,12 +0,0 @@ -diff -u -r kernel/nvidia-drm/nvidia-drm-fence.c kernel-patched/nvidia-drm/nvidia-drm-fence.c ---- kernel/nvidia-drm/nvidia-drm-fence.c 2016-08-09 01:43:19.000000000 +0200 -+++ kernel-patched/nvidia-drm/nvidia-drm-fence.c 2016-08-25 14:31:34.419655564 +0200 -@@ -325,7 +325,7 @@ - struct nvidia_drm_gem_object *nv_gem; - }; - --static void nvidia_drm_gem_prime_soft_fence_event -+static void NVKMS_KAPI_CALL nvidia_drm_gem_prime_soft_fence_event - ( - void *dataPtr, - NvU32 dataU32 Copied: nvidia/repos/extra-i686/fix-abi.patch (from rev 295128, nvidia/repos/testing-i686/fix-abi.patch) =================================================================== --- extra-i686/fix-abi.patch (rev 0) +++ extra-i686/fix-abi.patch 2017-05-01 07:00:05 UTC (rev 295129) @@ -0,0 +1,12 @@ +diff -u -r kernel/nvidia-drm/nvidia-drm-fence.c kernel-patched/nvidia-drm/nvidia-drm-fence.c +--- kernel/nvidia-drm/nvidia-drm-fence.c 2016-08-09 01:43:19.000000000 +0200 ++++ kernel-patched/nvidia-drm/nvidia-drm-fence.c 2016-08-25 14:31:34.419655564 +0200 +@@ -325,7 +325,7 @@ + struct nvidia_drm_gem_object *nv_gem; + }; + +-static void nvidia_drm_gem_prime_soft_fence_event ++static void NVKMS_KAPI_CALL nvidia_drm_gem_prime_soft_fence_event + ( + void *dataPtr, + NvU32 dataU32 Deleted: extra-i686/kernel_4.10.patch =================================================================== --- extra-i686/kernel_4.10.patch 2017-05-01 07:00:01 UTC (rev 295128) +++ extra-i686/kernel_4.10.patch 2017-05-01 07:00:05 UTC (rev 295129) @@ -1,382 +0,0 @@ -From ca8b106738521823707f3567cedb41ca158792a3 Mon Sep 17 00:00:00 2001 -From: Alberto Milone <alberto.mil...@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 - - int nv_init_pat_support(nvidia_stack_t *sp) -@@ -255,7 +284,14 @@ int nv_init_pat_support(nvidia_stack_t *sp) - #if defined(NV_ENABLE_PAT_SUPPORT) && defined(NV_ENABLE_HOTPLUG_CPU) - if (nv_pat_mode == NV_PAT_MODE_BUILTIN) - { -+#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0) - if (register_hotcpu_notifier(&nv_hotcpu_nfb) != 0) -+#else -+ if (cpuhp_setup_state(CPUHP_AP_ONLINE_DYN, -+ "gpu/nvidia:online", -+ nvidia_cpu_online, -+ nvidia_cpu_down_prep) != 0) -+#endif - { - nv_disable_pat_support(); - nv_printf(NV_DBG_ERRORS, -@@ -280,7 +316,11 @@ void nv_teardown_pat_support(void) - { - nv_disable_pat_support(); - #if defined(NV_ENABLE_PAT_SUPPORT) && defined(NV_ENABLE_HOTPLUG_CPU) -+#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0) - unregister_hotcpu_notifier(&nv_hotcpu_nfb); -+#else -+ cpuhp_remove_state_nocalls(CPUHP_AP_ONLINE_DYN); -+#endif - #endif - } - } --- -2.7.4 - Copied: nvidia/repos/extra-i686/kernel_4.10.patch (from rev 295128, nvidia/repos/testing-i686/kernel_4.10.patch) =================================================================== --- extra-i686/kernel_4.10.patch (rev 0) +++ extra-i686/kernel_4.10.patch 2017-05-01 07:00:05 UTC (rev 295129) @@ -0,0 +1,382 @@ +From ca8b106738521823707f3567cedb41ca158792a3 Mon Sep 17 00:00:00 2001 +From: Alberto Milone <alberto.mil...@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 + + int nv_init_pat_support(nvidia_stack_t *sp) +@@ -255,7 +284,14 @@ int nv_init_pat_support(nvidia_stack_t *sp) + #if defined(NV_ENABLE_PAT_SUPPORT) && defined(NV_ENABLE_HOTPLUG_CPU) + if (nv_pat_mode == NV_PAT_MODE_BUILTIN) + { ++#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0) + if (register_hotcpu_notifier(&nv_hotcpu_nfb) != 0) ++#else ++ if (cpuhp_setup_state(CPUHP_AP_ONLINE_DYN, ++ "gpu/nvidia:online", ++ nvidia_cpu_online, ++ nvidia_cpu_down_prep) != 0) ++#endif + { + nv_disable_pat_support(); + nv_printf(NV_DBG_ERRORS, +@@ -280,7 +316,11 @@ void nv_teardown_pat_support(void) + { + nv_disable_pat_support(); + #if defined(NV_ENABLE_PAT_SUPPORT) && defined(NV_ENABLE_HOTPLUG_CPU) ++#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0) + unregister_hotcpu_notifier(&nv_hotcpu_nfb); ++#else ++ cpuhp_remove_state_nocalls(CPUHP_AP_ONLINE_DYN); ++#endif + #endif + } + } +-- +2.7.4 + Deleted: extra-i686/nvidia.install =================================================================== --- extra-i686/nvidia.install 2017-05-01 07:00:01 UTC (rev 295128) +++ extra-i686/nvidia.install 2017-05-01 07:00:05 UTC (rev 295129) @@ -1,13 +0,0 @@ -post_install() { - EXTRAMODULES='extramodules-4.10-ARCH' - depmod $(cat /usr/lib/modules/${EXTRAMODULES}/version) - echo 'In order to use nvidia module, reboot the system.' -} - -post_upgrade() { - post_install -} - -post_remove() { - post_install -} Copied: nvidia/repos/extra-i686/nvidia.install (from rev 295128, nvidia/repos/testing-i686/nvidia.install) =================================================================== --- extra-i686/nvidia.install (rev 0) +++ extra-i686/nvidia.install 2017-05-01 07:00:05 UTC (rev 295129) @@ -0,0 +1,13 @@ +post_install() { + EXTRAMODULES='extramodules-4.10-ARCH' + depmod $(cat /usr/lib/modules/${EXTRAMODULES}/version) + echo 'In order to use nvidia module, reboot the system.' +} + +post_upgrade() { + post_install +} + +post_remove() { + post_install +} Deleted: extra-x86_64/PKGBUILD =================================================================== --- extra-x86_64/PKGBUILD 2017-05-01 07:00:01 UTC (rev 295128) +++ extra-x86_64/PKGBUILD 2017-05-01 07:00:05 UTC (rev 295129) @@ -1,88 +0,0 @@ -# $Id$ -# Maintainer: Sven-Hendrik Haase <s...@lutzhaase.com> -# Maintainer: Felix Yan <felixonm...@archlinux.org> -# Contributor: Thomas Baechler <tho...@archlinux.org> - -pkgbase=nvidia -pkgname=(nvidia nvidia-dkms) -pkgver=378.13 -_extramodules=extramodules-4.10-ARCH -pkgrel=5 -pkgdesc="NVIDIA drivers for linux" -arch=('i686' 'x86_64') -url="http://www.nvidia.com/" -makedepends=('nvidia-libgl' "nvidia-utils=${pkgver}" 'linux' 'linux-headers>=4.10.8' 'linux-headers<4.11') -license=('custom') -options=('!strip') -source=('kernel_4.10.patch') -source_i686=("http://us.download.nvidia.com/XFree86/Linux-x86/${pkgver}/NVIDIA-Linux-x86-${pkgver}.run") -source_x86_64=("http://us.download.nvidia.com/XFree86/Linux-x86_64/${pkgver}/NVIDIA-Linux-x86_64-${pkgver}-no-compat32.run") -md5sums=('e81769b830b7a1e60c635e3bbe559f59') -md5sums_i686=('dd1077750af9a067739ec291fb24175f') -md5sums_x86_64=('fe4d25b19a780a690cafc8e3b7c0113f') - -[[ "$CARCH" = "i686" ]] && _pkg="NVIDIA-Linux-x86-${pkgver}" -[[ "$CARCH" = "x86_64" ]] && _pkg="NVIDIA-Linux-x86_64-${pkgver}-no-compat32" - -prepare() { - sh "${_pkg}.run" --extract-only - cd "${_pkg}" - - patch -Np1 --no-backup-if-mismatch -i ../kernel_4.10.patch - - cp -a kernel kernel-dkms - cd kernel-dkms - sed -i "s/__VERSION_STRING/${pkgver}/" dkms.conf - sed -i 's/__JOBS/`nproc`/' dkms.conf - sed -i 's/__DKMS_MODULES//' dkms.conf - sed -i '$iBUILT_MODULE_NAME[0]="nvidia"\ -DEST_MODULE_LOCATION[0]="/kernel/drivers/video"\ -BUILT_MODULE_NAME[1]="nvidia-uvm"\ -DEST_MODULE_LOCATION[1]="/kernel/drivers/video"\ -BUILT_MODULE_NAME[2]="nvidia-modeset"\ -DEST_MODULE_LOCATION[2]="/kernel/drivers/video"\ -BUILT_MODULE_NAME[3]="nvidia-drm"\ -DEST_MODULE_LOCATION[3]="/kernel/drivers/video"' dkms.conf -} - -build() { - _kernver="$(cat /usr/lib/modules/${_extramodules}/version)" - cd "${_pkg}"/kernel - make SYSSRC=/usr/lib/modules/"${_kernver}/build" module -} - -package_nvidia() { - pkgdesc="NVIDIA drivers for linux" - depends=('linux>=4.10.8' 'linux<4.11' "nvidia-utils=${pkgver}" 'libgl') - install=nvidia.install - - install -D -m644 "${srcdir}/${_pkg}/kernel/nvidia.ko" \ - "${pkgdir}/usr/lib/modules/${_extramodules}/nvidia.ko" - install -D -m644 "${srcdir}/${_pkg}/kernel/nvidia-modeset.ko" \ - "${pkgdir}/usr/lib/modules/${_extramodules}/nvidia-modeset.ko" - install -D -m644 "${srcdir}/${_pkg}/kernel/nvidia-drm.ko" \ - "${pkgdir}/usr/lib/modules/${_extramodules}/nvidia-drm.ko" - - if [[ "$CARCH" = "x86_64" ]]; then - install -D -m644 "${srcdir}/${_pkg}/kernel/nvidia-uvm.ko" \ - "${pkgdir}/usr/lib/modules/${_extramodules}/nvidia-uvm.ko" - fi - - gzip "${pkgdir}/usr/lib/modules/${_extramodules}/"*.ko - install -d -m755 "${pkgdir}/usr/lib/modprobe.d" - - echo "blacklist nouveau" >> "${pkgdir}/usr/lib/modprobe.d/nvidia.conf" -} - -package_nvidia-dkms() { - pkgdesc="NVIDIA driver sources for linux" - depends=('dkms' "nvidia-utils=$pkgver" 'libgl') - optdepends=('linux-headers: Build the module for Arch kernel' - 'linux-lts-headers: Build the module for LTS Arch kernel') - conflicts+=('nvidia') - - cd ${_pkg} - install -dm 755 "${pkgdir}"/usr/{lib/modprobe.d,src} - cp -dr --no-preserve='ownership' kernel-dkms "${pkgdir}/usr/src/nvidia-${pkgver}" - echo 'blacklist nouveau' > "${pkgdir}/usr/lib/modprobe.d/nvidia.conf" -} Copied: nvidia/repos/extra-x86_64/PKGBUILD (from rev 295128, nvidia/repos/testing-x86_64/PKGBUILD) =================================================================== --- extra-x86_64/PKGBUILD (rev 0) +++ extra-x86_64/PKGBUILD 2017-05-01 07:00:05 UTC (rev 295129) @@ -0,0 +1,88 @@ +# $Id$ +# Maintainer: Sven-Hendrik Haase <s...@lutzhaase.com> +# Maintainer: Felix Yan <felixonm...@archlinux.org> +# Contributor: Thomas Baechler <tho...@archlinux.org> + +pkgbase=nvidia +pkgname=(nvidia nvidia-dkms) +pkgver=378.13 +_extramodules=extramodules-4.10-ARCH +pkgrel=6 +pkgdesc="NVIDIA drivers for linux" +arch=('i686' 'x86_64') +url="http://www.nvidia.com/" +makedepends=('nvidia-libgl' "nvidia-utils=${pkgver}" 'linux' 'linux-headers>=4.10.8' 'linux-headers<4.11') +license=('custom') +options=('!strip') +source=('kernel_4.10.patch') +source_i686=("http://us.download.nvidia.com/XFree86/Linux-x86/${pkgver}/NVIDIA-Linux-x86-${pkgver}.run") +source_x86_64=("http://us.download.nvidia.com/XFree86/Linux-x86_64/${pkgver}/NVIDIA-Linux-x86_64-${pkgver}-no-compat32.run") +md5sums=('e81769b830b7a1e60c635e3bbe559f59') +md5sums_i686=('dd1077750af9a067739ec291fb24175f') +md5sums_x86_64=('fe4d25b19a780a690cafc8e3b7c0113f') + +[[ "$CARCH" = "i686" ]] && _pkg="NVIDIA-Linux-x86-${pkgver}" +[[ "$CARCH" = "x86_64" ]] && _pkg="NVIDIA-Linux-x86_64-${pkgver}-no-compat32" + +prepare() { + sh "${_pkg}.run" --extract-only + cd "${_pkg}" + + patch -Np1 --no-backup-if-mismatch -i ../kernel_4.10.patch + + cp -a kernel kernel-dkms + cd kernel-dkms + sed -i "s/__VERSION_STRING/${pkgver}/" dkms.conf + sed -i 's/__JOBS/`nproc`/' dkms.conf + sed -i 's/__DKMS_MODULES//' dkms.conf + sed -i '$iBUILT_MODULE_NAME[0]="nvidia"\ +DEST_MODULE_LOCATION[0]="/kernel/drivers/video"\ +BUILT_MODULE_NAME[1]="nvidia-uvm"\ +DEST_MODULE_LOCATION[1]="/kernel/drivers/video"\ +BUILT_MODULE_NAME[2]="nvidia-modeset"\ +DEST_MODULE_LOCATION[2]="/kernel/drivers/video"\ +BUILT_MODULE_NAME[3]="nvidia-drm"\ +DEST_MODULE_LOCATION[3]="/kernel/drivers/video"' dkms.conf +} + +build() { + _kernver="$(cat /usr/lib/modules/${_extramodules}/version)" + cd "${_pkg}"/kernel + make SYSSRC=/usr/lib/modules/"${_kernver}/build" module +} + +package_nvidia() { + pkgdesc="NVIDIA drivers for linux" + depends=('linux>=4.10.8' 'linux<4.11' "nvidia-utils=${pkgver}" 'libgl') + install=nvidia.install + + install -D -m644 "${srcdir}/${_pkg}/kernel/nvidia.ko" \ + "${pkgdir}/usr/lib/modules/${_extramodules}/nvidia.ko" + install -D -m644 "${srcdir}/${_pkg}/kernel/nvidia-modeset.ko" \ + "${pkgdir}/usr/lib/modules/${_extramodules}/nvidia-modeset.ko" + install -D -m644 "${srcdir}/${_pkg}/kernel/nvidia-drm.ko" \ + "${pkgdir}/usr/lib/modules/${_extramodules}/nvidia-drm.ko" + + if [[ "$CARCH" = "x86_64" ]]; then + install -D -m644 "${srcdir}/${_pkg}/kernel/nvidia-uvm.ko" \ + "${pkgdir}/usr/lib/modules/${_extramodules}/nvidia-uvm.ko" + fi + + gzip "${pkgdir}/usr/lib/modules/${_extramodules}/"*.ko + install -d -m755 "${pkgdir}/usr/lib/modprobe.d" + + echo "blacklist nouveau" >> "${pkgdir}/usr/lib/modprobe.d/nvidia.conf" +} + +package_nvidia-dkms() { + pkgdesc="NVIDIA driver sources for linux" + depends=('dkms' "nvidia-utils=$pkgver" 'libgl') + optdepends=('linux-headers: Build the module for Arch kernel' + 'linux-lts-headers: Build the module for LTS Arch kernel') + conflicts+=('nvidia') + + cd ${_pkg} + install -dm 755 "${pkgdir}"/usr/{lib/modprobe.d,src} + cp -dr --no-preserve='ownership' kernel-dkms "${pkgdir}/usr/src/nvidia-${pkgver}" + echo 'blacklist nouveau' > "${pkgdir}/usr/lib/modprobe.d/nvidia.conf" +} Deleted: extra-x86_64/fix-abi.patch =================================================================== --- extra-x86_64/fix-abi.patch 2017-05-01 07:00:01 UTC (rev 295128) +++ extra-x86_64/fix-abi.patch 2017-05-01 07:00:05 UTC (rev 295129) @@ -1,12 +0,0 @@ -diff -u -r kernel/nvidia-drm/nvidia-drm-fence.c kernel-patched/nvidia-drm/nvidia-drm-fence.c ---- kernel/nvidia-drm/nvidia-drm-fence.c 2016-08-09 01:43:19.000000000 +0200 -+++ kernel-patched/nvidia-drm/nvidia-drm-fence.c 2016-08-25 14:31:34.419655564 +0200 -@@ -325,7 +325,7 @@ - struct nvidia_drm_gem_object *nv_gem; - }; - --static void nvidia_drm_gem_prime_soft_fence_event -+static void NVKMS_KAPI_CALL nvidia_drm_gem_prime_soft_fence_event - ( - void *dataPtr, - NvU32 dataU32 Copied: nvidia/repos/extra-x86_64/fix-abi.patch (from rev 295128, nvidia/repos/testing-x86_64/fix-abi.patch) =================================================================== --- extra-x86_64/fix-abi.patch (rev 0) +++ extra-x86_64/fix-abi.patch 2017-05-01 07:00:05 UTC (rev 295129) @@ -0,0 +1,12 @@ +diff -u -r kernel/nvidia-drm/nvidia-drm-fence.c kernel-patched/nvidia-drm/nvidia-drm-fence.c +--- kernel/nvidia-drm/nvidia-drm-fence.c 2016-08-09 01:43:19.000000000 +0200 ++++ kernel-patched/nvidia-drm/nvidia-drm-fence.c 2016-08-25 14:31:34.419655564 +0200 +@@ -325,7 +325,7 @@ + struct nvidia_drm_gem_object *nv_gem; + }; + +-static void nvidia_drm_gem_prime_soft_fence_event ++static void NVKMS_KAPI_CALL nvidia_drm_gem_prime_soft_fence_event + ( + void *dataPtr, + NvU32 dataU32 Deleted: extra-x86_64/kernel_4.10.patch =================================================================== --- extra-x86_64/kernel_4.10.patch 2017-05-01 07:00:01 UTC (rev 295128) +++ extra-x86_64/kernel_4.10.patch 2017-05-01 07:00:05 UTC (rev 295129) @@ -1,382 +0,0 @@ -From ca8b106738521823707f3567cedb41ca158792a3 Mon Sep 17 00:00:00 2001 -From: Alberto Milone <alberto.mil...@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 - - int nv_init_pat_support(nvidia_stack_t *sp) -@@ -255,7 +284,14 @@ int nv_init_pat_support(nvidia_stack_t *sp) - #if defined(NV_ENABLE_PAT_SUPPORT) && defined(NV_ENABLE_HOTPLUG_CPU) - if (nv_pat_mode == NV_PAT_MODE_BUILTIN) - { -+#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0) - if (register_hotcpu_notifier(&nv_hotcpu_nfb) != 0) -+#else -+ if (cpuhp_setup_state(CPUHP_AP_ONLINE_DYN, -+ "gpu/nvidia:online", -+ nvidia_cpu_online, -+ nvidia_cpu_down_prep) != 0) -+#endif - { - nv_disable_pat_support(); - nv_printf(NV_DBG_ERRORS, -@@ -280,7 +316,11 @@ void nv_teardown_pat_support(void) - { - nv_disable_pat_support(); - #if defined(NV_ENABLE_PAT_SUPPORT) && defined(NV_ENABLE_HOTPLUG_CPU) -+#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0) - unregister_hotcpu_notifier(&nv_hotcpu_nfb); -+#else -+ cpuhp_remove_state_nocalls(CPUHP_AP_ONLINE_DYN); -+#endif - #endif - } - } --- -2.7.4 - Copied: nvidia/repos/extra-x86_64/kernel_4.10.patch (from rev 295128, nvidia/repos/testing-x86_64/kernel_4.10.patch) =================================================================== --- extra-x86_64/kernel_4.10.patch (rev 0) +++ extra-x86_64/kernel_4.10.patch 2017-05-01 07:00:05 UTC (rev 295129) @@ -0,0 +1,382 @@ +From ca8b106738521823707f3567cedb41ca158792a3 Mon Sep 17 00:00:00 2001 +From: Alberto Milone <alberto.mil...@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 + + int nv_init_pat_support(nvidia_stack_t *sp) +@@ -255,7 +284,14 @@ int nv_init_pat_support(nvidia_stack_t *sp) + #if defined(NV_ENABLE_PAT_SUPPORT) && defined(NV_ENABLE_HOTPLUG_CPU) + if (nv_pat_mode == NV_PAT_MODE_BUILTIN) + { ++#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0) + if (register_hotcpu_notifier(&nv_hotcpu_nfb) != 0) ++#else ++ if (cpuhp_setup_state(CPUHP_AP_ONLINE_DYN, ++ "gpu/nvidia:online", ++ nvidia_cpu_online, ++ nvidia_cpu_down_prep) != 0) ++#endif + { + nv_disable_pat_support(); + nv_printf(NV_DBG_ERRORS, +@@ -280,7 +316,11 @@ void nv_teardown_pat_support(void) + { + nv_disable_pat_support(); + #if defined(NV_ENABLE_PAT_SUPPORT) && defined(NV_ENABLE_HOTPLUG_CPU) ++#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0) + unregister_hotcpu_notifier(&nv_hotcpu_nfb); ++#else ++ cpuhp_remove_state_nocalls(CPUHP_AP_ONLINE_DYN); ++#endif + #endif + } + } +-- +2.7.4 + Deleted: extra-x86_64/nvidia.install =================================================================== --- extra-x86_64/nvidia.install 2017-05-01 07:00:01 UTC (rev 295128) +++ extra-x86_64/nvidia.install 2017-05-01 07:00:05 UTC (rev 295129) @@ -1,13 +0,0 @@ -post_install() { - EXTRAMODULES='extramodules-4.10-ARCH' - depmod $(cat /usr/lib/modules/${EXTRAMODULES}/version) - echo 'In order to use nvidia module, reboot the system.' -} - -post_upgrade() { - post_install -} - -post_remove() { - post_install -} Copied: nvidia/repos/extra-x86_64/nvidia.install (from rev 295128, nvidia/repos/testing-x86_64/nvidia.install) =================================================================== --- extra-x86_64/nvidia.install (rev 0) +++ extra-x86_64/nvidia.install 2017-05-01 07:00:05 UTC (rev 295129) @@ -0,0 +1,13 @@ +post_install() { + EXTRAMODULES='extramodules-4.10-ARCH' + depmod $(cat /usr/lib/modules/${EXTRAMODULES}/version) + echo 'In order to use nvidia module, reboot the system.' +} + +post_upgrade() { + post_install +} + +post_remove() { + post_install +}