Skip to content

Commit

Permalink
new version
Browse files Browse the repository at this point in the history
  • Loading branch information
gitbarnabedikartola committed Sep 14, 2023
1 parent c6d22ed commit 21fea9d
Show file tree
Hide file tree
Showing 3 changed files with 93 additions and 9 deletions.
17 changes: 10 additions & 7 deletions PKGBUILD
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
# Maintainer : Thomas Baechler <[email protected]>

_linuxprefix=linux-xanmod
_extramodules=$(find /usr/lib/modules -type d -iname 6.4.15*xanmod* | rev | cut -d "/" -f1 | rev)
_extramodules=$(find /usr/lib/modules -type d -iname 6.5.3*xanmod* | rev | cut -d "/" -f1 | rev)

pkgname=$_linuxprefix-nvidia-470xx
pkgdesc="NVIDIA drivers for linux"
pkgver=470.199.02
pkgrel=64151
pkgrel=65310
arch=('x86_64')
url="http://www.nvidia.com/"
license=('custom')
Expand All @@ -22,9 +22,11 @@ options=(!strip)
install=nvidia.install
_durl="https://us.download.nvidia.com/XFree86/Linux-x86"
source=("${_durl}_64/${pkgver}/NVIDIA-Linux-x86_64-${pkgver}-no-compat32.run"
'kernel-6.4.patch')
'kernel-6.4.patch'
'kernel-6.5.patch')
sha256sums=('9c86f9ef6aceaf2b292407aa161b98d817b2eb10a615f971d29a20c2a748ad09'
'9fbab269f00beb78b44e4693ea44b399e4122a3dfba00322af3e5e3485a1eed3')
'9fbab269f00beb78b44e4693ea44b399e4122a3dfba00322af3e5e3485a1eed3'
'8688f9d70b34e8111722c0231f773050a62a5d1c1b56c88aa3bab8ebf502902a')

_pkg="NVIDIA-Linux-x86_64-${pkgver}-no-compat32"

Expand All @@ -34,21 +36,22 @@ prepare() {
cd "${_pkg}/kernel"
# patches here
patch -Np1 -i ../../kernel-6.4.patch
patch -Np1 -i ../../kernel-6.5.patch
}

build() {
_kernver=$(find /usr/lib/modules -type d -iname 6.4.15*xanmod* | rev | cut -d "/" -f1 | rev)
_kernver=$(find /usr/lib/modules -type d -iname 6.5.3*xanmod* | rev | cut -d "/" -f1 | rev)

cd "${_pkg}"
make -C kernel SYSSRC=/usr/lib/modules/"${_kernver}/build" module
}

package() {
cd "${_pkg}"
install -Dm644 kernel/*.ko -t "${pkgdir}/usr/lib/modules/${_extramodules}/"
install -Dm 644 kernel/*.ko -t "${pkgdir}/usr/lib/modules/${_extramodules}/"

# compress each module individually
find "${pkgdir}" -name '*.ko' -exec xz -T1 {} +

install -Dm644 LICENSE -t "${pkgdir}/usr/share/licenses/${pkgname}/"
install -Dm 644 LICENSE -t "${pkgdir}/usr/share/licenses/${pkgname}/"
}
81 changes: 81 additions & 0 deletions kernel-6.5.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
From 0ca9614e5b074d3dd01e95f47b3555f48e74f622 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Joan=20Bruguera=20Mic=C3=B3?= <[email protected]>
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
4 changes: 2 additions & 2 deletions nvidia.install
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
EXTRAMODULES=$(find /usr/lib/modules -type d -iname 6.4.15*xanmod* | rev | cut -d "/" -f1 | rev)
EXTRAMODULES=$(find /usr/lib/modules -type d -iname 6.5.3*xanmod* | rev | cut -d "/" -f1 | rev)

post_install() {
depmod $(find /usr/lib/modules -type d -iname 6.4.15*xanmod* | rev | cut -d "/" -f1 | rev)
depmod $(find /usr/lib/modules -type d -iname 6.5.3*xanmod* | rev | cut -d "/" -f1 | rev)
}

post_upgrade() {
Expand Down

0 comments on commit 21fea9d

Please sign in to comment.