forked from jengelh/virtualbox
68 lines
3.0 KiB
Diff
68 lines
3.0 KiB
Diff
|
Index: VirtualBox-5.1.12/src/VBox/Runtime/r0drv/linux/memobj-r0drv-linux.c
|
||
|
===================================================================
|
||
|
--- VirtualBox-5.1.12.orig/src/VBox/Runtime/r0drv/linux/memobj-r0drv-linux.c
|
||
|
+++ VirtualBox-5.1.12/src/VBox/Runtime/r0drv/linux/memobj-r0drv-linux.c
|
||
|
@@ -1078,7 +1078,12 @@ DECLHIDDEN(int) rtR0MemObjNativeLockUser
|
||
|
fWrite, /* force write access. */
|
||
|
# endif
|
||
|
&pMemLnx->apPages[0], /* Page array. */
|
||
|
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 10, 0)
|
||
|
+ papVMAs, /* vmas */
|
||
|
+ NULL);
|
||
|
+#else
|
||
|
papVMAs); /* vmas */
|
||
|
+#endif
|
||
|
#else /* LINUX_VERSION_CODE < KERNEL_VERSION(4, 6, 0) */
|
||
|
rc = get_user_pages(pTask, /* Task for fault accounting. */
|
||
|
pTask->mm, /* Whose pages. */
|
||
|
@@ -1093,7 +1098,12 @@ DECLHIDDEN(int) rtR0MemObjNativeLockUser
|
||
|
fWrite, /* force write access. */
|
||
|
# endif
|
||
|
&pMemLnx->apPages[0], /* Page array. */
|
||
|
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 10, 0)
|
||
|
+ papVMAs, /* vmas */
|
||
|
+ NULL);
|
||
|
+#else
|
||
|
papVMAs); /* vmas */
|
||
|
+#endif
|
||
|
#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(4, 6, 0) */
|
||
|
if (rc == cPages)
|
||
|
{
|
||
|
Index: VirtualBox-5.1.12/src/VBox/Runtime/r0drv/linux/mpnotification-r0drv-linux.c
|
||
|
===================================================================
|
||
|
--- VirtualBox-5.1.12.orig/src/VBox/Runtime/r0drv/linux/mpnotification-r0drv-linux.c
|
||
|
+++ VirtualBox-5.1.12/src/VBox/Runtime/r0drv/linux/mpnotification-r0drv-linux.c
|
||
|
@@ -39,8 +39,32 @@
|
||
|
|
||
|
|
||
|
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 5, 71) && defined(CONFIG_SMP)
|
||
|
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 10, 0)
|
||
|
+/* This hack allows VB to build under kernel 4.10 and later, but it
|
||
|
+ * should be replaced with a version that uses the hotplug state machine
|
||
|
+ */
|
||
|
|
||
|
+static DEFINE_MUTEX(cpu_add_remove_lock);
|
||
|
+static RAW_NOTIFIER_HEAD(cpu_chain);
|
||
|
|
||
|
+/* Need to know about CPUs going up/down? */
|
||
|
+static int register_cpu_notifier(struct notifier_block *nb)
|
||
|
+{
|
||
|
+ int ret;
|
||
|
+ mutex_lock(&cpu_add_remove_lock);
|
||
|
+ ret = raw_notifier_chain_register(&cpu_chain, nb);
|
||
|
+ mutex_unlock(&cpu_add_remove_lock);
|
||
|
+ return ret;
|
||
|
+}
|
||
|
+
|
||
|
+/* Need to know about CPUs going up/down? */
|
||
|
+static void unregister_cpu_notifier(struct notifier_block *nb)
|
||
|
+{
|
||
|
+ mutex_lock(&cpu_add_remove_lock);
|
||
|
+ raw_notifier_chain_unregister(&cpu_chain, nb);
|
||
|
+ mutex_unlock(&cpu_add_remove_lock);
|
||
|
+}
|
||
|
+#endif
|
||
|
/*********************************************************************************************************************************
|
||
|
* Internal Functions *
|
||
|
*********************************************************************************************************************************/
|