summarylogtreecommitdiffstats
path: root/kernel-5.9.patch
blob: 5ee5db8bc03267549ffaac320548fce88fbfcd6c (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
152
153
154
155
156
From 83046d3e6e55de2069bada70894c633c090f7ddc Mon Sep 17 00:00:00 2001
From: Gabriel Craciunescu <nix.or.die@gmail.com>
Date: Wed, 14 Oct 2020 15:39:07 +0200
Subject: [PATCH] Adjust to kernel 5.9

---
 module/evdi_cursor.c  |  4 ++++
 module/evdi_drv.c     | 21 +++++++++++++++++++--
 module/evdi_fb.c      | 13 ++++++++++++-
 module/evdi_gem.c     |  5 ++++-
 module/evdi_modeset.c |  5 ++++-
 5 files changed, 43 insertions(+), 5 deletions(-)

diff --git a/module/evdi_cursor.c b/module/evdi_cursor.c
index 10cbf29..cb4282a 100644
--- a/module/evdi_cursor.c
+++ b/module/evdi_cursor.c
@@ -55,7 +55,11 @@ static void evdi_cursor_set_gem(struct evdi_cursor *cursor,
 	if (obj)
 		drm_gem_object_get(&obj->base);
 	if (cursor->obj)
+#if KERNEL_VERSION(5, 9, 0) <= LINUX_VERSION_CODE
+		drm_gem_object_put(&cursor->obj->base);
+#else
 		drm_gem_object_put_unlocked(&cursor->obj->base);
+#endif
 
 	cursor->obj = obj;
 }
diff --git a/module/evdi_drv.c b/module/evdi_drv.c
index 7740ccc..f9d8a45 100644
--- a/module/evdi_drv.c
+++ b/module/evdi_drv.c
@@ -16,6 +16,9 @@
 #include <drm/drm_crtc_helper.h>
 #include <linux/module.h>
 #include <linux/platform_device.h>
+#if KERNEL_VERSION(5, 9, 0) <= LINUX_VERSION_CODE
+#include <linux/iommu.h>
+#endif
 
 #include "evdi_drv.h"
 #include "evdi_drm.h"
@@ -91,7 +94,11 @@ static struct drm_driver driver = {
 	.postclose = evdi_driver_postclose,
 
 	/* gem hooks */
+#if KERNEL_VERSION(5, 9, 0) <= LINUX_VERSION_CODE
+	.gem_free_object_unlocked = evdi_gem_free_object,
+#else
 	.gem_free_object = evdi_gem_free_object,
+#endif
 	.gem_vm_ops = &evdi_gem_vm_ops,
 
 	.dumb_create = evdi_dumb_create,
@@ -166,13 +173,23 @@ static int evdi_platform_probe(struct platform_device *pdev)
 {
 	struct drm_device *dev;
 	int ret;
-
+#if KERNEL_VERSION(5, 9, 0) <= LINUX_VERSION_CODE
+#if IS_ENABLED(CONFIG_IOMMU_API) && defined(CONFIG_INTEL_IOMMU)
+	struct dev_iommu iommu;
+#endif
+#endif
 	EVDI_CHECKPT();
 
-	/* Intel-IOMMU workaround: platform-bus unsupported, force ID-mapping */
+/* Intel-IOMMU workaround: platform-bus unsupported, force ID-mapping */
 #if IS_ENABLED(CONFIG_IOMMU_API) && defined(CONFIG_INTEL_IOMMU)
+#if KERNEL_VERSION(5, 9, 0) <= LINUX_VERSION_CODE
+	memset(&iommu, 0, sizeof(iommu));
+	iommu.priv = (void *)-1;
+	pdev->dev.iommu = &iommu;
+#else
 #define INTEL_IOMMU_DUMMY_DOMAIN                ((void *)-1)
 	pdev->dev.archdata.iommu = INTEL_IOMMU_DUMMY_DOMAIN;
+#endif
 #endif
 
 	dev = drm_dev_alloc(&driver, &pdev->dev);
diff --git a/module/evdi_fb.c b/module/evdi_fb.c
index 10d1990..3639bf8 100644
--- a/module/evdi_fb.c
+++ b/module/evdi_fb.c
@@ -319,8 +319,11 @@ static void evdi_user_framebuffer_destroy(struct drm_framebuffer *fb)
 
 	EVDI_CHECKPT();
 	if (efb->obj)
+#if KERNEL_VERSION(5, 9, 0) <= LINUX_VERSION_CODE
+		drm_gem_object_put(&efb->obj->base);
+#else
 		drm_gem_object_put_unlocked(&efb->obj->base);
-
+#endif
 	drm_framebuffer_cleanup(fb);
 	kfree(efb);
 }
@@ -438,7 +441,11 @@ static int evdifb_create(struct drm_fb_helper *helper,
 
 	return ret;
  out_gfree:
+#if KERNEL_VERSION(5, 9, 0) <= LINUX_VERSION_CODE
+	drm_gem_object_put(&efbdev->efb.obj->base);
+#else
 	drm_gem_object_put_unlocked(&efbdev->efb.obj->base);
+#endif
  out:
 	return ret;
 }
@@ -464,7 +471,11 @@ static void evdi_fbdev_destroy(__always_unused struct drm_device *dev,
 	if (efbdev->efb.obj) {
 		drm_framebuffer_unregister_private(&efbdev->efb.base);
 		drm_framebuffer_cleanup(&efbdev->efb.base);
+#if KERNEL_VERSION(5, 9, 0) <= LINUX_VERSION_CODE
+		drm_gem_object_put(&efbdev->efb.obj->base);
+#else
 		drm_gem_object_put_unlocked(&efbdev->efb.obj->base);
+#endif
 	}
 }
 
diff --git a/module/evdi_gem.c b/module/evdi_gem.c
index 9bb54d7..cc411b9 100644
--- a/module/evdi_gem.c
+++ b/module/evdi_gem.c
@@ -81,8 +81,11 @@ evdi_gem_create(struct drm_file *file,
 		kfree(obj);
 		return ret;
 	}
-
+#if KERNEL_VERSION(5, 9, 0) <= LINUX_VERSION_CODE
+	drm_gem_object_put(&obj->base);
+#else
 	drm_gem_object_put_unlocked(&obj->base);
+#endif
 	*handle_p = handle;
 	return 0;
 }
diff --git a/module/evdi_modeset.c b/module/evdi_modeset.c
index fb9bfac..c0f904c 100644
--- a/module/evdi_modeset.c
+++ b/module/evdi_modeset.c
@@ -129,8 +129,11 @@ static int evdi_crtc_cursor_set(struct drm_crtc *crtc,
 	evdi_cursor_set(evdi->cursor,
 			eobj, width, height, hot_x, hot_y,
 			format, stride);
-
+#if KERNEL_VERSION(5, 9, 0) <= LINUX_VERSION_CODE
+	drm_gem_object_put(obj);
+#else
 	drm_gem_object_put_unlocked(obj);
+#endif
 
 	/*
 	 * For now we don't care whether the application wanted the mouse set,