mirror of
https://github.com/archlinux-jerry/nvidia-340xx
synced 2024-12-22 14:09:24 +08:00
151 lines
4.7 KiB
Diff
151 lines
4.7 KiB
Diff
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");
|