From 86145ca31efafe221419193066ef3ad7b9df906a Mon Sep 17 00:00:00 2001 From: Miguel Date: Mon, 29 Jul 2024 22:37:14 -0600 Subject: [PATCH] New package: nvidia-open-dkms-580.109.02. Co-authored-by: Miguel --- srcpkgs/nvidia-open-dkms/files/dkms.conf | 26 ++++++++++++ ...atomic-kernel-modesetting-by-default.patch | 42 +++++++++++++++++++ .../patches/0003-Add-IBT-support.patch | 25 +++++++++++ .../patches/nvidia-tegra-bpmp.patch | 13 ++++++ srcpkgs/nvidia-open-dkms/template | 36 ++++++++++++++++ 5 files changed, 142 insertions(+) create mode 100644 srcpkgs/nvidia-open-dkms/files/dkms.conf create mode 100644 srcpkgs/nvidia-open-dkms/patches/0001-Enable-atomic-kernel-modesetting-by-default.patch create mode 100644 srcpkgs/nvidia-open-dkms/patches/0003-Add-IBT-support.patch create mode 100644 srcpkgs/nvidia-open-dkms/patches/nvidia-tegra-bpmp.patch create mode 100644 srcpkgs/nvidia-open-dkms/template diff --git a/srcpkgs/nvidia-open-dkms/files/dkms.conf b/srcpkgs/nvidia-open-dkms/files/dkms.conf new file mode 100644 index 00000000000000..15c2e6503376ec --- /dev/null +++ b/srcpkgs/nvidia-open-dkms/files/dkms.conf @@ -0,0 +1,26 @@ +PACKAGE_NAME="nvidia" +PACKAGE_VERSION="__PKGVER" +AUTOINSTALL="yes" + +# By default, DKMS will add KERNELRELEASE to the make command line; however, +# this will cause the kernel module build to infer that it was invoked via +# Kbuild directly instead of DKMS. The dkms(8) manual page recommends quoting +# the 'make' command name to suppress this behavior. +MAKE[0]="'make' -j$(nproc) NV_EXCLUDE_BUILD_MODULES='' KERNEL_UNAME=${kernelver} modules" + +# The list of kernel modules will be generated by nvidia-installer at runtime. +BUILT_MODULE_NAME[0]="nvidia" +BUILT_MODULE_LOCATION[0]="kernel-open" +DEST_MODULE_LOCATION[0]="/kernel/drivers/video" +BUILT_MODULE_NAME[1]="nvidia-uvm" +BUILT_MODULE_LOCATION[1]="kernel-open" +DEST_MODULE_LOCATION[1]="/kernel/drivers/video" +BUILT_MODULE_NAME[2]="nvidia-modeset" +BUILT_MODULE_LOCATION[2]="kernel-open" +DEST_MODULE_LOCATION[2]="/kernel/drivers/video" +BUILT_MODULE_NAME[3]="nvidia-drm" +BUILT_MODULE_LOCATION[3]="kernel-open" +DEST_MODULE_LOCATION[3]="/kernel/drivers/video" +BUILT_MODULE_NAME[4]="nvidia-peermem" +BUILT_MODULE_LOCATION[4]="kernel-open" +DEST_MODULE_LOCATION[4]="/kernel/drivers/video" diff --git a/srcpkgs/nvidia-open-dkms/patches/0001-Enable-atomic-kernel-modesetting-by-default.patch b/srcpkgs/nvidia-open-dkms/patches/0001-Enable-atomic-kernel-modesetting-by-default.patch new file mode 100644 index 00000000000000..0548693a56cb6e --- /dev/null +++ b/srcpkgs/nvidia-open-dkms/patches/0001-Enable-atomic-kernel-modesetting-by-default.patch @@ -0,0 +1,42 @@ +From 69769b8ebaaeca84a5188330f80c460dcc0fa747 Mon Sep 17 00:00:00 2001 +From: Eric Naim +Date: Fri, 24 Jan 2025 19:34:24 +0700 +Subject: [PATCH] Enable atomic kernel modesetting by default + +This is required for proper functionality under Wayland. fbdev has been default enabled since 570 so that +hunk can be removed from this patch. + +Signed-off-by: Eric Naim +--- + nvidia-drm/nvidia-drm-linux.c | 2 +- + nvidia-drm/nvidia-drm-os-interface.c | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/nvidia-drm/nvidia-drm-linux.c b/nvidia-drm/nvidia-drm-linux.c +index 0007cbf..bd0b9eb 100644 +--- a/kernel-open/nvidia-drm/nvidia-drm-linux.c ++++ b/kernel-open/nvidia-drm/nvidia-drm-linux.c +@@ -31,7 +31,7 @@ + + MODULE_PARM_DESC( + modeset, +- "Enable atomic kernel modesetting (1 = enable, 0 = disable (default))"); ++ "Enable atomic kernel modesetting (1 = enable (default), 0 = disable)"); + module_param_named(modeset, nv_drm_modeset_module_param, bool, 0400); + + #if defined(NV_DRM_FBDEV_AVAILABLE) +diff --git a/nvidia-drm/nvidia-drm-os-interface.c b/nvidia-drm/nvidia-drm-os-interface.c +index 7617476..f22afd7 100644 +--- a/kernel-open/nvidia-drm/nvidia-drm-os-interface.c ++++ b/kernel-open/nvidia-drm/nvidia-drm-os-interface.c +@@ -41,7 +41,7 @@ + #include + #endif + +-bool nv_drm_modeset_module_param = false; ++bool nv_drm_modeset_module_param = true; + bool nv_drm_fbdev_module_param = true; + + void *nv_drm_calloc(size_t nmemb, size_t size) +-- +2.48.1 diff --git a/srcpkgs/nvidia-open-dkms/patches/0003-Add-IBT-support.patch b/srcpkgs/nvidia-open-dkms/patches/0003-Add-IBT-support.patch new file mode 100644 index 00000000000000..caad6d70099faa --- /dev/null +++ b/srcpkgs/nvidia-open-dkms/patches/0003-Add-IBT-support.patch @@ -0,0 +1,25 @@ +From 1484c9ee0a60468dfd88954011fae0e28c0f73de Mon Sep 17 00:00:00 2001 +From: Peter Jung +Date: Fri, 18 Oct 2024 22:40:58 +0200 +Subject: [PATCH 3/6] Add IBT support + +Signed-off-by: Peter Jung +--- + src/nvidia-modeset/Makefile | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/src/nvidia-modeset/Makefile b/src/nvidia-modeset/Makefile +index 2b96f3fa..ed934014 100644 +--- a/src/nvidia-modeset/Makefile ++++ b/src/nvidia-modeset/Makefile +@@ -151,6 +151,7 @@ ifeq ($(TARGET_ARCH),x86_64) + CONDITIONAL_CFLAGS += $(call TEST_CC_ARG, -fno-jump-tables) + CONDITIONAL_CFLAGS += $(call TEST_CC_ARG, -mindirect-branch=thunk-extern) + CONDITIONAL_CFLAGS += $(call TEST_CC_ARG, -mindirect-branch-register) ++ CONDITIONAL_CFLAGS += $(call TEST_CC_ARG, -mharden-sls=all) + endif + + CFLAGS += $(CONDITIONAL_CFLAGS) +-- +2.47.0 + diff --git a/srcpkgs/nvidia-open-dkms/patches/nvidia-tegra-bpmp.patch b/srcpkgs/nvidia-open-dkms/patches/nvidia-tegra-bpmp.patch new file mode 100644 index 00000000000000..75f016e9807fe6 --- /dev/null +++ b/srcpkgs/nvidia-open-dkms/patches/nvidia-tegra-bpmp.patch @@ -0,0 +1,13 @@ +--- a/kernel-open/nvidia/nv-clk.c ++++ b/kernel-open/nvidia/nv-clk.c +@@ -27,8 +27,10 @@ + #include "nv-linux.h" + #include "nv-platform.h" + ++#if IS_ENABLED(CONFIG_TEGRA_BPMP) + #include + #include ++#endif // IS_ENABLED(CONFIG_TEGRA_BPMP) + + // Use the CCF APIs if enabled in Kernel config and RM build + // has Dual license define enabled. diff --git a/srcpkgs/nvidia-open-dkms/template b/srcpkgs/nvidia-open-dkms/template new file mode 100644 index 00000000000000..6969ec65a31840 --- /dev/null +++ b/srcpkgs/nvidia-open-dkms/template @@ -0,0 +1,36 @@ +# Template file for 'nvidia-open-dkms' +pkgname=nvidia-open-dkms +version=580.119.02 +revision=1 +archs="x86_64" +depends="dkms nvidia xz" +short_desc="NVIDIA drivers for linux - open DKMS kernel module" +maintainer="JkktBkkt " +license="GPL-2.0-only, MIT" +homepage="https://github.com/NVIDIA/open-gpu-kernel-modules" +distfiles="https://download.nvidia.com/XFree86/NVIDIA-kernel-module-source/NVIDIA-kernel-module-source-${version}.tar.xz" +checksum=ea06941cf2b095c2a9a6f1d0640a447d1c33baefbff9d95fd9726955dd210692 +replaces="nvidia-dkms>=0" +conflicts="nvidia390-dkms>=0 nvidia470-dkms>=0" +dkms_modules="nvidia-open-dkms ${version}" +triggers="dkms initramfs-regenerate" +provides="nvidia-dkms-${version}_${revision}" + +do_install() { + vmkdir usr/src/nvidia-open-dkms-${version} + vcopy "*" usr/src/nvidia-open-dkms-${version} + cp ${FILESDIR}/dkms.conf ${DESTDIR}/usr/src/nvidia-open-dkms-${version}/dkms.conf + vsed -e "s/__PKGVER/${version}/" -i ${DESTDIR}/usr/src/nvidia-open-dkms-${version}/dkms.conf + + # Blacklist nouveau + vmkdir usr/lib/modprobe.d + cat <<- END > ${DESTDIR}/usr/lib/modprobe.d/nvidia.conf + blacklist nouveau + blacklist nova_core + blacklist nova_drm + END + chmod 644 ${DESTDIR}/usr/lib/modprobe.d/nvidia.conf + + vdoc README.md + vlicense COPYING +}