nvidia kernel-5.6.4 rebuild

This commit is contained in:
akn
2020-04-14 16:19:36 +03:00
parent 5c90b1ac2b
commit c8f60af9df
11 changed files with 1659 additions and 4 deletions
@@ -30,6 +30,7 @@ def setup():
#5.5 patch icin
shelltools.move("tmp/.manifest", ".")
shelltools.system("patch -p1 < kernel-5.5.patch")
shelltools.system("patch -p1 < kernel-5.6.patch")
# Our libc is TLS enabled so use TLS library
@@ -0,0 +1,336 @@
diff -Nurp NVIDIA-Linux-x86_64-340.108.orig/kernel/conftest.sh NVIDIA-Linux-x86_64-340.108/kernel/conftest.sh
--- NVIDIA-Linux-x86_64-340.108.orig/kernel/conftest.sh 2019-12-12 00:04:24.000000000 +0200
+++ NVIDIA-Linux-x86_64-340.108/kernel/conftest.sh 2020-04-11 02:17:40.154699782 +0300
@@ -1188,6 +1188,19 @@ compile_test() {
compile_check_conftest "$CODE" "NV_IOREMAP_CACHE_PRESENT" "" "functions"
;;
+ ioremap_nocache)
+ #
+ # Determine if the ioremap_nocache() function is present.
+ #
+ 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.
@@ -1607,6 +1620,19 @@ compile_test() {
compile_check_conftest "$CODE" "NV_PROC_REMOVE_PRESENT" "" "functions"
;;
+ proc_ops)
+ #
+ # Determine if struct proc_ops is present.
+ #
+ CODE="
+ #include <linux/proc_fs.h>
+ void conftest_proc_ops(void) {
+ struct proc_ops pops;
+ }"
+
+ compile_check_conftest "$CODE" "NV_PROC_OPS_PRESENT" "" "types"
+ ;;
+
vm_operations_struct)
#
# Determine if the 'vm_operations_struct' structure has
@@ -2066,6 +2092,28 @@ compile_test() {
compile_check_conftest "$CODE" "NV_DRM_LEGACY_PCI_INIT_PRESENT" "" "functions"
;;
+ drm_pci_init)
+ #
+ # Determine if drm_pci_init() is present. drm_pci_init() was
+ # deprecated and renamed to drm_legacy_pci_init by:
+ #
+ # 2017-05-24 10631d724deff712343d96dd3017cd323349f761
+ #
+ CODE="
+ #if defined(NV_DRM_DRMP_H_PRESENT)
+ #include <drm/drmP.h>
+ #endif
+
+ #if defined(NV_DRM_DRM_PCI_H_PRESENT)
+ #include <drm/drm_pci.h>
+ #endif
+ void conftest_drm_pci_init(void) {
+ drm_pci_init();
+ }"
+
+ compile_check_conftest "$CODE" "NV_DRM_PCI_INIT_PRESENT" "" "functions"
+ ;;
+
timer_setup)
#
# Determine if the function timer_setup() is present.
@@ -2109,6 +2157,22 @@ compile_test() {
compile_check_conftest "$CODE" "NV_DO_GETTIMEOFDAY_PRESENT" "" "functions"
;;
+ timeval)
+ #
+ # Determine if timeval is present.
+ #
+ CODE="
+ #include <linux/time.h>
+ #if defined(NV_LINUX_KTIME_H_PRESENT)
+ #include <linux/ktime.h>
+ #endif
+ void conftest_timeval(void) {
+ struct timeval tv;
+ }"
+
+ compile_check_conftest "$CODE" "NV_TIMEVAL_PRESENT" "" "types"
+ ;;
+
drm_gem_object_put_unlocked)
#
# Determine if the function drm_gem_object_put_unlocked() is present.
diff -Nurp NVIDIA-Linux-x86_64-340.108.orig/kernel/Makefile NVIDIA-Linux-x86_64-340.108/kernel/Makefile
--- NVIDIA-Linux-x86_64-340.108.orig/kernel/Makefile 2019-12-12 00:04:24.000000000 +0200
+++ NVIDIA-Linux-x86_64-340.108/kernel/Makefile 2020-04-11 02:17:40.154699782 +0300
@@ -114,6 +114,7 @@ COMPILE_TESTS = \
nvmap_support \
acpi_evaluate_integer \
ioremap_cache \
+ ioremap_nocache \
ioremap_wc \
proc_dir_entry \
INIT_WORK \
@@ -132,6 +133,7 @@ COMPILE_TESTS = \
proc_create_data \
pde_data \
proc_remove \
+ proc_ops \
sg_table \
pm_vt_switch_required \
pci_save_state \
@@ -148,8 +150,10 @@ COMPILE_TESTS = \
vm_fault_has_address \
drm_driver_unload_has_int_return_type \
drm_legacy_pci_init \
+ drm_pci_init \
timer_setup \
do_gettimeofday \
+ timeval \
drm_gem_object_put_unlocked \
drm_driver_legacy_feature_bit_present \
drm_driver_prime_flag_present
diff -Nurp NVIDIA-Linux-x86_64-340.108.orig/kernel/nv-drm.c NVIDIA-Linux-x86_64-340.108/kernel/nv-drm.c
--- NVIDIA-Linux-x86_64-340.108.orig/kernel/nv-drm.c 2019-12-12 00:04:24.000000000 +0200
+++ NVIDIA-Linux-x86_64-340.108/kernel/nv-drm.c 2020-04-11 02:17:40.154699782 +0300
@@ -47,7 +47,61 @@
#include <drm/drm_gem.h>
#endif
-#if defined(NV_DRM_LEGACY_PCI_INIT_PRESENT)
+#if !defined(NV_DRM_LEGACY_PCI_INIT_PRESENT) && !defined(NV_DRM_PCI_INIT_PRESENT)
+static int nv_drm_pci_init(struct drm_driver *driver, struct pci_driver *pdriver)
+{
+ struct pci_dev *pdev = NULL;
+ const struct pci_device_id *pid;
+ int i;
+
+ DRM_DEBUG("\n");
+
+ if (WARN_ON(!(driver->driver_features & DRIVER_LEGACY)))
+ return -EINVAL;
+
+ /* If not using KMS, fall back to stealth mode manual scanning. */
+ INIT_LIST_HEAD(&driver->legacy_dev_list);
+ for (i = 0; pdriver->id_table[i].vendor != 0; i++) {
+ pid = &pdriver->id_table[i];
+
+ /* Loop around setting up a DRM device for each PCI device
+ * matching our ID and device class. If we had the internal
+ * function that pci_get_subsys and pci_get_class used, we'd
+ * be able to just pass pid in instead of doing a two-stage
+ * thing.
+ */
+ pdev = NULL;
+ while ((pdev =
+ pci_get_subsys(pid->vendor, pid->device, pid->subvendor,
+ pid->subdevice, pdev)) != NULL) {
+ if ((pdev->class & pid->class_mask) != pid->class)
+ continue;
+
+ /* stealth mode requires a manual probe */
+ pci_dev_get(pdev);
+ drm_get_pci_dev(pdev, pid, driver);
+ }
+ }
+ return 0;
+}
+
+static void nv_drm_pci_exit(struct drm_driver *driver, struct pci_driver *pdriver)
+{
+ struct drm_device *dev, *tmp;
+ DRM_DEBUG("\n");
+
+ if (!(driver->driver_features & DRIVER_LEGACY)) {
+ WARN_ON(1);
+ } else {
+ list_for_each_entry_safe(dev, tmp, &driver->legacy_dev_list,
+ legacy_dev_list) {
+ list_del(&dev->legacy_dev_list);
+ drm_put_dev(dev);
+ }
+ }
+ DRM_INFO("Module unloaded\n");
+}
+#elif defined(NV_DRM_LEGACY_PCI_INIT_PRESENT)
#define nv_drm_pci_init drm_legacy_pci_init
#define nv_drm_pci_exit drm_legacy_pci_exit
#else
diff -Nurp NVIDIA-Linux-x86_64-340.108.orig/kernel/nv-linux.h NVIDIA-Linux-x86_64-340.108/kernel/nv-linux.h
--- NVIDIA-Linux-x86_64-340.108.orig/kernel/nv-linux.h 2019-12-12 00:04:24.000000000 +0200
+++ NVIDIA-Linux-x86_64-340.108/kernel/nv-linux.h 2020-04-11 02:17:40.155699830 +0300
@@ -688,11 +688,15 @@ extern nv_spinlock_t km_lock;
VM_ALLOC_RECORD(ptr, size, "vm_ioremap"); \
}
+#if defined(NV_IOREMAP_NOCACHE_PRESENT)
#define NV_IOREMAP_NOCACHE(ptr, physaddr, size) \
{ \
(ptr) = ioremap_nocache(physaddr, size); \
VM_ALLOC_RECORD(ptr, size, "vm_ioremap_nocache"); \
}
+#else
+#define NV_IOREMAP_NOCACHE NV_IOREMAP
+#endif
#if defined(NV_IOREMAP_CACHE_PRESENT)
#define NV_IOREMAP_CACHE(ptr, physaddr, size) \
@@ -1971,6 +1975,19 @@ extern NvU32 nv_assign_gpu_count;
})
#endif
+#if defined(NV_PROC_OPS_PRESENT)
+#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; \
@@ -1982,6 +1999,7 @@ extern NvU32 nv_assign_gpu_count;
__data); \
__entry; \
})
+#endif
/*
* proc_mkdir_mode exists in Linux 2.6.9, but isn't exported until Linux 3.0.
@@ -2023,6 +2041,24 @@ extern NvU32 nv_assign_gpu_count;
remove_proc_entry(entry->name, entry->parent);
#endif
+#if defined(NV_PROC_OPS_PRESENT)
+#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, \
@@ -2040,6 +2076,7 @@ extern NvU32 nv_assign_gpu_count;
.llseek = seq_lseek, \
.release = single_release, \
};
+#endif
#endif /* CONFIG_PROC_FS */
diff -Nurp NVIDIA-Linux-x86_64-340.108.orig/kernel/nv-procfs.c NVIDIA-Linux-x86_64-340.108/kernel/nv-procfs.c
--- NVIDIA-Linux-x86_64-340.108.orig/kernel/nv-procfs.c 2019-12-12 00:04:24.000000000 +0200
+++ NVIDIA-Linux-x86_64-340.108/kernel/nv-procfs.c 2020-04-11 02:17:40.155699830 +0300
@@ -409,6 +409,15 @@ done:
return ((status < 0) ? status : (int)count);
}
+#if defined(NV_PROC_OPS_PRESENT)
+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,
@@ -417,6 +426,7 @@ static struct file_operations nv_procfs_
.llseek = seq_lseek,
.release = nv_procfs_close_registry,
};
+#endif
static int
nv_procfs_read_unbind_lock(
@@ -538,6 +548,15 @@ done:
return rc;
}
+#if defined(NV_PROC_OPS_PRESENT)
+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,
@@ -546,6 +565,7 @@ static struct file_operations nv_procfs_
.llseek = seq_lseek,
.release = nv_procfs_close_unbind_lock,
};
+#endif
static int
nv_procfs_read_text_file(
diff -Nurp NVIDIA-Linux-x86_64-340.108.orig/kernel/nv-time.h NVIDIA-Linux-x86_64-340.108/kernel/nv-time.h
--- NVIDIA-Linux-x86_64-340.108.orig/kernel/nv-time.h 2019-12-12 00:04:24.000000000 +0200
+++ NVIDIA-Linux-x86_64-340.108/kernel/nv-time.h 2020-04-11 02:17:40.155699830 +0300
@@ -28,6 +28,10 @@
#include <linux/ktime.h>
#endif
+#if !defined(NV_TIMEVAL_PRESENT)
+#define timeval __kernel_old_timeval
+#endif
+
static inline void nv_gettimeofday(struct timeval *tv)
{
#ifdef NV_DO_GETTIMEOFDAY_PRESENT
@@ -17,6 +17,7 @@
<AdditionalFile target="unfuck-340.108-build-fix.patch">unfuck-340.108-build-fix.patch</AdditionalFile>
<AdditionalFile owner="root" permission="0644" target="dkms.conf">dkms.conf</AdditionalFile>
<AdditionalFile owner="root" permission="0644" target="kernel-5.5.patch">NVIDIA-Linux-x86_64-340.108-kernel-5.5.patch</AdditionalFile>
<AdditionalFile owner="root" permission="0644" target="kernel-5.6.patch">NVIDIA-Linux-x86_64-340.108-kernel-5.6.patch</AdditionalFile>
</AdditionalFiles>
<BuildDependencies>
<Dependency version="5.6.4">kernel-module-headers</Dependency>
@@ -57,9 +57,15 @@ def build():
if get.buildTYPE() == 'emul32':
return
#kernel 5.6.4 32 bit patch hatası
elif get.ARCH() == "x86_64":
shelltools.system("patch -p1 < kernel-5.6-uvm.patch")
shelltools.export("SYSSRC", "/lib/modules/%s/build" % KDIR)
shelltools.cd("kernel")
autotools.make("module")
#shelltools.cd("uvm")
@@ -0,0 +1,30 @@
diff -Nurp NVIDIA-Linux-x86_64-390.132.orig/kernel/nvidia-uvm/uvm_linux.h NVIDIA-Linux-x86_64-390.132/kernel/nvidia-uvm/uvm_linux.h
--- NVIDIA-Linux-x86_64-390.132.orig/kernel/nvidia-uvm/uvm_linux.h 2019-11-01 14:37:49.000000000 +0200
+++ NVIDIA-Linux-x86_64-390.132/kernel/nvidia-uvm/uvm_linux.h 2020-04-11 01:44:45.233557933 +0300
@@ -329,7 +329,16 @@ static inline uint64_t NV_DIV64(uint64_t
}
#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);
@@ -0,0 +1,375 @@
diff -Nurp NVIDIA-Linux-x86_64-390.132.orig/kernel/common/inc/nv-linux.h NVIDIA-Linux-x86_64-390.132/kernel/common/inc/nv-linux.h
--- NVIDIA-Linux-x86_64-390.132.orig/kernel/common/inc/nv-linux.h 2019-11-01 14:37:47.000000000 +0200
+++ NVIDIA-Linux-x86_64-390.132/kernel/common/inc/nv-linux.h 2020-04-11 01:44:45.232557886 +0300
@@ -553,7 +553,11 @@ static inline void *nv_ioremap(NvU64 phy
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 -Nurp NVIDIA-Linux-x86_64-390.132.orig/kernel/common/inc/nv-procfs.h NVIDIA-Linux-x86_64-390.132/kernel/common/inc/nv-procfs.h
--- NVIDIA-Linux-x86_64-390.132.orig/kernel/common/inc/nv-procfs.h 2019-11-01 14:37:47.000000000 +0200
+++ NVIDIA-Linux-x86_64-390.132/kernel/common/inc/nv-procfs.h 2020-04-11 01:44:45.232557886 +0300
@@ -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 -Nurp NVIDIA-Linux-x86_64-390.132.orig/kernel/common/inc/nv-time.h NVIDIA-Linux-x86_64-390.132/kernel/common/inc/nv-time.h
--- NVIDIA-Linux-x86_64-390.132.orig/kernel/common/inc/nv-time.h 2019-11-01 14:37:47.000000000 +0200
+++ NVIDIA-Linux-x86_64-390.132/kernel/common/inc/nv-time.h 2020-04-11 01:44:45.232557886 +0300
@@ -30,7 +30,12 @@
#include <linux/ktime.h>
#endif
-static inline void nv_gettimeofday(struct timeval *tv)
+struct nv_timeval {
+ __kernel_long_t tv_sec;
+ __kernel_suseconds_t tv_usec;
+};
+
+static inline void nv_gettimeofday(struct nv_timeval *tv)
{
#ifdef NV_DO_GETTIMEOFDAY_PRESENT
do_gettimeofday(tv);
@@ -39,7 +44,7 @@ static inline void nv_gettimeofday(struc
ktime_get_real_ts64(&now);
- *tv = (struct timeval) {
+ *tv = (struct nv_timeval) {
.tv_sec = now.tv_sec,
.tv_usec = now.tv_nsec/1000,
};
diff -Nurp NVIDIA-Linux-x86_64-390.132.orig/kernel/conftest.sh NVIDIA-Linux-x86_64-390.132/kernel/conftest.sh
--- NVIDIA-Linux-x86_64-390.132.orig/kernel/conftest.sh 2020-04-11 01:44:21.688440269 +0300
+++ NVIDIA-Linux-x86_64-390.132/kernel/conftest.sh 2020-04-11 01:44:45.233557933 +0300
@@ -1189,6 +1189,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.
@@ -1422,6 +1438,31 @@ 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"
+ ;;
+
+ ktime_get_raw_ts64)
+ #
+ # Determine if the ktime_get_raw_ts64() function is present.
+ #
+ CODE="
+ #include <linux/ktime.h>
+ int conftest_ktime_get_raw_ts64(void) {
+ struct timespec64 ts = {0};
+
+ ktime_get_raw_ts64(&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 -Nurp NVIDIA-Linux-x86_64-390.132.orig/kernel/nvidia/nvidia.Kbuild NVIDIA-Linux-x86_64-390.132/kernel/nvidia/nvidia.Kbuild
--- NVIDIA-Linux-x86_64-390.132.orig/kernel/nvidia/nvidia.Kbuild 2019-11-01 12:31:51.000000000 +0200
+++ NVIDIA-Linux-x86_64-390.132/kernel/nvidia/nvidia.Kbuild 2020-04-11 01:44:45.233557933 +0300
@@ -117,6 +117,7 @@ NV_CONFTEST_FUNCTION_COMPILE_TESTS += on
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
@@ -169,7 +170,9 @@ NV_CONFTEST_TYPE_COMPILE_TESTS += outer_
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 += ktime_get_raw_ts64
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 -Nurp NVIDIA-Linux-x86_64-390.132.orig/kernel/nvidia/nvlink_linux.c NVIDIA-Linux-x86_64-390.132/kernel/nvidia/nvlink_linux.c
--- NVIDIA-Linux-x86_64-390.132.orig/kernel/nvidia/nvlink_linux.c 2019-11-01 14:37:55.000000000 +0200
+++ NVIDIA-Linux-x86_64-390.132/kernel/nvidia/nvlink_linux.c 2020-04-11 01:44:45.233557933 +0300
@@ -518,8 +518,8 @@ void * NVLINK_API_CALL nvlink_memcpy(voi
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(unsign
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 -Nurp NVIDIA-Linux-x86_64-390.132.orig/kernel/nvidia/nv-procfs.c NVIDIA-Linux-x86_64-390.132/kernel/nvidia/nv-procfs.c
--- NVIDIA-Linux-x86_64-390.132.orig/kernel/nvidia/nv-procfs.c 2019-11-01 14:37:47.000000000 +0200
+++ NVIDIA-Linux-x86_64-390.132/kernel/nvidia/nv-procfs.c 2020-04-11 01:44:45.233557933 +0300
@@ -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_
.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_
.llseek = seq_lseek,
.release = nv_procfs_close_unbind_lock,
};
+#endif
static int
nv_procfs_read_text_file(
diff -Nurp NVIDIA-Linux-x86_64-390.132.orig/kernel/nvidia/os-interface.c NVIDIA-Linux-x86_64-390.132/kernel/nvidia/os-interface.c
--- NVIDIA-Linux-x86_64-390.132.orig/kernel/nvidia/os-interface.c 2019-11-01 14:37:47.000000000 +0200
+++ NVIDIA-Linux-x86_64-390.132/kernel/nvidia/os-interface.c 2020-04-11 01:44:45.233557933 +0300
@@ -430,7 +430,7 @@ NV_STATUS NV_API_CALL os_get_current_tim
NvU32 *useconds
)
{
- struct timeval tm;
+ struct nv_timeval tm;
nv_gettimeofday(&tm);
@@ -444,9 +444,15 @@ NV_STATUS NV_API_CALL os_get_current_tim
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
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 Mil
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_re
{
struct ipmi_recv_msg *rx_msg;
int err_no;
- struct timeval tv;
+ struct nv_timeval tv;
NvU64 start_time;
nv_gettimeofday(&tv);
diff -Nurp NVIDIA-Linux-x86_64-390.132.orig/kernel/nvidia-modeset/nvidia-modeset-linux.c NVIDIA-Linux-x86_64-390.132/kernel/nvidia-modeset/nvidia-modeset-linux.c
--- NVIDIA-Linux-x86_64-390.132.orig/kernel/nvidia-modeset/nvidia-modeset-linux.c 2019-11-01 14:37:54.000000000 +0200
+++ NVIDIA-Linux-x86_64-390.132/kernel/nvidia-modeset/nvidia-modeset-linux.c 2020-04-11 01:44:45.233557933 +0300
@@ -216,7 +216,7 @@ void NVKMS_API_CALL nvkms_usleep(NvU64 u
NvU64 NVKMS_API_CALL nvkms_get_usec(void)
{
- struct timeval tv;
+ struct nv_timeval tv;
nv_gettimeofday(&tv);
@@ -1,2 +1,397 @@
blacklist nouveau
options nouveau modeset=0
.manifest | 1 +
kernel/common/inc/nv-drm.h | 36 ++++++++++++++++++++++++++++++++++++
kernel/conftest.sh | 31 +++++++++++++++++++++++++++++++
kernel/nvidia-drm/nvidia-drm-connector.c | 14 ++++++++++++++
kernel/nvidia-drm/nvidia-drm-connector.h | 2 +-
kernel/nvidia-drm/nvidia-drm-crtc.h | 2 +-
kernel/nvidia-drm/nvidia-drm-drv.c | 2 +-
kernel/nvidia-drm/nvidia-drm-encoder.h | 2 +-
kernel/nvidia-drm/nvidia-drm-fb.h | 2 +-
kernel/nvidia-drm/nvidia-drm-gem.h | 2 +-
kernel/nvidia-drm/nvidia-drm-helper.c | 2 +-
kernel/nvidia-drm/nvidia-drm-helper.h | 2 +-
kernel/nvidia-drm/nvidia-drm-modeset.h | 2 +-
kernel/nvidia-drm/nvidia-drm-os-interface.h | 2 +-
kernel/nvidia-drm/nvidia-drm-prime-fence.h | 2 +-
kernel/nvidia-drm/nvidia-drm-priv.h | 2 +-
kernel/nvidia-drm/nvidia-drm-utils.h | 2 +-
17 files changed, 95 insertions(+), 13 deletions(-)
diff -Nurp NVIDIA-Linux-x86_64-390.132.orig/kernel/common/inc/nv-drm.h NVIDIA-Linux-x86_64-390.132/kernel/common/inc/nv-drm.h
--- NVIDIA-Linux-x86_64-390.132.orig/kernel/common/inc/nv-drm.h 1970-01-01 02:00:00.000000000 +0200
+++ NVIDIA-Linux-x86_64-390.132/kernel/common/inc/nv-drm.h 2020-02-09 22:37:55.798547949 +0200
@@ -0,0 +1,36 @@
+#ifndef _NV_DRM_H_
+#define _NV_DRM_H_
+
+#include "conftest.h"
+
+#if defined(NV_DRM_DRMP_H_PRESENT)
+#include <drm/drmP.h>
+#else
+#include <linux/agp_backend.h>
+#include <linux/file.h>
+#include <linux/init.h>
+#include <linux/jiffies.h>
+#include <linux/kernel.h>
+#include <linux/mutex.h>
+#include <linux/slab.h>
+#include <linux/types.h>
+#include <asm/pgalloc.h>
+#include <linux/uaccess.h>
+
+#include <uapi/drm/drm.h>
+#include <uapi/drm/drm_mode.h>
+
+#include <drm/drm_agpsupport.h>
+#include <drm/drm_crtc.h>
+#include <drm/drm_drv.h>
+#include <drm/drm_prime.h>
+#include <drm/drm_pci.h>
+#include <drm/drm_ioctl.h>
+#include <drm/drm_sysfs.h>
+#include <drm/drm_vblank.h>
+#include <drm/drm_device.h>
+
+#include <drm/drm_gem.h>
+#endif
+
+#endif
diff -Nurp NVIDIA-Linux-x86_64-390.132.orig/kernel/conftest.sh NVIDIA-Linux-x86_64-390.132/kernel/conftest.sh
--- NVIDIA-Linux-x86_64-390.132.orig/kernel/conftest.sh 2019-11-01 11:39:53.000000000 +0200
+++ NVIDIA-Linux-x86_64-390.132/kernel/conftest.sh 2020-02-09 22:37:55.799547995 +0200
@@ -1678,6 +1678,9 @@ compile_test() {
CODE="
#if defined(NV_DRM_DRMP_H_PRESENT)
#include <drm/drmP.h>
+ #else
+ #include <drm/drm_drv.h>
+ #include <drm/drm_prime.h>
#endif
#if !defined(CONFIG_DRM) && !defined(CONFIG_DRM_MODULE)
#error DRM not enabled
@@ -2266,6 +2269,8 @@ compile_test() {
echo "$CONFTEST_PREAMBLE
#if defined(NV_DRM_DRMP_H_PRESENT)
#include <drm/drmP.h>
+ #else
+ #include <drm/drm_drv.h>
#endif
#include <drm/drm_atomic.h>
#if !defined(CONFIG_DRM) && !defined(CONFIG_DRM_MODULE)
@@ -2384,7 +2389,11 @@ compile_test() {
# 2013-12-11 b3f2333de8e81b089262b26d52272911523e605f
#
CODE="
+ #if defined(NV_DRM_DRMP_H_PRESENT)
#include <drm/drmP.h>
+ #else
+ #include <drm/drm_drv.h>
+ #endif
int conftest_drm_driver_has_legacy_dev_list(void) {
return offsetof(struct drm_driver, legacy_dev_list);
}"
@@ -2408,7 +2417,11 @@ compile_test() {
# 2017-07-23 e6fc3b68558e4c6d8d160b5daf2511b99afa8814
#
CODE="
+ #if defined(NV_DRM_DRMP_H_PRESENT)
#include <drm/drmP.h>
+ #else
+ #include <drm/drm_crtc.h>
+ #endif
int conftest_drm_crtc_init_with_planes_has_name_arg(void) {
return
@@ -2424,7 +2437,11 @@ compile_test() {
compile_check_conftest "$CODE" "NV_DRM_CRTC_INIT_WITH_PLANES_HAS_NAME_ARG" "" "types"
CODE="
+ #if defined(NV_DRM_DRMP_H_PRESENT)
#include <drm/drmP.h>
+ #else
+ #include <drm/drm_encoder.h>
+ #endif
int conftest_drm_encoder_init_has_name_arg(void) {
return
@@ -2439,7 +2456,11 @@ compile_test() {
compile_check_conftest "$CODE" "NV_DRM_ENCODER_INIT_HAS_NAME_ARG" "" "types"
echo "$CONFTEST_PREAMBLE
+ #if defined(NV_DRM_DRMP_H_PRESENT)
#include <drm/drmP.h>
+ #else
+ #include <drm/drm_plane.h>
+ #endif
int conftest_drm_universal_plane_init_has_format_modifiers_arg(void) {
return
@@ -2466,7 +2487,11 @@ compile_test() {
echo "#undef NV_DRM_UNIVERSAL_PLANE_INIT_HAS_FORMAT_MODIFIERS_ARG" | append_conftest "types"
echo "$CONFTEST_PREAMBLE
+ #if defined(NV_DRM_DRMP_H_PRESENT)
#include <drm/drmP.h>
+ #else
+ #include <drm/drm_plane.h>
+ #endif
int conftest_drm_universal_plane_init_has_name_arg(void) {
return
@@ -3605,7 +3630,9 @@ compile_test() {
# Introduce drm_framebuffer_{get,put}()) on 2017-02-28.
#
CODE="
+ #if defined(NV_DRM_DRMP_H_PRESENT)
#include <drm/drmP.h>
+ #endif
#if defined(NV_DRM_DRM_FRAMEBUFFER_H_PRESENT)
#include <drm/drm_framebuffer.h>
#endif
@@ -3624,7 +3651,9 @@ compile_test() {
# Introduce drm_gem_object_{get,put}()) on 2017-02-28.
#
CODE="
+ #if defined(NV_DRM_DRMP_H_PRESENT)
#include <drm/drmP.h>
+ #endif
#if defined(NV_DRM_DRM_GEM_H_PRESENT)
#include <drm/drm_gem.h>
#endif
@@ -3643,7 +3672,9 @@ compile_test() {
# introduce drm_dev_{get/put} functions) on 2017-09-26.
#
CODE="
+ #if defined(NV_DRM_DRMP_H_PRESENT)
#include <drm/drmP.h>
+ #endif
#if defined(NV_DRM_DRM_DRV_H_PRESENT)
#include <drm/drm_drv.h>
#endif
diff -Nurp NVIDIA-Linux-x86_64-390.132.orig/kernel/nvidia-drm/nvidia-drm-connector.c NVIDIA-Linux-x86_64-390.132/kernel/nvidia-drm/nvidia-drm-connector.c
--- NVIDIA-Linux-x86_64-390.132.orig/kernel/nvidia-drm/nvidia-drm-connector.c 2019-11-01 14:37:55.000000000 +0200
+++ NVIDIA-Linux-x86_64-390.132/kernel/nvidia-drm/nvidia-drm-connector.c 2020-02-09 22:37:55.799547995 +0200
@@ -20,6 +20,8 @@
* DEALINGS IN THE SOFTWARE.
*/
+#include <linux/version.h>
+
#include "nvidia-drm-conftest.h" /* NV_DRM_ATOMIC_MODESET_AVAILABLE */
#if defined(NV_DRM_ATOMIC_MODESET_AVAILABLE)
@@ -71,7 +73,11 @@ static enum drm_connector_status __nv_dr
struct nv_drm_encoder *nv_detected_encoder = NULL;
struct NvKmsKapiDynamicDisplayParams *pDetectParams = NULL;
+#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 5, 0)
unsigned int i;
+#else
+ struct drm_encoder *encoder = NULL;
+#endif
BUG_ON(!mutex_is_locked(&dev->mode_config.mutex));
@@ -87,11 +93,16 @@ static enum drm_connector_status __nv_dr
goto done;
}
+#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 5, 0)
for (i = 0;
i < DRM_CONNECTOR_MAX_ENCODER && detected_encoder == NULL; i++) {
struct drm_encoder *encoder;
+#else
+ drm_connector_for_each_possible_encoder(connector, encoder) {
+#endif
struct nv_drm_encoder *nv_encoder;
+#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 5, 0)
if (connector->encoder_ids[i] == 0) {
break;
}
@@ -102,6 +113,7 @@ static enum drm_connector_status __nv_dr
BUG_ON(encoder != NULL);
continue;
}
+#endif
/*
* DVI-I connectors can drive both digital and analog
@@ -169,6 +181,8 @@ static enum drm_connector_status __nv_dr
}
detected_encoder = encoder;
+
+ break;
}
}
diff -Nurp NVIDIA-Linux-x86_64-390.132.orig/kernel/nvidia-drm/nvidia-drm-connector.h NVIDIA-Linux-x86_64-390.132/kernel/nvidia-drm/nvidia-drm-connector.h
--- NVIDIA-Linux-x86_64-390.132.orig/kernel/nvidia-drm/nvidia-drm-connector.h 2019-11-01 14:37:54.000000000 +0200
+++ NVIDIA-Linux-x86_64-390.132/kernel/nvidia-drm/nvidia-drm-connector.h 2020-02-09 22:37:55.799547995 +0200
@@ -27,7 +27,7 @@
#if defined(NV_DRM_ATOMIC_MODESET_AVAILABLE)
-#include <drm/drmP.h>
+#include "nv-drm.h"
#include "nvtypes.h"
#include "nvkms-api-types.h"
diff -Nurp NVIDIA-Linux-x86_64-390.132.orig/kernel/nvidia-drm/nvidia-drm-crtc.h NVIDIA-Linux-x86_64-390.132/kernel/nvidia-drm/nvidia-drm-crtc.h
--- NVIDIA-Linux-x86_64-390.132.orig/kernel/nvidia-drm/nvidia-drm-crtc.h 2019-11-01 14:37:54.000000000 +0200
+++ NVIDIA-Linux-x86_64-390.132/kernel/nvidia-drm/nvidia-drm-crtc.h 2020-02-09 22:37:55.799547995 +0200
@@ -29,7 +29,7 @@
#include "nvidia-drm-helper.h"
-#include <drm/drmP.h>
+#include "nv-drm.h"
#include "nvtypes.h"
#include "nvkms-kapi.h"
diff -Nurp NVIDIA-Linux-x86_64-390.132.orig/kernel/nvidia-drm/nvidia-drm-drv.c NVIDIA-Linux-x86_64-390.132/kernel/nvidia-drm/nvidia-drm-drv.c
--- NVIDIA-Linux-x86_64-390.132.orig/kernel/nvidia-drm/nvidia-drm-drv.c 2019-11-01 14:37:54.000000000 +0200
+++ NVIDIA-Linux-x86_64-390.132/kernel/nvidia-drm/nvidia-drm-drv.c 2020-02-09 22:37:55.799547995 +0200
@@ -39,7 +39,7 @@
#include "nvidia-drm-ioctl.h"
-#include <drm/drmP.h>
+#include "nv-drm.h"
/*
* Commit fcd70cd36b9b ("drm: Split out drm_probe_helper.h")
diff -Nurp NVIDIA-Linux-x86_64-390.132.orig/kernel/nvidia-drm/nvidia-drm-encoder.h NVIDIA-Linux-x86_64-390.132/kernel/nvidia-drm/nvidia-drm-encoder.h
--- NVIDIA-Linux-x86_64-390.132.orig/kernel/nvidia-drm/nvidia-drm-encoder.h 2019-11-01 14:37:54.000000000 +0200
+++ NVIDIA-Linux-x86_64-390.132/kernel/nvidia-drm/nvidia-drm-encoder.h 2020-02-09 22:37:55.799547995 +0200
@@ -32,7 +32,7 @@
#if defined(NV_DRM_DRM_ENCODER_H_PRESENT)
#include <drm/drm_encoder.h>
#else
-#include <drm/drmP.h>
+#include "nv-drm.h"
#endif
#include "nvkms-kapi.h"
diff -Nurp NVIDIA-Linux-x86_64-390.132.orig/kernel/nvidia-drm/nvidia-drm-fb.h NVIDIA-Linux-x86_64-390.132/kernel/nvidia-drm/nvidia-drm-fb.h
--- NVIDIA-Linux-x86_64-390.132.orig/kernel/nvidia-drm/nvidia-drm-fb.h 2019-11-01 14:37:54.000000000 +0200
+++ NVIDIA-Linux-x86_64-390.132/kernel/nvidia-drm/nvidia-drm-fb.h 2020-02-09 22:37:55.799547995 +0200
@@ -27,7 +27,7 @@
#if defined(NV_DRM_ATOMIC_MODESET_AVAILABLE)
-#include <drm/drmP.h>
+#include "nv-drm.h"
#include "nvidia-drm-gem-nvkms-memory.h"
#include "nvkms-kapi.h"
diff -Nurp NVIDIA-Linux-x86_64-390.132.orig/kernel/nvidia-drm/nvidia-drm-gem.h NVIDIA-Linux-x86_64-390.132/kernel/nvidia-drm/nvidia-drm-gem.h
--- NVIDIA-Linux-x86_64-390.132.orig/kernel/nvidia-drm/nvidia-drm-gem.h 2019-11-01 14:37:54.000000000 +0200
+++ NVIDIA-Linux-x86_64-390.132/kernel/nvidia-drm/nvidia-drm-gem.h 2020-02-09 22:37:55.799547995 +0200
@@ -29,7 +29,7 @@
#include "nvidia-drm-priv.h"
-#include <drm/drmP.h>
+#include "nv-drm.h"
#include "nvkms-kapi.h"
#if defined(NV_DRM_DRIVER_HAS_GEM_PRIME_RES_OBJ)
diff -Nurp NVIDIA-Linux-x86_64-390.132.orig/kernel/nvidia-drm/nvidia-drm-helper.c NVIDIA-Linux-x86_64-390.132/kernel/nvidia-drm/nvidia-drm-helper.c
--- NVIDIA-Linux-x86_64-390.132.orig/kernel/nvidia-drm/nvidia-drm-helper.c 2019-11-01 14:37:54.000000000 +0200
+++ NVIDIA-Linux-x86_64-390.132/kernel/nvidia-drm/nvidia-drm-helper.c 2020-02-09 22:37:55.799547995 +0200
@@ -31,7 +31,7 @@
#if defined(NV_DRM_ATOMIC_MODESET_AVAILABLE)
-#include <drm/drmP.h>
+#include "nv-drm.h"
#if defined(NV_DRM_DRM_ATOMIC_UAPI_H_PRESENT)
#include <drm/drm_atomic_uapi.h>
#endif
diff -Nurp NVIDIA-Linux-x86_64-390.132.orig/kernel/nvidia-drm/nvidia-drm-helper.h NVIDIA-Linux-x86_64-390.132/kernel/nvidia-drm/nvidia-drm-helper.h
--- NVIDIA-Linux-x86_64-390.132.orig/kernel/nvidia-drm/nvidia-drm-helper.h 2019-11-01 14:37:54.000000000 +0200
+++ NVIDIA-Linux-x86_64-390.132/kernel/nvidia-drm/nvidia-drm-helper.h 2020-02-09 22:37:55.799547995 +0200
@@ -27,7 +27,7 @@
#if defined(NV_DRM_AVAILABLE)
-#include <drm/drmP.h>
+#include "nv-drm.h"
/*
* drm_dev_put() is added by commit 9a96f55034e41b4e002b767e9218d55f03bdff7d
diff -Nurp NVIDIA-Linux-x86_64-390.132.orig/kernel/nvidia-drm/nvidia-drm-modeset.h NVIDIA-Linux-x86_64-390.132/kernel/nvidia-drm/nvidia-drm-modeset.h
--- NVIDIA-Linux-x86_64-390.132.orig/kernel/nvidia-drm/nvidia-drm-modeset.h 2019-11-01 14:37:54.000000000 +0200
+++ NVIDIA-Linux-x86_64-390.132/kernel/nvidia-drm/nvidia-drm-modeset.h 2020-02-09 22:37:55.799547995 +0200
@@ -27,7 +27,7 @@
#if defined(NV_DRM_ATOMIC_MODESET_AVAILABLE)
-#include <drm/drmP.h>
+#include "nv-drm.h"
struct drm_atomic_state *nv_drm_atomic_state_alloc(struct drm_device *dev);
void nv_drm_atomic_state_clear(struct drm_atomic_state *state);
diff -Nurp NVIDIA-Linux-x86_64-390.132.orig/kernel/nvidia-drm/nvidia-drm-os-interface.h NVIDIA-Linux-x86_64-390.132/kernel/nvidia-drm/nvidia-drm-os-interface.h
--- NVIDIA-Linux-x86_64-390.132.orig/kernel/nvidia-drm/nvidia-drm-os-interface.h 2019-11-01 14:37:54.000000000 +0200
+++ NVIDIA-Linux-x86_64-390.132/kernel/nvidia-drm/nvidia-drm-os-interface.h 2020-02-09 22:37:55.799547995 +0200
@@ -29,7 +29,7 @@
#if defined(NV_DRM_AVAILABLE)
-#include <drm/drmP.h>
+#include "nv-drm.h"
/* Set to true when the atomic modeset feature is enabled. */
extern bool nv_drm_modeset_module_param;
diff -Nurp NVIDIA-Linux-x86_64-390.132.orig/kernel/nvidia-drm/nvidia-drm-prime-fence.h NVIDIA-Linux-x86_64-390.132/kernel/nvidia-drm/nvidia-drm-prime-fence.h
--- NVIDIA-Linux-x86_64-390.132.orig/kernel/nvidia-drm/nvidia-drm-prime-fence.h 2019-11-01 14:37:54.000000000 +0200
+++ NVIDIA-Linux-x86_64-390.132/kernel/nvidia-drm/nvidia-drm-prime-fence.h 2020-02-09 22:37:55.799547995 +0200
@@ -27,7 +27,7 @@
#if defined(NV_DRM_AVAILABLE)
-#include <drm/drmP.h>
+#include "nv-drm.h"
#if defined(NV_DRM_DRIVER_HAS_GEM_PRIME_RES_OBJ)
diff -Nurp NVIDIA-Linux-x86_64-390.132.orig/kernel/nvidia-drm/nvidia-drm-priv.h NVIDIA-Linux-x86_64-390.132/kernel/nvidia-drm/nvidia-drm-priv.h
--- NVIDIA-Linux-x86_64-390.132.orig/kernel/nvidia-drm/nvidia-drm-priv.h 2019-11-01 14:37:54.000000000 +0200
+++ NVIDIA-Linux-x86_64-390.132/kernel/nvidia-drm/nvidia-drm-priv.h 2020-02-09 22:37:55.799547995 +0200
@@ -27,7 +27,7 @@
#if defined(NV_DRM_AVAILABLE)
-#include <drm/drmP.h>
+#include "nv-drm.h"
#if defined(NV_DRM_DRM_GEM_H_PRESENT)
#include <drm/drm_gem.h>
diff -Nurp NVIDIA-Linux-x86_64-390.132.orig/kernel/nvidia-drm/nvidia-drm-utils.h NVIDIA-Linux-x86_64-390.132/kernel/nvidia-drm/nvidia-drm-utils.h
--- NVIDIA-Linux-x86_64-390.132.orig/kernel/nvidia-drm/nvidia-drm-utils.h 2019-11-01 14:37:54.000000000 +0200
+++ NVIDIA-Linux-x86_64-390.132/kernel/nvidia-drm/nvidia-drm-utils.h 2020-02-09 22:37:55.799547995 +0200
@@ -27,7 +27,7 @@
#if defined(NV_DRM_ATOMIC_MODESET_AVAILABLE)
-#include <drm/drmP.h>
+#include "nv-drm.h"
#include "nvkms-kapi.h"
struct NvKmsKapiConnectorInfo*
diff -Nurp NVIDIA-Linux-x86_64-390.132.orig/.manifest NVIDIA-Linux-x86_64-390.132/.manifest
--- NVIDIA-Linux-x86_64-390.132.orig/.manifest 2019-11-01 10:31:50.000000000 +0200
+++ NVIDIA-Linux-x86_64-390.132/.manifest 2020-02-09 22:37:55.798547949 +0200
@@ -37,6 +37,7 @@ kernel/nvidia/nv-ibmnpu.c 0644 KERNEL_MO
kernel/nvidia/nv-report-err.c 0644 KERNEL_MODULE_SRC INHERIT_PATH_DEPTH:1 MODULE:resman
kernel/conftest.sh 0644 KERNEL_MODULE_SRC INHERIT_PATH_DEPTH:1 MODULE:resman
kernel/common/inc/nv.h 0644 KERNEL_MODULE_SRC INHERIT_PATH_DEPTH:1 MODULE:resman
+kernel/common/inc/nv-drm.h 0644 KERNEL_MODULE_SRC INHERIT_PATH_DEPTH:1 MODULE:resman
kernel/common/inc/nv-pgprot.h 0644 KERNEL_MODULE_SRC INHERIT_PATH_DEPTH:1 MODULE:resman
kernel/common/inc/nv-mm.h 0644 KERNEL_MODULE_SRC INHERIT_PATH_DEPTH:1 MODULE:resman
kernel/common/inc/nv-timer.h 0644 KERNEL_MODULE_SRC INHERIT_PATH_DEPTH:1 MODULE:resman
+3 -2
View File
@@ -16,7 +16,8 @@
<AdditionalFiles>
<AdditionalFile owner="root" permission="0644" target="dkms.conf">dkms.conf</AdditionalFile>
<AdditionalFile owner="root" permission="0644" target="kernel-5.5.patch">NVIDIA-Linux-x86_64-390.132-kernel-5.5.patch</AdditionalFile>
<AdditionalFile owner="root" permission="0644" target="kernel-5.6.patch">kernel-5.6.patch</AdditionalFile>
<AdditionalFile owner="root" permission="0644" target="kernel-5.6.patch">NVIDIA-Linux-x86_64-390.132-kernel-5.6.patch</AdditionalFile>
<AdditionalFile owner="root" permission="0644" target="kernel-5.6-uvm.patch">NVIDIA-Linux-x86_64-390.132-kernel-5.6-uvm.patch</AdditionalFile>
</AdditionalFiles>
<BuildDependencies>
<Dependency version="5.6.4">kernel-module-headers</Dependency>
@@ -172,7 +173,7 @@
<Date>2020-04-15</Date>
<Version>390.132</Version>
<Comment>Rebuild.</Comment>
<Name>Mustafa Cinasal Bojara</Name>
<Name>Mustafa Cinasal</Name>
<Email>muscnsl@gmail.com</Email>
</Update>
<Update release="7">
@@ -31,6 +31,7 @@ def setup():
shelltools.system("patch -p1 < NVIDIA-Linux-x86_64-430.64-work-around-mga-bug-25890.patch")
shelltools.system("patch -p1 < NVIDIA-Linux-x86_64-430.64-kernel-5.5.patch")
shelltools.system("patch -p1 < kernel-5.6.patch")
# Our libc is TLS enabled so use TLS library
@@ -0,0 +1,508 @@
diff -Nurp NVIDIA-Linux-x86_64-430.64.orig/kernel/common/inc/nv-linux.h NVIDIA-Linux-x86_64-430.64/kernel/common/inc/nv-linux.h
--- NVIDIA-Linux-x86_64-430.64.orig/kernel/common/inc/nv-linux.h 2019-10-27 13:48:11.000000000 +0200
+++ NVIDIA-Linux-x86_64-430.64/kernel/common/inc/nv-linux.h 2020-04-11 01:30:24.576641371 +0300
@@ -534,7 +534,11 @@ static inline void *nv_ioremap(NvU64 phy
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 -Nurp NVIDIA-Linux-x86_64-430.64.orig/kernel/common/inc/nv-procfs.h NVIDIA-Linux-x86_64-430.64/kernel/common/inc/nv-procfs.h
--- NVIDIA-Linux-x86_64-430.64.orig/kernel/common/inc/nv-procfs.h 2020-04-11 01:29:29.475036592 +0300
+++ NVIDIA-Linux-x86_64-430.64/kernel/common/inc/nv-procfs.h 2020-04-11 01:28:48.300091052 +0300
@@ -28,6 +28,18 @@
#define IS_EXERCISE_ERROR_FORWARDING_ENABLED() (EXERCISE_ERROR_FORWARDING)
+#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 = proc_create_data(filename, mode, parent, fops, __data);\
+ __entry; \
+ })
+#else
#define NV_CREATE_PROC_FILE(filename,parent,__name,__data) \
({ \
struct proc_dir_entry *__entry; \
@@ -38,6 +50,7 @@
__entry = proc_create_data(filename, mode, parent, fops, __data);\
__entry; \
})
+#endif
/*
* proc_mkdir_mode exists in Linux 2.6.9, but isn't exported until Linux 3.0.
@@ -77,6 +90,44 @@
remove_proc_entry(entry->name, entry->parent);
#endif
+#if defined(NV_HAVE_PROC_OPS)
+#define NV_DEFINE_SINGLE_PROCFS_FILE(name, open_callback, close_callback) \
+ static int nv_procfs_open_##name( \
+ struct inode *inode, \
+ struct file *filep \
+ ) \
+ { \
+ int ret; \
+ ret = single_open(filep, nv_procfs_read_##name, \
+ NV_PDE_DATA(inode)); \
+ if (ret < 0) \
+ { \
+ return ret; \
+ } \
+ ret = open_callback(); \
+ if (ret < 0) \
+ { \
+ single_release(inode, filep); \
+ } \
+ return ret; \
+ } \
+ \
+ static int nv_procfs_release_##name( \
+ struct inode *inode, \
+ struct file *filep \
+ ) \
+ { \
+ close_callback(); \
+ return single_release(inode, filep); \
+ } \
+ \
+ 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 = nv_procfs_release_##name, \
+ };
+#else
#define NV_DEFINE_SINGLE_PROCFS_FILE(name, open_callback, close_callback) \
static int nv_procfs_open_##name( \
struct inode *inode, \
@@ -114,6 +165,7 @@
.llseek = seq_lseek, \
.release = nv_procfs_release_##name, \
};
+#endif
#endif /* CONFIG_PROC_FS */
diff -Nurp NVIDIA-Linux-x86_64-430.64.orig/kernel/common/inc/nv-time.h NVIDIA-Linux-x86_64-430.64/kernel/common/inc/nv-time.h
--- NVIDIA-Linux-x86_64-430.64.orig/kernel/common/inc/nv-time.h 2020-04-11 01:29:29.475036592 +0300
+++ NVIDIA-Linux-x86_64-430.64/kernel/common/inc/nv-time.h 2020-04-11 01:28:48.300091052 +0300
@@ -27,7 +27,12 @@
#include <linux/ktime.h>
-static inline void nv_gettimeofday(struct timeval *tv)
+struct nv_timeval {
+ __kernel_long_t tv_sec;
+ __kernel_suseconds_t tv_usec;
+};
+
+static inline void nv_gettimeofday(struct nv_timeval *tv)
{
#ifdef NV_DO_GETTIMEOFDAY_PRESENT
do_gettimeofday(tv);
@@ -36,7 +41,7 @@ static inline void nv_gettimeofday(struc
ktime_get_real_ts64(&now);
- *tv = (struct timeval) {
+ *tv = (struct nv_timeval) {
.tv_sec = now.tv_sec,
.tv_usec = now.tv_nsec/1000,
};
diff -Nurp NVIDIA-Linux-x86_64-430.64.orig/kernel/conftest.sh NVIDIA-Linux-x86_64-430.64/kernel/conftest.sh
--- NVIDIA-Linux-x86_64-430.64.orig/kernel/conftest.sh 2020-04-11 01:29:29.476036639 +0300
+++ NVIDIA-Linux-x86_64-430.64/kernel/conftest.sh 2020-04-11 01:28:48.300091052 +0300
@@ -777,6 +777,46 @@ compile_test() {
compile_check_conftest "$CODE" "NV_FILE_OPERATIONS_HAS_IOCTL" "" "types"
;;
+ 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"
+ ;;
+
+ ktime_get_raw_ts64)
+ #
+ # Determine if the ktime_get_raw_ts64() function is present.
+ #
+ CODE="
+ #include <linux/ktime.h>
+ int conftest_ktime_get_raw_ts64(void) {
+ struct timespec64 ts = {0};
+
+ ktime_get_raw_ts64(&ts64);
+ }"
+
+ compile_check_conftest "$CODE" "NV_KTIME_GET_RAW_TS64_PRESENT" "" "functions"
+ ;;
+
+ ktime_get_real_ts64)
+ #
+ # Determine if the ktime_get_real_ts64() function is present.
+ #
+ CODE="
+ #include <linux/ktime.h>
+ int conftest_ktime_get_raw_ts64(void) {
+ struct timespec64 ts = {0};
+
+ ktime_get_real_ts64(&ts64);
+ }"
+
+ compile_check_conftest "$CODE" "NV_KTIME_GET_REAL_TS64_PRESENT" "" "functions"
+ ;;
+
sg_alloc_table)
#
# sg_alloc_table_from_pages added by commit efc42bc98058
diff -Nurp NVIDIA-Linux-x86_64-430.64.orig/kernel/nvidia/linux_nvswitch.c NVIDIA-Linux-x86_64-430.64/kernel/nvidia/linux_nvswitch.c
--- NVIDIA-Linux-x86_64-430.64.orig/kernel/nvidia/linux_nvswitch.c 2020-04-11 01:29:29.476036639 +0300
+++ NVIDIA-Linux-x86_64-430.64/kernel/nvidia/linux_nvswitch.c 2020-04-11 01:28:48.301091099 +0300
@@ -1581,10 +1581,17 @@ nvswitch_os_get_platform_time
void
)
{
+#if defined(NV_KTIME_GET_REAL_TS64_PRESENT)
+ struct timespec64 ts64;
+
+ ktime_get_real_ts64(&ts64);
+ return ((NvU64)(ts64.tv_sec * NSEC_PER_SEC) + ts64.tv_nsec);
+#else
struct timespec ts;
getnstimeofday(&ts);
return ((NvU64) timespec_to_ns(&ts));
+#endif
}
void
diff -Nurp NVIDIA-Linux-x86_64-430.64.orig/kernel/nvidia/nvidia.Kbuild NVIDIA-Linux-x86_64-430.64/kernel/nvidia/nvidia.Kbuild
--- NVIDIA-Linux-x86_64-430.64.orig/kernel/nvidia/nvidia.Kbuild 2020-04-11 01:29:29.476036639 +0300
+++ NVIDIA-Linux-x86_64-430.64/kernel/nvidia/nvidia.Kbuild 2020-04-11 01:28:48.301091099 +0300
@@ -149,6 +149,9 @@ NV_CONFTEST_TYPE_COMPILE_TESTS += acpi_o
NV_CONFTEST_TYPE_COMPILE_TESTS += outer_flush_all
NV_CONFTEST_TYPE_COMPILE_TESTS += scatterlist
NV_CONFTEST_TYPE_COMPILE_TESTS += file_operations
+NV_CONFTEST_TYPE_COMPILE_TESTS += proc_ops
+NV_CONFTEST_TYPE_COMPILE_TESTS += ktime_get_raw_ts64
+NV_CONFTEST_TYPE_COMPILE_TESTS += ktime_get_real_ts64
NV_CONFTEST_TYPE_COMPILE_TESTS += vm_operations_struct
NV_CONFTEST_TYPE_COMPILE_TESTS += atomic_long_type
NV_CONFTEST_TYPE_COMPILE_TESTS += file_inode
diff -Nurp NVIDIA-Linux-x86_64-430.64.orig/kernel/nvidia/nvlink_linux.c NVIDIA-Linux-x86_64-430.64/kernel/nvidia/nvlink_linux.c
--- NVIDIA-Linux-x86_64-430.64.orig/kernel/nvidia/nvlink_linux.c 2020-04-11 01:29:29.476036639 +0300
+++ NVIDIA-Linux-x86_64-430.64/kernel/nvidia/nvlink_linux.c 2020-04-11 01:28:48.301091099 +0300
@@ -510,8 +510,8 @@ void * NVLINK_API_CALL nvlink_memcpy(voi
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)
@@ -520,9 +520,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;
@@ -536,9 +536,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;
@@ -558,7 +558,7 @@ void NVLINK_API_CALL nvlink_sleep(unsign
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 -Nurp NVIDIA-Linux-x86_64-430.64.orig/kernel/nvidia/nv-procfs.c NVIDIA-Linux-x86_64-430.64/kernel/nvidia/nv-procfs.c
--- NVIDIA-Linux-x86_64-430.64.orig/kernel/nvidia/nv-procfs.c 2020-04-11 01:29:29.476036639 +0300
+++ NVIDIA-Linux-x86_64-430.64/kernel/nvidia/nv-procfs.c 2020-04-11 01:28:48.301091099 +0300
@@ -482,6 +482,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,
@@ -490,6 +499,7 @@ static struct file_operations nv_procfs_
.llseek = seq_lseek,
.release = nv_procfs_close_registry,
};
+#endif
#if defined(CONFIG_PM)
static int
@@ -561,6 +571,15 @@ nv_procfs_open_suspend_depth(
return single_open(file, nv_procfs_show_suspend_depth, NULL);
}
+#if defined(NV_HAVE_PROC_OPS)
+static struct proc_ops nv_procfs_suspend_depth_fops = {
+ .proc_open = nv_procfs_open_suspend_depth,
+ .proc_read = seq_read,
+ .proc_write = nv_procfs_write_suspend_depth,
+ .proc_lseek = seq_lseek,
+ .proc_release = single_release
+};
+#else
static struct file_operations nv_procfs_suspend_depth_fops = {
.owner = THIS_MODULE,
.open = nv_procfs_open_suspend_depth,
@@ -569,6 +588,7 @@ static struct file_operations nv_procfs_
.llseek = seq_lseek,
.release = single_release
};
+#endif
static int
nv_procfs_show_suspend(
@@ -643,6 +663,15 @@ nv_procfs_open_suspend(
return single_open(file, nv_procfs_show_suspend, NULL);
}
+#if defined(NV_HAVE_PROC_OPS)
+static struct proc_ops nv_procfs_suspend_fops = {
+ .proc_open = nv_procfs_open_suspend,
+ .proc_read = seq_read,
+ .proc_write = nv_procfs_write_suspend,
+ .proc_lseek = seq_lseek,
+ .proc_release = single_release
+};
+#else
static struct file_operations nv_procfs_suspend_fops = {
.owner = THIS_MODULE,
.open = nv_procfs_open_suspend,
@@ -652,6 +681,7 @@ static struct file_operations nv_procfs_
.release = single_release
};
#endif
+#endif
/*
* Forwards error to nv_log_error which exposes data to vendor callback
@@ -754,12 +784,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(
@@ -881,6 +919,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,
@@ -889,6 +936,7 @@ static struct file_operations nv_procfs_
.llseek = seq_lseek,
.release = nv_procfs_close_unbind_lock,
};
+#endif
static const char*
numa_status_describe(nv_numa_status_t state)
@@ -1217,6 +1265,22 @@ done:
return retval;
}
+#if defined(NV_HAVE_PROC_OPS)
+static const struct proc_ops nv_procfs_numa_status_fops = {
+ .proc_open = nv_procfs_open_numa_status,
+ .proc_read = seq_read,
+ .proc_write = nv_procfs_write_file,
+ .proc_lseek = seq_lseek,
+ .proc_release = nv_procfs_close_numa_status,
+};
+
+static const struct proc_ops nv_procfs_offline_pages_fops = {
+ .proc_open = nv_procfs_open_offline_pages,
+ .proc_read = seq_read,
+ .proc_lseek = seq_lseek,
+ .proc_release = nv_procfs_close_offline_pages,
+};
+#else
static const struct file_operations nv_procfs_numa_status_fops = {
.owner = THIS_MODULE,
.open = nv_procfs_open_numa_status,
@@ -1233,6 +1297,7 @@ static const struct file_operations nv_p
.llseek = seq_lseek,
.release = nv_procfs_close_offline_pages,
};
+#endif
static int
nv_procfs_read_text_file(
diff -Nurp NVIDIA-Linux-x86_64-430.64.orig/kernel/nvidia/os-interface.c NVIDIA-Linux-x86_64-430.64/kernel/nvidia/os-interface.c
--- NVIDIA-Linux-x86_64-430.64.orig/kernel/nvidia/os-interface.c 2020-04-11 01:29:29.476036639 +0300
+++ NVIDIA-Linux-x86_64-430.64/kernel/nvidia/os-interface.c 2020-04-11 01:28:48.301091099 +0300
@@ -452,7 +452,7 @@ NV_STATUS NV_API_CALL os_get_current_tim
NvU32 *useconds
)
{
- struct timeval tm;
+ struct nv_timeval tm;
nv_gettimeofday(&tm);
@@ -466,9 +466,15 @@ NV_STATUS NV_API_CALL os_get_current_tim
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);
}
@@ -538,7 +544,7 @@ NV_STATUS NV_API_CALL os_delay_us(NvU32
unsigned long usec;
#ifdef NV_CHECK_DELAY_ACCURACY
- struct timeval tm1, tm2;
+ struct nv_timeval tm1, tm2;
nv_gettimeofday(&tm1);
#endif
@@ -578,9 +584,9 @@ NV_STATUS NV_API_CALL os_delay(NvU32 Mil
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);
@@ -1925,7 +1931,7 @@ static NV_STATUS NV_API_CALL _os_ipmi_re
{
struct ipmi_recv_msg *rx_msg;
int err_no;
- struct timeval tv;
+ struct nv_timeval tv;
NvU64 start_time;
nv_gettimeofday(&tv);
diff -Nurp NVIDIA-Linux-x86_64-430.64.orig/kernel/nvidia-modeset/nvidia-modeset-linux.c NVIDIA-Linux-x86_64-430.64/kernel/nvidia-modeset/nvidia-modeset-linux.c
--- NVIDIA-Linux-x86_64-430.64.orig/kernel/nvidia-modeset/nvidia-modeset-linux.c 2020-04-11 01:29:29.477036687 +0300
+++ NVIDIA-Linux-x86_64-430.64/kernel/nvidia-modeset/nvidia-modeset-linux.c 2020-04-11 01:28:48.302091146 +0300
@@ -279,7 +279,7 @@ void NVKMS_API_CALL nvkms_usleep(NvU64 u
NvU64 NVKMS_API_CALL nvkms_get_usec(void)
{
- struct timeval tv;
+ struct nv_timeval tv;
nv_gettimeofday(&tv);
diff -Nurp NVIDIA-Linux-x86_64-430.64.orig/kernel/nvidia-uvm/uvm_linux.h NVIDIA-Linux-x86_64-430.64/kernel/nvidia-uvm/uvm_linux.h
--- NVIDIA-Linux-x86_64-430.64.orig/kernel/nvidia-uvm/uvm_linux.h 2020-04-11 01:29:29.477036687 +0300
+++ NVIDIA-Linux-x86_64-430.64/kernel/nvidia-uvm/uvm_linux.h 2020-04-11 01:28:48.302091146 +0300
@@ -298,7 +298,16 @@ static inline uint64_t NV_DIV64(uint64_t
}
#endif
-#if defined(CLOCK_MONOTONIC_RAW)
+#if defined(NV_KTIME_GET_RAW_TS64_PRESENT)
+static inline NvU64 NV_GETTIME(void)
+{
+ struct timespec64 ts;
+
+ ktime_get_raw_ts64(&ts);
+
+ return (ts.tv_sec * 1000000000ULL + ts.tv_nsec);
+}
+#elif defined(CLOCK_MONOTONIC_RAW)
/* Return a nanosecond-precise value */
static inline NvU64 NV_GETTIME(void)
{
@@ -314,7 +323,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);
@@ -21,6 +21,7 @@
<AdditionalFiles>
<AdditionalFile owner="root" permission="0644" target="dkms.conf">dkms.conf</AdditionalFile>
<AdditionalFile owner="root" permission="0644" target="NVIDIA-Linux-x86_64-430.64-kernel-5.5.patch">mageia/NVIDIA-Linux-x86_64-430.64-kernel-5.5.patch</AdditionalFile>
<AdditionalFile owner="root" permission="0644" target="kernel-5.6.patch">mageia/NVIDIA-Linux-x86_64-430.64-kernel-5.6.patch</AdditionalFile>
<AdditionalFile owner="root" permission="0644" target="NVIDIA-Linux-x86_64-430.64-work-around-mga-bug-25890.patch">mageia/NVIDIA-Linux-x86_64-430.64-work-around-mga-bug-25890.patch</AdditionalFile>
</AdditionalFiles>
</Source>