diff options
author | UNMAINTAINED <UNMAINTAINED> | 2022-10-05 18:11:04 +0100 |
---|---|---|
committer | Willy Sudiarto Raharjo <willysr@slackbuilds.org> | 2022-10-08 09:12:44 +0700 |
commit | 6d1e605b15fa49ae7644cb1196ded5148c229bb6 (patch) | |
tree | d9fdb975a762e811cc739118b762bdb2855ee04b | |
parent | a6ba9f612e3369b8036b2ac11acbf8e850a5fd1b (diff) | |
download | slackbuilds-6d1e605b15fa49ae7644cb1196ded5148c229bb6.tar.gz |
system/nvidia-legacy340-kernel: Add patch for 5.18+ kernels.
Patch supplied by fourtysixandtwo@sliderr.net
Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
-rw-r--r-- | system/nvidia-legacy340-kernel/nvidia-legacy340-kernel.SlackBuild | 2 | ||||
-rw-r--r-- | system/nvidia-legacy340-kernel/patches/0010-kernel-5.18.patch | 151 |
2 files changed, 152 insertions, 1 deletions
diff --git a/system/nvidia-legacy340-kernel/nvidia-legacy340-kernel.SlackBuild b/system/nvidia-legacy340-kernel/nvidia-legacy340-kernel.SlackBuild index 7d33eb34d1..d2e1baf320 100644 --- a/system/nvidia-legacy340-kernel/nvidia-legacy340-kernel.SlackBuild +++ b/system/nvidia-legacy340-kernel/nvidia-legacy340-kernel.SlackBuild @@ -31,7 +31,7 @@ cd $(dirname $0) ; CWD=$(pwd) PRGNAM=nvidia-legacy340-kernel VERSION=${VERSION:-340.108} -BUILD=${BUILD:-1} +BUILD=${BUILD:-2} TAG=${TAG:-_SBo} PKGTYPE=${PKGTYPE:-tgz} diff --git a/system/nvidia-legacy340-kernel/patches/0010-kernel-5.18.patch b/system/nvidia-legacy340-kernel/patches/0010-kernel-5.18.patch new file mode 100644 index 0000000000..a2d19b0fed --- /dev/null +++ b/system/nvidia-legacy340-kernel/patches/0010-kernel-5.18.patch @@ -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"); |