update for kernel 5.18

This commit is contained in:
JerryXiao 2022-05-29 22:26:53 +08:00
parent eb76dd39d7
commit 25b93f5a3d
Signed by: Jerry
GPG key ID: 22618F758B5BE2E5
3 changed files with 158 additions and 3 deletions

View file

@ -1,7 +1,7 @@
pkgbase = nvidia-340xx pkgbase = nvidia-340xx
pkgdesc = NVIDIA drivers for linux, 340xx legacy branch pkgdesc = NVIDIA drivers for linux, 340xx legacy branch
pkgver = 340.108 pkgver = 340.108
pkgrel = 29 pkgrel = 30
url = https://www.nvidia.com/ url = https://www.nvidia.com/
arch = x86_64 arch = x86_64
license = custom license = custom
@ -21,6 +21,7 @@ pkgbase = nvidia-340xx
source = 0007-kernel-5.15.patch source = 0007-kernel-5.15.patch
source = 0008-kernel-5.16.patch source = 0008-kernel-5.16.patch
source = 0009-kernel-5.17.patch source = 0009-kernel-5.17.patch
source = 0010-kernel-5.18.patch
b2sums = 6538bbec53b10f8d20977f9b462052625742e9709ef06e24cf2e55de5d0c55f1620a4bb21396cfd89ebc54c32f921ea17e3e47eaa95abcbc24ecbd144fb89028 b2sums = 6538bbec53b10f8d20977f9b462052625742e9709ef06e24cf2e55de5d0c55f1620a4bb21396cfd89ebc54c32f921ea17e3e47eaa95abcbc24ecbd144fb89028
b2sums = 49d99f612e8eee3ab5e34083c25348bfd14ed5fc8a7984dafc0dad7c0ae0df2c0b2a63a1bb993da440eb0a60293d7c753ca3889bd2f51991b8ddc51bce2fe4a8 b2sums = 49d99f612e8eee3ab5e34083c25348bfd14ed5fc8a7984dafc0dad7c0ae0df2c0b2a63a1bb993da440eb0a60293d7c753ca3889bd2f51991b8ddc51bce2fe4a8
b2sums = 7150233df867a55f57aa5e798b9c7618329d98459fecc35c4acfad2e9772236cb229703c4fa072381c509279d0588173d65f46297231f4d3bfc65a1ef52e65b1 b2sums = 7150233df867a55f57aa5e798b9c7618329d98459fecc35c4acfad2e9772236cb229703c4fa072381c509279d0588173d65f46297231f4d3bfc65a1ef52e65b1
@ -32,6 +33,7 @@ pkgbase = nvidia-340xx
b2sums = b3b7bbd597252b25ccb68f431f83707a10d464996f6c74bb67143795df96054da719faf09c1ad2e1c215261356833ad3fa0d9e60552151f827f9d7be7ae44605 b2sums = b3b7bbd597252b25ccb68f431f83707a10d464996f6c74bb67143795df96054da719faf09c1ad2e1c215261356833ad3fa0d9e60552151f827f9d7be7ae44605
b2sums = caedc5651bfd14c02fb677f9c5e87adef298d871c6281b78ce184108310e4243ded82210873014be7fedee0dd6251305fa9bbce0c872b76438e0895ef76109d9 b2sums = caedc5651bfd14c02fb677f9c5e87adef298d871c6281b78ce184108310e4243ded82210873014be7fedee0dd6251305fa9bbce0c872b76438e0895ef76109d9
b2sums = 0266e1baaac9ffbb94d9e916a693b1663d8686b15e970bfc30f7c51f051a0af9267aa5f6a12b68586c69d2e9796a1124488b3997ba4b26db1a5ac10a892f0df2 b2sums = 0266e1baaac9ffbb94d9e916a693b1663d8686b15e970bfc30f7c51f051a0af9267aa5f6a12b68586c69d2e9796a1124488b3997ba4b26db1a5ac10a892f0df2
b2sums = d69c9acbe550d5fccca68ca6a0d5095cbcaf887d2bc43704a8eb85533896692f16701eef07ead297881f596f5502c3105bb5bea77b2dcaf6c4dc2b49941f9f19
pkgname = nvidia-340xx pkgname = nvidia-340xx
pkgdesc = NVIDIA drivers for linux, 340xx legacy branch pkgdesc = NVIDIA drivers for linux, 340xx legacy branch

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");

View file

@ -6,7 +6,7 @@
pkgbase=nvidia-340xx pkgbase=nvidia-340xx
pkgname=(nvidia-340xx nvidia-340xx-dkms); [ -n "$NVIDIA_340XX_DKMS_ONLY" ] && pkgname=(nvidia-340xx-dkms) pkgname=(nvidia-340xx nvidia-340xx-dkms); [ -n "$NVIDIA_340XX_DKMS_ONLY" ] && pkgname=(nvidia-340xx-dkms)
pkgver=340.108 pkgver=340.108
pkgrel=29 pkgrel=30
pkgdesc="NVIDIA drivers for linux, 340xx legacy branch" pkgdesc="NVIDIA drivers for linux, 340xx legacy branch"
arch=('x86_64') arch=('x86_64')
url="https://www.nvidia.com/" url="https://www.nvidia.com/"
@ -26,6 +26,7 @@ source=("https://us.download.nvidia.com/XFree86/Linux-x86_64/${pkgver}/NVIDIA-Li
0007-kernel-5.15.patch 0007-kernel-5.15.patch
0008-kernel-5.16.patch 0008-kernel-5.16.patch
0009-kernel-5.17.patch 0009-kernel-5.17.patch
0010-kernel-5.18.patch
) )
b2sums=('6538bbec53b10f8d20977f9b462052625742e9709ef06e24cf2e55de5d0c55f1620a4bb21396cfd89ebc54c32f921ea17e3e47eaa95abcbc24ecbd144fb89028' b2sums=('6538bbec53b10f8d20977f9b462052625742e9709ef06e24cf2e55de5d0c55f1620a4bb21396cfd89ebc54c32f921ea17e3e47eaa95abcbc24ecbd144fb89028'
'49d99f612e8eee3ab5e34083c25348bfd14ed5fc8a7984dafc0dad7c0ae0df2c0b2a63a1bb993da440eb0a60293d7c753ca3889bd2f51991b8ddc51bce2fe4a8' '49d99f612e8eee3ab5e34083c25348bfd14ed5fc8a7984dafc0dad7c0ae0df2c0b2a63a1bb993da440eb0a60293d7c753ca3889bd2f51991b8ddc51bce2fe4a8'
@ -37,7 +38,8 @@ b2sums=('6538bbec53b10f8d20977f9b462052625742e9709ef06e24cf2e55de5d0c55f1620a4bb
'31a4047ab84d13e32fd7fdbf9f69c696d3fab6666c541d2acf0a189c1d17c876970985167fd389a4adc0f786021172bdec1aa6d690736e3cf9fcd8ceabe5fd32' '31a4047ab84d13e32fd7fdbf9f69c696d3fab6666c541d2acf0a189c1d17c876970985167fd389a4adc0f786021172bdec1aa6d690736e3cf9fcd8ceabe5fd32'
'b3b7bbd597252b25ccb68f431f83707a10d464996f6c74bb67143795df96054da719faf09c1ad2e1c215261356833ad3fa0d9e60552151f827f9d7be7ae44605' 'b3b7bbd597252b25ccb68f431f83707a10d464996f6c74bb67143795df96054da719faf09c1ad2e1c215261356833ad3fa0d9e60552151f827f9d7be7ae44605'
'caedc5651bfd14c02fb677f9c5e87adef298d871c6281b78ce184108310e4243ded82210873014be7fedee0dd6251305fa9bbce0c872b76438e0895ef76109d9' 'caedc5651bfd14c02fb677f9c5e87adef298d871c6281b78ce184108310e4243ded82210873014be7fedee0dd6251305fa9bbce0c872b76438e0895ef76109d9'
'0266e1baaac9ffbb94d9e916a693b1663d8686b15e970bfc30f7c51f051a0af9267aa5f6a12b68586c69d2e9796a1124488b3997ba4b26db1a5ac10a892f0df2') '0266e1baaac9ffbb94d9e916a693b1663d8686b15e970bfc30f7c51f051a0af9267aa5f6a12b68586c69d2e9796a1124488b3997ba4b26db1a5ac10a892f0df2'
'd69c9acbe550d5fccca68ca6a0d5095cbcaf887d2bc43704a8eb85533896692f16701eef07ead297881f596f5502c3105bb5bea77b2dcaf6c4dc2b49941f9f19')
_pkg="NVIDIA-Linux-x86_64-${pkgver}-no-compat32" _pkg="NVIDIA-Linux-x86_64-${pkgver}-no-compat32"
# default is 'linux' substitute custom name here # default is 'linux' substitute custom name here