2020-09-09 15:44:15 +02:00
|
|
|
This patch file contains the changes needed to compile the VirtualBox
|
|
|
|
modules for kernel 5.9.0+.
|
|
|
|
|
|
|
|
The changes are as follows:
|
|
|
|
1. The kernel headers no longer define HAVE_UNLOCKED_IOCTL; however,
|
|
|
|
this symbol is needed for compilation of VB.
|
|
|
|
2. The calling sequence for get_user_pages_remote() is changed.
|
|
|
|
3. Routine sched_setscheduler() is replaced by sched_set_fifo_low().
|
|
|
|
4. The type of vbox_master_set() is changed from int to void.
|
|
|
|
5. Routine drm_gem_object_put_unlocked() is replaced by drm_gem_object_put().
|
|
|
|
6. Member offset is removed from struct ttm_buffer_object.
|
|
|
|
|
|
|
|
Index: VirtualBox-6.1.14/src/VBox/Runtime/r0drv/linux/the-linux-kernel.h
|
2020-08-20 23:50:14 +02:00
|
|
|
===================================================================
|
2020-09-09 15:44:15 +02:00
|
|
|
--- VirtualBox-6.1.14.orig/src/VBox/Runtime/r0drv/linux/the-linux-kernel.h
|
|
|
|
+++ VirtualBox-6.1.14/src/VBox/Runtime/r0drv/linux/the-linux-kernel.h
|
2020-08-20 23:50:14 +02:00
|
|
|
@@ -137,7 +137,10 @@
|
|
|
|
#include <linux/interrupt.h>
|
|
|
|
#include <linux/completion.h>
|
|
|
|
#include <linux/compiler.h>
|
|
|
|
-#ifndef HAVE_UNLOCKED_IOCTL /* linux/fs.h defines this */
|
2020-09-09 15:44:15 +02:00
|
|
|
+#if RTLNX_VER_MIN(5, 9, 0)
|
2020-08-20 23:50:14 +02:00
|
|
|
+#define HAVE_UNLOCKED_IOCTL 1 /* defined in linux/fs.h for kernels before 5.9 */
|
|
|
|
+#endif
|
|
|
|
+#ifndef HAVE_UNLOCKED_IOCTL
|
|
|
|
# include <linux/smp_lock.h>
|
|
|
|
#endif
|
|
|
|
/* For the shared folders module */
|
2020-09-09 15:44:15 +02:00
|
|
|
Index: VirtualBox-6.1.14/src/VBox/Runtime/r0drv/linux/memobj-r0drv-linux.c
|
2020-08-20 23:50:14 +02:00
|
|
|
===================================================================
|
2020-09-09 15:44:15 +02:00
|
|
|
--- VirtualBox-6.1.14.orig/src/VBox/Runtime/r0drv/linux/memobj-r0drv-linux.c
|
|
|
|
+++ VirtualBox-6.1.14/src/VBox/Runtime/r0drv/linux/memobj-r0drv-linux.c
|
|
|
|
@@ -1181,7 +1181,9 @@ DECLHIDDEN(int) rtR0MemObjNativeLockUser
|
2020-08-20 23:50:14 +02:00
|
|
|
*/
|
|
|
|
else
|
|
|
|
rc = get_user_pages_remote(
|
2020-09-09 15:44:15 +02:00
|
|
|
+#if RTLNX_VER_MAX(5, 9, 0)
|
2020-08-20 23:50:14 +02:00
|
|
|
pTask, /* Task for fault accounting. */
|
|
|
|
+#endif
|
2020-09-09 15:44:15 +02:00
|
|
|
pTask->mm, /* Whose pages. */
|
2020-08-20 23:50:14 +02:00
|
|
|
R3Ptr, /* Where from. */
|
|
|
|
cPages, /* How many pages. */
|
2020-09-09 15:44:15 +02:00
|
|
|
Index: VirtualBox-6.1.14/src/VBox/Runtime/r0drv/linux/thread2-r0drv-linux.c
|
2020-08-20 23:50:14 +02:00
|
|
|
===================================================================
|
2020-09-09 15:44:15 +02:00
|
|
|
--- VirtualBox-6.1.14.orig/src/VBox/Runtime/r0drv/linux/thread2-r0drv-linux.c
|
|
|
|
+++ VirtualBox-6.1.14/src/VBox/Runtime/r0drv/linux/thread2-r0drv-linux.c
|
2020-08-20 23:50:14 +02:00
|
|
|
@@ -92,8 +92,12 @@ DECLHIDDEN(int) rtThreadNativeSetPriorit
|
|
|
|
return VERR_INVALID_PARAMETER;
|
|
|
|
}
|
|
|
|
|
2020-09-09 15:44:15 +02:00
|
|
|
+#if RTLNX_VER_MAX(5, 9, 0)
|
2020-08-20 23:50:14 +02:00
|
|
|
sched_setscheduler(current, iSchedClass, &Param);
|
|
|
|
#else
|
|
|
|
+ sched_set_fifo_low(current);
|
|
|
|
+#endif
|
|
|
|
+#else
|
|
|
|
RT_NOREF_PV(enmType);
|
|
|
|
#endif
|
|
|
|
RT_NOREF_PV(pThread);
|
2020-09-09 15:44:15 +02:00
|
|
|
Index: VirtualBox-6.1.14/src/VBox/Additions/linux/drm/vbox_drv.c
|
2020-08-20 23:50:14 +02:00
|
|
|
===================================================================
|
2020-09-09 15:44:15 +02:00
|
|
|
--- VirtualBox-6.1.14.orig/src/VBox/Additions/linux/drm/vbox_drv.c
|
|
|
|
+++ VirtualBox-6.1.14/src/VBox/Additions/linux/drm/vbox_drv.c
|
|
|
|
@@ -262,8 +262,13 @@ static const struct file_operations vbox
|
2020-08-20 23:50:14 +02:00
|
|
|
.read = drm_read,
|
|
|
|
};
|
|
|
|
|
2020-09-09 15:44:15 +02:00
|
|
|
+#if RTLNX_VER_MAX(5, 9, 0)
|
2020-08-20 23:50:14 +02:00
|
|
|
static int vbox_master_set(struct drm_device *dev,
|
|
|
|
struct drm_file *file_priv, bool from_open)
|
|
|
|
+#else
|
|
|
|
+static void vbox_master_set(struct drm_device *dev,
|
|
|
|
+ struct drm_file *file_priv, bool from_open)
|
|
|
|
+#endif
|
|
|
|
{
|
|
|
|
struct vbox_private *vbox = dev->dev_private;
|
|
|
|
|
2020-09-09 15:44:15 +02:00
|
|
|
Index: VirtualBox-6.1.14/src/VBox/Additions/linux/drm/vbox_fb.c
|
2020-08-20 23:50:14 +02:00
|
|
|
===================================================================
|
2020-09-09 15:44:15 +02:00
|
|
|
--- VirtualBox-6.1.14.orig/src/VBox/Additions/linux/drm/vbox_fb.c
|
|
|
|
+++ VirtualBox-6.1.14/src/VBox/Additions/linux/drm/vbox_fb.c
|
2020-08-20 23:50:14 +02:00
|
|
|
@@ -405,7 +405,11 @@ void vbox_fbdev_fini(struct drm_device *
|
|
|
|
vbox_bo_unpin(bo);
|
|
|
|
vbox_bo_unreserve(bo);
|
|
|
|
}
|
2020-09-09 15:44:15 +02:00
|
|
|
+#if RTLNX_VER_MIN(5, 9, 0)
|
2020-08-20 23:50:14 +02:00
|
|
|
+ drm_gem_object_put(afb->obj);
|
|
|
|
+#else
|
|
|
|
drm_gem_object_put_unlocked(afb->obj);
|
|
|
|
+#endif
|
|
|
|
afb->obj = NULL;
|
|
|
|
}
|
|
|
|
drm_fb_helper_fini(&fbdev->helper);
|
2020-09-09 15:44:15 +02:00
|
|
|
Index: VirtualBox-6.1.14/src/VBox/Additions/linux/drm/vbox_main.c
|
2020-08-20 23:50:14 +02:00
|
|
|
===================================================================
|
2020-09-09 15:44:15 +02:00
|
|
|
--- VirtualBox-6.1.14.orig/src/VBox/Additions/linux/drm/vbox_main.c
|
|
|
|
+++ VirtualBox-6.1.14/src/VBox/Additions/linux/drm/vbox_main.c
|
2020-08-20 23:50:14 +02:00
|
|
|
@@ -40,14 +40,19 @@
|
|
|
|
#include <VBoxVideoVBE.h>
|
|
|
|
|
|
|
|
#include "hgsmi_channels.h"
|
|
|
|
+#include <linux/version.h>
|
|
|
|
+
|
|
|
|
|
|
|
|
static void vbox_user_framebuffer_destroy(struct drm_framebuffer *fb)
|
|
|
|
{
|
|
|
|
struct vbox_framebuffer *vbox_fb = to_vbox_framebuffer(fb);
|
|
|
|
|
|
|
|
if (vbox_fb->obj)
|
2020-09-09 15:44:15 +02:00
|
|
|
+#if RTLNX_VER_MAX(5, 9, 0)
|
2020-08-20 23:50:14 +02:00
|
|
|
drm_gem_object_put_unlocked(vbox_fb->obj);
|
|
|
|
-
|
|
|
|
+#else
|
|
|
|
+ drm_gem_object_put(vbox_fb->obj);
|
|
|
|
+#endif
|
|
|
|
drm_framebuffer_cleanup(fb);
|
|
|
|
kfree(fb);
|
|
|
|
}
|
|
|
|
@@ -221,7 +226,11 @@ static struct drm_framebuffer *vbox_user
|
|
|
|
err_free_vbox_fb:
|
|
|
|
kfree(vbox_fb);
|
|
|
|
err_unref_obj:
|
2020-09-09 15:44:15 +02:00
|
|
|
+#if RTLNX_VER_MAX(5, 9, 0)
|
2020-08-20 23:50:14 +02:00
|
|
|
drm_gem_object_put_unlocked(obj);
|
|
|
|
+#else
|
|
|
|
+ drm_gem_object_put(obj);
|
|
|
|
+#endif
|
|
|
|
return ERR_PTR(ret);
|
|
|
|
}
|
|
|
|
|
|
|
|
@@ -588,7 +597,11 @@ int vbox_dumb_create(struct drm_file *fi
|
|
|
|
return ret;
|
|
|
|
|
|
|
|
ret = drm_gem_handle_create(file, gobj, &handle);
|
2020-09-09 15:44:15 +02:00
|
|
|
+#if RTLNX_VER_MAX(5, 9, 0)
|
2020-08-20 23:50:14 +02:00
|
|
|
drm_gem_object_put_unlocked(gobj);
|
|
|
|
+#else
|
|
|
|
+ drm_gem_object_put(gobj);
|
|
|
|
+#endif
|
|
|
|
if (ret)
|
|
|
|
return ret;
|
|
|
|
|
2020-09-09 15:44:15 +02:00
|
|
|
Index: VirtualBox-6.1.14/src/VBox/Additions/linux/drm/vbox_drv.h
|
2020-08-20 23:50:14 +02:00
|
|
|
===================================================================
|
2020-09-09 15:44:15 +02:00
|
|
|
--- VirtualBox-6.1.14.orig/src/VBox/Additions/linux/drm/vbox_drv.h
|
|
|
|
+++ VirtualBox-6.1.14/src/VBox/Additions/linux/drm/vbox_drv.h
|
|
|
|
@@ -417,6 +417,9 @@ struct vbox_bo {
|
2020-08-20 23:50:14 +02:00
|
|
|
#else
|
|
|
|
struct ttm_place placements[3];
|
|
|
|
#endif
|
2020-09-09 15:44:15 +02:00
|
|
|
+#if RTLNX_VER_MIN(5, 9, 0)
|
2020-08-20 23:50:14 +02:00
|
|
|
+ uint64_t offset;
|
|
|
|
+#endif
|
|
|
|
int pin_count;
|
|
|
|
};
|
|
|
|
|
2020-09-09 15:44:15 +02:00
|
|
|
Index: VirtualBox-6.1.14/src/VBox/Additions/linux/drm/vbox_mode.c
|
2020-08-20 23:50:14 +02:00
|
|
|
===================================================================
|
2020-09-09 15:44:15 +02:00
|
|
|
--- VirtualBox-6.1.14.orig/src/VBox/Additions/linux/drm/vbox_mode.c
|
|
|
|
+++ VirtualBox-6.1.14/src/VBox/Additions/linux/drm/vbox_mode.c
|
|
|
|
@@ -885,8 +885,11 @@ out_unmap_bo:
|
2020-08-20 23:50:14 +02:00
|
|
|
out_unreserve_bo:
|
|
|
|
vbox_bo_unreserve(bo);
|
|
|
|
out_unref_obj:
|
2020-09-09 15:44:15 +02:00
|
|
|
+#if RTLNX_VER_MAX(5, 9, 0)
|
2020-08-20 23:50:14 +02:00
|
|
|
drm_gem_object_put_unlocked(obj);
|
|
|
|
-
|
|
|
|
+#else
|
|
|
|
+ drm_gem_object_put(obj);
|
|
|
|
+#endif
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2020-09-09 15:44:15 +02:00
|
|
|
Index: VirtualBox-6.1.14/src/VBox/Additions/linux/drm/vbox_ttm.c
|
2020-08-20 23:50:14 +02:00
|
|
|
===================================================================
|
2020-09-09 15:44:15 +02:00
|
|
|
--- VirtualBox-6.1.14.orig/src/VBox/Additions/linux/drm/vbox_ttm.c
|
|
|
|
+++ VirtualBox-6.1.14/src/VBox/Additions/linux/drm/vbox_ttm.c
|
|
|
|
@@ -445,7 +445,11 @@ err_free_vboxbo:
|
2020-08-20 23:50:14 +02:00
|
|
|
|
|
|
|
static inline u64 vbox_bo_gpu_offset(struct vbox_bo *bo)
|
|
|
|
{
|
2020-09-09 15:44:15 +02:00
|
|
|
+#if RTLNX_VER_MAX(5, 9, 0)
|
2020-08-20 23:50:14 +02:00
|
|
|
return bo->bo.offset;
|
|
|
|
+#else
|
|
|
|
+ return bo->offset;
|
|
|
|
+#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
int vbox_bo_pin(struct vbox_bo *bo, u32 pl_flag, u64 *gpu_addr)
|