aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLenard Spencer <lenardrspencer@gmai.com>2023-12-08 14:32:37 +0700
committerWilly Sudiarto Raharjo <willysr@slackbuilds.org>2023-12-08 14:34:24 +0700
commit5df42573dc0c053184ea0324e722abc760d1f023 (patch)
tree498a989ebd148be187ea5ae21f369f4ff44f49c7
parent800891c4b640ce17286bc0ae0d03d7102dd66fcb (diff)
system/nvidia-legacy390-kernel: 6.6.x kernel.
Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
-rw-r--r--system/nvidia-legacy390-kernel/README2
-rw-r--r--system/nvidia-legacy390-kernel/nvidia-legacy390-kernel.SlackBuild11
-rw-r--r--system/nvidia-legacy390-kernel/patches/kernel-6.2.patch145
-rw-r--r--system/nvidia-legacy390-kernel/patches/kernel-6.3.patch89
-rw-r--r--system/nvidia-legacy390-kernel/patches/kernel-6.4.patch14
-rw-r--r--system/nvidia-legacy390-kernel/patches/kernel-6.5.patch70
-rw-r--r--system/nvidia-legacy390-kernel/patches/kernel-6.6.patch16
7 files changed, 345 insertions, 2 deletions
diff --git a/system/nvidia-legacy390-kernel/README b/system/nvidia-legacy390-kernel/README
index a420c5aa1658..d31e2f095378 100644
--- a/system/nvidia-legacy390-kernel/README
+++ b/system/nvidia-legacy390-kernel/README
@@ -14,6 +14,8 @@ You do not need this file at all if you have a proper and complete
The xf86-video-nouveau-blacklist package from /extra is required.
+To build against the new 6.6.x kernel, pass KERNEL66=yes to the script.
+
BIG FAT NOTE: The Nvidia 390.xx series is EOL as of December 2022.
Because of the ABI change from xorg-server 1.20 to 1.21, the Nvidia 390
driver will no longer work on Slackware versions later than 15.0.
diff --git a/system/nvidia-legacy390-kernel/nvidia-legacy390-kernel.SlackBuild b/system/nvidia-legacy390-kernel/nvidia-legacy390-kernel.SlackBuild
index 2fa6d158340e..aedaf0445fce 100644
--- a/system/nvidia-legacy390-kernel/nvidia-legacy390-kernel.SlackBuild
+++ b/system/nvidia-legacy390-kernel/nvidia-legacy390-kernel.SlackBuild
@@ -29,7 +29,7 @@ cd $(dirname $0) ; CWD=$(pwd)
PRGNAM=nvidia-legacy390-kernel
VERSION=${VERSION:-390.157}
-BUILD=${BUILD:-1}
+BUILD=${BUILD:-2}
TAG=${TAG:-_SBo}
PKGTYPE=${PKGTYPE:-tgz}
@@ -67,7 +67,7 @@ if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
fi
TMP=${TMP:-/tmp/SBo}
-PKG=${PKG:-$TMP/package-$PRGNAM}
+PKG=$TMP/package-$PRGNAM
OUTPUT=${OUTPUT:-/tmp}
rm -rf $PKG
@@ -87,6 +87,13 @@ find -L . \
unset ARCH
cd kernel || exit 1
+# Patch for kernel 6.6.x
+ if [ "${KERNEL66:-no}" = "yes" ]; then
+ for i in `ls $CWD/patches`; do
+ patch -p1 < $CWD/patches/$i
+ done
+ fi
+
# CC=${CC:-gcc} suppresses an otherwise harmless "compiler mismatch"
# message. If you custom-build your kernel with clang,
# then pass CC=clang to this script.
diff --git a/system/nvidia-legacy390-kernel/patches/kernel-6.2.patch b/system/nvidia-legacy390-kernel/patches/kernel-6.2.patch
new file mode 100644
index 000000000000..e88c982de973
--- /dev/null
+++ b/system/nvidia-legacy390-kernel/patches/kernel-6.2.patch
@@ -0,0 +1,145 @@
+From 5db7eb5a62003bbe04f3f07d089fcf5445b34a29 Mon Sep 17 00:00:00 2001
+From: Joan Bruguera <joanbrugueram@gmail.com>
+Date: Sun, 25 Dec 2022 22:05:14 +0000
+Subject: [PATCH] Tentative fix for NVIDIA 470.161.03 driver for Linux 6.2-rc1
+
+---
+ nvidia-drm/nvidia-drm-connector.c | 22 ++++++++++++++++++++++
+ nvidia-drm/nvidia-drm-drv.c | 4 ++++
+ nvidia/nv-acpi.c | 19 ++++++++++++++++---
+ 3 files changed, 42 insertions(+), 3 deletions(-)
+
+diff --git a/nvidia-drm/nvidia-drm-connector.c b/nvidia-drm/nvidia-drm-connector.c
+index 6fbcd63..a5ab9e9 100644
+--- a/nvidia-drm/nvidia-drm-connector.c
++++ b/nvidia-drm/nvidia-drm-connector.c
+@@ -20,6 +20,8 @@
+ * DEALINGS IN THE SOFTWARE.
+ */
+
++#include <linux/version.h>
++#include <drm/drm_edid.h>
+ #include "nvidia-drm-conftest.h" /* NV_DRM_ATOMIC_MODESET_AVAILABLE */
+
+ #if defined(NV_DRM_ATOMIC_MODESET_AVAILABLE)
+@@ -98,6 +100,7 @@ __nv_drm_detect_encoder(struct NvKmsKapiDynamicDisplayParams *pDetectParams,
+ break;
+ }
+
++#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 2, 0)
+ if (connector->override_edid) {
+ const struct drm_property_blob *edid = connector->edid_blob_ptr;
+
+@@ -110,6 +113,25 @@ __nv_drm_detect_encoder(struct NvKmsKapiDynamicDisplayParams *pDetectParams,
+ sizeof(pDetectParams->edid.buffer));
+ }
+ }
++#else
++ // Rel. commit "drm/edid: detach debugfs EDID override from EDID property update" (Jani Nikula, 24 Oct 2022)
++ // NOTE: HUGE HACK!
++ mutex_lock(&connector->edid_override_mutex);
++ if (connector->edid_override) {
++ const struct edid *edid = drm_edid_raw(connector->edid_override);
++ size_t edid_length = EDID_LENGTH * (edid->extensions + 1);
++ if (edid_length <= sizeof(pDetectParams->edid.buffer)) {
++ memcpy(pDetectParams->edid.buffer, edid, edid_length);
++ pDetectParams->edid.bufferSize = edid_length;
++ pDetectParams->overrideEdid = NV_TRUE;
++ } else {
++ WARN_ON(edid_length >
++ sizeof(pDetectParams->edid.buffer));
++ }
++ }
++ mutex_unlock(&connector->edid_override_mutex);
++
++#endif
+
+ if (!nvKms->getDynamicDisplayInfo(nv_dev->pDevice, pDetectParams)) {
+ NV_DRM_DEV_LOG_ERR(
+diff --git a/nvidia-drm/nvidia-drm-drv.c b/nvidia-drm/nvidia-drm-drv.c
+index 6d007b1..d08ab4c 100644
+--- a/nvidia-drm/nvidia-drm-drv.c
++++ b/nvidia-drm/nvidia-drm-drv.c
+@@ -20,6 +20,7 @@
+ * 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"
+@@ -240,9 +241,12 @@ nv_drm_init_mode_config(struct nv_drm_device *nv_dev,
+ dev->mode_config.preferred_depth = 24;
+ dev->mode_config.prefer_shadow = 1;
+
++// Rel. commit "drm: Remove drm_mode_config::fb_base" (Zack Rusin, 18 Oct 2022)
++#if defined(CONFIG_FB) && LINUX_VERSION_CODE < KERNEL_VERSION(6, 2, 0)
+ /* Currently unused. Update when needed. */
+
+ dev->mode_config.fb_base = 0;
++#endif
+
+ #if defined(NV_DRM_CRTC_STATE_HAS_ASYNC_FLIP) || \
+ defined(NV_DRM_CRTC_STATE_HAS_PAGEFLIP_FLAGS)
+diff --git a/nvidia/nv-acpi.c b/nvidia/nv-acpi.c
+index 07501eb..1fdf71c 100644
+--- a/nvidia/nv-acpi.c
++++ b/nvidia/nv-acpi.c
+@@ -8,6 +8,7 @@
+ * _NVRM_COPYRIGHT_END_
+ */
+
++#include <linux/version.h>
+ #define __NO_VERSION__
+
+ #include "os-interface.h"
+@@ -24,7 +25,10 @@ static NV_STATUS nv_acpi_extract_object (const union acpi_object *, void *, N
+
+ static int nv_acpi_add (struct acpi_device *);
+
+-#if !defined(NV_ACPI_DEVICE_OPS_REMOVE_ARGUMENT_COUNT) || (NV_ACPI_DEVICE_OPS_REMOVE_ARGUMENT_COUNT == 2)
++// Rel. commit "ACPI: make remove callback of ACPI driver void" (Dawei Li, 14 Nov 2022)
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 2, 0))
++static void nv_acpi_remove_one_arg_void(struct acpi_device *device);
++#elif !defined(NV_ACPI_DEVICE_OPS_REMOVE_ARGUMENT_COUNT) || (NV_ACPI_DEVICE_OPS_REMOVE_ARGUMENT_COUNT == 2)
+ static int nv_acpi_remove_two_args(struct acpi_device *device, int type);
+ #else
+ static int nv_acpi_remove_one_arg(struct acpi_device *device);
+@@ -80,7 +84,10 @@ static const struct acpi_driver nv_acpi_driver_template = {
+ .ids = nv_video_device_ids,
+ .ops = {
+ .add = nv_acpi_add,
+-#if !defined(NV_ACPI_DEVICE_OPS_REMOVE_ARGUMENT_COUNT) || (NV_ACPI_DEVICE_OPS_REMOVE_ARGUMENT_COUNT == 2)
++// Rel. commit "ACPI: make remove callback of ACPI driver void" (Dawei Li, 14 Nov 2022)
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 2, 0))
++ .remove = nv_acpi_remove_one_arg_void,
++#elif !defined(NV_ACPI_DEVICE_OPS_REMOVE_ARGUMENT_COUNT) || (NV_ACPI_DEVICE_OPS_REMOVE_ARGUMENT_COUNT == 2)
+ .remove = nv_acpi_remove_two_args,
+ #else
+ .remove = nv_acpi_remove_one_arg,
+@@ -342,7 +349,10 @@ static int nv_acpi_add(struct acpi_device *device)
+ return 0;
+ }
+
+-#if !defined(NV_ACPI_DEVICE_OPS_REMOVE_ARGUMENT_COUNT) || (NV_ACPI_DEVICE_OPS_REMOVE_ARGUMENT_COUNT == 2)
++// Rel. commit "ACPI: make remove callback of ACPI driver void" (Dawei Li, 14 Nov 2022)
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 2, 0))
++static void nv_acpi_remove_one_arg_void(struct acpi_device *device)
++#elif !defined(NV_ACPI_DEVICE_OPS_REMOVE_ARGUMENT_COUNT) || (NV_ACPI_DEVICE_OPS_REMOVE_ARGUMENT_COUNT == 2)
+ static int nv_acpi_remove_two_args(struct acpi_device *device, int type)
+ #else
+ static int nv_acpi_remove_one_arg(struct acpi_device *device)
+@@ -396,7 +406,10 @@ static int nv_acpi_remove_one_arg(struct acpi_device *device)
+ device->driver_data = NULL;
+ }
+
++// Rel. commit "ACPI: make remove callback of ACPI driver void" (Dawei Li, 14 Nov 2022)
++#if (LINUX_VERSION_CODE < KERNEL_VERSION(6, 2, 0))
+ return status;
++#endif
+ }
+
+ /*
+--
+2.39.0
+
diff --git a/system/nvidia-legacy390-kernel/patches/kernel-6.3.patch b/system/nvidia-legacy390-kernel/patches/kernel-6.3.patch
new file mode 100644
index 000000000000..f062e780d7a6
--- /dev/null
+++ b/system/nvidia-legacy390-kernel/patches/kernel-6.3.patch
@@ -0,0 +1,89 @@
+diff --git a/common/inc/nv-linux.h b/common/inc/nv-linux.h
+index 2c4cb7b..f68fcf2 100644
+--- a/common/inc/nv-linux.h
++++ b/common/inc/nv-linux.h
+@@ -1996,4 +1996,17 @@ static inline NvU64 nv_expand_nvlink_addr(NvU64 addr47)
+ #include <linux/backlight.h>
+ #endif
+
++#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 3, 0)
++// Rel. commit "mm: introduce vma->vm_flags wrapper functions" (Suren Baghdasaryan, 26 Jan 2023)
++static inline void vm_flags_set(struct vm_area_struct *vma, vm_flags_t flags)
++{
++ vma->vm_flags |= flags;
++}
++
++static inline void vm_flags_clear(struct vm_area_struct *vma, vm_flags_t flags)
++{
++ vma->vm_flags &= ~flags;
++}
++#endif
++
+ #endif /* _NV_LINUX_H_ */
+diff --git a/nvidia-drm/nvidia-drm-fb.c b/nvidia-drm/nvidia-drm-fb.c
+index 725164a..c35e0ee 100644
+--- a/nvidia-drm/nvidia-drm-fb.c
++++ b/nvidia-drm/nvidia-drm-fb.c
+@@ -29,6 +29,7 @@
+ #include "nvidia-drm-fb.h"
+ #include "nvidia-drm-utils.h"
+ #include "nvidia-drm-gem.h"
++#include "nvidia-drm-helper.h"
+
+ #include <drm/drm_crtc_helper.h>
+
+diff --git a/nvidia-uvm/uvm8.c b/nvidia-uvm/uvm8.c
+index 11cb373..49e1047 100644
+--- a/nvidia-uvm/uvm8.c
++++ b/nvidia-uvm/uvm8.c
+@@ -658,7 +658,7 @@ static int uvm_mmap(struct file *filp, struct vm_area_struct *vma)
+ // Using VM_DONTCOPY would be nice, but madvise(MADV_DOFORK) can reset that
+ // so we have to handle vm_open on fork anyway. We could disable MADV_DOFORK
+ // with VM_IO, but that causes other mapping issues.
+- vma->vm_flags |= VM_MIXEDMAP | VM_DONTEXPAND;
++ vm_flags_set(vma, VM_MIXEDMAP | VM_DONTEXPAND);
+
+ vma->vm_ops = &uvm_vm_ops_managed;
+
+diff --git a/nvidia/nv-mmap.c b/nvidia/nv-mmap.c
+index 0b0a6f2..da891ff 100644
+--- a/nvidia/nv-mmap.c
++++ b/nvidia/nv-mmap.c
+@@ -447,7 +447,7 @@ int nvidia_mmap_helper(
+ addr = mmap_start;
+
+ // Needed for the linux kernel for mapping compound pages
+- vma->vm_flags |= VM_MIXEDMAP;
++ vm_flags_set(vma, VM_MIXEDMAP);
+
+ for (j = 0; j < pages; j++)
+ {
+@@ -471,7 +471,7 @@ int nvidia_mmap_helper(
+ }
+ }
+
+- vma->vm_flags |= VM_IO;
++ vm_flags_set(vma, VM_IO);
+ }
+ else
+ {
+@@ -533,15 +533,15 @@ int nvidia_mmap_helper(
+
+ NV_PRINT_AT(NV_DBG_MEMINFO, at);
+
+- vma->vm_flags |= (VM_IO | VM_LOCKED | VM_RESERVED);
+- vma->vm_flags |= (VM_DONTEXPAND | VM_DONTDUMP);
++ vm_flags_set(vma, VM_IO | VM_LOCKED | VM_RESERVED);
++ vm_flags_set(vma, VM_DONTEXPAND | VM_DONTDUMP);
+ }
+
+ if ((prot & NV_PROTECT_WRITEABLE) == 0)
+ {
+ vma->vm_page_prot = NV_PGPROT_READ_ONLY(vma->vm_page_prot);
+- vma->vm_flags &= ~VM_WRITE;
+- vma->vm_flags &= ~VM_MAYWRITE;
++ vm_flags_clear(vma, VM_WRITE);
++ vm_flags_clear(vma, VM_MAYWRITE);
+ }
+
+ vma->vm_ops = &nv_vm_ops;
diff --git a/system/nvidia-legacy390-kernel/patches/kernel-6.4.patch b/system/nvidia-legacy390-kernel/patches/kernel-6.4.patch
new file mode 100644
index 000000000000..a4f1762ea1b7
--- /dev/null
+++ b/system/nvidia-legacy390-kernel/patches/kernel-6.4.patch
@@ -0,0 +1,14 @@
+*** a/nvidia-drm/nvidia-drm-drv.c 2023-07-02 16:08:37.702462187 -0400
+--- b/nvidia-drm/nvidia-drm-drv.c 2023-07-02 16:23:58.040020274 -0400
+*************** static void nv_drm_update_drm_driver_fea
+*** 766,772 ****
+--- 766,774 ----
+
+ 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(6, 4, 0)
+ nv_drm_driver.dumb_destroy = nv_drm_dumb_destroy;
++ #endif
+
+ #if defined(NV_DRM_DRIVER_HAS_GEM_PRIME_CALLBACKS)
+ nv_drm_driver.gem_vm_ops = &nv_drm_gem_vma_ops;
diff --git a/system/nvidia-legacy390-kernel/patches/kernel-6.5.patch b/system/nvidia-legacy390-kernel/patches/kernel-6.5.patch
new file mode 100644
index 000000000000..6bed8e1a7868
--- /dev/null
+++ b/system/nvidia-legacy390-kernel/patches/kernel-6.5.patch
@@ -0,0 +1,70 @@
+diff --git a/common/inc/nv-mm.h b/kernel/common/inc/nv-mm.h
+index aec55b0..acd396d 100644
+--- a/common/inc/nv-mm.h
++++ b/common/inc/nv-mm.h
+@@ -23,6 +23,7 @@
+ #ifndef __NV_MM_H__
+ #define __NV_MM_H__
+
++#include <linux/version.h>
+ #include "conftest.h"
+
+ #if !defined(NV_VM_FAULT_T_IS_PRESENT)
+@@ -47,7 +48,27 @@ typedef int vm_fault_t;
+ *
+ */
+
+-#if defined(NV_GET_USER_PAGES_HAS_TASK_STRUCT)
++// Rel. commit. "mm/gup: remove unused vmas parameter from get_user_pages()" (Lorenzo Stoakes, 14 May 2023)
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 5, 0)
++#include <linux/mm.h>
++
++static inline long NV_GET_USER_PAGES(unsigned long start,
++ unsigned long nr_pages,
++ int write,
++ int force,
++ struct page **pages,
++ struct vm_area_struct **vmas)
++{
++ unsigned int flags = 0;
++
++ if (write)
++ flags |= FOLL_WRITE;
++ if (force)
++ flags |= FOLL_FORCE;
++
++ return get_user_pages(start, nr_pages, flags, pages);
++}
++#elif defined(NV_GET_USER_PAGES_HAS_TASK_STRUCT)
+ #if defined(NV_GET_USER_PAGES_HAS_WRITE_AND_FORCE_ARGS)
+ #define NV_GET_USER_PAGES(start, nr_pages, write, force, pages, vmas) \
+ get_user_pages(current, current->mm, start, nr_pages, write, force, pages, vmas)
+@@ -130,7 +151,27 @@ typedef int vm_fault_t;
+ *
+ */
+
+-#if defined(NV_GET_USER_PAGES_REMOTE_PRESENT)
++// Rel. commit. "mm/gup: remove unused vmas parameter from get_user_pages_remote()" (Lorenzo Stoakes, 14 May 2023)
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 5, 0)
++static inline long NV_GET_USER_PAGES_REMOTE(struct task_struct *tsk,
++ struct mm_struct *mm,
++ unsigned long start,
++ unsigned long nr_pages,
++ int write,
++ int force,
++ struct page **pages,
++ struct vm_area_struct **vmas)
++{
++ unsigned int flags = 0;
++
++ if (write)
++ flags |= FOLL_WRITE;
++ if (force)
++ flags |= FOLL_FORCE;
++
++ return get_user_pages_remote(mm, start, nr_pages, flags, pages, NULL);
++}
++#elif defined(NV_GET_USER_PAGES_REMOTE_PRESENT)
+ #if defined(NV_GET_USER_PAGES_REMOTE_HAS_WRITE_AND_FORCE_ARGS)
+ #define NV_GET_USER_PAGES_REMOTE get_user_pages_remote
+ #else
diff --git a/system/nvidia-legacy390-kernel/patches/kernel-6.6.patch b/system/nvidia-legacy390-kernel/patches/kernel-6.6.patch
new file mode 100644
index 000000000000..8f246b988814
--- /dev/null
+++ b/system/nvidia-legacy390-kernel/patches/kernel-6.6.patch
@@ -0,0 +1,16 @@
+diff --ignore-space-change --unified --recursive --no-dereference a/nvidia-drm/nvidia-drm-drv.c b/nvidia-drm/nvidia-drm-drv.c
+--- a/nvidia-drm/nvidia-drm-drv.c
++++ b/nvidia-drm/nvidia-drm-drv.c
+@@ -700,8 +700,11 @@
+
+ .ioctls = nv_drm_ioctls,
+ .num_ioctls = ARRAY_SIZE(nv_drm_ioctls),
+-
++// Rel. commit "drm/prime: Unexport helpers for fd/handle conversion" (Thomas Zimmermann, 20 Jun 2023)
++// This function is no longer exported, but leaving it to NULL is equivalent
++#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 6, 0)
+ .prime_handle_to_fd = drm_gem_prime_handle_to_fd,
++#endif
+
+ #if defined(NV_DRM_DRIVER_HAS_GEM_PRIME_CALLBACKS)
+ .gem_prime_export = nv_drm_gem_prime_export,