nvidia304: update to 304.137

This commit is contained in:
Helmut Pozimski 2017-09-20 20:18:43 +02:00
parent 6b26c8d0e8
commit 086f252db0
5 changed files with 5 additions and 234 deletions

View file

@ -1,20 +0,0 @@
Author: Luca Boccassi <luca.boccassi@gmail.com>
Description: Fix kernel module load on 4.9 and greater
From kernel 4.9 and newer (commit fa5386459f06) non-modesetting drivers have
to use the DRM flag DRIVER_LEGACY. Without this flag the kernel module does
not load correctly.
--- kernel/nv-drm.c
+++ kernel/nv-drm.c
@@ -71,7 +71,11 @@
};
static struct drm_driver nv_drm_driver = {
+#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 9, 0)
.driver_features = 0,
+#else
+ .driver_features = DRIVER_LEGACY,
+#endif
.load = nv_drm_load,
.unload = nv_drm_unload,
.fops = &nv_drm_fops,

View file

@ -1,105 +0,0 @@
From d270372bf8abcf45409b30cdb33069280527b0ff Mon Sep 17 00:00:00 2001
From: Alberto Milone <alberto.milone@canonical.com>
Date: Wed, 15 Feb 2017 18:01:02 +0100
Subject: [PATCH 1/1] Add support for Linux 4.10
---
nv-linux.h | 5 +++++
nv-pat.c | 40 ++++++++++++++++++++++++++++++++++++++++
2 files changed, 45 insertions(+)
diff --git kernel/nv-linux.h kernel/nv-linux.h
index b46e71f..3081c06 100644
--- kernel/nv-linux.h
+++ kernel/nv-linux.h
@@ -1895,8 +1895,13 @@ static inline NvU64 nv_node_end_pfn(int nid)
#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 kernel/nv-pat.c kernel/nv-pat.c
index e71e81c..d742789 100644
--- kernel/nv-pat.c
+++ kernel/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
nv_kern_cpu_callback(struct notifier_block *nfb, unsigned long action, void *hcpu)
{
@@ -234,6 +235,34 @@ static struct notifier_block nv_hotcpu_nfb = {
.notifier_call = nv_kern_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(nv_stack_t *sp)
@@ -255,7 +284,14 @@ int nv_init_pat_support(nv_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

View file

@ -1,44 +0,0 @@
--- kernel/nv-drm.c.orig
+++ kernel/nv-drm.c
@@ -22,6 +22,8 @@
#include <drm/drm_gem.h>
#endif
+#include <linux/version.h>
+
extern nv_linux_state_t *nv_linux_devices;
static int nv_drm_load(
@@ -42,7 +44,11 @@
return -ENODEV;
}
+#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 11, 0)
static int nv_drm_unload(
+#else
+static void nv_drm_unload(
+#endif
struct drm_device *dev
)
{
@@ -52,11 +58,19 @@
{
if (nvl->dev == dev->pdev)
{
+#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 11, 0)
return 0;
+#else
+ return;
+#endif
}
}
+#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 11, 0)
return -ENODEV;
+#else
+ return;
+#endif
}
static const struct file_operations nv_drm_fops = {

View file

@ -1,54 +0,0 @@
--- kernel/conftest.sh.orig
+++ kernel/conftest.sh
@@ -362,7 +362,11 @@
# Determine if the set_memory_uc() function is present.
#
CODE="
- #include <asm/cacheflush.h>
+ #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0)
+ #include <asm/set_memory.h>
+ #else
+ #include <asm/cacheflush.h>
+ #endif
void conftest_set_memory_uc(void) {
set_memory_uc();
}"
@@ -375,7 +379,11 @@
# Determine if the set_memory_array_uc() function is present.
#
CODE="
- #include <asm/cacheflush.h>
+ #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0)
+ #include <asm/set_memory.h>
+ #else
+ #include <asm/cacheflush.h>
+ #endif
void conftest_set_memory_array_uc(void) {
set_memory_array_uc();
}"
@@ -388,7 +396,11 @@
# Determine if the set_pages_uc() function is present.
#
CODE="
- #include <asm/cacheflush.h>
+ #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0)
+ #include <asm/set_memory.h>
+ #else
+ #include <asm/cacheflush.h>
+ #endif
void conftest_set_pages_uc(void) {
set_pages_uc();
}"
--- kernel/nv-vm.c.orig
+++ kernel/nv-vm.c
@@ -13,6 +13,10 @@
#include "nv.h"
#include "nv-linux.h"
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0)
+ #include <asm/set_memory.h>
+#endif
+
static inline void nv_set_contig_memory_uc(nv_pte_t *page_ptr, NvU32 num_pages)
{
if (nv_update_memory_types)

View file

@ -2,8 +2,8 @@
_desc="NVIDIA drivers (For GeForce 5 FX, 6, 7, 8 series)" _desc="NVIDIA drivers (For GeForce 5 FX, 6, 7, 8 series)"
pkgname=nvidia304 pkgname=nvidia304
version=304.135 version=304.137
revision=5 revision=1
maintainer="Juan RP <xtraeme@voidlinux.eu>" maintainer="Juan RP <xtraeme@voidlinux.eu>"
license="Proprietary NVIDIA license" license="Proprietary NVIDIA license"
homepage="http://www.nvidia.com" homepage="http://www.nvidia.com"
@ -22,11 +22,11 @@ subpackages="${pkgname}-dkms ${pkgname}-opencl ${pkgname}-libs"
if [ "${XBPS_TARGET_MACHINE}" = "i686" ]; then if [ "${XBPS_TARGET_MACHINE}" = "i686" ]; then
_pkg="NVIDIA-Linux-x86-${version}" _pkg="NVIDIA-Linux-x86-${version}"
distfiles="http://us.download.nvidia.com/XFree86/Linux-x86/${version}/${_pkg}.run" distfiles="http://us.download.nvidia.com/XFree86/Linux-x86/${version}/${_pkg}.run"
checksum=5cb0a191ddca7b4c72b3c26cd57b7d719878ce628d24b5b026a0e5c8d3a00d93 checksum=ca98379fc2090bdfe8b74113d6ac7bcc7eadbd86a489c3c4ec4cd5ba9f6064f8
else else
_pkg="NVIDIA-Linux-x86_64-${version}-no-compat32" _pkg="NVIDIA-Linux-x86_64-${version}-no-compat32"
distfiles="http://us.download.nvidia.com/XFree86/Linux-x86_64/${version}/${_pkg}.run" distfiles="http://us.download.nvidia.com/XFree86/Linux-x86_64/${version}/${_pkg}.run"
checksum=352f4a4d5ef692b26383e2cf9ec866f6973f905d53eb6bc9f2161b6ba2afae5a checksum=cd774539c322fca8328d382389a40f5aaece4c4bc562fac400f45af6ba7b78b1
fi fi
do_extract() { do_extract() {
@ -35,13 +35,7 @@ do_extract() {
./${_pkg}.run --extract-only ./${_pkg}.run --extract-only
rm -f ${_pkg}.run rm -f ${_pkg}.run
} }
do_configure() {
cd ${_pkg}
patch -sNp0 -i ${FILESDIR}/drm-driver-legacy.patch
patch -sNp0 -i ${FILESDIR}/kernel_4.10.patch
patch -sNp0 -i ${FILESDIR}/kernel_4.11.patch
patch -sNp0 -i ${FILESDIR}/kernel_4.12.patch
}
do_install() { do_install() {
cd ${_pkg} cd ${_pkg}