Merge pull request #4075 from MilhouseVH/nvidia-340.108

xf86-video-nvidia-legacy: update to xf86-video-nvidia-legacy-340.108
This commit is contained in:
Jernej Škrabec 2019-12-28 19:27:17 +01:00 committed by GitHub
commit 385cf5a50b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 2 additions and 383 deletions

View File

@ -3,8 +3,8 @@
# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv)
PKG_NAME="xf86-video-nvidia-legacy"
PKG_VERSION="340.107"
PKG_SHA256="6dc6f183c69c414670d8adef0286a2362eedd6e16ec6dfae811e48ea4a4505dc"
PKG_VERSION="340.108"
PKG_SHA256="995d44fef587ff5284497a47a95d71adbee0c13020d615e940ac928f180f5b77"
PKG_ARCH="x86_64"
PKG_LICENSE="nonfree"
PKG_SITE="http://www.nvidia.com/"

View File

@ -1,257 +0,0 @@
From 8ca52f318962cf0f5d4fba74f676c4c58940d7a6 Mon Sep 17 00:00:00 2001
From: MilhouseVH <milhouseVH.github@nmacleod.com>
Date: Fri, 22 Feb 2019 21:19:00 +0000
Subject: [PATCH] fix build for 5.0
Source: https://devtalk.nvidia.com/default/topic/1047179/linux/-solved-nvidia-340-107-linux-5-0-rc5-failed-to-build-kernel-module/post/5315771/#5315771
---
kernel/Makefile | 2 ++
kernel/conftest.sh | 33 +++++++++++++++++++++++++++++++++
kernel/nv-drm.c | 12 +++++++++++-
kernel/nv-time.h | 24 ++++++++++++++++++++++++
kernel/os-interface.c | 13 +++++++------
kernel/uvm/Makefile | 1 +
kernel/uvm/nvidia_uvm_linux.h | 1 +
kernel/uvm/nvidia_uvm_lite.c | 4 ++--
8 files changed, 81 insertions(+), 9 deletions(-)
create mode 100644 kernel/nv-time.h
diff --git a/kernel/Makefile b/kernel/Makefile
index 8ac3c1a..1959dce 100644
--- a/kernel/Makefile
+++ b/kernel/Makefile
@@ -147,6 +147,8 @@ COMPILE_TESTS = \
vm_fault_present \
vm_fault_has_address \
drm_driver_unload_has_int_return_type \
+ drm_gem_object_get \
+ do_gettimeofday \
drm_legacy_pci_init \
timer_setup
#
diff --git a/kernel/conftest.sh b/kernel/conftest.sh
index 64d75a1..fb0bf60 100755
--- a/kernel/conftest.sh
+++ b/kernel/conftest.sh
@@ -168,6 +168,7 @@ test_headers() {
FILES="$FILES linux/sched/task.h"
FILES="$FILES xen/ioemu.h"
FILES="$FILES linux/fence.h"
+ FILES="$FILES linux/ktime.h"
FILES_ARCH="$FILES_ARCH asm/set_memory.h"
@@ -1971,6 +1972,38 @@ compile_test() {
compile_check_conftest "$CODE" "NV_DRM_DRIVER_UNLOAD_HAS_INT_RETURN_TYPE" "" "types"
;;
+ drm_gem_object_get)
+ #
+ # Determine if the function drm_gem_object_get() is present.
+ #
+ CODE="
+ #include <drm/drmP.h>
+ #if defined(NV_DRM_DRM_GEM_H_PRESENT)
+ #include <drm/drm_gem.h>
+ #endif
+ void conftest_drm_gem_object_get(void) {
+ drm_gem_object_get();
+ }"
+
+ compile_check_conftest "$CODE" "NV_DRM_GEM_OBJECT_GET_PRESENT" "" "functions"
+ ;;
+
+ do_gettimeofday)
+ #
+ # Determine if the function do_gettimeofday() is present.
+ #
+ CODE="
+ #include <linux/time.h>
+ #if defined(NV_LINUX_KTIME_H_PRESENT)
+ #include <linux/ktime.h>
+ #endif
+ void conftest_do_gettimeofday(void) {
+ do_gettimeofday();
+ }"
+
+ compile_check_conftest "$CODE" "NV_DO_GETTIMEOFDAY_PRESENT" "" "functions"
+ ;;
+
drm_legacy_pci_init)
#
# Determine if drm_legacy_pci_init() is present. drm_pci_init() was
diff --git a/kernel/nv-drm.c b/kernel/nv-drm.c
index 0eb72e4..1c968de 100644
--- a/kernel/nv-drm.c
+++ b/kernel/nv-drm.c
@@ -37,6 +37,16 @@ struct nv_gem_object {
struct page **pages;
};
+static inline void
+nv_drm_gem_object_unreference_unlocked(struct nv_gem_object *nv_gem)
+{
+#if defined(NV_DRM_GEM_OBJECT_GET_PRESENT)
+ drm_gem_object_put_unlocked(&nv_gem->base);
+#else
+ drm_gem_object_unreference_unlocked(&nv_gem->base);
+#endif
+}
+
static int nv_drm_load(
struct drm_device *dev,
unsigned long flags
@@ -252,7 +262,7 @@ RM_STATUS NV_API_CALL nv_alloc_os_descriptor_handle(
goto done;
}
- drm_gem_object_unreference_unlocked(&nv_obj->base);
+ nv_drm_gem_object_unreference_unlocked(nv_obj);
status = RM_OK;
diff --git a/kernel/nv-time.h b/kernel/nv-time.h
new file mode 100644
index 0000000..cc828aa
--- /dev/null
+++ b/kernel/nv-time.h
@@ -0,0 +1,24 @@
+#ifndef __NV_TIME_H__
+#define __NV_TIME_H__
+
+#include "conftest.h"
+#include <linux/time.h>
+
+#if defined(NV_LINUX_KTIME_H_PRESENT)
+#include <linux/ktime.h>
+#endif
+
+static inline void nv_gettimeofday(struct timeval *tv)
+{
+#ifdef NV_DO_GETTIMEOFDAY_PRESENT
+ do_gettimeofday(tv);
+#else
+ struct timespec64 now;
+
+ ktime_get_real_ts64(&now);
+ tv->tv_sec = now.tv_sec;
+ tv->tv_usec = now.tv_nsec/1000;
+#endif
+}
+
+#endif
diff --git a/kernel/os-interface.c b/kernel/os-interface.c
index 7e3d362..7190b26 100644
--- a/kernel/os-interface.c
+++ b/kernel/os-interface.c
@@ -13,6 +13,7 @@
#include "os-interface.h"
#include "nv-linux.h"
+#include "nv-time.h"
RM_STATUS NV_API_CALL os_disable_console_access(void)
{
@@ -440,7 +441,7 @@ RM_STATUS NV_API_CALL os_get_current_time(
{
struct timeval tm;
- do_gettimeofday(&tm);
+ nv_gettimeofday(&tm);
*seconds = tm.tv_sec;
*useconds = tm.tv_usec;
@@ -475,7 +476,7 @@ RM_STATUS NV_API_CALL os_delay_us(NvU32 MicroSeconds)
#ifdef NV_CHECK_DELAY_ACCURACY
struct timeval tm1, tm2;
- do_gettimeofday(&tm1);
+ nv_gettimeofday(&tm1);
#endif
if (in_irq() && (MicroSeconds > NV_MAX_ISR_DELAY_US))
@@ -490,7 +491,7 @@ RM_STATUS NV_API_CALL os_delay_us(NvU32 MicroSeconds)
udelay(usec);
#ifdef NV_CHECK_DELAY_ACCURACY
- do_gettimeofday(&tm2);
+ nv_gettimeofday(&tm2);
nv_printf(NV_DBG_ERRORS, "NVRM: osDelayUs %d: 0x%x 0x%x\n",
MicroSeconds, tm2.tv_sec - tm1.tv_sec, tm2.tv_usec - tm1.tv_usec);
#endif
@@ -518,7 +519,7 @@ RM_STATUS NV_API_CALL os_delay(NvU32 MilliSeconds)
struct timeval tm_start;
#endif
- do_gettimeofday(&tm_aux);
+ nv_gettimeofday(&tm_aux);
#ifdef NV_CHECK_DELAY_ACCURACY
tm_start = tm_aux;
#endif
@@ -552,7 +553,7 @@ RM_STATUS NV_API_CALL os_delay(NvU32 MilliSeconds)
do
{
schedule_timeout(jiffies);
- do_gettimeofday(&tm_aux);
+ nv_gettimeofday(&tm_aux);
if (NV_TIMERCMP(&tm_aux, &tm_end, <))
{
NV_TIMERSUB(&tm_end, &tm_aux, &tm_aux);
@@ -574,7 +575,7 @@ RM_STATUS NV_API_CALL os_delay(NvU32 MilliSeconds)
udelay(MicroSeconds);
}
#ifdef NV_CHECK_DELAY_ACCURACY
- do_gettimeofday(&tm_aux);
+ nv_gettimeofday(&tm_aux);
timersub(&tm_aux, &tm_start, &tm_aux);
nv_printf(NV_DBG_ERRORS, "NVRM: osDelay %dmsec: %d.%06dsec\n",
MilliSeconds, tm_aux.tv_sec, tm_aux.tv_usec);
diff --git a/kernel/uvm/Makefile b/kernel/uvm/Makefile
index 42ad927..5c7b466 100644
--- a/kernel/uvm/Makefile
+++ b/kernel/uvm/Makefile
@@ -171,6 +171,7 @@ COMPILE_TESTS = \
kbasename \
fatal_signal_pending \
kuid_t \
+ do_gettimeofday \
vm_fault_has_address
MODULE_NAME:= nvidia-uvm
diff --git a/kernel/uvm/nvidia_uvm_linux.h b/kernel/uvm/nvidia_uvm_linux.h
index 1625209..1edb620 100644
--- a/kernel/uvm/nvidia_uvm_linux.h
+++ b/kernel/uvm/nvidia_uvm_linux.h
@@ -146,6 +146,7 @@
#include <linux/interrupt.h> /* tasklets, interrupt helpers */
#include <linux/timer.h>
#include <linux/time.h> /* do_gettimeofday()*/
+#include "nv-time.h"
#include <asm/div64.h> /* do_div() */
#if defined(NV_ASM_SYSTEM_H_PRESENT)
diff --git a/kernel/uvm/nvidia_uvm_lite.c b/kernel/uvm/nvidia_uvm_lite.c
index 246ed04..8bcf548 100644
--- a/kernel/uvm/nvidia_uvm_lite.c
+++ b/kernel/uvm/nvidia_uvm_lite.c
@@ -2008,7 +2008,7 @@ static RM_STATUS _check_ecc_errors(UvmGpuMigrationTracking *pMigTracker,
{
if (!!(rmInterruptSet) && !bEccIncomingError)
{
- do_gettimeofday(&eccErrorStartTime);
+ nv_gettimeofday(&eccErrorStartTime);
_set_timeout_in_usec(&eccErrorStartTime, &eccTimeout,
UVM_ECC_ERR_TIMEOUT_USEC);
@@ -2040,7 +2040,7 @@ static RM_STATUS _check_ecc_errors(UvmGpuMigrationTracking *pMigTracker,
//
if (!!(rmInterruptSet) && (eccErrorStartTime.tv_usec != 0))
{
- do_gettimeofday(&eccErrorCurrentTime);
+ nv_gettimeofday(&eccErrorCurrentTime);
if ((eccErrorCurrentTime.tv_sec > eccTimeout.tv_sec) ||
((eccErrorCurrentTime.tv_sec == eccTimeout.tv_sec) &&
(eccErrorCurrentTime.tv_usec >= eccTimeout.tv_usec)))
--
2.14.1

View File

@ -1,16 +0,0 @@
diff -Nur nv/kernel/nv-drm.c nv2/kernel/nv-drm.c
--- nv/kernel/nv-drm.c 2018-05-25 06:16:20.000000000 +0200
+++ nv2/kernel/nv-drm.c 2019-05-09 20:51:33.364278935 +0200
@@ -146,11 +146,7 @@
};
static struct drm_driver nv_drm_driver = {
-#if defined(DRIVER_LEGACY)
.driver_features = DRIVER_GEM | DRIVER_PRIME | DRIVER_LEGACY,
-#else
- .driver_features = DRIVER_GEM | DRIVER_PRIME,
-#endif
.load = nv_drm_load,
.unload = nv_drm_unload,
.fops = &nv_drm_fops,

View File

@ -1,56 +0,0 @@
From ed289eab447108005a21ca8f85d90b8cb721712d Mon Sep 17 00:00:00 2001
From: MilhouseVH <milhouseVH.github@nmacleod.com>
Date: Mon, 22 Jul 2019 12:40:01 +0100
Subject: [PATCH] on_each_cpu/smp_call_function: with 5.3-rc1 ignore return, as
always 0
See: https://github.com/torvalds/linux/commit/e0e86b111bca6bbf746c03ec5cf3e6a61fa3f8e9
---
kernel/nv-linux.h | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/kernel/nv-linux.h b/kernel/nv-linux.h
index 4043bf1..10ba6a4 100644
--- a/kernel/nv-linux.h
+++ b/kernel/nv-linux.h
@@ -873,14 +873,14 @@ extern void *nv_stack_t_cache;
#if (NV_SMP_CALL_FUNCTION_ARGUMENT_COUNT == 4)
#define NV_SMP_CALL_FUNCTION(func, info, wait) \
({ \
- int __ret = smp_call_function(func, info, 1, wait); \
- __ret; \
+ smp_call_function(func, info, 1, wait); \
+ 0; \
})
#elif (NV_SMP_CALL_FUNCTION_ARGUMENT_COUNT == 3)
#define NV_SMP_CALL_FUNCTION(func, info, wait) \
({ \
- int __ret = smp_call_function(func, info, wait); \
- __ret; \
+ smp_call_function(func, info, wait); \
+ 0; \
})
#else
#error "NV_SMP_CALL_FUNCTION_ARGUMENT_COUNT value unrecognized!"
@@ -893,14 +893,14 @@ extern void *nv_stack_t_cache;
#if (NV_ON_EACH_CPU_ARGUMENT_COUNT == 4)
#define NV_ON_EACH_CPU(func, info, wait) \
({ \
- int __ret = on_each_cpu(func, info, 1, wait); \
- __ret; \
+ on_each_cpu(func, info, 1, wait); \
+ 0; \
})
#elif (NV_ON_EACH_CPU_ARGUMENT_COUNT == 3)
#define NV_ON_EACH_CPU(func, info, wait) \
({ \
- int __ret = on_each_cpu(func, info, wait); \
- __ret; \
+ on_each_cpu(func, info, wait); \
+ 0; \
})
#else
#error "NV_ON_EACH_CPU_ARGUMENT_COUNT value unrecognized!"
--
2.14.1

View File

@ -1,26 +0,0 @@
From dbff36065f2359d8ba0e6e359428998f20208f8b Mon Sep 17 00:00:00 2001
From: MilhouseVH <milhouseVH.github@nmacleod.com>
Date: Tue, 1 Oct 2019 16:20:08 +0100
Subject: [PATCH] DRIVER_PRIME: remove it for 5.4-rc1
Ref: https://github.com/torvalds/linux/commit/0424fdaf883a689d5185c0d0665b265373945898
---
kernel/nv-drm.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kernel/nv-drm.c b/kernel/nv-drm.c
index 7097069..a0110fa 100644
--- a/kernel/nv-drm.c
+++ b/kernel/nv-drm.c
@@ -156,7 +156,7 @@ static const struct file_operations nv_drm_fops = {
};
static struct drm_driver nv_drm_driver = {
- .driver_features = DRIVER_GEM | DRIVER_PRIME | DRIVER_LEGACY,
+ .driver_features = DRIVER_GEM | DRIVER_LEGACY,
.load = nv_drm_load,
.unload = nv_drm_unload,
.fops = &nv_drm_fops,
--
2.14.1

View File

@ -1,26 +0,0 @@
From 8d1388c2ec0febfd77527a8bc5791a5b75bfcb66 Mon Sep 17 00:00:00 2001
From: MilhouseVH <milhouseVH.github@nmacleod.com>
Date: Tue, 8 Oct 2019 04:08:51 +0100
Subject: [PATCH] Fix deprecated SUBDIRS= in 5.4-rc2
Ref: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?h=v5.4-rc2&id=7e35b42591c058b91282f95ce3b2cf0c05ffe93d
---
kernel/nvidia-modules-common.mk | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kernel/nvidia-modules-common.mk b/kernel/nvidia-modules-common.mk
index 918e8a9..8d36dbb 100644
--- a/kernel/nvidia-modules-common.mk
+++ b/kernel/nvidia-modules-common.mk
@@ -176,7 +176,7 @@ ifndef NV_VERBOSE
endif
KBUILD_PARAMS += KBUILD_VERBOSE=$(NV_VERBOSE)
-KBUILD_PARAMS += -C $(KERNEL_SOURCES) SUBDIRS=$(PWD)
+KBUILD_PARAMS += -C $(KERNEL_SOURCES) M=$(PWD)
KBUILD_PARAMS += ARCH=$(ARCH)
#
--
2.14.1