Github messages for voidlinux
 help / color / mirror / Atom feed
From: abenson <abenson@users.noreply.github.com>
To: ml@inbox.vuxu.org
Subject: [PR PATCH] nvidia390: add patches for linux6.3
Date: Sat, 27 May 2023 16:38:59 +0200	[thread overview]
Message-ID: <gh-mailinglist-notifications-41a7ca26-5023-4802-975b-f1789d68868e-void-packages-44115@inbox.vuxu.org> (raw)

[-- Attachment #1: Type: text/plain, Size: 486 bytes --]

There is a new pull request by abenson against master on the void-packages repository

https://github.com/abenson/void-packages nvidia390_6.3
https://github.com/void-linux/void-packages/pull/44115

nvidia390: add patches for linux6.3

#### Testing the changes
- I tested the changes in this PR: **YES**

#### Local build testing
- I built this PR locally for my native architecture, x86_64

A patch file from https://github.com/void-linux/void-packages/pull/44115.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-nvidia390_6.3-44115.patch --]
[-- Type: text/x-diff, Size: 8009 bytes --]

From 24743cf741d601968b848903cac09220b8c3314f Mon Sep 17 00:00:00 2001
From: Andrew Benson <abenson@gmail.com>
Date: Sat, 27 May 2023 09:38:01 -0500
Subject: [PATCH] nvidia390: add patches for linux6.3

---
 srcpkgs/nvidia390/files/linux6.3-x64.patch    | 89 +++++++++++++++++++
 srcpkgs/nvidia390/files/linux6.3-x86.patch    | 76 ++++++++++++++++
 .../nvidia-470xx-fix-linux-6.2.patch          |  0
 srcpkgs/nvidia390/template                    | 14 ++-
 4 files changed, 177 insertions(+), 2 deletions(-)
 create mode 100644 srcpkgs/nvidia390/files/linux6.3-x64.patch
 create mode 100644 srcpkgs/nvidia390/files/linux6.3-x86.patch
 rename srcpkgs/nvidia390/{patches => files}/nvidia-470xx-fix-linux-6.2.patch (100%)

diff --git a/srcpkgs/nvidia390/files/linux6.3-x64.patch b/srcpkgs/nvidia390/files/linux6.3-x64.patch
new file mode 100644
index 000000000000..f062e780d7a6
--- /dev/null
+++ b/srcpkgs/nvidia390/files/linux6.3-x64.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/srcpkgs/nvidia390/files/linux6.3-x86.patch b/srcpkgs/nvidia390/files/linux6.3-x86.patch
new file mode 100644
index 000000000000..b6c7bb1580df
--- /dev/null
+++ b/srcpkgs/nvidia390/files/linux6.3-x86.patch
@@ -0,0 +1,76 @@
+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/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/srcpkgs/nvidia390/patches/nvidia-470xx-fix-linux-6.2.patch b/srcpkgs/nvidia390/files/nvidia-470xx-fix-linux-6.2.patch
similarity index 100%
rename from srcpkgs/nvidia390/patches/nvidia-470xx-fix-linux-6.2.patch
rename to srcpkgs/nvidia390/files/nvidia-470xx-fix-linux-6.2.patch
diff --git a/srcpkgs/nvidia390/template b/srcpkgs/nvidia390/template
index 5b1900374f36..2f5088b14c01 100644
--- a/srcpkgs/nvidia390/template
+++ b/srcpkgs/nvidia390/template
@@ -4,7 +4,7 @@ _desc="NVIDIA drivers (GeForce 400, 500 series)"
 
 pkgname=nvidia390
 version=390.157
-revision=3
+revision=4
 maintainer="Andrew Benson <abenson+void@gmail.com>"
 license="custom:NVIDIA Proprietary"
 homepage="https://www.nvidia.com/en-us/drivers/unix/"
@@ -28,7 +28,7 @@ else
 	checksum=162317a49aa5a521eb888ec12119bfe5a45cec4e8653efc575a2d04fb05bf581
 fi
 
-patch_args="-Np1 --directory=${XBPS_BUILDDIR}/${pkgname}-${version}/${_pkg}/kernel"
+patch_args="-Ntp1 --directory=${XBPS_BUILDDIR}/${pkgname}-${version}/${_pkg}/kernel"
 subpackages="nvidia390-gtklibs nvidia390-dkms nvidia390-opencl nvidia390-libs"
 
 do_extract() {
@@ -39,6 +39,16 @@ do_extract() {
 	cd ${_pkg}
 }
 
+do_patch() {
+	patch ${patch_args} -i ${FILESDIR}/nvidia-470xx-fix-linux-6.2.patch
+	case "$XBPS_TARGET_MACHINE" in
+		i686)
+			patch ${patch_args} -i ${FILESDIR}/linux6.3-x86.patch ;;
+		x86_64)
+			patch ${patch_args} -i ${FILESDIR}/linux6.3-x64.patch ;;
+	esac
+}
+
 pre_install() {
 	cd ${_pkg}
 	cp nvidia_icd.json.template nvidia_icd.json

             reply	other threads:[~2023-05-27 14:39 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-27 14:38 abenson [this message]
2023-05-29 19:10 ` [PR PATCH] [Merged]: " abenson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=gh-mailinglist-notifications-41a7ca26-5023-4802-975b-f1789d68868e-void-packages-44115@inbox.vuxu.org \
    --to=abenson@users.noreply.github.com \
    --cc=ml@inbox.vuxu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).