xf86-video-nvidia-legacy: fix build with kernel 4.12.y

This commit is contained in:
MilhouseVH 2017-07-14 21:30:56 +01:00
parent 0a1fcd15d6
commit d71a911372

View File

@ -0,0 +1,116 @@
From 5afc687f2f2fb085c5470e7cadff7c936239130a Mon Sep 17 00:00:00 2001
From: MilhouseVH <milhouseVH.github@nmacleod.com>
Date: Thu, 13 Jul 2017 06:17:12 +0100
Subject: [PATCH] Fix build with kernel 4.12.y
See: https://devtalk.nvidia.com/default/topic/1008771/linux/nvidia-340-xx-compile-error-with-kernel-4-12-rc1/post/5179612/#5179612
---
kernel/conftest.sh | 18 +++++++++++++++---
kernel/nv-vm.c | 4 ++++
kernel/uvm/conftest.sh | 18 +++++++++++++++---
3 files changed, 34 insertions(+), 6 deletions(-)
diff --git a/kernel/conftest.sh b/kernel/conftest.sh
index d74ddf3..a412a45 100755
--- a/kernel/conftest.sh
+++ b/kernel/conftest.sh
@@ -362,7 +362,11 @@ compile_test() {
# 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 @@ compile_test() {
# 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 @@ compile_test() {
# 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();
}"
diff --git a/kernel/nv-vm.c b/kernel/nv-vm.c
index 0a9e59e..ef04694 100644
--- a/kernel/nv-vm.c
+++ b/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)
diff --git a/kernel/uvm/conftest.sh b/kernel/uvm/conftest.sh
index d74ddf3..a412a45 100755
--- a/kernel/uvm/conftest.sh
+++ b/kernel/uvm/conftest.sh
@@ -362,7 +362,11 @@ compile_test() {
# 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 @@ compile_test() {
# 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 @@ compile_test() {
# 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();
}"
--
2.7.4