system/nvidia-legacy390-kernel: Updated for version 390.144.

Signed-off-by: Matteo Bernardini <ponce@slackbuilds.org>

Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
This commit is contained in:
Lenard Spencer 2021-08-14 19:33:38 +02:00 committed by Willy Sudiarto Raharjo
parent 4b5fee8ec1
commit 3bdbf701ff
No known key found for this signature in database
GPG key ID: 3F617144D7238786
7 changed files with 114 additions and 162 deletions

View file

@ -1,6 +1,6 @@
This is the kernel-module needed by the proprietary binary nvidia
driver. You also need the nvidia-legacy390-driver package from
SlackBuilds.org.
driver.
You also need the nvidia-driver package from SlackBuilds.org.
To build the package for a kernel different from the running one,
start the script setting the KERNEL variable as in

View file

@ -1,47 +0,0 @@
Taken from https://build.opensuse.org/package/view_file/X11:Drivers:Video/nvidia-gfxG04/kernel-5.12.patch
Credit to Larry Finger <Larry.Finger@lwfinger.net>
390.143 refresh and version check by JF
Index: NVIDIA-Linux-x86_64-390.143-no-compat32/kernel/nvidia-drm/nvidia-drm-drv.c
===================================================================
--- NVIDIA-Linux-x86_64-390.143-no-compat32.orig/kernel/nvidia-drm/nvidia-drm-drv.c
+++ NVIDIA-Linux-x86_64-390.143-no-compat32/kernel/nvidia-drm/nvidia-drm-drv.c
@@ -20,6 +20,8 @@
* DEALINGS IN THE SOFTWARE.
*/
+#include <linux/version.h>
+
#include "nvidia-drm-conftest.h" /* NV_DRM_AVAILABLE and NV_DRM_DRM_GEM_H_PRESENT */
#include "nvidia-drm-priv.h"
@@ -737,6 +737,17 @@ static struct drm_driver nv_drm_driver =
#endif
};
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 12, 0)
+/* Starting with kernel 5.12, drm_gem_dumb_destroy() is no longer exported.
+ * For that reason, we need to supply a replacement version.
+ */
+int replace_dumb_destroy(struct drm_file *file,
+ struct drm_device *dev,
+ u32 handle)
+{
+ return drm_gem_handle_delete(file, handle);
+}
+#endif
/*
* Update the global nv_drm_driver for the intended features.
@@ -760,7 +767,11 @@ static void nv_drm_update_drm_driver_fea
nv_drm_driver.dumb_create = nv_drm_dumb_create;
nv_drm_driver.dumb_map_offset = nv_drm_dumb_map_offset;
+#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 12, 0)
nv_drm_driver.dumb_destroy = nv_drm_dumb_destroy;
+#else
+ nv_drm_driver.dumb_destroy = replace_dumb_destroy;
+#endif
#if defined(NV_DRM_DRIVER_HAS_GEM_PRIME_CALLBACKS)
nv_drm_driver.gem_vm_ops = &nv_drm_gem_vma_ops;

View file

@ -1,103 +0,0 @@
diff --git a/kernel/conftest.sh b/kernel/conftest.sh
index 4b6a9ed..25a8afa 100755
--- a/kernel/conftest.sh
+++ b/kernel/conftest.sh
@@ -4408,6 +4408,38 @@ compile_test() {
fi
;;
+ drm_plane_atomic_update_has_atomic_state_arg)
+ #
+ # Determine if drm_plane_helper_funcs::atomic_update takes 'state'
+ # argument of 'struct drm_atomic_state' type.
+ #
+ # The commit 977697e20b3d ("drm/atomic: Pass the full state to
+ # planes atomic disable and update") passed the full atomic state to
+ # drm_crtc_helper_funcs::atomic_update() and atomic_disable().
+ #
+ echo "$CONFTEST_PREAMBLE
+ #include <drm/drm_modeset_helper_vtables.h>
+ #include <drm/drm_crtc_helper.h>
+ #include <drm/drm_plane_helper.h>
+ #include <drm/drm_atomic.h>
+ #include <drm/drm_atomic_helper.h>
+ void conftest_drm_plane_helper_atomic_update_has_atomic_state_arg(
+ struct drm_plane *plane, struct drm_atomic_state *state) {
+ const struct drm_plane_helper_funcs *funcs = plane->helper_private;
+ funcs->atomic_update(plane, state);
+ }" > conftest$$.c
+
+ $CC $CFLAGS -Werror=incompatible-pointer-types -c conftest$$.c > /dev/null 2>&1
+ rm -f conftest$$.c
+
+ if [ -f conftest$$.o ]; then
+ rm -f conftest$$.o
+ echo "#define NV_DRM_PLANE_ATOMIC_UPDATE_HAS_ATOMIC_STATE_ARG" | append_conftest "types"
+ else
+ echo "#undef NV_DRM_PLANE_ATOMIC_UPDATE_HAS_ATOMIC_STATE_ARG" | append_conftest "types"
+ fi
+ ;;
+
drm_gem_object_vmap_has_map_arg)
#
# Determine if drm_gem_object_funcs::vmap takes 'map'
diff --git a/kernel/nvidia-drm/nvidia-drm-crtc.c b/kernel/nvidia-drm/nvidia-drm-crtc.c
index 8abd1f3..d5e5cfd 100644
--- a/kernel/nvidia-drm/nvidia-drm-crtc.c
+++ b/kernel/nvidia-drm/nvidia-drm-crtc.c
@@ -131,13 +131,21 @@ plane_req_config_update(struct drm_plane_state *plane_state,
}
static int nv_drm_plane_atomic_check(struct drm_plane *plane,
+#if defined(NV_DRM_PLANE_ATOMIC_UPDATE_HAS_ATOMIC_STATE_ARG)
+ struct drm_atomic_state *state)
+#else
struct drm_plane_state *plane_state)
+#endif
{
int i;
struct drm_crtc *crtc;
struct drm_crtc_state *crtc_state;
NvKmsKapiPlaneType type;
+#if defined(NV_DRM_PLANE_ATOMIC_UPDATE_HAS_ATOMIC_STATE_ARG)
+ struct drm_plane_state *plane_state = drm_atomic_get_new_plane_state(state,
+ plane);
+#endif
if (NV_DRM_WARN(!drm_plane_type_to_nvkms_plane_type(plane->type, &type))) {
goto done;
}
@@ -166,12 +174,20 @@ done:
}
static void nv_drm_plane_atomic_update(struct drm_plane *plane,
+#if defined(NV_DRM_PLANE_ATOMIC_UPDATE_HAS_ATOMIC_STATE_ARG)
+ struct drm_atomic_state *old_state)
+#else
struct drm_plane_state *old_state)
+#endif
{
}
static void nv_drm_plane_atomic_disable(struct drm_plane *plane,
+#if defined(NV_DRM_PLANE_ATOMIC_UPDATE_HAS_ATOMIC_STATE_ARG)
+ struct drm_atomic_state *old_state)
+#else
struct drm_plane_state *old_state)
+#endif
{
}
diff --git a/kernel/nvidia-drm/nvidia-drm.Kbuild b/kernel/nvidia-drm/nvidia-drm.Kbuild
index 885ab49..2cb0f9f 100644
--- a/kernel/nvidia-drm/nvidia-drm.Kbuild
+++ b/kernel/nvidia-drm/nvidia-drm.Kbuild
@@ -100,4 +100,5 @@ NV_CONFTEST_TYPE_COMPILE_TESTS += drm_driver_has_gem_free_object
NV_CONFTEST_TYPE_COMPILE_TESTS += drm_prime_pages_to_sg_has_drm_device_arg
NV_CONFTEST_TYPE_COMPILE_TESTS += drm_driver_has_gem_prime_callbacks
NV_CONFTEST_TYPE_COMPILE_TESTS += drm_crtc_atomic_check_has_atomic_state_arg
+NV_CONFTEST_TYPE_COMPILE_TESTS += drm_plane_atomic_update_has_atomic_state_arg
NV_CONFTEST_TYPE_COMPILE_TESTS += drm_gem_object_vmap_has_map_arg
--
2.30.2

View file

@ -0,0 +1,30 @@
diff -Nur kernel.orig/nvidia-uvm/uvm_linux.h kernel/nvidia-uvm/uvm_linux.h
--- kernel.orig/nvidia-uvm/uvm_linux.h 2021-06-02 19:09:58.000000000 -0400
+++ kernel/nvidia-uvm/uvm_linux.h 2021-07-21 00:58:00.406951472 -0400
@@ -29,6 +29,8 @@
//
//
+#include <linux/version.h>
+
#ifndef _UVM_LINUX_H
#define _UVM_LINUX_H
@@ -475,10 +477,17 @@
#elif (NV_WAIT_ON_BIT_LOCK_ARGUMENT_COUNT == 4)
static __sched int uvm_bit_wait(void *word)
{
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 14, 0))
if (signal_pending_state(current->state, current))
return 1;
schedule();
return 0;
+#else
+ if (signal_pending_state(current->__state, current))
+ return 1;
+ schedule();
+ return 0;
+#endif
}
#define UVM_WAIT_ON_BIT_LOCK(word, bit, mode) \
wait_on_bit_lock(word, bit, uvm_bit_wait, mode)

View file

@ -0,0 +1,70 @@
diff -Nur kernel.orig/nvidia/nvlink_linux.c kernel/nvidia/nvlink_linux.c
--- kernel.orig/nvidia/nvlink_linux.c 2021-06-02 19:10:01.000000000 -0400
+++ kernel/nvidia/nvlink_linux.c 2021-07-21 00:54:04.940862052 -0400
@@ -21,6 +21,7 @@
*******************************************************************************/
+#include <linux/version.h>
#include "conftest.h"
#include "nvlink_common.h"
@@ -597,7 +598,12 @@
// the requested timeout has expired, loop until less
// than a jiffie of the desired delay remains.
//
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 14, 0))
current->state = TASK_INTERRUPTIBLE;
+#else
+ // Rel. commit "sched: Change task_struct::state" (Peter Zijlstra, Jun 11 2021)
+ WRITE_ONCE(current->__state, TASK_INTERRUPTIBLE);
+#endif
do
{
schedule_timeout(jiffies);
diff -Nur kernel.orig/nvidia/os-interface.c kernel/nvidia/os-interface.c
--- kernel.orig/nvidia/os-interface.c 2021-06-02 19:09:57.000000000 -0400
+++ kernel/nvidia/os-interface.c 2021-07-21 00:54:31.512104423 -0400
@@ -8,6 +8,7 @@
* _NVRM_COPYRIGHT_END_
*/
+#include <linux/version.h>
#define __NO_VERSION__
#include "nv-misc.h"
@@ -580,7 +581,12 @@
// the requested timeout has expired, loop until less
// than a jiffie of the desired delay remains.
//
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 14, 0))
current->state = TASK_INTERRUPTIBLE;
+#else
+ // Rel. commit "sched: Change task_struct::state" (Peter Zijlstra, Jun 11 2021)
+ WRITE_ONCE(current->__state, TASK_INTERRUPTIBLE);
+#endif
do
{
schedule_timeout(jiffies);
diff -Nur kernel.orig/nvidia-drm/nvidia-drm-drv.c kernel/nvidia-drm/nvidia-drm-drv.c
--- kernel.orig/nvidia-drm/nvidia-drm-drv.c 2021-06-02 19:10:01.000000000 -0400
+++ kernel/nvidia-drm/nvidia-drm-drv.c 2021-07-21 02:56:07.552121923 -0400
@@ -20,6 +20,8 @@
* DEALINGS IN THE SOFTWARE.
*/
+#include <linux/version.h>
+
#include "nvidia-drm-conftest.h" /* NV_DRM_AVAILABLE and NV_DRM_DRM_GEM_H_PRESENT */
#include "nvidia-drm-priv.h"
@@ -811,7 +813,9 @@
dev->dev_private = nv_dev;
nv_dev->dev = dev;
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 14, 0))
dev->pdev = pdev;
+#endif
/* Register DRM device to DRM sub-system */

View file

@ -25,12 +25,10 @@
# Thanks to Robby Workman for suggestions to improve this script.
# see nvidia-driver/changelog.txt
cd $(dirname $0) ; CWD=$(pwd)
PRGNAM=nvidia-legacy390-kernel
VERSION=${VERSION:-390.143}
VERSION=${VERSION:-390.144}
BUILD=${BUILD:-1}
TAG=${TAG:-_SBo}
PKGTYPE=${PKGTYPE:-tgz}
@ -87,8 +85,12 @@ find -L . \
\( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \
-o -perm 440 -o -perm 400 \) -exec chmod 644 {} \;
patch -p1 < $CWD/kernel-5.12.patch
patch -p1 < $CWD/kernel-5.13.patch
# Patch for 5.14 kernel:
patch -p0 < $CWD/kernel-5.14.patch
# 64-bit only:
if [ "$ARCH" = "x86_64" ]; then
patch -p0 < $CWD/kernel-5.14-uvm.patch
fi
(cd kernel || exit 1
make SYSSRC=$KERNELPATH module || exit 1

View file

@ -1,10 +1,10 @@
PRGNAM="nvidia-legacy390-kernel"
VERSION="390.143"
VERSION="390.144"
HOMEPAGE="http://www.nvidia.com"
DOWNLOAD="https://download.nvidia.com/XFree86/Linux-x86/390.143/NVIDIA-Linux-x86-390.143.run"
MD5SUM="7b5704f3c89223d5ecb4f26ca9463c26"
DOWNLOAD_x86_64="https://download.nvidia.com/XFree86/Linux-x86_64/390.143/NVIDIA-Linux-x86_64-390.143.run"
MD5SUM_x86_64="1b526fa9567a09eb1e18545f675c8f82"
DOWNLOAD="https://download.nvidia.com/XFree86/Linux-x86/390.144/NVIDIA-Linux-x86-390.144.run"
MD5SUM="6ee8cd784135bd79f5e416b6815f443d"
DOWNLOAD_x86_64="https://download.nvidia.com/XFree86/Linux-x86_64/390.144/NVIDIA-Linux-x86_64-390.144.run"
MD5SUM_x86_64="dc6a203e3c32456e16e6fae5c8a7c728"
REQUIRES=""
MAINTAINER="Lenard Spencer"
EMAIL="lenardrspencer@gmai.com"