summarylogtreecommitdiffstats
path: root/0010-kernel-5.18.patch
blob: 93bcefa684e2066abfb8a1b6d8ac92ec6ed7393b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
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");