14 Commits

Author SHA1 Message Date
e6eb6a544f remove gcc version mismatch check; add patches up to kernel 6.3 [release 340.108-16mamba;Thu Jul 27 2023] 2024-01-06 07:47:10 +01:00
7b2cc10558 add nvidia libraries to ldconfig and regenerate initramfs [release 340.108-15mamba;Tue Feb 21 2023] 2024-01-06 07:47:07 +01:00
9d5df2e5e7 fix content of /etc/X11/xorg.conf.d/20-nvidia.conf [release 340.108-14mamba;Tue Feb 14 2023] 2024-01-06 07:47:04 +01:00
77121c304f install nvidia-tls.so in libdir; install xorg configuration fragment and blacklist nouveau [release 340.108-13mamba;Thu Feb 09 2023] 2024-01-06 07:47:01 +01:00
736b9d964b patch dkms.conf to fix build error caused by src dir called nvidia_340 [release 340.108-12mamba;Tue Feb 07 2023] 2024-01-06 07:46:59 +01:00
cd5cf86516 require (post) glibc-devel [release 340.108-11mamba;Mon Feb 06 2023] 2024-01-06 07:46:56 +01:00
f3487a078d added patches up to kernel 6.0 [release 340.108-10mamba;Mon Feb 06 2023] 2024-01-06 07:46:53 +01:00
13c1fa55b5 need to rename libGL etc. as libGL_nvidia or ldconfig will overwrite libglvnd library [release 340.108-9mamba;Sun Apr 25 2021] 2024-01-06 07:46:50 +01:00
2f706e269f fix for removal of alternatives overwriting symlinks belonging to libglvnd [release 340.108-8mamba;Sun Apr 25 2021] 2024-01-06 07:46:50 +01:00
2fcf4da333 repackaged with libglvnd and libmesa layout [release 340.108-7mamba;Fri Apr 23 2021] 2024-01-06 07:46:49 +01:00
788f8167e4 dkms: add IGNORE_CC_MISMATCH=1 before make command to fix build with gcc 10.1+ [release 340.108-3mamba;Fri Aug 21 2020] 2024-01-06 07:46:49 +01:00
e5b90118b1 dkms: replace obsoleted SUBDIRS= with M= [release 340.108-2mamba;Fri Jul 24 2020] 2024-01-06 07:46:49 +01:00
aab066c1bc update to 340.107 [release 340.107-1mamba;Thu Feb 28 2019] 2024-01-06 07:46:49 +01:00
758284eda1 patched to fix 'Error: Driver nvidia is already registered, aborting...' [release 340.102-2mamba;Sat Aug 12 2017] 2024-01-06 07:46:49 +01:00
20 changed files with 2381 additions and 314 deletions

14
20-nvidia.conf Normal file
View File

@ -0,0 +1,14 @@
Section "Files"
ModulePath "/usr/lib64/nvidia/xorg"
ModulePath "/usr/lib64/xorg/modules"
EndSection
Section "Device"
Identifier "Nvidia Card"
Driver "nvidia"
VendorName "NVIDIA Corporation"
EndSection
Section "ServerFlags"
Option "IgnoreABI" "1"
EndSection

View File

@ -0,0 +1,11 @@
--- NVIDIA-Linux-x86_64-340.102/kernel/nv.c.orig 2017-08-12 11:58:37.536676945 +0200
+++ NVIDIA-Linux-x86_64-340.102/kernel/nv.c 2017-08-12 11:59:26.101854994 +0200
@@ -1040,6 +1040,8 @@
pci_unregister_driver(&nv_pci_driver);
+ nv_unregister_procfs();
+
failed5:
rm_shutdown_rm(sp);

View File

@ -0,0 +1,28 @@
From 19996a25efb250a1b8c7d06fdb85b5462e2a7797 Mon Sep 17 00:00:00 2001
From: leigh123linux <leigh123linux@googlemail.com>
Date: Sun, 30 Jul 2017 12:16:14 +0100
Subject: [PATCH 1/4] 4.9.0_kernel
---
kernel/nv-drm.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/kernel/nv-drm.c b/kernel/nv-drm.c
index 4c1a3ae..ea9f17e 100644
--- a/kernel/nv-drm.c
+++ b/kernel/nv-drm.c
@@ -115,7 +115,11 @@ static const struct file_operations nv_drm_fops = {
};
static struct drm_driver nv_drm_driver = {
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 9, 0)
+ .driver_features = DRIVER_GEM | DRIVER_PRIME | DRIVER_LEGACY,
+#else
.driver_features = DRIVER_GEM | DRIVER_PRIME,
+#endif
.load = nv_drm_load,
.unload = nv_drm_unload,
.fops = &nv_drm_fops,
--
2.13.3

View File

@ -0,0 +1,38 @@
--- NVIDIA-Linux-x86-340.107/kernel/conftest_orig.sh 2018-10-18 11:31:58.727173092 +1100
+++ NVIDIA-Linux-x86-340.107/kernel/conftest.sh 2018-10-18 11:32:10.909169831 +1100
@@ -27,7 +27,7 @@
COMPILE_TEST_HEADERS="macros functions symbols types generic headers"
KERNEL_ARCH="$ARCH"
-if [ "$ARCH" = "i386" -o "$ARCH" = "x86_64" ]; then
+if [ "$ARCH" = "i386" -o "$ARCH" = "x86" -o "$ARCH" = "x86_64" ]; then
if [ -d "$SOURCES/arch/x86" ]; then
KERNEL_ARCH="x86"
fi
@@ -213,7 +213,7 @@
if [ "$OUTPUT" != "$SOURCES" ]; then
MACH_CFLAGS="-I$HEADERS/asm-$ARCH/mach-default"
- if [ "$ARCH" = "i386" -o "$ARCH" = "x86_64" ]; then
+ if [ "$ARCH" = "i386" -o "$ARCH" = "x86" -o "$ARCH" = "x86_64" ]; then
MACH_CFLAGS="$MACH_CFLAGS -I$HEADERS/asm-x86/mach-default"
MACH_CFLAGS="$MACH_CFLAGS -I$SOURCES/arch/x86/include/asm/mach-default"
MACH_CFLAGS="$MACH_CFLAGS -I$HEADERS/arch/x86/include/uapi"
@@ -230,7 +230,7 @@
fi
else
MACH_CFLAGS="-I$HEADERS/asm/mach-default"
- if [ "$ARCH" = "i386" -o "$ARCH" = "x86_64" ]; then
+ if [ "$ARCH" = "i386" -o "$ARCH" = "x86" -o "$ARCH" = "x86_64" ]; then
MACH_CFLAGS="$MACH_CFLAGS -I$HEADERS/asm-x86/mach-default"
MACH_CFLAGS="$MACH_CFLAGS -I$SOURCES/arch/x86/include/asm/mach-default"
MACH_CFLAGS="$MACH_CFLAGS -I$HEADERS/arch/x86/include/uapi"
@@ -250,7 +250,7 @@
CFLAGS="$BASE_CFLAGS $MACH_CFLAGS $OUTPUT_CFLAGS $AUTOCONF_CFLAGS"
CFLAGS="$CFLAGS -I$HEADERS -I$HEADERS/uapi -I$OUTPUT/include/generated/uapi"
- if [ "$ARCH" = "i386" -o "$ARCH" = "x86_64" ]; then
+ if [ "$ARCH" = "i386" -o "$ARCH" = "x86" -o "$ARCH" = "x86_64" ]; then
CFLAGS="$CFLAGS -I$SOURCES/arch/x86/include"
CFLAGS="$CFLAGS -I$SOURCES/arch/x86/include/uapi"
CFLAGS="$CFLAGS -I$OUTPUT/arch/x86/include/generated"

View File

@ -0,0 +1,24 @@
diff -Nru nvidia_340-340.108.orig/NVIDIA-Linux-x86_64-340.108/kernel/dkms.conf nvidia_340-340.108/NVIDIA-Linux-x86_64-340.108/kernel/dkms.conf
--- kernel/dkms.conf 2023-02-07 20:06:16.847865991 +0100
+++ kernel/dkms.conf 2023-02-07 20:07:00.366621491 +0100
@@ -4,9 +4,9 @@
num_cpu_cores=1
fi
-PACKAGE_NAME="nvidia"
+PACKAGE_NAME="nvidia_340"
PACKAGE_VERSION="340.108"
-BUILT_MODULE_NAME[0]="$PACKAGE_NAME"
+BUILT_MODULE_NAME[0]="nvidia"
DEST_MODULE_LOCATION[0]="/kernel/drivers/video"
MAKE[0]="make -j$num_cpu_cores module KERNEL_UNAME=${kernelver}"
CLEAN="make clean"
diff -Nru nvidia_340-340.108.orig/NVIDIA-Linux-x86_64-340.108/kernel/uvm/dkms.conf.fragment nvidia_340-340.108/NVIDIA-Linux-x86_64-340.108/kernel/uvm/dkms.conf.fragment
--- kernel/uvm/dkms.conf.fragment 2019-12-11 23:04:24.000000000 +0100
+++ kernel/uvm/dkms.conf.fragment 2023-02-07 20:07:18.056522182 +0100
@@ -1,4 +1,4 @@
-BUILT_MODULE_NAME[1]="${PACKAGE_NAME}-uvm"
+BUILT_MODULE_NAME[1]="nvidia-uvm"
BUILT_MODULE_LOCATION[1]="uvm/"
DEST_MODULE_LOCATION[1]="/kernel/drivers/video"
MAKE[0]+="; make -C uvm module KERNEL_UNAME=${kernelver} KBUILD_EXTMOD=${dkms_tree}/${PACKAGE_NAME}/${PACKAGE_VERSION}/build/uvm"

View File

@ -0,0 +1,18 @@
https://github.com/warpme/minimyth2/tree/master/script/nvidia/nvidia-340.108/files
diff -Naur NVIDIA-Linux-x86_64-340.108-old/kernel/nv-drm.c NVIDIA-Linux-x86_64-340.108-new/kernel/nv-drm.c
--- NVIDIA-Linux-x86_64-340.108-old/kernel/nv-drm.c 2020-12-13 19:10:56.759999937 +0100
+++ NVIDIA-Linux-x86_64-340.108-new/kernel/nv-drm.c 2020-12-13 19:09:02.039999925 +0100
@@ -322,8 +322,11 @@
{
struct nv_gem_object *nv_obj = container_of(obj, struct nv_gem_object, base);
int page_count = obj->size >> PAGE_SHIFT;
-
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 10, 0)
+ return drm_prime_pages_to_sg(obj->dev, nv_obj->pages, page_count);
+#else
return drm_prime_pages_to_sg(nv_obj->pages, page_count);
+#endif
}
static void* nv_gem_prime_vmap(

View File

@ -0,0 +1,174 @@
diff -Naur NVIDIA-Linux-x86_64-340.108-old/kernel/conftest.sh NVIDIA-Linux-x86_64-340.108-new/kernel/conftest.sh
--- NVIDIA-Linux-x86_64-340.108-old/kernel/conftest.sh 2021-05-24 20:08:18.743742335 +0200
+++ NVIDIA-Linux-x86_64-340.108-new/kernel/conftest.sh 2021-05-24 20:13:18.019314390 +0200
@@ -1578,21 +1578,21 @@
#include <drm/drm_drv.h>
#endif
- #if defined(NV_DRM_DRM_PRIME_H_PRESENT)
- #include <drm/drm_prime.h>
- #endif
-
#if !defined(CONFIG_DRM) && !defined(CONFIG_DRM_MODULE)
#error DRM not enabled
#endif
+
void conftest_drm_available(void) {
struct drm_driver drv;
- drv.gem_prime_pin = 0;
- drv.gem_prime_get_sg_table = 0;
- drv.gem_prime_vmap = 0;
- drv.gem_prime_vunmap = 0;
- (void)drm_gem_prime_import;
- (void)drm_gem_prime_export;
+
+ /* 2013-10-02 1bb72532ac260a2d3982b40bdd4c936d779d0d16 */
+ (void)drm_dev_alloc;
+
+ /* 2013-10-02 c22f0ace1926da399d9a16dfaf09174c1b03594c */
+ (void)drm_dev_register;
+
+ /* 2013-10-02 c3a49737ef7db0bdd4fcf6cf0b7140a883e32b2a */
+ (void)drm_dev_unregister;
}"
compile_check_conftest "$CODE" "NV_DRM_AVAILABLE" "" "generic"
diff -Naur NVIDIA-Linux-x86_64-340.108-old/kernel/nv-drm.c NVIDIA-Linux-x86_64-340.108-new/kernel/nv-drm.c
--- NVIDIA-Linux-x86_64-340.108-old/kernel/nv-drm.c 2021-05-24 20:08:18.779739237 +0200
+++ NVIDIA-Linux-x86_64-340.108-new/kernel/nv-drm.c 2021-05-24 20:42:13.443288819 +0200
@@ -60,6 +60,8 @@
#else
#include <drm/drm_agpsupport.h>
+#include "linux/dma-buf.h"
+
struct nv_drm_agp_head {
struct agp_kern_info agp_info;
struct list_head memory;
@@ -210,8 +212,10 @@
/* No locking needed since shadow-attach is single-threaded since it may
* only be called from the per-driver module init hook. */
+#if LINUX_VERSION_CODE <= KERNEL_VERSION(5, 10, 0)
if (drm_core_check_feature(dev, DRIVER_LEGACY))
list_add_tail(&dev->legacy_dev_list, &driver->legacy_dev_list);
+#endif
return 0;
@@ -239,8 +243,10 @@
if (WARN_ON(!(driver->driver_features & DRIVER_LEGACY)))
return -EINVAL;
+#if LINUX_VERSION_CODE <= KERNEL_VERSION(5, 10, 0)
/* If not using KMS, fall back to stealth mode manual scanning. */
INIT_LIST_HEAD(&driver->legacy_dev_list);
+#endif
for (i = 0; pdriver->id_table[i].vendor != 0; i++) {
pid = &pdriver->id_table[i];
@@ -273,11 +279,13 @@
if (!(driver->driver_features & DRIVER_LEGACY)) {
WARN_ON(1);
} else {
+#if LINUX_VERSION_CODE <= KERNEL_VERSION(5, 10, 0)
list_for_each_entry_safe(dev, tmp, &driver->legacy_dev_list,
legacy_dev_list) {
list_del(&dev->legacy_dev_list);
drm_put_dev(dev);
}
+#endif
}
DRM_INFO("Module unloaded\n");
}
@@ -402,6 +410,39 @@
.llseek = noop_llseek,
};
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 11, 0)
+struct sg_table *nv_drm_gem_prime_get_sg_table(struct drm_gem_object *gem)
+{
+ return nv_gem_prime_get_sg_table(gem);
+}
+
+static int nv_drm_gem_vmap(struct drm_gem_object *gem,
+ struct dma_buf_map *map)
+{
+ map->vaddr = nv_gem_prime_vmap(gem);
+ if (map->vaddr == NULL) {
+ return -ENOMEM;
+ }
+ map->is_iomem = true;
+ return 0;
+}
+
+static void nv_drm_gem_vunmap(struct drm_gem_object *gem,
+ struct dma_buf_map *map)
+{
+ nv_gem_prime_vunmap(gem, map->vaddr);
+ map->vaddr = NULL;
+}
+
+static struct drm_gem_object_funcs nv_drm_gem_object_funcs = {
+ .free = nv_gem_free,
+ .export = drm_gem_prime_export,
+ .get_sg_table = nv_drm_gem_prime_get_sg_table,
+ .vmap = nv_drm_gem_vmap,
+ .vunmap = nv_drm_gem_vunmap,
+};
+#endif
+
static struct drm_driver nv_drm_driver = {
.driver_features = DRIVER_GEM
@@ -420,17 +461,19 @@
.set_busid = drm_pci_set_busid,
#endif
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 9, 0)
- .gem_free_object_unlocked = nv_gem_free,
-#else
+#if LINUX_VERSION_CODE <= KERNEL_VERSION(5, 8, 0)
.gem_free_object = nv_gem_free,
+#elif LINUX_VERSION_CODE <= KERNEL_VERSION(5, 10, 0)
+ .gem_free_object_unlocked = nv_gem_free,
#endif
.prime_handle_to_fd = drm_gem_prime_handle_to_fd,
+#if LINUX_VERSION_CODE <= KERNEL_VERSION(5, 10, 0)
.gem_prime_export = drm_gem_prime_export,
.gem_prime_get_sg_table = nv_gem_prime_get_sg_table,
.gem_prime_vmap = nv_gem_prime_vmap,
.gem_prime_vunmap = nv_gem_prime_vunmap,
+#endif
.name = "nvidia-drm",
.desc = "NVIDIA DRM driver",
diff -Naur NVIDIA-Linux-x86_64-340.108-old/kernel/nv-linux.h NVIDIA-Linux-x86_64-340.108-new/kernel/nv-linux.h
--- NVIDIA-Linux-x86_64-340.108-old/kernel/nv-linux.h 2021-05-24 20:08:18.775739581 +0200
+++ NVIDIA-Linux-x86_64-340.108-new/kernel/nv-linux.h 2021-05-24 20:09:18.748287771 +0200
@@ -119,7 +119,9 @@
#include <asm/tlbflush.h> /* flush_tlb(), flush_tlb_all() */
#include <linux/cpu.h> /* CPU hotplug support */
#endif
-#include <asm/kmap_types.h> /* page table entry lookup */
+#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 11, 0)
+ #include <asm/kmap_types.h> /* page table entry lookup */
+#endif
#include <linux/pci.h> /* pci_find_class, etc */
#include <linux/interrupt.h> /* tasklets, interrupt helpers */
diff -Naur NVIDIA-Linux-x86_64-340.108-old/kernel/uvm/nvidia_uvm_linux.h NVIDIA-Linux-x86_64-340.108-new/kernel/uvm/nvidia_uvm_linux.h
--- NVIDIA-Linux-x86_64-340.108-old/kernel/uvm/nvidia_uvm_linux.h 2021-05-24 20:08:18.775739581 +0200
+++ NVIDIA-Linux-x86_64-340.108-new/kernel/uvm/nvidia_uvm_linux.h 2021-05-24 20:09:18.749287739 +0200
@@ -141,7 +141,9 @@
#if !defined(NV_VMWARE)
#include <asm/tlbflush.h> /* flush_tlb(), flush_tlb_all() */
#endif
-#include <asm/kmap_types.h> /* page table entry lookup */
+#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 11, 0)
+ #include <asm/kmap_types.h> /* page table entry lookup */
+#endif
#include <linux/interrupt.h> /* tasklets, interrupt helpers */
#include <linux/timer.h>

View File

@ -0,0 +1,213 @@
diff -Naur NVIDIA-Linux-x86_64-340.108-no-compat32.5.13/kernel/nv-drm.c NVIDIA-Linux-x86_64-340.108-no-compat32.5.14/kernel/nv-drm.c
--- NVIDIA-Linux-x86_64-340.108-no-compat32.5.13/kernel/nv-drm.c 2021-07-25 10:29:29.336505688 +0200
+++ NVIDIA-Linux-x86_64-340.108-no-compat32.5.14/kernel/nv-drm.c 2021-09-16 16:49:10.929858547 +0200
@@ -57,8 +57,11 @@
#if defined(NV_DRM_GET_PCI_DEV_PRESENT)
#define nv_drm_get_pci_dev drm_get_pci_dev
#else
+#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 14, 0)
#include <drm/drm_agpsupport.h>
-
+#else
+#include <drm/drm_legacy.h>
+#endif
#include "linux/dma-buf.h"
struct nv_drm_agp_head {
@@ -82,6 +85,11 @@
struct list_head head;
};
+struct nv_drm_extra_priv_data {
+ struct pci_dev *pdev;
+ struct drm_agp_head *agp;
+};
+
/*
* Code from drm_agp_init/nv_drm_{free,unbind}_agp
* Extracted from commit: 5b8b9d0c6d0e0f1993c6c56deaf9646942c49d94, file: drivers/gpu/drm/drm_agpsupport.c
@@ -89,13 +97,14 @@
struct drm_agp_head *nv_drm_agp_init(struct drm_device *dev)
{
struct nv_drm_agp_head *head = NULL;
+ struct nv_drm_extra_priv_data *extra = dev->dev_private;
head = kzalloc(sizeof(*head), GFP_KERNEL);
if (!head)
return NULL;
- head->bridge = agp_find_bridge(dev->pdev);
+ head->bridge = agp_find_bridge(extra->pdev);
if (!head->bridge) {
- head->bridge = agp_backend_acquire(dev->pdev);
+ head->bridge = agp_backend_acquire(extra->pdev);
if (!head->bridge) {
kfree(head);
return NULL;
@@ -133,48 +142,71 @@
static void nv_drm_pci_agp_init(struct drm_device *dev)
{
if (drm_core_check_feature(dev, DRIVER_USE_AGP)) {
- if (pci_find_capability(dev->pdev, PCI_CAP_ID_AGP))
- dev->agp = nv_drm_agp_init(dev);
- if (dev->agp) {
- dev->agp->agp_mtrr = arch_phys_wc_add(
- dev->agp->agp_info.aper_base,
- dev->agp->agp_info.aper_size *
+ struct nv_drm_extra_priv_data *extra = dev->dev_private;
+
+ if (pci_find_capability(extra->pdev, PCI_CAP_ID_AGP))
+ extra->agp = nv_drm_agp_init(dev);
+ if (extra->agp) {
+ extra->agp->agp_mtrr = arch_phys_wc_add(
+ extra->agp->agp_info.aper_base,
+ extra->agp->agp_info.aper_size *
1024 * 1024);
}
}
}
+#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 14, 0)
+
+#else
+/* copied from v5.14.5 */
+int nv_drm_legacy_agp_release(struct drm_device *dev)
+{
+ struct nv_drm_extra_priv_data *extra = dev->dev_private;
+
+ if (!extra->agp || !extra->agp->acquired)
+ return -EINVAL;
+ agp_backend_release(extra->agp->bridge);
+ extra->agp->acquired = 0;
+ return 0;
+}
+#endif
+
void nv_drm_legacy_agp_clear(struct drm_device *dev)
{
struct nv_drm_agp_mem *entry, *tempe;
+ struct nv_drm_extra_priv_data *extra = dev->dev_private;
- if (!dev->agp)
+ if (!extra->agp)
return;
if (!drm_core_check_feature(dev, DRIVER_LEGACY))
return;
- list_for_each_entry_safe(entry, tempe, &dev->agp->memory, head) {
+ list_for_each_entry_safe(entry, tempe, &extra->agp->memory, head) {
if (entry->bound)
nv_drm_unbind_agp(entry->memory);
nv_drm_free_agp(entry->memory, entry->pages);
kfree(entry);
}
- INIT_LIST_HEAD(&dev->agp->memory);
+ INIT_LIST_HEAD(&extra->agp->memory);
- if (dev->agp->acquired)
+ if (extra->agp->acquired)
+#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 14, 0)
drm_agp_release(dev);
-
- dev->agp->acquired = 0;
- dev->agp->enabled = 0;
+#else
+ nv_drm_legacy_agp_release(dev);
+#endif
+ extra->agp->acquired = 0;
+ extra->agp->enabled = 0;
}
void nv_drm_pci_agp_destroy(struct drm_device *dev)
{
- if (dev->agp) {
- arch_phys_wc_del(dev->agp->agp_mtrr);
+ struct nv_drm_extra_priv_data *extra = dev->dev_private;
+ if (extra->agp) {
+ arch_phys_wc_del(extra->agp->agp_mtrr);
nv_drm_legacy_agp_clear(dev);
- kfree(dev->agp);
- dev->agp = NULL;
+ kfree(extra->agp);
+ extra->agp = NULL;
}
}
@@ -183,6 +215,7 @@
struct drm_driver *driver)
{
struct drm_device *dev;
+ struct nv_drm_extra_priv_data *extra;
int ret;
DRM_DEBUG("\n");
@@ -191,11 +224,18 @@
if (IS_ERR(dev))
return PTR_ERR(dev);
+ extra = kzalloc(sizeof(*extra), GFP_KERNEL);
+ if (IS_ERR(extra))
+ goto err_free;
+
+ extra->pdev = pdev;
+
ret = pci_enable_device(pdev);
if (ret)
- goto err_free;
+ goto err_free2;
- dev->pdev = pdev;
+ /* use the not used (i hope) dev_private to store deprecated/legacy pointers */
+ dev->dev_private = extra;
#ifdef __alpha__
dev->hose = pdev->sysdata;
#endif
@@ -221,6 +261,8 @@
err_agp:
nv_drm_pci_agp_destroy(dev);
pci_disable_device(pdev);
+err_free2:
+ kfree(extra);
err_free:
drm_dev_put(dev);
return ret;
@@ -303,10 +345,11 @@
)
{
nv_linux_state_t *nvl;
+ struct nv_drm_extra_priv_data *extra = dev->dev_private;
for (nvl = nv_linux_devices; nvl != NULL; nvl = nvl->next)
{
- if (nvl->dev == dev->pdev)
+ if (nvl->dev == extra->pdev)
{
nvl->drm = dev;
return 0;
@@ -327,10 +370,11 @@
)
{
nv_linux_state_t *nvl;
+ struct nv_drm_extra_priv_data *extra = dev->dev_private;
for (nvl = nv_linux_devices; nvl != NULL; nvl = nvl->next)
{
- if (nvl->dev == dev->pdev)
+ if (nvl->dev == extra->pdev)
{
BUG_ON(nvl->drm != dev);
nvl->drm = NULL;
diff -Naur NVIDIA-Linux-x86_64-340.108-no-compat32.5.13/kernel/os-interface.c NVIDIA-Linux-x86_64-340.108-no-compat32.5.14/kernel/os-interface.c
--- NVIDIA-Linux-x86_64-340.108-no-compat32.5.13/kernel/os-interface.c 2021-07-25 10:29:29.083168593 +0200
+++ NVIDIA-Linux-x86_64-340.108-no-compat32.5.14/kernel/os-interface.c 2021-09-16 13:17:43.345906445 +0200
@@ -549,7 +549,11 @@
// the requested timeout has expired, loop until less
// than a jiffie of the desired delay remains.
//
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 14, 0)
+ current->__state = TASK_INTERRUPTIBLE;
+#else
current->state = TASK_INTERRUPTIBLE;
+#endif
do
{
schedule_timeout(jiffies);

View File

@ -0,0 +1,14 @@
diff -Naur NVIDIA-Linux-x86_64-340.108-old/kernel/nv-drm.c NVIDIA-Linux-x86_64-340.108-new/kernel/nv-drm.c
--- NVIDIA-Linux-x86_64-340.108-old/kernel/nv-drm.c 2021-11-06 20:08:18.779739237 +0200
+++ NVIDIA-Linux-x86_64-340.108-new/kernel/nv-drm.c 2021-11-06 20:42:13.443288819 +0200
@@ -529,7 +529,9 @@ RM_STATUS NV_API_CALL nv_alloc_os_descri
#if defined(NV_DRM_GEM_OBJECT_PUT_UNLOCKED_PRESENT)
drm_gem_object_put_unlocked(&nv_obj->base);
#else
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 9, 0)
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 15, 0)
+ drm_gem_object_put(&nv_obj->base);
+#elif LINUX_VERSION_CODE >= KERNEL_VERSION(5, 9, 0)
drm_gem_object_put_locked(&nv_obj->base);
#else
drm_gem_object_unreference_unlocked(&nv_obj->base);

View File

@ -0,0 +1,30 @@
--- a/kernel/os-interface.h 2019-12-11 22:04:24.000000000 +0000
+++ b/kernel/os-interface.h 2022-01-10 02:04:26.740899810 +0000
@@ -24,7 +24,12 @@
* *
\***************************************************************************/
+#include <linux/version.h>
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 16, 0)
+#include <linux/stdarg.h>
+#else
#include <stdarg.h>
+#endif
/*
* Define away Microsoft compiler extensions when possible
--- a/kernel/nv.h 2019-12-11 22:04:24.000000000 +0000
+++ b/kernel/nv.h 2022-01-10 02:29:07.828733372 +0000
@@ -13,7 +13,12 @@
#define _NV_H_
#include <nvtypes.h>
+#include <linux/version.h>
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 16, 0)
+#include <linux/stdarg.h>
+#else
#include <stdarg.h>
+#endif
#if !defined(NV_MIN)
#define NV_MIN(_a,_b) ((_a) < (_b) ? (_a) : (_b))

View File

@ -0,0 +1,57 @@
diff -Naur a/kernel/conftest.sh b/kernel/conftest.sh
--- a/kernel/conftest.sh 2022-04-02 10:27:54.463179319 +0000
+++ b/kernel/conftest.sh 2022-04-02 10:27:54.553179467 +0000
@@ -1619,7 +1619,11 @@
CODE="
#include <linux/proc_fs.h>
void conftest_PDE_DATA(void) {
+ #if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 17, 0)
+ pde_data();
+ #else
PDE_DATA();
+ #endif
}"
compile_check_conftest "$CODE" "NV_PDE_DATA_PRESENT" "" "functions"
diff -Naur a/kernel/nv-linux.h b/kernel/nv-linux.h
--- a/kernel/nv-linux.h 2022-04-02 10:27:54.463179319 +0000
+++ b/kernel/nv-linux.h 2022-04-02 10:27:54.556512806 +0000
@@ -266,9 +266,9 @@
#endif
#ifdef CONFIG_PROC_FS
-#include <linux/proc_fs.h>
#include <linux/seq_file.h>
#endif
+#include <linux/proc_fs.h>
#ifdef CONFIG_KDB
#include <linux/kdb.h>
@@ -2052,8 +2052,12 @@
})
#if defined(NV_PDE_DATA_PRESENT)
+#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 17, 0)
# define NV_PDE_DATA(inode) PDE_DATA(inode)
#else
+# define NV_PDE_DATA(inode) pde_data(inode)
+#endif
+#else
# define NV_PDE_DATA(inode) PDE(inode)->data
#endif
diff -Naur a/kernel/uvm/conftest.sh b/kernel/uvm/conftest.sh
--- a/kernel/uvm/conftest.sh 2022-04-02 10:27:54.456512642 +0000
+++ b/kernel/uvm/conftest.sh 2022-04-02 10:27:54.556512806 +0000
@@ -1578,7 +1578,11 @@
CODE="
#include <linux/proc_fs.h>
void conftest_PDE_DATA(void) {
+ #if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 17, 0)
+ pde_data();
+ #else
PDE_DATA();
+ #endif
}"
compile_check_conftest "$CODE" "NV_PDE_DATA_PRESENT" "" "functions"

View File

@ -0,0 +1,151 @@
diff -Naur a/kernel/nv-acpi.c b/kernel/nv-acpi.c
--- a/kernel/nv-acpi.c 2019-12-12 06:04:24.000000000 +0800
+++ b/kernel/nv-acpi.c 2022-05-29 20:00:00.000000000 +0800
@@ -577,9 +577,13 @@
{
if (!nvif_parent_gpu_handle) /* unknown error */
break;
-
- retVal = acpi_bus_get_device(nvif_parent_gpu_handle, &device);
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 18, 0)
+ device = acpi_fetch_acpi_dev(nvif_parent_gpu_handle);
+ retVal = 0;
+#else
+ retVal = acpi_bus_get_device(nvif_parent_gpu_handle, &device);
+#endif
if (ACPI_FAILURE(retVal) || !device)
break;
@@ -652,8 +656,11 @@
if (nvif_parent_gpu_handle == NULL)
return;
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 18, 0)
+ device = acpi_fetch_acpi_dev(nvif_parent_gpu_handle);
+#else
acpi_bus_get_device(nvif_parent_gpu_handle, &device);
-
+#endif
nv_uninstall_notifier(device, nv_acpi_event);
nvif_parent_gpu_handle = NULL;
@@ -1212,7 +1219,12 @@
if (!dev_handle)
return RM_ERR_INVALID_ARGUMENT;
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 18, 0)
+ device = acpi_fetch_acpi_dev(dev_handle);
+ status = 0;
+#else
status = acpi_bus_get_device(dev_handle, &device);
+#endif
if (ACPI_FAILURE(status) || !device)
return RM_ERR_INVALID_ARGUMENT;
diff -Naur a/kernel/nv-dma.c b/kernel/nv-dma.c
--- a/kernel/nv-dma.c 2019-12-12 06:04:24.000000000 +0800
+++ b/kernel/nv-dma.c 2022-05-29 20:00:00.000000000 +0800
@@ -136,10 +136,17 @@
return status;
}
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 18, 0)
+ dma_map->sg_map_count = dma_map_sg(&dma_map->dev->dev,
+ NV_DMA_MAP_SCATTERLIST(dma_map),
+ NV_DMA_MAP_SCATTERLIST_LENGTH(dma_map),
+ DMA_BIDIRECTIONAL);
+#else
dma_map->sg_map_count = pci_map_sg(dma_map->dev,
NV_DMA_MAP_SCATTERLIST(dma_map),
NV_DMA_MAP_SCATTERLIST_LENGTH(dma_map),
PCI_DMA_BIDIRECTIONAL);
+#endif
if (dma_map->sg_map_count == 0)
{
nv_printf(NV_DBG_ERRORS,
@@ -211,8 +218,13 @@
if (dma_map->sg_map_count != 0)
{
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 18, 0)
+ dma_unmap_sg(&dma_map->dev->dev, NV_DMA_MAP_SCATTERLIST(dma_map),
+ NV_DMA_MAP_SCATTERLIST_LENGTH(dma_map), DMA_BIDIRECTIONAL);
+#else
pci_unmap_sg(dma_map->dev, NV_DMA_MAP_SCATTERLIST(dma_map),
NV_DMA_MAP_SCATTERLIST_LENGTH(dma_map), PCI_DMA_BIDIRECTIONAL);
+#endif
}
*priv = dma_map->user_pages;
diff -Naur a/kernel/nv-drm.c b/kernel/nv-drm.c
--- a/kernel/nv-drm.c 2022-05-29 21:57:55.203782383 +0800
+++ b/kernel/nv-drm.c 2022-05-29 20:00:00.000000000 +0800
@@ -458,9 +458,15 @@
return nv_gem_prime_get_sg_table(gem);
}
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 18, 0)
+static int nv_drm_gem_vmap(struct drm_gem_object *gem,
+ struct iosys_map *map)
+{
+#else
static int nv_drm_gem_vmap(struct drm_gem_object *gem,
struct dma_buf_map *map)
{
+#endif
map->vaddr = nv_gem_prime_vmap(gem);
if (map->vaddr == NULL) {
return -ENOMEM;
@@ -469,9 +475,15 @@
return 0;
}
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 18, 0)
+static void nv_drm_gem_vunmap(struct drm_gem_object *gem,
+ struct iosys_map *map)
+{
+#else
static void nv_drm_gem_vunmap(struct drm_gem_object *gem,
struct dma_buf_map *map)
{
+#endif
nv_gem_prime_vunmap(gem, map->vaddr);
map->vaddr = NULL;
}
diff -Naur a/kernel/nv-vm.c b/kernel/nv-vm.c
--- a/kernel/nv-vm.c 2019-12-12 06:04:24.000000000 +0800
+++ b/kernel/nv-vm.c 2022-05-29 20:00:00.000000000 +0800
@@ -169,12 +169,20 @@
static inline int nv_map_sg(struct pci_dev *dev, struct scatterlist *sg)
{
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 18, 0)
+ return dma_map_sg(&dev->dev, sg, 1, DMA_BIDIRECTIONAL);
+#else
return pci_map_sg(dev, sg, 1, PCI_DMA_BIDIRECTIONAL);
+#endif
}
static inline void nv_unmap_sg(struct pci_dev *dev, struct scatterlist *sg)
{
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 18, 0)
+ dma_unmap_sg(&dev->dev, sg, 1, DMA_BIDIRECTIONAL);
+#else
pci_unmap_sg(dev, sg, 1, PCI_DMA_BIDIRECTIONAL);
+#endif
}
#define NV_MAP_SG_MAX_RETRIES 16
diff -Naur a/kernel/nv-frontend.c b/kernel/nv-frontend.c
--- a/kernel/nv-frontend.c 2019-12-12 06:04:24.000000000 +0800
+++ b/kernel/nv-frontend.c 2022-05-29 20:00:00.000000000 +0800
@@ -15,7 +15,7 @@
#include "nv-frontend.h"
#if defined(MODULE_LICENSE)
-MODULE_LICENSE("NVIDIA");
+MODULE_LICENSE("GPL");
#endif
#if defined(MODULE_INFO)
MODULE_INFO(supported, "external");

View File

@ -0,0 +1,780 @@
From 2154cc447a2377cfd60a7b7c5b619e689ebf71b1 Mon Sep 17 00:00:00 2001
From: graysky <graysky@archlinux.us>
Date: Thu, 22 Oct 2020 06:58:53 -0400
Subject: [PATCH 1/3] kernel-5.7
credit: https://gitlab.manjaro.org/packages?utf8=%E2%9C%93&filter=nvidia-340xx
---
kernel/Makefile | 5 +
kernel/conftest.sh | 81 +++++++++++++
kernel/dkms.conf | 8 +-
kernel/nv-drm.c | 229 ++++++++++++++++++++++++++++++++++-
kernel/nv-linux.h | 49 ++++++++
kernel/nv-procfs.c | 20 +++
kernel/nv-time.h | 9 +-
kernel/nv.c | 2 +-
kernel/os-interface.c | 8 +-
kernel/uvm/Makefile | 1 +
kernel/uvm/conftest.sh | 4 +
kernel/uvm/nvidia_uvm_lite.c | 29 ++++-
12 files changed, 431 insertions(+), 14 deletions(-)
diff --git a/kernel/Makefile b/kernel/Makefile
index 125a690..2597080 100644
--- a/kernel/Makefile
+++ b/kernel/Makefile
@@ -108,12 +108,14 @@ COMPILE_TESTS = \
acquire_console_sem \
console_lock \
kmem_cache_create \
+ kmem_cache_create_usercopy \
outer_flush_all \
on_each_cpu \
smp_call_function \
nvmap_support \
acpi_evaluate_integer \
ioremap_cache \
+ ioremap_nocache \
ioremap_wc \
proc_dir_entry \
INIT_WORK \
@@ -122,6 +124,7 @@ COMPILE_TESTS = \
pci_domain_nr \
pci_dma_mapping_error \
file_operations \
+ proc_ops \
sg_alloc_table \
sg_init_table \
pci_get_domain_bus_and_slot \
@@ -147,6 +150,8 @@ COMPILE_TESTS = \
vm_fault_present \
vm_fault_has_address \
drm_driver_unload_has_int_return_type \
+ drm_get_pci_dev \
+ drm_pci_init \
drm_legacy_pci_init \
timer_setup \
do_gettimeofday \
diff --git a/kernel/conftest.sh b/kernel/conftest.sh
index b7a85f0..a5225e5 100755
--- a/kernel/conftest.sh
+++ b/kernel/conftest.sh
@@ -176,6 +176,7 @@ test_headers() {
FILES="$FILES linux/ktime.h"
FILES="$FILES linux/file.h"
+ FILES_ARCH="$FILES_ARCH asm/pgtable.h"
FILES_ARCH="$FILES_ARCH asm/set_memory.h"
translate_and_find_header_files $HEADERS $FILES
@@ -440,6 +441,9 @@ compile_test() {
# Determine if the set_memory_array_uc() function is present.
#
CODE="
+ #if defined(NV_ASM_PGTABLE_H_PRESENT)
+ #include <asm/pgtable.h>
+ #endif
#if defined(NV_ASM_SET_MEMORY_H_PRESENT)
#include <asm/set_memory.h>
#else
@@ -914,6 +918,21 @@ compile_test() {
fi
;;
+ kmem_cache_create_usercopy)
+ #
+ # Determine if the kmem_cache_create_usercopy function exists.
+ #
+ # This function was added by:
+ # 2017-06-10 8eb8284b412906181357c2b0110d879d5af95e52
+ CODE="
+ #include <linux/slab.h>
+ void kmem_cache_create_usercopy(void) {
+ kmem_cache_create_usercopy();
+ }"
+
+ compile_check_conftest "$CODE" "NV_KMEM_CACHE_CREATE_USERCOPY_PRESENT" "" "functions"
+ ;;
+
smp_call_function)
#
# Determine if the smp_call_function() function is
@@ -1188,6 +1207,22 @@ compile_test() {
compile_check_conftest "$CODE" "NV_IOREMAP_CACHE_PRESENT" "" "functions"
;;
+ ioremap_nocache)
+ #
+ # Determine if the ioremap_nocache() function is present.
+ #
+ # Removed by commit 4bdc0d676a64 ("remove ioremap_nocache and
+ # devm_ioremap_nocache") in v5.6 (2020-01-06)
+ #
+ CODE="
+ #include <asm/io.h>
+ void conftest_ioremap_nocache(void) {
+ ioremap_nocache();
+ }"
+
+ compile_check_conftest "$CODE" "NV_IOREMAP_NOCACHE_PRESENT" "" "functions"
+ ;;
+
ioremap_wc)
#
# Determine if the ioremap_wc() function is present.
@@ -1371,6 +1406,16 @@ compile_test() {
compile_check_conftest "$CODE" "NV_FILE_OPERATIONS_HAS_COMPAT_IOCTL" "" "types"
;;
+ proc_ops)
+ CODE="
+ #include <linux/proc_fs.h>
+ int conftest_proc_ops(void) {
+ return offsetof(struct proc_ops, proc_open);
+ }"
+
+ compile_check_conftest "$CODE" "NV_HAVE_PROC_OPS" "" "types"
+ ;;
+
sg_init_table)
#
# Determine if the sg_init_table() function is present.
@@ -2044,6 +2089,42 @@ compile_test() {
compile_check_conftest "$CODE" "NV_DRM_DRIVER_UNLOAD_HAS_INT_RETURN_TYPE" "" "types"
;;
+ drm_get_pci_dev)
+ #
+ # Determine if drm_get_pci_dev() is present.
+ #
+ CODE="
+ #if defined(NV_DRM_DRMP_H_PRESENT)
+ #include <drm/drmP.h>
+ #endif
+
+ #if defined(NV_DRM_DRM_PCI_H_PRESENT)
+ #include <drm/drm_pci.h>
+ #endif
+
+ void conftest_drm_legacy_pci_init(void) {
+ drm_get_pci_dev();
+ }"
+
+ compile_check_conftest "$CODE" "NV_DRM_GET_PCI_DEV_PRESENT" "" "functions"
+ ;;
+
+ drm_pci_init)
+ #
+ # Determine if drm_pci_init() is present.
+ #
+ CODE="
+ #if defined(NV_DRM_DRMP_H_PRESENT)
+ #include <drm/drmP.h>
+ #endif
+
+ void conftest_drm_legacy_pci_init(void) {
+ drm_pci_init();
+ }"
+
+ compile_check_conftest "$CODE" "NV_DRM_PCI_INIT_PRESENT" "" "functions"
+ ;;
+
drm_legacy_pci_init)
#
# Determine if drm_legacy_pci_init() is present. drm_pci_init() was
diff --git a/kernel/dkms.conf b/kernel/dkms.conf
index 79a02ae..3140f03 100644
--- a/kernel/dkms.conf
+++ b/kernel/dkms.conf
@@ -1,7 +1,13 @@
+if [ -x /usr/bin/nproc ]; then
+ num_cpu_cores=$(nproc)
+else
+ num_cpu_cores=1
+fi
+
PACKAGE_NAME="nvidia"
PACKAGE_VERSION="340.108"
BUILT_MODULE_NAME[0]="$PACKAGE_NAME"
DEST_MODULE_LOCATION[0]="/kernel/drivers/video"
-MAKE[0]="make module KERNEL_UNAME=${kernelver}"
+MAKE[0]="make -j$num_cpu_cores module KERNEL_UNAME=${kernelver}"
CLEAN="make clean"
AUTOINSTALL="yes"
diff --git a/kernel/nv-drm.c b/kernel/nv-drm.c
index 0d1cdbf..85db07e 100644
--- a/kernel/nv-drm.c
+++ b/kernel/nv-drm.c
@@ -50,9 +50,236 @@
#if defined(NV_DRM_LEGACY_PCI_INIT_PRESENT)
#define nv_drm_pci_init drm_legacy_pci_init
#define nv_drm_pci_exit drm_legacy_pci_exit
-#else
+#elif defined(NV_DRM_PCI_INIT_PRESENT)
#define nv_drm_pci_init drm_pci_init
#define nv_drm_pci_exit drm_pci_exit
+#else
+#if defined(NV_DRM_GET_PCI_DEV_PRESENT)
+#define nv_drm_get_pci_dev drm_get_pci_dev
+#else
+#include <drm/drm_agpsupport.h>
+
+struct nv_drm_agp_head {
+ struct agp_kern_info agp_info;
+ struct list_head memory;
+ unsigned long mode;
+ struct agp_bridge_data *bridge;
+ int enabled;
+ int acquired;
+ unsigned long base;
+ int agp_mtrr;
+ int cant_use_aperture;
+ unsigned long page_mask;
+};
+
+struct nv_drm_agp_mem {
+ unsigned long handle;
+ struct agp_memory *memory;
+ unsigned long bound;
+ int pages;
+ struct list_head head;
+};
+
+/*
+ * Code from drm_agp_init/nv_drm_{free,unbind}_agp
+ * Extracted from commit: 5b8b9d0c6d0e0f1993c6c56deaf9646942c49d94, file: drivers/gpu/drm/drm_agpsupport.c
+ */
+struct drm_agp_head *nv_drm_agp_init(struct drm_device *dev)
+{
+ struct nv_drm_agp_head *head = NULL;
+
+ head = kzalloc(sizeof(*head), GFP_KERNEL);
+ if (!head)
+ return NULL;
+ head->bridge = agp_find_bridge(dev->pdev);
+ if (!head->bridge) {
+ head->bridge = agp_backend_acquire(dev->pdev);
+ if (!head->bridge) {
+ kfree(head);
+ return NULL;
+ }
+ agp_copy_info(head->bridge, &head->agp_info);
+ agp_backend_release(head->bridge);
+ } else {
+ agp_copy_info(head->bridge, &head->agp_info);
+ }
+ if (head->agp_info.chipset == NOT_SUPPORTED) {
+ kfree(head);
+ return NULL;
+ }
+ INIT_LIST_HEAD(&head->memory);
+ head->cant_use_aperture = head->agp_info.cant_use_aperture;
+ head->page_mask = head->agp_info.page_mask;
+ head->base = head->agp_info.aper_base;
+ return (struct drm_agp_head *)head;
+}
+
+void nv_drm_free_agp(struct agp_memory *handle, int pages)
+{
+ agp_free_memory(handle);
+}
+
+int nv_drm_unbind_agp(struct agp_memory *handle)
+{
+ return agp_unbind_memory(handle);
+}
+
+/*
+ * Code from drm_pci_agp_{clear,destroy,init}/drm_get_pci_dev
+ * Extracted from commit: 5b8b9d0c6d0e0f1993c6c56deaf9646942c49d94, file: drivers/gpu/drm/drm_pci.c
+ */
+static void nv_drm_pci_agp_init(struct drm_device *dev)
+{
+ if (drm_core_check_feature(dev, DRIVER_USE_AGP)) {
+ if (pci_find_capability(dev->pdev, PCI_CAP_ID_AGP))
+ dev->agp = nv_drm_agp_init(dev);
+ if (dev->agp) {
+ dev->agp->agp_mtrr = arch_phys_wc_add(
+ dev->agp->agp_info.aper_base,
+ dev->agp->agp_info.aper_size *
+ 1024 * 1024);
+ }
+ }
+}
+
+void nv_drm_legacy_agp_clear(struct drm_device *dev)
+{
+ struct nv_drm_agp_mem *entry, *tempe;
+
+ if (!dev->agp)
+ return;
+ if (!drm_core_check_feature(dev, DRIVER_LEGACY))
+ return;
+
+ list_for_each_entry_safe(entry, tempe, &dev->agp->memory, head) {
+ if (entry->bound)
+ nv_drm_unbind_agp(entry->memory);
+ nv_drm_free_agp(entry->memory, entry->pages);
+ kfree(entry);
+ }
+ INIT_LIST_HEAD(&dev->agp->memory);
+
+ if (dev->agp->acquired)
+ drm_agp_release(dev);
+
+ dev->agp->acquired = 0;
+ dev->agp->enabled = 0;
+}
+
+void nv_drm_pci_agp_destroy(struct drm_device *dev)
+{
+ if (dev->agp) {
+ arch_phys_wc_del(dev->agp->agp_mtrr);
+ nv_drm_legacy_agp_clear(dev);
+ kfree(dev->agp);
+ dev->agp = NULL;
+ }
+}
+
+static int nv_drm_get_pci_dev(struct pci_dev *pdev,
+ const struct pci_device_id *ent,
+ struct drm_driver *driver)
+{
+ struct drm_device *dev;
+ int ret;
+
+ DRM_DEBUG("\n");
+
+ dev = drm_dev_alloc(driver, &pdev->dev);
+ if (IS_ERR(dev))
+ return PTR_ERR(dev);
+
+ ret = pci_enable_device(pdev);
+ if (ret)
+ goto err_free;
+
+ dev->pdev = pdev;
+#ifdef __alpha__
+ dev->hose = pdev->sysdata;
+#endif
+
+ if (drm_core_check_feature(dev, DRIVER_MODESET))
+ pci_set_drvdata(pdev, dev);
+
+ nv_drm_pci_agp_init(dev);
+
+ ret = drm_dev_register(dev, ent->driver_data);
+ if (ret)
+ goto err_agp;
+
+ /* No locking needed since shadow-attach is single-threaded since it may
+ * only be called from the per-driver module init hook. */
+ if (drm_core_check_feature(dev, DRIVER_LEGACY))
+ list_add_tail(&dev->legacy_dev_list, &driver->legacy_dev_list);
+
+ return 0;
+
+err_agp:
+ nv_drm_pci_agp_destroy(dev);
+ pci_disable_device(pdev);
+err_free:
+ drm_dev_put(dev);
+ return ret;
+}
+#endif
+
+/*
+ * Code from drm_legacy_pci_{init,exit}
+ * Extracted from tag: v5.6.3, file: drivers/gpu/drm/drm_pci.c
+ */
+int nv_drm_pci_init(struct drm_driver *driver, struct pci_driver *pdriver)
+{
+ struct pci_dev *pdev = NULL;
+ const struct pci_device_id *pid;
+ int i;
+
+ DRM_DEBUG("\n");
+
+ if (WARN_ON(!(driver->driver_features & DRIVER_LEGACY)))
+ return -EINVAL;
+
+ /* If not using KMS, fall back to stealth mode manual scanning. */
+ INIT_LIST_HEAD(&driver->legacy_dev_list);
+ for (i = 0; pdriver->id_table[i].vendor != 0; i++) {
+ pid = &pdriver->id_table[i];
+
+ /* Loop around setting up a DRM device for each PCI device
+ * matching our ID and device class. If we had the internal
+ * function that pci_get_subsys and pci_get_class used, we'd
+ * be able to just pass pid in instead of doing a two-stage
+ * thing.
+ */
+ pdev = NULL;
+ while ((pdev =
+ pci_get_subsys(pid->vendor, pid->device, pid->subvendor,
+ pid->subdevice, pdev)) != NULL) {
+ if ((pdev->class & pid->class_mask) != pid->class)
+ continue;
+
+ /* stealth mode requires a manual probe */
+ pci_dev_get(pdev);
+ nv_drm_get_pci_dev(pdev, pid, driver);
+ }
+ }
+ return 0;
+}
+
+void nv_drm_pci_exit(struct drm_driver *driver, struct pci_driver *pdriver)
+{
+ struct drm_device *dev, *tmp;
+ DRM_DEBUG("\n");
+
+ if (!(driver->driver_features & DRIVER_LEGACY)) {
+ WARN_ON(1);
+ } else {
+ list_for_each_entry_safe(dev, tmp, &driver->legacy_dev_list,
+ legacy_dev_list) {
+ list_del(&dev->legacy_dev_list);
+ drm_put_dev(dev);
+ }
+ }
+ DRM_INFO("Module unloaded\n");
+}
#endif
extern nv_linux_state_t *nv_linux_devices;
diff --git a/kernel/nv-linux.h b/kernel/nv-linux.h
index a1d2c68..83e6433 100644
--- a/kernel/nv-linux.h
+++ b/kernel/nv-linux.h
@@ -688,11 +688,16 @@ extern nv_spinlock_t km_lock;
VM_ALLOC_RECORD(ptr, size, "vm_ioremap"); \
}
+#if defined(NV_IOREMAP_NOCACHE_PRESENT)
#define NV_IOREMAP_NOCACHE(ptr, physaddr, size) \
{ \
(ptr) = ioremap_nocache(physaddr, size); \
VM_ALLOC_RECORD(ptr, size, "vm_ioremap_nocache"); \
}
+#else
+#define NV_IOREMAP_NOCACHE(ptr, physaddr, size) \
+ NV_IOREMAP(ptr, physaddr, size)
+#endif
#if defined(NV_IOREMAP_CACHE_PRESENT)
#define NV_IOREMAP_CACHE(ptr, physaddr, size) \
@@ -774,6 +779,17 @@ extern nv_spinlock_t km_lock;
#error "NV_KMEM_CACHE_CREATE() undefined (kmem_cache_create() unavailable)!"
#endif
+#if defined(NV_KMEM_CACHE_CREATE_USERCOPY_PRESENT)
+#define NV_KMEM_CACHE_CREATE_USERCOPY(kmem_cache, name, type) \
+ { \
+ kmem_cache = kmem_cache_create_usercopy(name, sizeof(type), \
+ 0, 0, 0, sizeof(type), NULL); \
+ }
+#else
+#define NV_KMEM_CACHE_CREATE_USERCOPY(kmem_cache, name, type) \
+ NV_KMEM_CACHE_CREATE(kmem_cache, name, type)
+#endif
+
#define NV_KMEM_CACHE_ALLOC(ptr, kmem_cache, type) \
{ \
(ptr) = kmem_cache_alloc(kmem_cache, GFP_KERNEL); \
@@ -1971,6 +1987,19 @@ extern NvU32 nv_assign_gpu_count;
})
#endif
+#if defined(NV_HAVE_PROC_OPS)
+#define NV_CREATE_PROC_FILE(filename,parent,__name,__data) \
+ ({ \
+ struct proc_dir_entry *__entry; \
+ int mode = (S_IFREG | S_IRUGO); \
+ const struct proc_ops *fops = &nv_procfs_##__name##_fops; \
+ if (fops->proc_write != 0) \
+ mode |= S_IWUSR; \
+ __entry = NV_CREATE_PROC_ENTRY(filename, mode, parent, fops, \
+ __data); \
+ __entry; \
+ })
+#else
#define NV_CREATE_PROC_FILE(filename,parent,__name,__data) \
({ \
struct proc_dir_entry *__entry; \
@@ -1982,6 +2011,7 @@ extern NvU32 nv_assign_gpu_count;
__data); \
__entry; \
})
+#endif
/*
* proc_mkdir_mode exists in Linux 2.6.9, but isn't exported until Linux 3.0.
@@ -2023,6 +2053,24 @@ extern NvU32 nv_assign_gpu_count;
remove_proc_entry(entry->name, entry->parent);
#endif
+#if defined(NV_HAVE_PROC_OPS)
+#define NV_DEFINE_PROCFS_SINGLE_FILE(__name) \
+ static int nv_procfs_open_##__name( \
+ struct inode *inode, \
+ struct file *filep \
+ ) \
+ { \
+ return single_open(filep, nv_procfs_read_##__name, \
+ NV_PDE_DATA(inode)); \
+ } \
+ \
+ static const struct proc_ops nv_procfs_##__name##_fops = { \
+ .proc_open = nv_procfs_open_##__name, \
+ .proc_read = seq_read, \
+ .proc_lseek = seq_lseek, \
+ .proc_release = single_release, \
+ };
+#else
#define NV_DEFINE_PROCFS_SINGLE_FILE(__name) \
static int nv_procfs_open_##__name( \
struct inode *inode, \
@@ -2040,6 +2088,7 @@ extern NvU32 nv_assign_gpu_count;
.llseek = seq_lseek, \
.release = single_release, \
};
+#endif
#endif /* CONFIG_PROC_FS */
diff --git a/kernel/nv-procfs.c b/kernel/nv-procfs.c
index ebca3e8..9365c3c 100644
--- a/kernel/nv-procfs.c
+++ b/kernel/nv-procfs.c
@@ -409,6 +409,15 @@ done:
return ((status < 0) ? status : (int)count);
}
+#if defined(NV_HAVE_PROC_OPS)
+static struct proc_ops nv_procfs_registry_fops = {
+ .proc_open = nv_procfs_open_registry,
+ .proc_read = seq_read,
+ .proc_write = nv_procfs_write_file,
+ .proc_lseek = seq_lseek,
+ .proc_release = nv_procfs_close_registry,
+};
+#else
static struct file_operations nv_procfs_registry_fops = {
.owner = THIS_MODULE,
.open = nv_procfs_open_registry,
@@ -417,6 +426,7 @@ static struct file_operations nv_procfs_registry_fops = {
.llseek = seq_lseek,
.release = nv_procfs_close_registry,
};
+#endif
static int
nv_procfs_read_unbind_lock(
@@ -538,6 +548,15 @@ done:
return rc;
}
+#if defined(NV_HAVE_PROC_OPS)
+static struct proc_ops nv_procfs_unbind_lock_fops = {
+ .proc_open = nv_procfs_open_unbind_lock,
+ .proc_read = seq_read,
+ .proc_write = nv_procfs_write_file,
+ .proc_lseek = seq_lseek,
+ .proc_release = nv_procfs_close_unbind_lock,
+};
+#else
static struct file_operations nv_procfs_unbind_lock_fops = {
.owner = THIS_MODULE,
.open = nv_procfs_open_unbind_lock,
@@ -546,6 +565,7 @@ static struct file_operations nv_procfs_unbind_lock_fops = {
.llseek = seq_lseek,
.release = nv_procfs_close_unbind_lock,
};
+#endif
static int
nv_procfs_read_text_file(
diff --git a/kernel/nv-time.h b/kernel/nv-time.h
index a34ceb2..780f8bc 100644
--- a/kernel/nv-time.h
+++ b/kernel/nv-time.h
@@ -28,7 +28,12 @@
#include <linux/ktime.h>
#endif
-static inline void nv_gettimeofday(struct timeval *tv)
+struct nv_timeval {
+ __kernel_long_t tv_sec;
+ __kernel_suseconds_t tv_usec;
+};
+
+static inline void nv_gettimeofday(struct nv_timeval *tv)
{
#ifdef NV_DO_GETTIMEOFDAY_PRESENT
do_gettimeofday(tv);
@@ -37,7 +42,7 @@ static inline void nv_gettimeofday(struct timeval *tv)
ktime_get_real_ts64(&now);
- *tv = (struct timeval) {
+ *tv = (struct nv_timeval) {
.tv_sec = now.tv_sec,
.tv_usec = now.tv_nsec/1000,
};
diff --git a/kernel/nv.c b/kernel/nv.c
index a167be9..a218f83 100644
--- a/kernel/nv.c
+++ b/kernel/nv.c
@@ -752,7 +752,7 @@ int __init nvidia_init_module(void)
NV_SPIN_LOCK_INIT(&km_lock);
#endif
- NV_KMEM_CACHE_CREATE(nv_stack_t_cache, NV_STACK_CACHE_STR, nv_stack_t);
+ NV_KMEM_CACHE_CREATE_USERCOPY(nv_stack_t_cache, NV_STACK_CACHE_STR, nv_stack_t);
if (nv_stack_t_cache == NULL)
{
nv_printf(NV_DBG_ERRORS, "NVRM: stack cache allocation failed!\n");
diff --git a/kernel/os-interface.c b/kernel/os-interface.c
index 7190b26..0c0dc05 100644
--- a/kernel/os-interface.c
+++ b/kernel/os-interface.c
@@ -439,7 +439,7 @@ RM_STATUS NV_API_CALL os_get_current_time(
NvU32 *useconds
)
{
- struct timeval tm;
+ struct nv_timeval tm;
nv_gettimeofday(&tm);
@@ -474,7 +474,7 @@ RM_STATUS NV_API_CALL os_delay_us(NvU32 MicroSeconds)
unsigned long usec;
#ifdef NV_CHECK_DELAY_ACCURACY
- struct timeval tm1, tm2;
+ struct nv_timeval tm1, tm2;
nv_gettimeofday(&tm1);
#endif
@@ -514,9 +514,9 @@ RM_STATUS NV_API_CALL os_delay(NvU32 MilliSeconds)
unsigned long MicroSeconds;
unsigned long jiffies;
unsigned long mdelay_safe_msec;
- struct timeval tm_end, tm_aux;
+ struct nv_timeval tm_end, tm_aux;
#ifdef NV_CHECK_DELAY_ACCURACY
- struct timeval tm_start;
+ struct nv_timeval tm_start;
#endif
nv_gettimeofday(&tm_aux);
diff --git a/kernel/uvm/Makefile b/kernel/uvm/Makefile
index 0cad8ff..043a08d 100644
--- a/kernel/uvm/Makefile
+++ b/kernel/uvm/Makefile
@@ -207,6 +207,7 @@ ccflags-y += $(EXTRA_CFLAGS)
RM_MODULE_SYMVERS:= $(RM_OUT_DIR)/Module.symvers
UVM_MODULE_SYMVERS:= $(obj)/Module.symvers
+KBUILD_EXTRA_SYMBOLS:= $(UVM_MODULE_SYMVERS)
module $(MODULE_NAME).ko: $(UVM_MODULE_SYMVERS) debug_diagnostics_printing
diff --git a/kernel/uvm/conftest.sh b/kernel/uvm/conftest.sh
index b7a85f0..33e2a63 100755
--- a/kernel/uvm/conftest.sh
+++ b/kernel/uvm/conftest.sh
@@ -176,6 +176,7 @@ test_headers() {
FILES="$FILES linux/ktime.h"
FILES="$FILES linux/file.h"
+ FILES_ARCH="$FILES_ARCH asm/pgtable.h"
FILES_ARCH="$FILES_ARCH asm/set_memory.h"
translate_and_find_header_files $HEADERS $FILES
@@ -440,6 +441,9 @@ compile_test() {
# Determine if the set_memory_array_uc() function is present.
#
CODE="
+ #if defined(NV_ASM_PGTABLE_H_PRESENT)
+ #include <asm/pgtable.h>
+ #endif
#if defined(NV_ASM_SET_MEMORY_H_PRESENT)
#include <asm/set_memory.h>
#else
diff --git a/kernel/uvm/nvidia_uvm_lite.c b/kernel/uvm/nvidia_uvm_lite.c
index 6943e7c..9a7e3b6 100644
--- a/kernel/uvm/nvidia_uvm_lite.c
+++ b/kernel/uvm/nvidia_uvm_lite.c
@@ -131,8 +131,8 @@ static
RM_STATUS _preexisting_error_on_channel(UvmGpuMigrationTracking *pMigTracker,
UvmCommitRecord *pRecord);
-static void _set_timeout_in_usec(struct timeval *src,
- struct timeval *result,
+static void _set_timeout_in_usec(struct nv_timeval *src,
+ struct nv_timeval *result,
unsigned long timeoutInUsec)
{
if (!src || !result)
@@ -820,7 +820,13 @@ done:
}
#if defined(NV_VM_OPERATIONS_STRUCT_HAS_FAULT)
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 17, 0)
+vm_fault_t _fault(struct vm_fault *vmf)
+#elif LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0)
+int _fault(struct vm_fault *vmf)
+#else
int _fault(struct vm_area_struct *vma, struct vm_fault *vmf)
+#endif
{
#if defined(NV_VM_FAULT_HAS_ADDRESS)
unsigned long vaddr = vmf->address;
@@ -828,8 +834,15 @@ int _fault(struct vm_area_struct *vma, struct vm_fault *vmf)
unsigned long vaddr = (unsigned long)vmf->virtual_address;
#endif
struct page *page = NULL;
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 17, 0)
+ vm_fault_t retval;
+#else
int retval;
+#endif
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0)
+ struct vm_area_struct *vma = vmf->vma;
+#endif
retval = _fault_common(vma, vaddr, &page, vmf->flags);
vmf->page = page;
@@ -868,7 +881,13 @@ static struct vm_operations_struct uvmlite_vma_ops =
// it's dealing with anonymous mapping (see handle_pte_fault).
//
#if defined(NV_VM_OPERATIONS_STRUCT_HAS_FAULT)
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 17, 0)
+vm_fault_t _sigbus_fault(struct vm_fault *vmf)
+#elif LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0)
+int _sigbus_fault(struct vm_fault *vmf)
+#else
int _sigbus_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
+#endif
{
vmf->page = NULL;
return VM_FAULT_SIGBUS;
@@ -1992,9 +2011,9 @@ void umvlite_destroy_per_process_gpu_resources(UvmGpuUuid *gpuUuidStruct)
static RM_STATUS _check_ecc_errors(UvmGpuMigrationTracking *pMigTracker,
NvBool *pIsEccErrorSet)
{
- struct timeval eccErrorStartTime = {0};
- struct timeval eccErrorCurrentTime = {0};
- struct timeval eccTimeout = {0};
+ struct nv_timeval eccErrorStartTime = {0};
+ struct nv_timeval eccErrorCurrentTime = {0};
+ struct nv_timeval eccTimeout = {0};
NvBool bEccErrorTimeout = NV_FALSE;
NvBool bEccIncomingError = NV_FALSE;
unsigned rmInterruptSet = 0;
--
2.29.0

View File

@ -0,0 +1,92 @@
From 2cc3342b4b3c96bcc4062513011d35c079b009a2 Mon Sep 17 00:00:00 2001
From: graysky <graysky@archlinux.us>
Date: Thu, 22 Oct 2020 06:59:59 -0400
Subject: [PATCH 2/3] kernel-5.8
credit: https://launchpad.net/~kelebek333/+archive/ubuntu/nvidia-legacy/+packages
extracted from: https://launchpadlibrarian.net/492468557/nvidia-graphics-drivers-340_340.108-1lmtrfocal3_340.108-2lmtrfocal.diff.gz
---
kernel/nv-linux.h | 8 ++++++++
kernel/nvidia-modules-common.mk | 1 +
kernel/os-mlock.c | 8 ++++++++
kernel/uvm/nvidia_uvm_lite_api.c | 4 ++++
4 files changed, 21 insertions(+)
diff --git a/kernel/nv-linux.h b/kernel/nv-linux.h
index 83e6433..d055552 100644
--- a/kernel/nv-linux.h
+++ b/kernel/nv-linux.h
@@ -669,11 +669,19 @@ extern nv_spinlock_t km_lock;
# define KM_FREE_RECORD(a,b,c)
#endif
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 8, 0)
+#define NV_VMALLOC(ptr, size) \
+ { \
+ (ptr) = __vmalloc(size, GFP_KERNEL); \
+ VM_ALLOC_RECORD(ptr, size, "vm_vmalloc"); \
+ }
+#else
#define NV_VMALLOC(ptr, size) \
{ \
(ptr) = __vmalloc(size, GFP_KERNEL, PAGE_KERNEL); \
VM_ALLOC_RECORD(ptr, size, "vm_vmalloc"); \
}
+#endif
#define NV_VFREE(ptr, size) \
{ \
diff --git a/kernel/nvidia-modules-common.mk b/kernel/nvidia-modules-common.mk
index b94591b..0e4c228 100644
--- a/kernel/nvidia-modules-common.mk
+++ b/kernel/nvidia-modules-common.mk
@@ -222,6 +222,7 @@ build-sanity-checks:
define BUILD_MODULE_RULE
$(1): build-sanity-checks $(3)
@echo "NVIDIA: calling KBUILD..."; \
+ touch .nv-kernel.o.cmd; \
$$(MAKE) "CC=$$(CC)" NV_MODULE_SUFFIX=$$(strip $(2)) $$(KBUILD_PARAMS) modules; \
echo "NVIDIA: left KBUILD."; \
if ! [ -f $(1) ]; then \
diff --git a/kernel/os-mlock.c b/kernel/os-mlock.c
index 8a1fa2f..fc50543 100644
--- a/kernel/os-mlock.c
+++ b/kernel/os-mlock.c
@@ -44,11 +44,19 @@ RM_STATUS NV_API_CALL os_lock_user_pages(
return rmStatus;
}
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 8, 0)
+ down_read(&mm->mmap_lock);
+ ret = NV_GET_USER_PAGES((unsigned long)address,
+ page_count, write, force, user_pages, NULL);
+ up_read(&mm->mmap_lock);
+ pinned = ret;
+#else
down_read(&mm->mmap_sem);
ret = NV_GET_USER_PAGES((unsigned long)address,
page_count, write, force, user_pages, NULL);
up_read(&mm->mmap_sem);
pinned = ret;
+#endif
if (ret < 0)
{
diff --git a/kernel/uvm/nvidia_uvm_lite_api.c b/kernel/uvm/nvidia_uvm_lite_api.c
index 8448eb6..97a4818 100644
--- a/kernel/uvm/nvidia_uvm_lite_api.c
+++ b/kernel/uvm/nvidia_uvm_lite_api.c
@@ -30,6 +30,10 @@
#include "uvm_gpu_ops_tests.h"
#endif
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 8, 0)
+#define mmap_sem mmap_lock
+#endif
+
//
// nvidia_uvm_lite_api.c
//
--
2.29.0

View File

@ -0,0 +1,107 @@
From fea401df7500bfbead5a42b1e74560dbddf2f5a3 Mon Sep 17 00:00:00 2001
From: graysky <graysky@archlinux.us>
Date: Thu, 22 Oct 2020 07:00:35 -0400
Subject: [PATCH 3/3] kernel-5.9
credit: https://github.com/warpme/minimyth2/blob/master/script/nvidia/nvidia-340.108/files/nvidia-340.108-fix-5.9-kernel-compile.patch
---
kernel/nv-drm.c | 8 ++++++++
kernel/nv-linux.h | 9 +++++++--
kernel/nv.c | 4 ++++
kernel/uvm/nvidia_uvm_linux.h | 2 ++
4 files changed, 21 insertions(+), 2 deletions(-)
diff --git a/kernel/nv-drm.c b/kernel/nv-drm.c
index 85db07e..f0c1299 100644
--- a/kernel/nv-drm.c
+++ b/kernel/nv-drm.c
@@ -415,7 +415,11 @@ static struct drm_driver nv_drm_driver = {
.set_busid = drm_pci_set_busid,
#endif
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 9, 0)
+ .gem_free_object_unlocked = nv_gem_free,
+#else
.gem_free_object = nv_gem_free,
+#endif
.prime_handle_to_fd = drm_gem_prime_handle_to_fd,
.gem_prime_export = drm_gem_prime_export,
@@ -511,8 +515,12 @@ RM_STATUS NV_API_CALL nv_alloc_os_descriptor_handle(
#if defined(NV_DRM_GEM_OBJECT_PUT_UNLOCKED_PRESENT)
drm_gem_object_put_unlocked(&nv_obj->base);
+#else
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 9, 0)
+ drm_gem_object_put_locked(&nv_obj->base);
#else
drm_gem_object_unreference_unlocked(&nv_obj->base);
+#endif
#endif
status = RM_OK;
diff --git a/kernel/nv-linux.h b/kernel/nv-linux.h
index d055552..524a8fe 100644
--- a/kernel/nv-linux.h
+++ b/kernel/nv-linux.h
@@ -136,8 +136,10 @@
#if defined(NVCPU_X86_64) && !defined(HAVE_COMPAT_IOCTL)
#include <linux/syscalls.h> /* sys_ioctl() */
+#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 9, 0)
#include <linux/ioctl32.h> /* register_ioctl32_conversion() */
#endif
+#endif
#if !defined(NV_FILE_OPERATIONS_HAS_IOCTL) && \
!defined(NV_FILE_OPERATIONS_HAS_UNLOCKED_IOCTL)
@@ -2249,10 +2251,13 @@ static inline NvU64 nv_node_end_pfn(int nid)
pages, vmas, NULL);
#else
-
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 9, 0)
+ return get_user_pages_remote(mm, start, nr_pages, flags,
+ pages, vmas, NULL);
+#else
return get_user_pages_remote(tsk, mm, start, nr_pages, flags,
pages, vmas);
-
+#endif
#endif
}
diff --git a/kernel/nv.c b/kernel/nv.c
index a218f83..be4e0f8 100644
--- a/kernel/nv.c
+++ b/kernel/nv.c
@@ -2785,7 +2785,11 @@ nvidia_probe
#if defined(CONFIG_VGA_ARB)
#if defined(VGA_DEFAULT_DEVICE)
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 9, 0)
+ vga_get(VGA_DEFAULT_DEVICE, VGA_RSRC_LEGACY_MASK, 0);
+#else
vga_tryget(VGA_DEFAULT_DEVICE, VGA_RSRC_LEGACY_MASK);
+#endif
#endif
vga_set_legacy_decoding(dev, VGA_RSRC_NONE);
#endif
diff --git a/kernel/uvm/nvidia_uvm_linux.h b/kernel/uvm/nvidia_uvm_linux.h
index 1625209..efc181f 100644
--- a/kernel/uvm/nvidia_uvm_linux.h
+++ b/kernel/uvm/nvidia_uvm_linux.h
@@ -158,8 +158,10 @@
#if defined(NVCPU_X86_64) && !defined(HAVE_COMPAT_IOCTL)
#include <linux/syscalls.h> /* sys_ioctl() */
+#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 9, 0)
#include <linux/ioctl32.h> /* register_ioctl32_conversion() */
#endif
+#endif
#if !defined(NV_FILE_OPERATIONS_HAS_IOCTL) && \
!defined(NV_FILE_OPERATIONS_HAS_UNLOCKED_IOCTL)
--
2.29.0

View File

@ -0,0 +1,151 @@
diff -Naur a/kernel/nv-acpi.c b/kernel/nv-acpi.c
--- a/kernel/nv-acpi.c 2022-10-14 02:26:04.379601051 +0000
+++ b/kernel/nv-acpi.c 2022-10-14 02:28:07.309332369 +0000
@@ -178,6 +178,53 @@
return 0;
}
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 0, 0)
+static struct nv_acpi_add_enumerated_data {
+ nv_acpi_t *object;
+ int *counter;
+};
+static int nv_acpi_add_enumerated(struct acpi_device *dev, void *data)
+{
+ struct nv_acpi_add_enumerated_data *rcvd_data = data;
+ nv_acpi_t *pNvAcpiObject = rcvd_data->object;
+ int *device_counter = rcvd_data->counter;
+ acpi_status status = -1;
+ nv_acpi_integer_t device_id = 0;
+ if (!dev)
+ return 0;
+ if (*device_counter == NV_MAXNUM_DISPLAY_DEVICES) {
+ nv_printf(NV_DBG_ERRORS,
+ "NVRM: nv_acpi_add: Total number of devices cannot exceed %d\n",
+ NV_MAXNUM_DISPLAY_DEVICES);
+ return 1;
+ }
+ status =
+ acpi_evaluate_integer(dev->handle, "_ADR", NULL, &device_id);
+ if (ACPI_FAILURE(status))
+ /* Couldnt query device_id for this device */
+ return 0;
+
+ device_id = (device_id & 0xffff);
+
+ if ((device_id != 0x100) && /* Not a known CRT device-id */
+ (device_id != 0x200) && /* Not a known TV device-id */
+ (device_id != 0x0110) && (device_id != 0x0118) && (device_id != 0x0400) && /* Not an LCD*/
+ (device_id != 0x0111) && (device_id != 0x0120) && (device_id != 0x0300)) /* Not a known DVI device-id */
+ {
+ /* This isnt a known device Id.
+ Do default switching on this system. */
+ pNvAcpiObject->default_display_mask = 1;
+ return 1;
+ }
+
+ pNvAcpiObject->pNvVideo[*device_counter].dev_id = device_id;
+ pNvAcpiObject->pNvVideo[*device_counter].dev_handle = dev->handle;
+
+ (*device_counter)++;
+ return 0;
+}
+#endif
+
static int nv_acpi_add(struct acpi_device *device)
{
/*
@@ -190,8 +237,10 @@
union acpi_object control_argument_0 = { ACPI_TYPE_INTEGER };
struct acpi_object_list control_argument_list = { 0, NULL };
nv_stack_t *sp = NULL;
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 0, 0)
struct list_head *node, *next;
nv_acpi_integer_t device_id = 0;
+#endif
int device_counter = 0;
NV_KMEM_CACHE_ALLOC_STACK(sp);
@@ -220,6 +269,7 @@
// grab handles to all the important nodes representing devices
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 0, 0)
list_for_each_safe(node, next, &device->children)
{
struct acpi_device *dev =
@@ -261,6 +311,13 @@
device_counter++;
}
+#else
+ struct nv_acpi_add_enumerated_data data = {
+ .object = pNvAcpiObject,
+ .counter = &device_counter,
+ };
+ acpi_dev_for_each_child(device, nv_acpi_add_enumerated, &data);
+#endif
// arg 0, bits 1:0, 0 = enable events
control_argument_0.integer.type = ACPI_TYPE_INTEGER;
@@ -1192,6 +1249,31 @@
return status;
}
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 0, 0)
+static int nv_acpi_ddc_method_enumerated(struct acpi_device *dev, void *data)
+{
+ acpi_handle *lcd_dev_handle = data;
+ acpi_status status;
+ nv_acpi_integer_t device_id = 0;
+ if (!dev)
+ return 0;
+ status = acpi_evaluate_integer(dev->handle, "_ADR", NULL, &device_id);
+ if (ACPI_FAILURE(status))
+ /* Couldnt query device_id for this device */
+ return 0;
+
+ device_id = (device_id & 0xffff);
+
+ if ((device_id == 0x0110) || (device_id == 0x0118) || (device_id == 0x0400)) /* Only for an LCD*/
+ {
+ *lcd_dev_handle = dev->handle;
+ nv_printf(NV_DBG_INFO, "NVRM: %s Found LCD: %x\n", __FUNCTION__, device_id);
+ return 1;
+ }
+ return 0;
+}
+#endif
+
/*
* This function executes a _DDC ACPI method.
*/
@@ -1207,8 +1289,10 @@
union acpi_object *ddc;
union acpi_object ddc_arg0 = { ACPI_TYPE_INTEGER };
struct acpi_object_list input = { 1, &ddc_arg0 };
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 0, 0)
struct list_head *node, *next;
nv_acpi_integer_t device_id = 0;
+#endif
NvU32 i;
acpi_handle dev_handle = NULL;
acpi_handle lcd_dev_handle = NULL;
@@ -1239,6 +1323,7 @@
return RM_ERR_NOT_SUPPORTED;
}
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 0, 0)
list_for_each_safe(node, next, &device->children)
{
struct acpi_device *dev =
@@ -1262,6 +1347,9 @@
}
}
+#else
+ acpi_dev_for_each_child(device, nv_acpi_ddc_method_enumerated, &lcd_dev_handle);
+#endif
if (lcd_dev_handle == NULL)
{

View File

@ -0,0 +1,61 @@
--- a/kernel/conftest.sh 2023-02-24 10:35:02.633467500 +0100
+++ b/kernel/conftest.sh 2023-02-24 11:13:02.892079164 +0100
@@ -794,12 +794,19 @@
echo "$CONFTEST_PREAMBLE
#include <linux/acpi.h>
+ #include <linux/version.h>
acpi_op_remove conftest_op_remove_routine;
+ #if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 2, 0)
+ void conftest_acpi_device_ops_remove(struct acpi_device *device) {
+ conftest_op_remove_routine(device);
+ }
+ #else
int conftest_acpi_device_ops_remove(struct acpi_device *device) {
return conftest_op_remove_routine(device);
- }" > conftest$$.c
+ }
+ #endif" > conftest$$.c
$CC $CFLAGS -c conftest$$.c > /dev/null 2>&1
rm -f conftest$$.c
--- a/kernel/nv-acpi.c 2023-02-24 10:35:02.643467765 +0100
+++ b/kernel/nv-acpi.c 2023-02-24 11:09:14.821580592 +0100
@@ -26,8 +26,12 @@
#if !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
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 2, 0)
+static void nv_acpi_remove_one_arg(struct acpi_device *device);
+#else
static int nv_acpi_remove_one_arg(struct acpi_device *device);
#endif
+#endif
static void nv_acpi_event (acpi_handle, u32, void *);
static acpi_status nv_acpi_find_methods (acpi_handle, u32, void *, void **);
@@ -356,8 +360,12 @@
#if !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
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 2, 0)
+static void nv_acpi_remove_one_arg(struct acpi_device *device)
+#else
static int nv_acpi_remove_one_arg(struct acpi_device *device)
#endif
+#endif
{
/*
* This function will cause RM to relinquish control of the VGA ACPI device.
@@ -407,7 +415,9 @@
device->driver_data = NULL;
}
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 2, 0)
return status;
+#endif
}
static void nv_acpi_event(acpi_handle handle, u32 event_type, void *data)

View File

@ -0,0 +1,106 @@
--- a/kernel/nv-mmap.c 2023-05-03 11:48:48.481814709 +0200
+++ b/kernel/nv-mmap.c 2023-05-03 11:51:39.220313386 +0200
@@ -312,7 +312,11 @@
goto done;
}
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 3, 0)
+ vm_flags_set(vma, VM_IO);
+#else
vma->vm_flags |= VM_IO;
+#endif
}
else
{
@@ -363,8 +367,13 @@
NV_PRINT_AT(NV_DBG_MEMINFO, at);
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 3, 0)
+ vm_flags_set(vma, VM_IO | VM_LOCKED | VM_RESERVED);
+ vm_flags_set(vma, VM_DONTEXPAND | VM_DONTDUMP);
+#else
vma->vm_flags |= (VM_IO | VM_LOCKED | VM_RESERVED);
vma->vm_flags |= (VM_DONTEXPAND | VM_DONTDUMP);
+#endif
}
if (status == 0)
@@ -374,8 +383,13 @@
if ((prot & NV_PROTECT_WRITEABLE) == 0)
{
vma->vm_page_prot = NV_PGPROT_READ_ONLY(vma->vm_page_prot);
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 3, 0)
+ vm_flags_clear(vma, VM_WRITE);
+ vm_flags_clear(vma, VM_MAYWRITE);
+#else
vma->vm_flags &= ~VM_WRITE;
vma->vm_flags &= ~VM_MAYWRITE;
+#endif
}
vma->vm_ops = &nv_vm_ops;
--- a/kernel/uvm/nvidia_uvm_lite.c 2023-05-03 12:00:17.508256190 +0200
+++ b/kernel/uvm/nvidia_uvm_lite.c 2023-05-03 12:03:59.160897071 +0200
@@ -1524,10 +1524,17 @@
vma->vm_ops = &uvmlite_vma_ops;
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 3, 0)
+ // Prohibit copying the vma on fork().
+ vm_flags_set(vma, VM_DONTCOPY);
+ // Prohibt mremap() that would expand the vma.
+ vm_flags_set(vma, VM_DONTEXPAND);
+#else
// Prohibit copying the vma on fork().
vma->vm_flags |= VM_DONTCOPY;
// Prohibt mremap() that would expand the vma.
vma->vm_flags |= VM_DONTEXPAND;
+#endif
// Other cases of vma modification are detected in _mmap_open().
@@ -1546,9 +1553,15 @@
return -EINVAL;
vma->vm_ops = &counters_vma_ops;
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 3, 0)
+ vm_flags_clear(vma, VM_MAYWRITE);
+ // prevent vm_insert_page from modifying the vma's flags:
+ vm_flags_set(vma, VM_MIXEDMAP);
+#else
vma->vm_flags &= ~VM_MAYWRITE;
// prevent vm_insert_page from modifying the vma's flags:
vma->vm_flags |= VM_MIXEDMAP;
+#endif
ret = 0;
}
UVM_DBG_PRINT_RL("vma 0x%p [0x%p, 0x%p) ret %d pgoff"
@@ -2527,8 +2540,13 @@
// Subsequent access from userspace after the pages are unmapped will cause
// a SIGSEGV.
//
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 3, 0)
+ vm_flags_clear(vma, VM_READ|VM_MAYREAD);
+ vm_flags_clear(vma, VM_WRITE|VM_MAYWRITE);
+#else
vma->vm_flags &= ~(VM_READ|VM_MAYREAD);
vma->vm_flags &= ~(VM_WRITE|VM_MAYWRITE);
+#endif
}
//
@@ -2536,8 +2554,13 @@
//
static void _set_vma_accessible(struct vm_area_struct * vma)
{
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 3, 0)
+ vm_flags_set(vma, VM_READ|VM_MAYREAD);
+ vm_flags_set(vma, VM_WRITE|VM_MAYWRITE);
+#else
vma->vm_flags |= (VM_READ|VM_MAYREAD);
vma->vm_flags |= (VM_WRITE|VM_MAYWRITE);
+#endif
}
//

View File

@ -1,23 +1,49 @@
%define nvidia_current_ver %version
%define nvidia_current_libver %version
Name: nvidia_340
Version: 340.76
Version: 340.108
Epoch: 1
Release: 2mamba
Release: 16mamba
Summary: NVIDIA proprietary accelerated drivers for the Linux Kernel
Group: System/Kernel and Hardware
Vendor: openmamba
Distribution: openmamba
Packager: Silvan Calarco <silvan.calarco@mambasoft.it>
URL: http://www.nvidia.com/object/unix.html
Source0: http://us.download.nvidia.com/XFree86/Linux-x86/%{nvidia_current_ver}/NVIDIA-Linux-x86-%{nvidia_current_ver}.run
Source1: http://us.download.nvidia.com/XFree86/Linux-x86_64/%{nvidia_current_ver}/NVIDIA-Linux-x86_64-%{nvidia_current_ver}.run
URL: https://www.nvidia.com/en-us/drivers/unix/
Source0: http://us.download.nvidia.com/XFree86/Linux-x86/%{version}/NVIDIA-Linux-x86-%{version}.run
Source1: http://us.download.nvidia.com/XFree86/Linux-x86_64/%{version}/NVIDIA-Linux-x86_64-%{version}.run
Source2: nvidia_340.sysusers
Source3: 20-nvidia.conf
Patch0: nvidia-331.20-x86-conftest.patch
Patch1: nvidia-340.102-kernel-4.9.patch
Patch2: nvidia_340-340.102-kernel-4.9-2.patch
Patch3: nvidia_340-340.107-conftest-x86.patch
Patch4: nvidia_340-340.108-kernel-5.7.patch
Patch5: nvidia_340-340.108-kernel-5.8.patch
Patch6: nvidia_340-340.108-kernel-5.9.patch
Patch7: nvidia_340-340.108-kernel-5.10.patch
Patch8: nvidia_340-340.108-kernel-5.11.patch
Patch9: nvidia_340-340.108-kernel-5.14.patch
Patch10: nvidia_340-340.108-kernel-5.15.patch
Patch11: nvidia_340-340.108-kernel-5.16.patch
Patch12: nvidia_340-340.108-kernel-5.17.patch
Patch13: nvidia_340-340.108-kernel-5.18.patch
Patch14: nvidia_340-340.108-kernel-6.0.patch
Patch15: nvidia_340-340.108-dkms-rename_nvidia_340.patch
Patch16: nvidia_340-340.108-kernel-6.2.patch
Patch17: nvidia_340-340.108-kernel-6.3.patch
License: no OSI Approved
## AUTOBUILDREQ-BEGIN
BuildRequires: glibc-devel
BuildRequires: libX11-devel
BuildRequires: libXext-devel
BuildRequires: libat-spi2-core-devel
BuildRequires: libgdk-pixbuf-devel
BuildRequires: libglib-devel
BuildRequires: libglvnd-devel
BuildRequires: libgtk2-devel
BuildRequires: libpango-devel
## AUTOBUILDREQ-END
ExclusiveArch: i586 x86_64
BuildRoot: %{_tmppath}/%{name}-%{version}-root
%description
nvidia proprietary accelerated drivers for the Linux Kernel.
@ -30,65 +56,34 @@ Summary: NVIDIA Accelerated Libraries for Xorg
Requires: xorg-server >= 1.1.0
Requires(post):kernelheaders
Requires(post):dkms
Requires(post):glibc-devel
Requires(pre): xorg-ext-libglx-%{name} == %{epoch}:%{version}-%{release}
Requires(pre): libGL-%{name}-X11 == %{epoch}:%{version}-%{release}
Provides: xorgdrvvideo
Provides: kernelnvidia
Conflicts: xorg-drv-video-nvidia
Conflicts: xorg-drv-video-nvidia_304
AutoReq: no
Conflicts: xorg-drv-video-nvidia_390
Provides: libGL-%{name}-X11
Obsoletes: libGL-%{name}-X11 < 1:340.108-7mamba
Obsoletes: libglx-nvidia < 1:340.108-7mamba
Provides: xorg-ext-libglx-%{name}
Obsoletes: xorg-ext-libglx-%{name} < 1:340.108-7mamba
Conflicts: xorg-ext-libglx-nvidia_304
Conflicts: xorg-ext-libglx-nvidia_390
Conflicts: xorg-ext-libglx-nvidia
Provides: xorg-apps-%{name}
Obsoletes: xorg-apps-%{name} < 1:340.108-7mamba
Conflicts: xorg-apps-nvidia_304
Conflicts: xorg-apps-nvidia_390
Conflicts: xorg-apps-nvidia
%description -n xorg-drv-video-%{name}
The NVIDIA Accelerated Linux Driver Set brings both accelerated 2D functionality and high performance OpenGL support to Linux x86 with theuse of NVIDIA graphics processing units (GPUs).
These drivers provide optimized hardware acceleration of OpenGL applications via a direct-rendering X Server and support nearly all NVIDIA graphics chips.
TwinView, TV-Out and flat panel displays are also supported.
This package contains the Xorg libraries.
%package -n libGL-%{name}-X11
Group: System/Libraries
Summary: NVIDIA proprietary OpenGL library implementation
Requires: xorg-ext-libglx-%{name} == %{epoch}:%{version}-%{release}
Provides: xorglibGL
Provides: libGL.so.1
Conflicts: libGL-nvidia-X11
%description -n libGL-%{name}-X11
The NVIDIA Accelerated Linux Driver Set brings both accelerated 2D functionality and high performance OpenGL support to Linux x86 with theuse of NVIDIA graphics processing units (GPUs).
These drivers provide optimized hardware acceleration of OpenGL applications via a direct-rendering X Server and support nearly all NVIDIA graphics chips.
TwinView, TV-Out and flat panel displays are also supported.
This package contains the NVIDIA proprietary OpenGL library implementation for Xorg.
%package -n xorg-ext-libglx-%{name}
Group: System/Libraries
Summary: NVIDIA proprietary glx library implementation
Provides: xorglibglx
Conflicts: xorg-ext-libglx-nvidia
%description -n xorg-ext-libglx-%{name}
The NVIDIA Accelerated Linux Driver Set brings both accelerated 2D functionality and high performance OpenGL support to Linux x86 with theuse of NVIDIA graphics processing units (GPUs).
These drivers provide optimized hardware acceleration of OpenGL applications via a direct-rendering X Server and support nearly all NVIDIA graphics chips.
TwinView, TV-Out and flat panel displays are also supported.
This package contains the NVIDIA proprietary glx library implementation for Xorg.
%package -n xorg-apps-%{name}
Group: System/Tools
Summary: NVIDIA configuration tools
Conflicts: xorg-apps-nvidia
%description -n xorg-apps-%{name}
The NVIDIA Accelerated Linux Driver Set brings both accelerated 2D functionality and high performance OpenGL support to Linux x86 with theuse of NVIDIA graphics processing units (GPUs).
These drivers provide optimized hardware acceleration of OpenGL applications via a direct-rendering X Server and support nearly all NVIDIA graphics chips.
TwinView, TV-Out and flat panel displays are also supported.
This package contains the NVIDIA tools nvidia-settings, nvidia-xconfig, and nvidia-smi.
%package -n xorg-drv-video-%{name}-doc
Group: Documentation
Summary: HTML documentation for NVIDIA Accelerated Libraries for Xorg
@ -96,162 +91,209 @@ AutoReq: no
%description -n xorg-drv-video-%{name}-doc
The NVIDIA Accelerated Linux Driver Set brings both accelerated 2D functionality and high performance OpenGL support to Linux x86 with theuse of NVIDIA graphics processing units (GPUs).
These drivers provide optimized hardware acceleration of OpenGL applications via a direct-rendering X Server and support nearly all NVIDIA graphics chips.
TwinView, TV-Out and flat panel displays are also supported.
This package contains the HTML documentation.
%prep
%setup -q -c -n %{name}-%{version} -T
%global __provides_exclude ^(libGL\\.so.*|libEGL\\.so.*|libGLESv1_CM\\.so.*|libGLESv2\\.so.*|libOpenCL\\.so.*)$
%define _default_patch_fuzz 2
#
# unpack NVIDIA files
#
%if "%{_target_cpu}" == "x86_64"
sh %{SOURCE1} --extract-only
ln -sf NVIDIA-Linux-x86_64-%{nvidia_current_ver} current
ln -sf NVIDIA-Linux-x86_64-%{version} current
%else
sh %{SOURCE0} --extract-only
ln -sf NVIDIA-Linux-x86-%{nvidia_current_ver} current
ln -sf NVIDIA-Linux-x86-%{version} current
%endif
sed -i "s|__UTILS_PATH__|%{_bindir}|;s|__PIXMAP_PATH__|%{_datadir}/pixmaps|" \
current/nvidia-settings.desktop
cd current
%patch0 -p1
#%patch0 -p1
#%patch1 -p1
##%patch2 -p1
%patch 3 -p1
%patch 4 -p1
%patch 5 -p1
%patch 6 -p1
%patch 7 -p1
%patch 8 -p1
%patch 9 -p1 -b .kernel-5.14
%patch 10 -p1 -b .kernel-5.15
%patch 11 -p1 -b .kernel-5.16
%patch 12 -p1 -b .kernel-5.17
%patch 13 -p1 -b .kernel-5.18
%patch 14 -p1 -b .kernel-6.0
%patch 15 -p0 -b .dkms
%patch 16 -p1 -b .kernel-6.2
%patch 17 -p1 -b .kernel-6.3
tar xf nvidia-persistenced-init.tar.bz2
# remove gcc version mismatch check (kernel built with different gcc version)
rm -f kernel/gcc-version-check.c
cd ..
%build
%install
[ "%{buildroot}" != / ] && rm -rf "%{buildroot}"
pushd current
# From Arch Linux
# X driver
install -D -m755 nvidia_drv.so %{buildroot}%{_libdir}/xorg/modules/drivers/nvidia_drv.so
# GLX extension module for X
install -D -m755 libglx.so.%{version} %{buildroot}%{_libdir}/nvidia/xorg/libglx.so.%{version}
# Ensure that X finds glx
ln -s libglx.so.%{version} %{buildroot}%{_libdir}/nvidia/xorg/libglx.so.1
ln -s libglx.so.%{version} %{buildroot}%{_libdir}/nvidia/xorg/libglx.so
# EGL and OpenGL ES libraries
install -D -m755 libGL.so.%{version} %{buildroot}%{_libdir}/nvidia/libGL.so.%{version}
install -D -m755 libEGL.so.%{version} %{buildroot}%{_libdir}/nvidia/libEGL.so.%{version}
install -D -m755 libGLESv1_CM.so.%{version} %{buildroot}%{_libdir}/nvidia/libGLESv1_CM.so.%{version}
install -D -m755 libGLESv2.so.%{version} %{buildroot}%{_libdir}/nvidia/libGLESv2.so.%{version}
# OpenGL core library
install -D -m755 libnvidia-glcore.so.%{version} %{buildroot}%{_libdir}/libnvidia-glcore.so.%{version}
install -D -m755 libnvidia-eglcore.so.%{version} %{buildroot}%{_libdir}/libnvidia-eglcore.so.%{version}
install -D -m755 libnvidia-glsi.so.%{version} %{buildroot}%{_libdir}/libnvidia-glsi.so.%{version}
# OpenCL
install -D -m644 nvidia.icd %{buildroot}%{_sysconfdir}/OpenCL/vendors/nvidia.icd
install -D -m755 libnvidia-compiler.so.%{version} %{buildroot}%{_libdir}/libnvidia-compiler.so.%{version}
install -D -m755 libnvidia-opencl.so.%{version} %{buildroot}%{_libdir}/libnvidia-opencl.so.%{version}
# misc
install -D -m755 libnvidia-ifr.so.%{version} %{buildroot}%{_libdir}/libnvidia-ifr.so.%{version}
install -D -m755 libnvidia-fbc.so.%{version} %{buildroot}%{_libdir}/libnvidia-fbc.so.%{version}
install -D -m755 libnvidia-encode.so.%{version} %{buildroot}%{_libdir}/libnvidia-encode.so.%{version}
install -D -m755 libnvidia-cfg.so.%{version} %{buildroot}%{_libdir}/libnvidia-cfg.so.%{version}
install -D -m755 libnvidia-ml.so.%{version} %{buildroot}%{_libdir}/libnvidia-ml.so.%{version}
# VDPAU
install -D -m755 libvdpau_nvidia.so.%{version} %{buildroot}%{_libdir}/vdpau/libvdpau_nvidia.so.%{version}
# nvidia-tls library
install -D -m755 tls/libnvidia-tls.so.%{version} %{buildroot}%{_libdir}/libnvidia-tls.so.%{version}
# CUDA
install -D -m755 libcuda.so.%{version} %{buildroot}%{_libdir}/libcuda.so.%{version}
install -D -m755 libnvcuvid.so.%{version} %{buildroot}%{_libdir}/libnvcuvid.so.%{version}
# DEBUG
install -D -m755 nvidia-debugdump %{buildroot}%{_bindir}/nvidia-debugdump
# nvidia-xconfig
install -D -m755 nvidia-xconfig %{buildroot}%{_bindir}/nvidia-xconfig
install -D -m644 nvidia-xconfig.1.gz %{buildroot}%{_mandir}/man1/nvidia-xconfig.1.gz
# nvidia-settings
install -D -m755 nvidia-settings %{buildroot}%{_bindir}/nvidia-settings
install -D -m644 nvidia-settings.1.gz %{buildroot}%{_mandir}/man1/nvidia-settings.1.gz
install -D -m644 nvidia-settings.desktop %{buildroot}%{_datadir}/applications/nvidia-settings.desktop
install -D -m644 nvidia-settings.png %{buildroot}%{_datadir}/pixmaps/nvidia-settings.png
sed -e 's:__UTILS_PATH__:/usr/bin:' -e 's:__PIXMAP_PATH__:/usr/share/pixmaps:' -i %{buildroot}%{_datadir}/applications/nvidia-settings.desktop
# nvidia-bug-report
install -D -m755 nvidia-bug-report.sh %{buildroot}%{_bindir}/nvidia-bug-report.sh
# nvidia-smi
install -D -m755 nvidia-smi %{buildroot}%{_bindir}/nvidia-smi
install -D -m644 nvidia-smi.1.gz %{buildroot}%{_mandir}/man1/nvidia-smi.1.gz
# nvidia-cuda-mps
install -D -m755 nvidia-cuda-mps-server %{buildroot}%{_bindir}/nvidia-cuda-mps-server
install -D -m755 nvidia-cuda-mps-control %{buildroot}%{_bindir}/nvidia-cuda-mps-control
install -D -m644 nvidia-cuda-mps-control.1.gz %{buildroot}%{_mandir}/man1/nvidia-cuda-mps-control.1.gz
# nvidia-modprobe
# This should be removed if nvidia fixed their uvm module!
install -D -m4755 nvidia-modprobe %{buildroot}%{_bindir}/nvidia-modprobe
install -D -m644 nvidia-modprobe.1.gz %{buildroot}%{_mandir}/man1/nvidia-modprobe.1.gz
# nvidia-persistenced
install -D -m755 nvidia-persistenced %{buildroot}%{_bindir}/nvidia-persistenced
install -D -m644 nvidia-persistenced.1.gz %{buildroot}%{_mandir}/man1/nvidia-persistenced.1.gz
install -D -m644 nvidia-persistenced-init/systemd/nvidia-persistenced.service.template %{buildroot}%{_unitdir}/nvidia-persistenced.service
sed -i 's/__USER__/nvidia-persistenced/' %{buildroot}%{_unitdir}/nvidia-persistenced.service
# application profiles
install -D -m644 nvidia-application-profiles-%{version}-rc %{buildroot}%{_datadir}/nvidia/nvidia-application-profiles-%{version}-rc
install -D -m644 nvidia-application-profiles-%{version}-key-documentation %{buildroot}%{_datadir}/nvidia/nvidia-application-profiles-%{version}-key-documentation
install -Dm644 %{SOURCE2} %{buildroot}%{_sysusersdir}/nvidia.conf
# dkms
install -d -m0755 %{buildroot}%{_prefix}/src/%{name}-%{version}
cp -a kernel/* %{buildroot}%{_prefix}/src/%{name}-%{version}/
cat > %{buildroot}%{_prefix}/src/%{name}-%{version}/dkms.conf << _EOF
PACKAGE_NAME=%{name}
PACKAGE_VERSION=%{version}
MAKE="ln -sf /usr/src/\${PACKAGE_NAME}-\${PACKAGE_VERSION}/nv-kernel.o \${dkms_tree}/\${PACKAGE_NAME}/\${PACKAGE_VERSION}/build/;\
make -C \${kernel_source_dir} KERNEL_SOURCES=\${kernel_source_dir} SUBDIRS=\${dkms_tree}/\${PACKAGE_NAME}/\${PACKAGE_VERSION}/build modules"
CLEAN="make -C \${kernel_source_dir} SUBDIRS=\${dkms_tree}/\${PACKAGE_NAME}/\${PACKAGE_VERSION}/build clean"
BUILT_MODULE_NAME=nvidia
BUILT_MODULE_LOCATION=./
DEST_MODULE_LOCATION=/kernel/drivers/video
REMAKE_INITRD=no
AUTOINSTALL=yes
_EOF
cat kernel/uvm/dkms.conf.fragment >> %{buildroot}%{_prefix}/src/%{name}-%{version}/dkms.conf
install -D -m 0755 libnvidia-wfb.so.%{nvidia_current_libver} \
%{buildroot}%{_libdir}/xorg/modules/libnvidia-wfb.so.%{nvidia_current_libver}
# blacklist nouveau
install -d -m0755 %{buildroot}%{_modprobedir}
echo "blacklist nouveau
" > %{buildroot}%{_modprobedir}/%{name}.conf
install -D -m 0755 libcuda.so.%{nvidia_current_libver} \
%{buildroot}%{_libdir}/libcuda.so.%{nvidia_current_libver}
# Install X.org configuration fragment
install -D -m0644 %{SOURCE3} %{buildroot}%{_sysconfdir}/X11/xorg.conf.d/20-nvidia.conf
install -D -m 0755 libGL.so.%{nvidia_current_libver} \
%{buildroot}%{_libdir}/libGL_so.%{nvidia_current_libver}
ln -s libGL_so.%{nvidia_current_libver} %{buildroot}%{_libdir}/libGL_current_so.1
# Add nvidia GL* libraries to ldconfig path
install -d -m0755 %{buildroot}%{_sysconfdir}/ld.so.conf.d
cat > %{buildroot}%{_sysconfdir}/ld.so.conf.d/nvidia_340.conf << __EOF
%{_libdir}/nvidia
__EOF
install -D -m 0755 libglx.so.%{nvidia_current_libver} \
%{buildroot}%{_libdir}/xorg/modules/extensions/libglx_so.%{nvidia_current_libver}
ln -s libglx_so.%{nvidia_current_libver} \
%{buildroot}%{_libdir}/xorg/modules/extensions/libglx_current_so
install -d -m0755 %{buildroot}%{_sysconfdir}/dracut.conf.d
cat > %{buildroot}%{_sysconfdir}/dracut.conf.d/20-nvidia_340.conf << __EOF
add_drivers+=" nvidia "
__EOF
install -D -m 0755 libnvcuvid.so.%{nvidia_current_libver} \
%{buildroot}%{_libdir}/libnvcuvid.so.%{nvidia_current_libver}
install -D -m 0755 libnvidia-cfg.so.%{nvidia_current_libver} \
%{buildroot}%{_libdir}/libnvidia-cfg_so.%{nvidia_current_libver}
ln -s libnvidia-cfg_so.%{nvidia_current_libver} \
%{buildroot}%{_libdir}/libnvidia-cfg_current_so
## Clutter workaround (http://blog.sukimashita.com/2015/04/13/gnome-3-16-and-nvidia-binary-driver-crash-with-totem-gnome-maps-cheese-and-others/)
#mkdir -p %{buildroot}%{_sysconfdir}/profile.d/
#cat > %{buildroot}%{_sysconfdir}/profile.d/nvidia-clutter.sh << _EOF
#export CLUTTER_BACKEND=x11
#_EOF
#chmod +x %{buildroot}%{_sysconfdir}/profile.d/nvidia-clutter.sh
install -D -m 0755 libnvidia-compiler.so.%{nvidia_current_libver} \
%{buildroot}%{_libdir}/libnvidia-compiler.so.%{nvidia_current_libver}
install -D -m 0755 libnvidia-encode.so.%{nvidia_current_libver} \
%{buildroot}%{_libdir}/libnvidia-encode.so.%{nvidia_current_libver}
install -D -m 0755 libnvidia-glcore.so.%{nvidia_current_libver} \
%{buildroot}%{_libdir}/libnvidia-glcore.so.%{nvidia_current_libver}
install -D -m 0755 libnvidia-ml.so.%{nvidia_current_libver} \
%{buildroot}%{_libdir}/libnvidia-ml.so.%{nvidia_current_libver}
ln -s libnvidia-ml.so.%{nvidia_current_libver} \
%{buildroot}%{_libdir}/libnvidia-ml.so.1
install -D -m 0755 libnvidia-opencl.so.%{nvidia_current_libver} \
%{buildroot}%{_libdir}/libnvidia-opencl.so.%{nvidia_current_libver}
install -D -m 0755 tls/libnvidia-tls.so.%{nvidia_current_libver} \
%{buildroot}%{_libdir}/tls/libnvidia-tls.so.%{nvidia_current_libver}
#ln -s libnvidia-tls_so.%{nvidia_current_libver} \
# %{buildroot}%{_libdir}/tls/libnvidia-tls_current_so.1
install -D -m 0755 libnvidia-tls.so.%{nvidia_current_libver} \
%{buildroot}%{_libdir}/libnvidia-tls.so.%{nvidia_current_libver}
#ln -s libnvidia-tls_so.%{nvidia_current_libver} \
# %{buildroot}%{_libdir}/libnvidia-tls_current_so.1
install -D -m755 libOpenCL.so.1.0.0 \
%{buildroot}%{_libdir}/libOpenCL_nvidia_so.1.0.0
#install -D -m755 libvdpau_nvidia.so.%{nvidia_current_libver} \
# %{buildroot}%{_libdir}/vdpau/libvdpau_nvidia.so.%{nvidia_current_libver}
#ln -s libvdpau_nvidia.so.%{nvidia_current_libver} \
# %{buildroot}%{_libdir}/vdpau/libvdpau_nvidia.so
#install -D -m 0755 libXvMCNVIDIA.so.%{nvidia_current_libver} \
# %{buildroot}%{_libdir}/libXvMCNVIDIA_so.%{nvidia_current_libver}
#ln -s libXvMCNVIDIA_so.%{nvidia_current_libver} \
# %{buildroot}%{_libdir}/libXvMCNVIDIA_current_so
#install -D -m 644 libXvMCNVIDIA.a %{buildroot}%{_libdir}/libXvMCNVIDIA.a
install -D -m 0755 nvidia_drv.so \
%{buildroot}%{_libdir}/xorg/modules/drivers/nvidia_current_drv_so
install -d %{buildroot}%{_sbindir}
cat > %{buildroot}%{_sbindir}/update-alternatives-set-nvidia << _EOF
#!/bin/sh
#update-alternatives --set nvidia_\$(uname -r)_%{kernel_ver_u}.ko \
#/lib/modules/\$(uname -r)/kernel/drivers/video/nvidia_current_ko
update-alternatives --set libglx.so %{_libdir}/xorg/modules/extensions/libglx_current_so
update-alternatives --set nvidia_drv.so %{_libdir}/xorg/modules/drivers/nvidia_current_drv_so
update-alternatives --set libGL.so.1 %{_libdir}/libGL_current_so.1
#update-alternatives --set libXvMCNVIDIA_dynamic.so %{_libdir}/libXvMCNVIDIA_current_so
update-alternatives --set libnvidia-cfg.so %{_libdir}/libnvidia-cfg_current_so
update-alternatives --set libOpenCL.so.1 %{_libdir}/libOpenCL_nvidia_so.1.0.0
#update-alternatives --set libnvidia-tls.so.1.lib %{_libdir}/libnvidia-tls_current_so.1
#update-alternatives --set libnvidia-tls.so.1 %{_libdir}/tls/libnvidia-tls_current_so.1
_EOF
for f in nvidia-xconfig nvidia-settings nvidia-smi; do
install -D -m 775 ${f} %{buildroot}%{_bindir}/${f}
install -D -m 644 ${f}.1.gz %{buildroot}%{_mandir}/man1/${f}.1.gz
done
install -D -m 644 nvidia-settings.desktop \
%{buildroot}%{_datadir}/applications/nvidia-settings.desktop
install -D -m 644 nvidia-settings.png \
%{buildroot}%{_datadir}/pixmaps/nvidia-settings.png
install -D -m755 libvdpau_nvidia.so.%{nvidia_current_libver} \
%{buildroot}%{_libdir}/vdpau/libvdpau_nvidia.so.%{nvidia_current_libver}
install -D -m755 libOpenCL.so.1.0.0 \
%{buildroot}%{_libdir}/libOpenCL_nvidia_so.1.0.0
ln -s libvdpau_nvidia.so.%{nvidia_current_libver} \
%{buildroot}%{_libdir}/vdpau/libvdpau_nvidia.so
# Clutter workaround (http://blog.sukimashita.com/2015/04/13/gnome-3-16-and-nvidia-binary-driver-crash-with-totem-gnome-maps-cheese-and-others/)
mkdir -p %{buildroot}%{_sysconfdir}/profile.d/
cat > %{buildroot}%{_sysconfdir}/profile.d/nvidia-clutter.sh << _EOF
export CLUTTER_BACKEND=x11
_EOF
chmod +x %{buildroot}%{_sysconfdir}/profile.d/nvidia-clutter.sh
%check
cd current/kernel
#for d in /lib/modules/4.*/build; do
# kver=`echo $d|sed "s|/lib/modules/\(.*\)/build.*|\1|"`
# [ "${kver:0:4}" == "4.0." -o "${kver:0:3}" == "4.1." ] && continue
# [ "${kver/-arm}" == "${kver}" ] || continue
d=/lib/modules/`uname -r`/build
rm -f *.ko
make %{_smp_mflags} SYSSRC=$d module
for n in nvidia; do
[ -e ${n}.ko ] || exit 1
done
make %{_smp_mflags} SYSSRC=$d clean
#done
%clean
[ "%{buildroot}" != / ] && rm -rf "%{buildroot}"
%preun -n xorg-drv-video-%{name}
# erase
dkms remove -q -m %{name} -v %{version} --all
if [ $1 -eq 0 ]; then
/sbin/ldconfig
/sbin/depmod -a -F /boot/System.map-`uname -r` \
`uname -r` &>/dev/null
fi
:
%posttrans -n xorg-drv-video-%{name}
if [ $1 -ge 1 ]; then
# clean any legacy alternatives symlink
@ -259,165 +301,120 @@ if [ $1 -ge 1 ]; then
#dkms remove -q -m nvidia -v 304.60 --all
dkms add -q -m %{name} -v %{version}
dkms install -q -m %{name} -v %{version}
/sbin/depmod -a -F /boot/System.map-%{kernel_ver}%{?KERNEL_TARGET} \
%{kernel_ver}%{?KERNEL_TARGET} &>/dev/null
/usr/sbin/mkinitrd -f
fi
/sbin/ldconfig
:
%post -n xorg-drv-video-%{name}
# new install
update-alternatives --remove libnvidia-tls.so %{_libdir}/libnvidia-tls_current.so 2>/dev/null
if [ $1 -ge 1 ]; then
# update-alternatives \
# --install %{_libdir}/libXvMCNVIDIA_dynamic.so libXvMCNVIDIA_dynamic.so \
# %{_libdir}/libXvMCNVIDIA_current_so 50
update-alternatives \
--install %{_libdir}/libnvidia-cfg.so libnvidia-cfg.so \
%{_libdir}/libnvidia-cfg_current_so 50
# update-alternatives \
# --install %{_libdir}/libnvidia-tls.so.1 libnvidia-tls.so.1.lib \
# %{_libdir}/libnvidia-tls_current_so.1 50
# update-alternatives \
# --install %{_libdir}/tls/libnvidia-tls.so.1 libnvidia-tls.so.1 \
# %{_libdir}/tls/libnvidia-tls_current_so.1 50
[ -e %{_libdir}/xorg/modules/drivers/nvidia_drv.so ] && \
rm -f %{_libdir}/xorg/modules/drivers/nvidia_drv.so
update-alternatives \
--install %{_libdir}/xorg/modules/drivers/nvidia_drv.so nvidia_drv.so \
%{_libdir}/xorg/modules/drivers/nvidia_current_drv_so 50
update-alternatives \
--install %{_libdir}/libOpenCL.so.1 libOpenCL.so.1 \
%{_libdir}/libOpenCL_nvidia_so.1.0.0 20
fi
if [ $1 -eq 1 -a -n "`grep nv /etc/X11/xorg.conf 2>/dev/null`" ]; then
sed -i "s|\"nv\"|\"nvidia\"|" /etc/X11/xorg.conf
sed -i "s|Load \"dri\"||" /etc/X11/xorg.conf
fi
/sbin/ldconfig
/sbin/depmod -a -F /boot/System.map-%{kernel_ver}%{?KERNEL_TARGET} \
%{kernel_ver}%{?KERNEL_TARGET} &>/dev/null
exit 0
%preun -n xorg-drv-video-%{name}
# erase
dkms remove -q -m nvidia -v %{version} --all
if [ $1 -eq 0 ]; then
# update-alternatives \
# --remove libXvMCNVIDIA_dynamic.so %{_libdir}/libXvMCNVIDIA_current_so
update-alternatives \
--remove libnvidia-cfg.so %{_libdir}/libnvidia-cfg_current_so
update-alternatives \
--remove libnvidia-tls.so.1.lib %{_libdir}/libnvidia-tls_current_so.1
update-alternatives \
--remove libnvidia-tls.so.1 %{_libdir}/tls/libnvidia-tls_current_so.1
[ ! -L %{_libdir}/xorg/modules/drivers/nvidia_drv.so ] && \
rm -f %{_libdir}/xorg/modules/drivers/nvidia_drv.so
update-alternatives \
--remove nvidia_drv.so %{_libdir}/xorg/modules/drivers/nvidia_current_drv_so
update-alternatives \
--remove libOpenCL.so.1 %{_libdir}/libOpenCL_nvidia_so.1.0.0
[ -w /etc/X11/xorg.conf ] && \
sed -i "s|\"nvidia\"|\"nv\"|" /etc/X11/xorg.conf
/sbin/ldconfig
/sbin/depmod -a -F /boot/System.map-`uname -r` \
`uname -r` &>/dev/null
fi
exit 0
%post -n xorg-ext-libglx-%{name}
update-alternatives --remove libglx.so %{_libdir}/libglx_current.so 2>/dev/null
/usr/sbin/update-alternatives \
--install %{_libdir}/xorg/modules/extensions/libglx.so libglx.so \
%{_libdir}/xorg/modules/extensions/libglx_current_so 20
exit 0
%preun -n xorg-ext-libglx-%{name}
if [ $1 -eq 0 ]; then
/usr/sbin/update-alternatives --remove libglx.so \
%{_libdir}/xorg/modules/extensions/libglx_current_so
fi
exit 0
%post -n libGL-%{name}-X11
update-alternatives --remove libGL.so.1 %{_libdir}/libGL_current.so.1 2>/dev/null
/usr/sbin/update-alternatives \
--install %{_libdir}/libGL.so.1 libGL.so.1 \
%{_libdir}/libGL_current_so.1 20
/sbin/ldconfig
exit 0
%preun -n libGL-%{name}-X11
if [ $1 -eq 0 ]; then
/usr/sbin/update-alternatives --remove libGL.so.1 \
%{_libdir}/libGL_current_so.1
fi
/sbin/ldconfig
exit 0
%files -n libGL-%{name}-X11
%defattr(-,root,root)
%{_libdir}/libGL_so.%{nvidia_current_libver}
%{_libdir}/libGL_current_so.1
%files -n xorg-ext-libglx-%{name}
%defattr(-,root,root)
%{_libdir}/xorg/modules/extensions/libglx_current_so
%{_libdir}/xorg/modules/extensions/libglx_so.%{nvidia_current_libver}
%triggerpostun -n xorg-drv-video-%{name} -- xorg-drv-video-%{name} < 1:340.108-9mamba
# /bin and /sbin are removed during old filesystem postun
# Fixes for removal of alternatives overwriting symlinks belonging to libglvnd
[ "`readlink -f %{_libdir}/libGL.so.1`" = "%{_libdir}/libGL.so.340.108" ] && ln -sf libGL.so.1.7.0 %{_libdir}/libGL.so.1
[ "`readlink -f %{_libdir}/libEGL.so.1`" = "%{_libdir}/libEGL.so.340.108" ] && ln -sf libEGL.so.1.1.0 %{_libdir}/libEGL.so.1
[ "`readlink -f %{_libdir}/libGLESv2.so.2`" = "%{_libdir}/libGLESv2.so.340.108" ] && ln -sf libGLESv2.so.2.1.0 %{_libdir}/libGLESv2.so.2
:
%files -n xorg-drv-video-%{name}
%defattr(-,root,root)
%{_sysconfdir}/profile.d/nvidia-clutter.sh
%{_sysconfdir}/ld.so.conf.d/nvidia_340.conf
%{_sysconfdir}/dracut.conf.d/20-nvidia_340.conf
#%{_sysconfdir}/profile.d/nvidia-clutter.sh
%{_sysconfdir}/OpenCL/vendors/nvidia.icd
%{_sysconfdir}/X11/xorg.conf.d/20-nvidia.conf
%dir %{_prefix}/src/%{name}-%{version}
%{_prefix}/src/%{name}-%{version}/*
%attr(0755,root,root) %{_sbindir}/update-alternatives-set-nvidia
%{_libdir}/libnvidia-glcore.so.%{nvidia_current_libver}
#%{_libdir}/libXvMCNVIDIA.a
#%{_libdir}/libXvMCNVIDIA_so.%{nvidia_current_libver}
#%{_libdir}/libXvMCNVIDIA_current_so
%{_libdir}/xorg/modules/drivers/nvidia_current_drv_so
%{_libdir}/xorg/modules/libnvidia-wfb.so.%{nvidia_current_libver}
#%{_libdir}/xorg/modules/libwfb.so
%{_bindir}/nvidia-*
%{_unitdir}/nvidia-persistenced.service
%{_prefix}/lib/sysusers.d/nvidia.conf
%{_modprobedir}/%{name}.conf
%{_libdir}/nvidia/libEGL.so.*
%{_libdir}/nvidia/libGL.so.*
%{_libdir}/nvidia/libGLESv1_CM.so.*
%{_libdir}/nvidia/libGLESv2.so.*
%{_libdir}/libcuda.so.*
%{_libdir}/libnvcuvid.so.*
%{_libdir}/libnvidia-compiler.so.*
%{_libdir}/libnvidia-encode.so.*
%{_libdir}/libnvidia-opencl.so.*
%{_libdir}/libnvidia-cfg_so.%{nvidia_current_libver}
%{_libdir}/libnvidia-cfg_current_so
%{_libdir}/libnvidia-tls.so.%{nvidia_current_libver}
#%{_libdir}/libnvidia-tls_current_so.1
#%{_libdir}/tls/libnvidia-tls_current_so.1
%{_libdir}/libnvidia-ml.so.1
%{_libdir}/libnvidia-ml.so.%{nvidia_current_libver}
%{_libdir}/tls/libnvidia-tls.so.%{nvidia_current_libver}
%{_libdir}/libOpenCL_nvidia_so.1.0.0
%{_libdir}/vdpau/libvdpau_nvidia.so
%{_libdir}/vdpau/libvdpau_nvidia.so.%{nvidia_current_libver}
%doc current/LICENSE
%files -n xorg-apps-%{name}
%defattr(-,root,root)
%{_bindir}/nvidia-settings
%{_bindir}/nvidia-xconfig
%{_bindir}/nvidia-smi
%{_libdir}/libnvidia-*.so.*
%{_libdir}/libnvidia-tls.so.*
%{_libdir}/nvidia/xorg/libglx.so
%{_libdir}/nvidia/xorg/libglx.so.*
%{_libdir}/vdpau/libvdpau_nvidia.so.*
%{_libdir}/xorg/modules/drivers/nvidia_drv.so
%{_datadir}/applications/nvidia-settings.desktop
%{_datadir}/nvidia/nvidia-application-profiles-%{version}-key-documentation
%{_datadir}/nvidia/nvidia-application-profiles-%{version}-rc
%{_datadir}/pixmaps/nvidia-settings.png
%{_mandir}/man1/nvidia-settings.*
%{_mandir}/man1/nvidia-smi.*
%{_mandir}/man1/nvidia-xconfig.*
%{_mandir}/man1/nvidia-cuda-mps-control.1*
%{_mandir}/man1/nvidia-modprobe.1*
%{_mandir}/man1/nvidia-persistenced.1*
%{_mandir}/man1/nvidia-settings.1*
%{_mandir}/man1/nvidia-smi.1*
%{_mandir}/man1/nvidia-xconfig.1*
%doc current/LICENSE
%files -n xorg-drv-video-%{name}-doc
%defattr(-,root,root)
%doc current/{LICENSE,NVIDIA_Changelog,README.txt} current/html
%doc current/{NVIDIA_Changelog,README.txt} current/html
%changelog
* Thu Jul 27 2023 Silvan Calarco <silvan.calarco@mambasoft.it> 340.108-16mamba
- remove gcc version mismatch check; add patches up to kernel 6.3
* Tue Feb 21 2023 Silvan Calarco <silvan.calarco@mambasoft.it> 340.108-15mamba
- add nvidia libraries to ldconfig and regenerate initramfs
* Tue Feb 14 2023 Silvan Calarco <silvan.calarco@mambasoft.it> 340.108-14mamba
- fix content of /etc/X11/xorg.conf.d/20-nvidia.conf
* Thu Feb 09 2023 Silvan Calarco <silvan.calarco@mambasoft.it> 340.108-13mamba
- install nvidia-tls.so in libdir; install xorg configuration fragment and blacklist nouveau
* Tue Feb 07 2023 Silvan Calarco <silvan.calarco@mambasoft.it> 340.108-12mamba
- patch dkms.conf to fix build error caused by src dir called nvidia_340
* Mon Feb 06 2023 Silvan Calarco <silvan.calarco@mambasoft.it> 340.108-11mamba
- require (post) glibc-devel
* Mon Feb 06 2023 Silvan Calarco <silvan.calarco@mambasoft.it> 340.108-10mamba
- added patches up to kernel 6.0
* Sun Apr 25 2021 Silvan Calarco <silvan.calarco@mambasoft.it> 340.108-9mamba
- need to rename libGL etc. as libGL_nvidia or ldconfig will overwrite libglvnd library
* Sun Apr 25 2021 Silvan Calarco <silvan.calarco@mambasoft.it> 340.108-8mamba
- fix for removal of alternatives overwriting symlinks belonging to libglvnd
* Fri Apr 23 2021 Silvan Calarco <silvan.calarco@mambasoft.it> 340.108-7mamba
- repackaged with libglvnd and libmesa layout
* Sun Apr 18 2021 Silvan Calarco <silvan.calarco@mambasoft.it> 340.108-6mamba
- install included dkms file
* Sun Apr 18 2021 Silvan Calarco <silvan.calarco@mambasoft.it> 340.108-5mamba
- install included dkms file
* Thu Apr 15 2021 Silvan Calarco <silvan.calarco@mambasoft.it> 340.108-4mamba
- added patches up to kernel 5.11
* Fri Aug 21 2020 Silvan Calarco <silvan.calarco@mambasoft.it> 340.108-3mamba
- dkms: add IGNORE_CC_MISMATCH=1 before make command to fix build with gcc 10.1+
* Fri Jul 24 2020 Silvan Calarco <silvan.calarco@mambasoft.it> 340.108-2mamba
- dkms: replace obsoleted SUBDIRS= with M=
* Thu Jul 23 2020 Silvan Calarco <silvan.calarco@mambasoft.it> 340.108-1mamba
- update to 340.108
* Thu Feb 28 2019 Silvan Calarco <silvan.calarco@mambasoft.it> 340.107-1mamba
- update to 340.107
* Sat Aug 12 2017 Silvan Calarco <silvan.calarco@mambasoft.it> 340.102-2mamba
- patched to fix 'Error: Driver nvidia is already registered, aborting...'
* Sun Aug 06 2017 Silvan Calarco <silvan.calarco@mambasoft.it> 340.102-1mamba
- update to 340.102
* Thu May 28 2015 Silvan Calarco <silvan.calarco@mambasoft.it> 340.76-2mamba
- CLUTTER_BACKEND workaround to fix Gnome >= 3.16 apps
@ -756,7 +753,7 @@ exit 0
* Thu Apr 26 2007 Silvan Calarco <silvan.calarco@mambasoft.it> 2.6.21-1mamba
- rebuild with kernel 2.6.21
* Mon Mar 13 2007 Silvan Calarco <silvan.calarco@mambasoft.it> 2.6.20-2qilnx
* Tue Mar 13 2007 Silvan Calarco <silvan.calarco@mambasoft.it> 2.6.20-2qilnx
- driver update to 9755
- obsolete old kernel's package
@ -764,7 +761,7 @@ exit 0
- update to version 2.6.20 by autospec
- nvidia driver update to 9746
* Wed Dec 28 2006 Silvan Calarco <silvan.calrco@qilinux.it> 2.6.19-2qilnx
* Thu Dec 28 2006 Silvan Calarco <silvan.calrco@qilinux.it> 2.6.19-2qilnx
- rename libglx-nvidia to xorg-ext-libglx-nvidia and obsolete libglx-nvidia
* Thu Dec 21 2006 Silvan Calarco <silvan.calrco@qilinux.it> 2.6.19-1qilnx
@ -794,7 +791,7 @@ exit 0
* Sun Apr 16 2006 Silvan Calarco <silvan.calarco@mambasoft.it> 2.6.16-2qilnx
- update to version 1.0-8756
* Sat Apr 02 2006 Silvan Calarco <silvan.calarco@mambasoft.it> 2.6.16-1qilnx
* Sun Apr 02 2006 Silvan Calarco <silvan.calarco@mambasoft.it> 2.6.16-1qilnx
- new kernel version build
* Thu Mar 30 2006 Silvan Calarco <silvan.calarco@mambasoft.it> 2.6.15-11qilnx

1
nvidia_340.sysusers Normal file
View File

@ -0,0 +1 @@
u nvidia-persistenced 143 'NVIDIA Persistence Daemon'