Skip to content
Snippets Groups Projects
Commit 643d3067 authored by Philip Müller's avatar Philip Müller
Browse files

Initial commit

parents
No related branches found
No related tags found
No related merge requests found
PKGBUILD 0 → 100644
##############################
# Not working with Kernel 5.9
##############################
# Maintainer: Philip Müller <philm[at]manjaro[dot]org>
# Maintainer: Bernhard Landauer <bernhard[at]manjaro[dot]org>
# Maintainer: Helmut Stult <helmut[at]manjaro[dot]org>
# Arch credits:
# Maintainer : Thomas Baechler <thomas@archlinux.org>
_linuxprefix=linux510
_extramodules=extramodules-5.10-MANJARO
# don't edit here
pkgver=390.132
_nver=390
# edit here for new version
_sver=132
# edit here for new build
pkgrel=0
pkgname=$_linuxprefix-nvidia-${_nver}xx
_pkgname=nvidia
_pkgver="${_nver}.${_sver}"
pkgdesc="NVIDIA drivers for linux."
arch=('x86_64')
url="http://www.nvidia.com/"
depends=("$_linuxprefix" "nvidia-390xx-utils=${_pkgver}")
makedepends=("$_linuxprefix-headers")
groups=("$_linuxprefix-extramodules")
provides=("nvidia=$pkgver")
conflicts=("$_linuxprefix-nvidia-340xx" "$_linuxprefix-nvidia-418xx" "$_linuxprefix-nvidia-430xx"
"$_linuxprefix-nvidia-435xx" "$_linuxprefix-nvidia-440xx" "$_linuxprefix-nvidia-450xx")
license=('custom')
install=nvidia.install
options=(!strip)
durl="http://us.download.nvidia.com/XFree86/Linux-x86"
source=("${durl}_64/${_pkgver}/NVIDIA-Linux-x86_64-${_pkgver}-no-compat32.run"
"kernel-5.5.patch" "kernel-5.6.patch" "kernel-5.7.patch" "kernel-5.8.patch")
sha256sums=('b6b4b8af37e78e026c9ebdf4a5c64ea412dfcb710931dd028c22dac228de659d'
'c72d89546b6dbd332e678800e48acbcdb29c1e1f23f986f77cee2c46b1a91e75'
'a1068603de0dbd5c4b1167a370811560313461fff71b66ee8d74adea4b596f7f'
'b5f733102fb749c5dc2a959004dd555d108989a6e375e52d46add290e0f6723f'
'96da198e7ff43d8673d79d5a7fa6b82972c85df0661753eb1cb235ccd5fdac22')
_pkg="NVIDIA-Linux-x86_64-${_pkgver}-no-compat32"
pkgver() {
printf '%s' "${_pkgver}"
}
prepare() {
sh "${_pkg}.run" --extract-only
cd "${_pkg}"
# patches here
# Fix compile problem with 5.5
msg2 "PATCH: kernel-5.5"
patch -p1 --no-backup-if-mismatch -i "$srcdir"/kernel-5.5.patch
# Fix compile problem with 5.6
msg2 "PATCH: kernel-5.6"
patch -p1 --no-backup-if-mismatch -i "$srcdir"/kernel-5.6.patch
# Fix compile problem with 5.7
msg2 "PATCH: kernel-5.7"
patch -p1 --no-backup-if-mismatch -i "$srcdir"/kernel-5.7.patch
# Fix compile problem with 5.8
msg2 "PATCH: kernel-5.8"
patch -p1 --no-backup-if-mismatch -i "$srcdir"/kernel-5.8.patch
}
build() {
_kernver="$(cat /usr/lib/modules/${_extramodules}/version)"
cd "${_pkg}"/kernel
make SYSSRC=/usr/lib/modules/"${_kernver}/build" module
}
package() {
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"
install -D -m644 "${srcdir}/${_pkg}/kernel/nvidia-uvm.ko" \
"${pkgdir}/usr/lib/modules/${_extramodules}/nvidia-uvm.ko"
gzip "${pkgdir}/usr/lib/modules/${_extramodules}/"*.ko
sed -i -e "s/EXTRAMODULES='.*'/EXTRAMODULES='${_extramodules}'/" "${startdir}/nvidia.install"
}
This diff is collapsed.
diff --git a/kernel/common/inc/nv-linux.h b/kernel/common/inc/nv-linux.h
index 85041c2..ac5bb95 100644
--- a/kernel/common/inc/nv-linux.h
+++ b/kernel/common/inc/nv-linux.h
@@ -553,7 +553,11 @@ static inline void *nv_ioremap(NvU64 phys, NvU64 size)
static inline void *nv_ioremap_nocache(NvU64 phys, NvU64 size)
{
+#if defined(NV_IOREMAP_NOCACHE_PRESENT)
void *ptr = ioremap_nocache(phys, size);
+#else
+ void *ptr = ioremap(phys, size);
+#endif
if (ptr)
NV_MEMDBG_ADD(ptr, size);
return ptr;
diff --git a/kernel/common/inc/nv-procfs.h b/kernel/common/inc/nv-procfs.h
index 3c812ea..e57c4f9 100644
--- a/kernel/common/inc/nv-procfs.h
+++ b/kernel/common/inc/nv-procfs.h
@@ -52,6 +52,19 @@
})
#endif
+#if defined(NV_HAVE_PROC_OPS)
+#define NV_CREATE_PROC_FILE(filename,parent,__name,__data) \
+ ({ \
+ struct proc_dir_entry *__entry; \
+ int mode = (S_IFREG | S_IRUGO); \
+ const struct proc_ops *fops = &nv_procfs_##__name##_fops; \
+ if (fops->proc_write != 0) \
+ mode |= S_IWUSR; \
+ __entry = NV_CREATE_PROC_ENTRY(filename, mode, parent, fops, \
+ __data); \
+ __entry; \
+ })
+#else
#define NV_CREATE_PROC_FILE(filename,parent,__name,__data) \
({ \
struct proc_dir_entry *__entry; \
@@ -63,6 +76,7 @@
__data); \
__entry; \
})
+#endif
/*
* proc_mkdir_mode exists in Linux 2.6.9, but isn't exported until Linux 3.0.
@@ -104,6 +118,24 @@
remove_proc_entry(entry->name, entry->parent);
#endif
+#if defined(NV_HAVE_PROC_OPS)
+#define NV_DEFINE_PROCFS_SINGLE_FILE(__name) \
+ static int nv_procfs_open_##__name( \
+ struct inode *inode, \
+ struct file *filep \
+ ) \
+ { \
+ return single_open(filep, nv_procfs_read_##__name, \
+ NV_PDE_DATA(inode)); \
+ } \
+ \
+ static const struct proc_ops nv_procfs_##__name##_fops = { \
+ .proc_open = nv_procfs_open_##__name, \
+ .proc_read = seq_read, \
+ .proc_lseek = seq_lseek, \
+ .proc_release = single_release, \
+ };
+#else
#define NV_DEFINE_PROCFS_SINGLE_FILE(__name) \
static int nv_procfs_open_##__name( \
struct inode *inode, \
@@ -121,6 +153,7 @@
.llseek = seq_lseek, \
.release = single_release, \
};
+#endif
#endif /* CONFIG_PROC_FS */
diff --git a/kernel/common/inc/nv-time.h b/kernel/common/inc/nv-time.h
index 2c799c9..b005363 100644
--- a/kernel/common/inc/nv-time.h
+++ b/kernel/common/inc/nv-time.h
@@ -30,7 +30,13 @@
#include <linux/ktime.h>
#endif
-static inline void nv_gettimeofday(struct timeval *tv)
+#if defined(NV_HAVE_TIMEVAL)
+#define nv_timeval timeval
+#else
+#define nv_timeval __kernel_old_timeval
+#endif
+
+static inline void nv_gettimeofday(struct nv_timeval *tv)
{
#ifdef NV_DO_GETTIMEOFDAY_PRESENT
do_gettimeofday(tv);
@@ -39,7 +45,7 @@ static inline void nv_gettimeofday(struct timeval *tv)
ktime_get_real_ts64(&now);
- *tv = (struct timeval) {
+ *tv = (struct nv_timeval) {
.tv_sec = now.tv_sec,
.tv_usec = now.tv_nsec/1000,
};
diff --git a/kernel/conftest.sh b/kernel/conftest.sh
index ec9e093..e0f937d 100755
--- a/kernel/conftest.sh
+++ b/kernel/conftest.sh
@@ -1197,6 +1197,22 @@ compile_test() {
compile_check_conftest "$CODE" "NV_IOREMAP_CACHE_PRESENT" "" "functions"
;;
+ ioremap_nocache)
+ #
+ # Determine if the ioremap_nocache() function is present.
+ #
+ # Removed by commit 4bdc0d676a64 ("remove ioremap_nocache and
+ # devm_ioremap_nocache") in v5.6 (2020-01-06)
+ #
+ CODE="
+ #include <asm/io.h>
+ void conftest_ioremap_nocache(void) {
+ ioremap_nocache();
+ }"
+
+ compile_check_conftest "$CODE" "NV_IOREMAP_NOCACHE_PRESENT" "" "functions"
+ ;;
+
ioremap_wc)
#
# Determine if the ioremap_wc() function is present.
@@ -1430,6 +1446,45 @@ compile_test() {
compile_check_conftest "$CODE" "NV_SG_ALLOC_TABLE_FROM_PAGES_PRESENT" "" "functions"
;;
+ proc_ops)
+ CODE="
+ #include <linux/proc_fs.h>
+ int conftest_proc_ops(void) {
+ return offsetof(struct proc_ops, proc_open);
+ }"
+
+ compile_check_conftest "$CODE" "NV_HAVE_PROC_OPS" "" "types"
+ ;;
+
+ timeval)
+ CODE="
+ #include <linux/time.h>
+ #if defined(NV_LINUX_KTIME_H_PRESENT)
+ #include <linux/ktime.h>
+ #endif
+ int conftest_timeval(void) {
+ return offsetof(struct timeval, tv_sec);
+ }"
+
+ compile_check_conftest "$CODE" "NV_HAVE_TIMEVAL" "" "types"
+ ;;
+
+ ktime_get_raw_ts64)
+ #
+ # Determine if the ktime_get_raw_ts64() function is present.
+ #
+ CODE="
+ #include <linux/time.h>
+ #if defined(NV_LINUX_KTIME_H_PRESENT)
+ #include <linux/ktime.h>
+ #endif
+ int conftest_ktime_get_raw_ts64(void) {
+ ktime_get_raw_ts64();
+ }"
+
+ compile_check_conftest "$CODE" "NV_KTIME_GET_RAW_TS64_PRESENT" "" "functions"
+ ;;
+
efi_enabled)
#
# Determine if the efi_enabled symbol is present, or if
diff --git a/kernel/nvidia-modeset/nvidia-modeset-linux.c b/kernel/nvidia-modeset/nvidia-modeset-linux.c
index d42aabb..f0404fb 100644
--- a/kernel/nvidia-modeset/nvidia-modeset-linux.c
+++ b/kernel/nvidia-modeset/nvidia-modeset-linux.c
@@ -216,7 +216,7 @@ void NVKMS_API_CALL nvkms_usleep(NvU64 usec)
NvU64 NVKMS_API_CALL nvkms_get_usec(void)
{
- struct timeval tv;
+ struct nv_timeval tv;
nv_gettimeofday(&tv);
diff --git a/kernel/nvidia-uvm/uvm_linux.h b/kernel/nvidia-uvm/uvm_linux.h
index 8784a82..c256cdb 100644
--- a/kernel/nvidia-uvm/uvm_linux.h
+++ b/kernel/nvidia-uvm/uvm_linux.h
@@ -329,7 +329,16 @@ static inline uint64_t NV_DIV64(uint64_t dividend, uint64_t divisor, uint64_t *r
}
#endif
-#if defined(CLOCK_MONOTONIC_RAW)
+#if defined(NV_KTIME_GET_RAW_TS64_PRESENT)
+static inline NvU64 NV_GETTIME(void)
+{
+ struct timespec64 ts64 = {0};
+
+ ktime_get_raw_ts64(&ts64);
+
+ return (ts64.tv_sec * 1000000000ULL + ts64.tv_nsec);
+}
+#elif defined(CLOCK_MONOTONIC_RAW)
/* Return a nanosecond-precise value */
static inline NvU64 NV_GETTIME(void)
{
@@ -345,7 +354,7 @@ static inline NvU64 NV_GETTIME(void)
* available non-GPL symbols. */
static inline NvU64 NV_GETTIME(void)
{
- struct timeval tv = {0};
+ struct nv_timeval tv = {0};
nv_gettimeofday(&tv);
diff --git a/kernel/nvidia/nv-procfs.c b/kernel/nvidia/nv-procfs.c
index 5808a88..bc60a08 100644
--- a/kernel/nvidia/nv-procfs.c
+++ b/kernel/nvidia/nv-procfs.c
@@ -414,6 +414,15 @@ done:
return ((status < 0) ? status : (int)count);
}
+#if defined(NV_HAVE_PROC_OPS)
+static struct proc_ops nv_procfs_registry_fops = {
+ .proc_open = nv_procfs_open_registry,
+ .proc_read = seq_read,
+ .proc_write = nv_procfs_write_file,
+ .proc_lseek = seq_lseek,
+ .proc_release = nv_procfs_close_registry,
+};
+#else
static struct file_operations nv_procfs_registry_fops = {
.owner = THIS_MODULE,
.open = nv_procfs_open_registry,
@@ -422,6 +431,7 @@ static struct file_operations nv_procfs_registry_fops = {
.llseek = seq_lseek,
.release = nv_procfs_close_registry,
};
+#endif
/*
* Forwards error to nv_log_error which exposes data to vendor callback
@@ -517,12 +527,20 @@ done:
return status;
}
+#if defined(NV_HAVE_PROC_OPS)
+static struct proc_ops nv_procfs_exercise_error_forwarding_fops = {
+ .proc_open = nv_procfs_open_exercise_error_forwarding,
+ .proc_write = nv_procfs_write_file,
+ .proc_release = nv_procfs_close_exercise_error_forwarding,
+};
+#else
static struct file_operations nv_procfs_exercise_error_forwarding_fops = {
.owner = THIS_MODULE,
.open = nv_procfs_open_exercise_error_forwarding,
.write = nv_procfs_write_file,
.release = nv_procfs_close_exercise_error_forwarding,
};
+#endif
static int
nv_procfs_read_unbind_lock(
@@ -650,6 +668,15 @@ done:
return rc;
}
+#if defined(NV_HAVE_PROC_OPS)
+static struct proc_ops nv_procfs_unbind_lock_fops = {
+ .proc_open = nv_procfs_open_unbind_lock,
+ .proc_read = seq_read,
+ .proc_write = nv_procfs_write_file,
+ .proc_lseek = seq_lseek,
+ .proc_release = nv_procfs_close_unbind_lock,
+};
+#else
static struct file_operations nv_procfs_unbind_lock_fops = {
.owner = THIS_MODULE,
.open = nv_procfs_open_unbind_lock,
@@ -658,6 +685,7 @@ static struct file_operations nv_procfs_unbind_lock_fops = {
.llseek = seq_lseek,
.release = nv_procfs_close_unbind_lock,
};
+#endif
static int
nv_procfs_read_text_file(
diff --git a/kernel/nvidia/nvidia.Kbuild b/kernel/nvidia/nvidia.Kbuild
index 8ae1016..dea8d10 100644
--- a/kernel/nvidia/nvidia.Kbuild
+++ b/kernel/nvidia/nvidia.Kbuild
@@ -117,6 +117,7 @@ NV_CONFTEST_FUNCTION_COMPILE_TESTS += on_each_cpu
NV_CONFTEST_FUNCTION_COMPILE_TESTS += smp_call_function
NV_CONFTEST_FUNCTION_COMPILE_TESTS += acpi_evaluate_integer
NV_CONFTEST_FUNCTION_COMPILE_TESTS += ioremap_cache
+NV_CONFTEST_FUNCTION_COMPILE_TESTS += ioremap_nocache
NV_CONFTEST_FUNCTION_COMPILE_TESTS += ioremap_wc
NV_CONFTEST_FUNCTION_COMPILE_TESTS += acpi_walk_namespace
NV_CONFTEST_FUNCTION_COMPILE_TESTS += pci_domain_nr
@@ -125,6 +126,7 @@ NV_CONFTEST_FUNCTION_COMPILE_TESTS += sg_alloc_table
NV_CONFTEST_FUNCTION_COMPILE_TESTS += sg_init_table
NV_CONFTEST_FUNCTION_COMPILE_TESTS += pci_get_domain_bus_and_slot
NV_CONFTEST_FUNCTION_COMPILE_TESTS += get_num_physpages
+NV_CONFTEST_FUNCTION_COMPILE_TESTS += ktime_get_raw_ts64
NV_CONFTEST_FUNCTION_COMPILE_TESTS += efi_enabled
NV_CONFTEST_FUNCTION_COMPILE_TESTS += proc_create_data
NV_CONFTEST_FUNCTION_COMPILE_TESTS += pde_data
@@ -169,7 +171,9 @@ NV_CONFTEST_TYPE_COMPILE_TESTS += outer_flush_all
NV_CONFTEST_TYPE_COMPILE_TESTS += proc_dir_entry
NV_CONFTEST_TYPE_COMPILE_TESTS += scatterlist
NV_CONFTEST_TYPE_COMPILE_TESTS += sg_table
+NV_CONFTEST_TYPE_COMPILE_TESTS += proc_ops
NV_CONFTEST_TYPE_COMPILE_TESTS += file_operations
+NV_CONFTEST_TYPE_COMPILE_TESTS += timeval
NV_CONFTEST_TYPE_COMPILE_TESTS += vm_operations_struct
NV_CONFTEST_TYPE_COMPILE_TESTS += atomic_long_type
NV_CONFTEST_TYPE_COMPILE_TESTS += pci_save_state
diff --git a/kernel/nvidia/nvlink_linux.c b/kernel/nvidia/nvlink_linux.c
index 0014280..537b257 100644
--- a/kernel/nvidia/nvlink_linux.c
+++ b/kernel/nvidia/nvlink_linux.c
@@ -518,8 +518,8 @@ void * NVLINK_API_CALL nvlink_memcpy(void *dest, void *src, NvLength size)
static NvBool nv_timer_less_than
(
- const struct timeval *a,
- const struct timeval *b
+ const struct nv_timeval *a,
+ const struct nv_timeval *b
)
{
return (a->tv_sec == b->tv_sec) ? (a->tv_usec < b->tv_usec)
@@ -528,9 +528,9 @@ static NvBool nv_timer_less_than
static void nv_timeradd
(
- const struct timeval *a,
- const struct timeval *b,
- struct timeval *result
+ const struct nv_timeval *a,
+ const struct nv_timeval *b,
+ struct nv_timeval *result
)
{
result->tv_sec = a->tv_sec + b->tv_sec;
@@ -544,9 +544,9 @@ static void nv_timeradd
static void nv_timersub
(
- const struct timeval *a,
- const struct timeval *b,
- struct timeval *result
+ const struct nv_timeval *a,
+ const struct nv_timeval *b,
+ struct nv_timeval *result
)
{
result->tv_sec = a->tv_sec - b->tv_sec;
@@ -566,7 +566,7 @@ void NVLINK_API_CALL nvlink_sleep(unsigned int ms)
unsigned long us;
unsigned long jiffies;
unsigned long mdelay_safe_msec;
- struct timeval tm_end, tm_aux;
+ struct nv_timeval tm_end, tm_aux;
nv_gettimeofday(&tm_aux);
diff --git a/kernel/nvidia/os-interface.c b/kernel/nvidia/os-interface.c
index 344daa8..39d0a19 100644
--- a/kernel/nvidia/os-interface.c
+++ b/kernel/nvidia/os-interface.c
@@ -430,7 +430,7 @@ NV_STATUS NV_API_CALL os_get_current_time(
NvU32 *useconds
)
{
- struct timeval tm;
+ struct nv_timeval tm;
nv_gettimeofday(&tm);
@@ -444,9 +444,15 @@ NV_STATUS NV_API_CALL os_get_current_time(
void NV_API_CALL os_get_current_tick(NvU64 *nseconds)
{
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 5, 0)
+ struct timespec64 ts;
+
+ jiffies_to_timespec64(jiffies, &ts);
+#else
struct timespec ts;
jiffies_to_timespec(jiffies, &ts);
+#endif
*nseconds = ((NvU64)ts.tv_sec * NSEC_PER_SEC + (NvU64)ts.tv_nsec);
}
@@ -502,7 +508,7 @@ NV_STATUS NV_API_CALL os_delay_us(NvU32 MicroSeconds)
unsigned long usec;
#ifdef NV_CHECK_DELAY_ACCURACY
- struct timeval tm1, tm2;
+ struct nv_timeval tm1, tm2;
nv_gettimeofday(&tm1);
#endif
@@ -542,9 +548,9 @@ NV_STATUS NV_API_CALL os_delay(NvU32 MilliSeconds)
unsigned long MicroSeconds;
unsigned long jiffies;
unsigned long mdelay_safe_msec;
- struct timeval tm_end, tm_aux;
+ struct nv_timeval tm_end, tm_aux;
#ifdef NV_CHECK_DELAY_ACCURACY
- struct timeval tm_start;
+ struct nv_timeval tm_start;
#endif
nv_gettimeofday(&tm_aux);
@@ -1926,7 +1932,7 @@ static NV_STATUS NV_API_CALL _os_ipmi_receive_resp
{
struct ipmi_recv_msg *rx_msg;
int err_no;
- struct timeval tv;
+ struct nv_timeval tv;
NvU64 start_time;
nv_gettimeofday(&tv);
diff --git a/kernel/conftest.sh b/kernel/conftest.sh
index 463a464..353697a 100755
--- a/kernel/conftest.sh
+++ b/kernel/conftest.sh
@@ -139,6 +139,7 @@ test_headers() {
# Arch specific headers which need testing
FILES_ARCH="asm/book3s/64/hash-64k.h"
FILES_ARCH="$FILES_ARCH asm/set_memory.h"
+ FILES_ARCH="$FILES_ARCH asm/pgtable.h"
FILES_ARCH="$FILES_ARCH asm/powernv.h"
FILES_ARCH="$FILES_ARCH asm/tlbflush.h"
@@ -422,6 +423,9 @@ compile_test() {
# Determine if the set_memory_array_uc() function is present.
#
CODE="
+ #if defined(NV_ASM_PGTABLE_H_PRESENT)
+ #include <asm/pgtable.h>
+ #endif
#if defined(NV_ASM_SET_MEMORY_H_PRESENT)
#include <asm/set_memory.h>
#else
diff --git a/kernel/common/inc/nv-linux.h b/kernel/common/inc/nv-linux.h
index ac5bb95..7f46c30 100644
--- a/kernel/common/inc/nv-linux.h
+++ b/kernel/common/inc/nv-linux.h
@@ -531,7 +531,13 @@ extern int nv_pat_mode;
static inline void *nv_vmalloc(unsigned long size)
{
+#if NV_VMALLOC_ARGUMENT_COUNT_ARGUMENT_COUNT == 3
void *ptr = __vmalloc(size, GFP_KERNEL, PAGE_KERNEL);
+#elif NV_VMALLOC_ARGUMENT_COUNT_ARGUMENT_COUNT == 2
+ void *ptr = __vmalloc(size, GFP_KERNEL);
+#else
+#error "NV_VMALLOC_ARGUMENT_COUNT_ARGUMENT_COUNT value unrecognized!"
+#endif
if (ptr)
NV_MEMDBG_ADD(ptr, size);
return ptr;
diff --git a/kernel/common/inc/nv-mm.h b/kernel/common/inc/nv-mm.h
index 51c74b4..c0f9a61 100644
--- a/kernel/common/inc/nv-mm.h
+++ b/kernel/common/inc/nv-mm.h
@@ -25,6 +25,10 @@
#include "conftest.h"
+#if defined(NV_MM_STRUCT_HAS_MMAP_LOCK)
+#define mmap_sem mmap_lock
+#endif
+
#ifndef NV_VMF_INSERT_PFN_PRESENT
typedef int vm_fault_t;
#endif
diff --git a/kernel/conftest.sh b/kernel/conftest.sh
index e2aa328..1ba22dc 100755
--- a/kernel/conftest.sh
+++ b/kernel/conftest.sh
@@ -2646,6 +2646,49 @@ compile_test() {
compile_check_conftest "$CODE" "NV_VZALLOC_PRESENT" "" "functions"
;;
+ vmalloc_argument_count)
+ #
+ # Determine how many arguments __vmalloc takes.
+ #
+ # Changed by commit fc3af83c4fca ("mm: remove the pgprot argument
+ # to __vmalloc")
+ #
+ echo "$CONFTEST_PREAMBLE
+ #include <linux/mm.h>
+ #include <linux/vmalloc.h>
+ void conftest_vmalloc_argument_count(void) {
+ __vmalloc(0, GFP_KERNEL, PAGE_KERNEL);
+ }" > conftest$$.c
+
+ $CC $CFLAGS -c conftest$$.c > /dev/null 2>&1
+ rm -f conftest$$.c
+
+ if [ -f conftest$$.o ]; then
+ echo "#define NV_VMALLOC_ARGUMENT_COUNT_ARGUMENT_COUNT 3" | append_conftest "functions"
+ else
+ echo "#define NV_VMALLOC_ARGUMENT_COUNT_ARGUMENT_COUNT 2" | append_conftest "functions"
+ fi
+
+ rm -f conftest$$.o
+ ;;
+
+ mm_struct_has_mmap_lock)
+ #
+ # Determine if the mm_struct structure has 'mmap_lock'.
+ #
+ # Changed by commit ea7b54944ef9 ("mmap locking API: rename mmap_sem
+ # to mmap_lock")
+ #
+ CODE="
+ #include <linux/mm.h>
+
+ int conftest_mm_struct_has_mmap_lock(void) {
+ return offsetof(struct mm_struct, mmap_lock);
+ }"
+
+ compile_check_conftest "$CODE" "NV_MM_STRUCT_HAS_MMAP_LOCK" "" "types"
+ ;;
+
drm_driver_has_set_busid)
#
# Determine if the drm_driver structure has a 'set_busid' callback
diff --git a/kernel/nvidia/nvidia.Kbuild b/kernel/nvidia/nvidia.Kbuild
index dea8d10..aa1bf6d 100644
--- a/kernel/nvidia/nvidia.Kbuild
+++ b/kernel/nvidia/nvidia.Kbuild
@@ -156,6 +156,7 @@ NV_CONFTEST_FUNCTION_COMPILE_TESTS += kmem_cache_create_usercopy
NV_CONFTEST_FUNCTION_COMPILE_TESTS += do_gettimeofday
NV_CONFTEST_FUNCTION_COMPILE_TESTS += dma_direct_map_resource
NV_CONFTEST_FUNCTION_COMPILE_TESTS += vmf_insert_pfn
+NV_CONFTEST_FUNCTION_COMPILE_TESTS += vmalloc_argument_count
NV_CONFTEST_SYMBOL_COMPILE_TESTS += is_export_symbol_gpl_of_node_to_nid
NV_CONFTEST_SYMBOL_COMPILE_TESTS += is_export_symbol_present_swiotlb_map_sg_attrs
@@ -193,6 +194,7 @@ NV_CONFTEST_TYPE_COMPILE_TESTS += kstrtoull
NV_CONFTEST_TYPE_COMPILE_TESTS += backlight_properties_type
NV_CONFTEST_TYPE_COMPILE_TESTS += kmem_cache_has_kobj_remove_work
NV_CONFTEST_TYPE_COMPILE_TESTS += sysfs_slab_unlink
+NV_CONFTEST_TYPE_COMPILE_TESTS += mm_struct_has_mmap_lock
NV_CONFTEST_GENERIC_COMPILE_TESTS += dom0_kernel_present
NV_CONFTEST_GENERIC_COMPILE_TESTS += nvidia_vgpu_kvm_build
post_install() {
EXTRAMODULES='extramodules-5.9-MANJARO'
depmod $(cat /usr/lib/modules/$EXTRAMODULES/version)
echo 'In order to use nvidia module, reboot the system.'
}
post_upgrade() {
EXTRAMODULES='extramodules-5.9-MANJARO'
depmod $(cat /usr/lib/modules/$EXTRAMODULES/version)
if [ "$(vercmp $2 310.19-2)" -lt 0 ]; then
echo 'If your card is from the 7xxx series or earlier, install nvidia-304xx'
fi
}
post_remove() {
EXTRAMODULES='extramodules-5.9-MANJARO'
depmod $(cat /usr/lib/modules/$EXTRAMODULES/version)
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment