From dc744632a515cd35ace151af05489aa63b63ad1c Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jan=20R=C4=99korajski?= Date: Wed, 10 May 2017 22:52:34 +0200 Subject: [PATCH] - build fixes for kernel 4.11 - rel 2 --- linux-4.11.patch | 126 +++++++++++++++++++++ xorg-driver-video-nvidia-legacy-304xx.spec | 4 +- 2 files changed, 129 insertions(+), 1 deletion(-) create mode 100644 linux-4.11.patch diff --git a/linux-4.11.patch b/linux-4.11.patch new file mode 100644 index 0000000..04eb7f1 --- /dev/null +++ b/linux-4.11.patch @@ -0,0 +1,126 @@ +--- kernel/nv-linux.h ++++ kernel/nv-linux.h +@@ -2082,6 +2082,8 @@ static inline NvU64 nv_node_end_pfn(int nid) + * 2016 Dec 14:5b56d49fc31dbb0487e14ead790fc81ca9fb2c99 + */ + ++#include ++ + #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 +@@ -2129,8 +2131,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 + +--- 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 + 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(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 + } + } +--- kernel/nv-drm.c 2017-03-31 03:42:21.000000000 +0200 ++++ kernel/nv-drm.c 2017-04-06 23:53:14.273356795 +0200 +@@ -48,7 +48,7 @@ + return -ENODEV; + } + +-static int nv_drm_unload( ++static void nv_drm_unload( + struct drm_device *dev + ) + { +@@ -60,7 +60,7 @@ + { + if (nvl->dev == dev->pdev) + { +- return 0; ++ return; + } + } + +@@ -64,7 +64,7 @@ + } + } + +- return -ENODEV; ++ return; + } + + static void nv_gem_free( diff --git a/xorg-driver-video-nvidia-legacy-304xx.spec b/xorg-driver-video-nvidia-legacy-304xx.spec index 94ea8d4..b038336 100644 --- a/xorg-driver-video-nvidia-legacy-304xx.spec +++ b/xorg-driver-video-nvidia-legacy-304xx.spec @@ -25,7 +25,7 @@ exit 1 %define no_install_post_check_so 1 -%define rel 1 +%define rel 2 %define mname nvidia-legacy-304xx %define pname xorg-driver-video-%{mname} Summary: Linux Drivers for nVidia GeForce/Quadro Chips @@ -49,6 +49,7 @@ Patch0: X11-driver-nvidia-GL.patch Patch1: X11-driver-nvidia-desktop.patch Patch2: linux-4.0.patch Patch3: linux-4.10.patch +Patch4: linux-4.11.patch URL: http://www.nvidia.com/object/unix.html BuildRequires: rpmbuild(macros) >= 1.701 %{?with_kernel:%{expand:%buildrequires_kernel kernel%%{_alt_kernel}-module-build >= 3:2.6.20.2}} @@ -250,6 +251,7 @@ rm -rf NVIDIA-Linux-x86*-%{version}* %patch1 -p1 %patch2 -p1 %patch3 -p1 +%patch4 -p0 %build %{?with_kernel:%{expand:%build_kernel_packages}} -- 2.43.0