Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add patch for Linux 6.5 #17

Merged
merged 2 commits into from
Sep 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions debian/dkms_nvidia.conf
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ BUILT_MODULE_NAME[2]="nvidia-drm"
DEST_MODULE_LOCATION[2]="/kernel/drivers/char/drm"
AUTOINSTALL="yes"
PATCH[0]="disable_fstack-clash-protection_fcf-protection.patch"
PATCH[1]="buildfix_kernel_6.4.patch"
PATCH[2]="buildfix_kernel_6.5.patch"
#PATCH[1]="buildfix_kernel_6.3.patch"
#PATCH[1]="buildfix_kernel_6.2.patch"
#PATCH[1]="buildfix_kernel_5.19.patch"
Expand Down
35 changes: 35 additions & 0 deletions debian/dkms_nvidia/patches/buildfix_kernel_6.4.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
From 4981428cda825b415eea60313f71bf386cc9f7e1 Mon Sep 17 00:00:00 2001
From: Joan Bruguera <joanbrugueram@gmail.com>
Date: Sat, 25 Feb 2023 10:57:26 +0000
Subject: [PATCH] Tentative fix for NVIDIA 470.199.02 driver for Linux 6.4-rc1

---
nvidia-drm/nvidia-drm-drv.c | 5 +++++
1 file changed, 5 insertions(+)

--- 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"
@@ -873,9 +874,13 @@

nv_drm_driver.dumb_create = nv_drm_dumb_create;
nv_drm_driver.dumb_map_offset = nv_drm_dumb_map_offset;
+// Rel. commit "drm: remove dumb_destroy callback" (Christian König, 26 Jan 2023)
+// NB: No resources are leaked, the kernel releases the same resources by default
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 4, 0)
#if defined(NV_DRM_DRIVER_HAS_DUMB_DESTROY)
nv_drm_driver.dumb_destroy = nv_drm_dumb_destroy;
#endif /* NV_DRM_DRIVER_HAS_DUMB_DESTROY */
+#endif
#endif /* NV_DRM_ATOMIC_MODESET_AVAILABLE */
}

--
2.40.1
82 changes: 82 additions & 0 deletions debian/dkms_nvidia/patches/buildfix_kernel_6.5.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
From 0ca9614e5b074d3dd01e95f47b3555f48e74f622 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Joan=20Bruguera=20Mic=C3=B3?= <joanbrugueram@gmail.com>
Date: Wed, 17 May 2023 21:54:08 +0000
Subject: [PATCH] Tentative fix for NVIDIA 470.182.03 driver for Linux 6.5-rc1

---
common/inc/nv-mm.h | 45 +++++++++++++++++++++++++++++++++++++++++++--
1 file changed, 43 insertions(+), 2 deletions(-)

diff --git a/common/inc/nv-mm.h b/common/inc/nv-mm.h
index 54f6f60..25333e8 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
--
2.41.0

2 changes: 2 additions & 0 deletions debian/templates/dkms_nvidia.conf.in
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ BUILT_MODULE_NAME[2]="nvidia-drm"
DEST_MODULE_LOCATION[2]="/kernel/drivers/char/drm"
AUTOINSTALL="yes"
PATCH[0]="disable_fstack-clash-protection_fcf-protection.patch"
PATCH[1]="buildfix_kernel_6.4.patch"
PATCH[2]="buildfix_kernel_6.5.patch"
#PATCH[1]="buildfix_kernel_6.3.patch"
#PATCH[1]="buildfix_kernel_6.2.patch"
#PATCH[1]="buildfix_kernel_5.19.patch"
Expand Down