update for linux-lts 6.1.14

This commit is contained in:
JerryXiao 2023-02-28 14:23:35 +08:00
parent 43b07c751c
commit 7044f8a445
Signed by: Jerry
GPG key ID: 22618F758B5BE2E5
7 changed files with 390 additions and 37 deletions

View file

@ -1,18 +1,17 @@
pkgbase = nvidia-340xx-lts
pkgdesc = NVIDIA drivers for linux-lts, 340xx legacy branch
pkgver = 340.108
pkgrel = 5
pkgrel = 6
url = https://www.nvidia.com/
arch = x86_64
license = custom
makedepends = nvidia-340xx-utils=340.108
makedepends = linux-lts>=5.15.14
makedepends = linux-lts-headers>=5.15.14
makedepends = linux-lts>=6.1.14
makedepends = linux-lts-headers>=6.1.14
conflicts = nvidia-lts
options = !strip
source = https://us.download.nvidia.com/XFree86/Linux-x86_64/340.108/NVIDIA-Linux-x86_64-340.108-no-compat32.run
source = 20-nvidia.conf
source = 0000-fix-multi-core-build.patch
source = 0001-kernel-5.7.patch
source = 0002-kernel-5.8.patch
source = 0003-kernel-5.9.patch
@ -20,9 +19,12 @@ pkgbase = nvidia-340xx-lts
source = 0005-kernel-5.11.patch
source = 0006-kernel-5.14.patch
source = 0007-kernel-5.15.patch
source = 0008-kernel-5.16.patch
source = 0009-kernel-5.17.patch
source = 0010-kernel-5.18.patch
source = 0011-kernel-6.0.patch
sha256sums = 995d44fef587ff5284497a47a95d71adbee0c13020d615e940ac928f180f5b77
sha256sums = 5b4cb7620abc1729a13c78a2fb33ccaeb7d92f42936d929885324c81f2b7c985
sha256sums = 82d14e9e6ec47c345d225d9f398238b7254cd5ae581c70e8521b9157ec747890
sha256sums = c8bda5fb238fbebc5bf6ae4b7646e48b30a96b9060ced20d93c53c14ac3161f6
sha256sums = 10b91c8dbc269ff1d8e3e8a1866926c309ff3912d191a05cd5724a3139776f32
sha256sums = e06af37ffa2203698594e0f58816b809feced9b2374927e13b85fd5c18fa3114
@ -30,6 +32,10 @@ pkgbase = nvidia-340xx-lts
sha256sums = 2430303d6a0f48418532229aa5377e8848be762a8fdc790edeba30e6eec5214c
sha256sums = 47ca88252c6b40f488f403f81c3eb1c1e5a5eed1dc353e31d53b5c815c433238
sha256sums = ff4869ea16eb3d894b13a6ca6775906ce0feacf405a2ade63c4f052df6024769
sha256sums = ad663464d7f57f0f7136bd727ed088d733b087be10cd944ba7d089c421536717
sha256sums = e9970b3ab78f34bdfa29f5dc4f6772aa35026d14d14a0e35bd9744187583edc9
sha256sums = ebb3c5f9b41d0d5081b27a6335ffa6114d65dbcb98f935158167877c394ccb89
sha256sums = b741790983e2bfba1c7d1842af73a353fbe0de987bec3ee05385d20f244226b9
pkgname = nvidia-340xx-lts
pkgdesc = NVIDIA drivers for linux-lts, 340xx legacy branch.

View file

@ -1,20 +0,0 @@
This patch will allow the call to make by dkms to use all host cpu cores.
See: https://github.com/dell/dkms/issues/100
--- a/dkms.conf 2019-12-11 17:04:24.000000000 -0500
+++ b/dkms.conf 2020-01-10 12:47:44.770501121 -0500
@@ -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"

30
0008-kernel-5.16.patch Normal file
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))

57
0009-kernel-5.17.patch Normal file
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"

151
0010-kernel-5.18.patch Normal file
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");

121
0011-kernel-6.0.patch Normal file
View file

@ -0,0 +1,121 @@
--- a/kernel/nv-acpi.c 2020-01-01 00:00:00.000000000 +0000
+++ b/kernel/nv-acpi.c 2020-01-01 00:00:00.000000000 +0000
@@ -190,9 +190,9 @@
union acpi_object control_argument_0 = { ACPI_TYPE_INTEGER };
struct acpi_object_list control_argument_list = { 0, NULL };
nv_stack_t *sp = NULL;
- struct list_head *node, *next;
nv_acpi_integer_t device_id = 0;
int device_counter = 0;
+ acpi_handle handle = NULL;
NV_KMEM_CACHE_ALLOC_STACK(sp);
if (sp == NULL)
@@ -220,13 +220,12 @@
// grab handles to all the important nodes representing devices
- list_for_each_safe(node, next, &device->children)
+ do
{
- struct acpi_device *dev =
- list_entry(node, struct acpi_device, node);
-
- if (!dev)
- continue;
+ status = acpi_get_next_object(ACPI_TYPE_DEVICE, device->handle,
+ handle, &handle);
+ if (ACPI_FAILURE(status) || (handle == NULL))
+ break;
if (device_counter == NV_MAXNUM_DISPLAY_DEVICES)
{
@@ -237,7 +236,7 @@
}
status =
- acpi_evaluate_integer(dev->handle, "_ADR", NULL, &device_id);
+ acpi_evaluate_integer(handle, "_ADR", NULL, &device_id);
if (ACPI_FAILURE(status))
/* Couldnt query device_id for this device */
continue;
@@ -256,11 +255,11 @@
}
pNvAcpiObject->pNvVideo[device_counter].dev_id = device_id;
- pNvAcpiObject->pNvVideo[device_counter].dev_handle = dev->handle;
+ pNvAcpiObject->pNvVideo[device_counter].dev_handle = handle;
device_counter++;
- }
+ } while (handle != NULL);
// arg 0, bits 1:0, 0 = enable events
control_argument_0.integer.type = ACPI_TYPE_INTEGER;
@@ -1202,16 +1201,15 @@
)
{
acpi_status status;
- struct acpi_device *device = NULL;
struct acpi_buffer output = { ACPI_ALLOCATE_BUFFER, NULL };
union acpi_object *ddc;
union acpi_object ddc_arg0 = { ACPI_TYPE_INTEGER };
struct acpi_object_list input = { 1, &ddc_arg0 };
- struct list_head *node, *next;
nv_acpi_integer_t device_id = 0;
NvU32 i;
acpi_handle dev_handle = NULL;
acpi_handle lcd_dev_handle = NULL;
+ acpi_handle handle = NULL;
if (!nv_acpi_get_device_handle(nv, &dev_handle))
return RM_ERR_NOT_SUPPORTED;
@@ -1219,16 +1217,6 @@
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;
-
if (!NV_MAY_SLEEP())
{
#if defined(DEBUG)
@@ -1239,15 +1227,15 @@
return RM_ERR_NOT_SUPPORTED;
}
- list_for_each_safe(node, next, &device->children)
+ while (lcd_dev_handle == NULL)
{
- struct acpi_device *dev =
- list_entry(node, struct acpi_device, node);
+ status = acpi_get_next_object(ACPI_TYPE_DEVICE, dev_handle,
+ handle, &handle);
+ if (ACPI_FAILURE(status) || (handle == NULL))
+ break;
- if (!dev)
- continue;
+ status = acpi_evaluate_integer(handle, "_ADR", NULL, &device_id);
- status = acpi_evaluate_integer(dev->handle, "_ADR", NULL, &device_id);
if (ACPI_FAILURE(status))
/* Couldnt query device_id for this device */
continue;
@@ -1256,7 +1244,7 @@
if ((device_id == 0x0110) || (device_id == 0x0118) || (device_id == 0x0400)) /* Only for an LCD*/
{
- lcd_dev_handle = dev->handle;
+ lcd_dev_handle = handle;
nv_printf(NV_DBG_INFO, "NVRM: %s Found LCD: %x\n", __FUNCTION__, device_id);
break;
}

View file

@ -6,11 +6,11 @@
pkgbase=nvidia-340xx-lts
pkgname=(nvidia-340xx-lts nvidia-340xx-lts-dkms)
pkgver=340.108
pkgrel=5
pkgrel=6
pkgdesc="NVIDIA drivers for linux-lts, 340xx legacy branch"
arch=('x86_64')
url="https://www.nvidia.com/"
makedepends=("nvidia-340xx-utils=${pkgver}" 'linux-lts>=5.15.14' 'linux-lts-headers>=5.15.14')
makedepends=("nvidia-340xx-utils=${pkgver}" 'linux-lts>=6.1.14' 'linux-lts-headers>=6.1.14')
conflicts=('nvidia-lts')
license=('custom')
options=(!strip)
@ -18,7 +18,6 @@ options=(!strip)
# https://gitlab.manjaro.org/packages?utf8=%E2%9C%93&filter=nvidia-340xx
source=("https://us.download.nvidia.com/XFree86/Linux-x86_64/${pkgver}/NVIDIA-Linux-x86_64-${pkgver}-no-compat32.run"
20-nvidia.conf
0000-fix-multi-core-build.patch
0001-kernel-5.7.patch
0002-kernel-5.8.patch
0003-kernel-5.9.patch
@ -26,17 +25,24 @@ source=("https://us.download.nvidia.com/XFree86/Linux-x86_64/${pkgver}/NVIDIA-Li
0005-kernel-5.11.patch
0006-kernel-5.14.patch
0007-kernel-5.15.patch
0008-kernel-5.16.patch
0009-kernel-5.17.patch
0010-kernel-5.18.patch
0011-kernel-6.0.patch
)
sha256sums=('995d44fef587ff5284497a47a95d71adbee0c13020d615e940ac928f180f5b77'
'5b4cb7620abc1729a13c78a2fb33ccaeb7d92f42936d929885324c81f2b7c985'
'82d14e9e6ec47c345d225d9f398238b7254cd5ae581c70e8521b9157ec747890'
'c8bda5fb238fbebc5bf6ae4b7646e48b30a96b9060ced20d93c53c14ac3161f6'
'10b91c8dbc269ff1d8e3e8a1866926c309ff3912d191a05cd5724a3139776f32'
'e06af37ffa2203698594e0f58816b809feced9b2374927e13b85fd5c18fa3114'
'5e184ca5fcbf5071050f23503bfd3391c4bc1ccc31453338791a3da3885b6085'
'2430303d6a0f48418532229aa5377e8848be762a8fdc790edeba30e6eec5214c'
'47ca88252c6b40f488f403f81c3eb1c1e5a5eed1dc353e31d53b5c815c433238'
'ff4869ea16eb3d894b13a6ca6775906ce0feacf405a2ade63c4f052df6024769')
'ff4869ea16eb3d894b13a6ca6775906ce0feacf405a2ade63c4f052df6024769'
'ad663464d7f57f0f7136bd727ed088d733b087be10cd944ba7d089c421536717'
'e9970b3ab78f34bdfa29f5dc4f6772aa35026d14d14a0e35bd9744187583edc9'
'ebb3c5f9b41d0d5081b27a6335ffa6114d65dbcb98f935158167877c394ccb89'
'b741790983e2bfba1c7d1842af73a353fbe0de987bec3ee05385d20f244226b9')
_pkg="NVIDIA-Linux-x86_64-${pkgver}-no-compat32"
# default is 'linux' substitute custom name here
@ -48,13 +54,15 @@ prepare() {
sh "${_pkg}.run" --extract-only
cd "${_pkg}"
patch -Np1 -i ../0001-kernel-5.7.patch
patch -Np1 -i ../0002-kernel-5.8.patch
patch -Np1 -i ../0003-kernel-5.9.patch
patch -Np1 -i ../0004-kernel-5.10.patch
patch -Np1 -i ../0005-kernel-5.11.patch
patch -Np1 -i ../0006-kernel-5.14.patch
patch -Np1 -i ../0007-kernel-5.15.patch
local src
for src in "${source[@]}"; do
src="${src%%::*}"
src="${src##*/}"
[[ $src = 0*.patch ]] || continue
echo "Applying patch $src..."
patch -Np1 < "../$src"
done
cp -a kernel kernel-dkms
}