| 1 | Index: virtualbox/vboxdrv/r0drv/linux/memobj-r0drv-linux.c
|
|---|
| 2 | ===================================================================
|
|---|
| 3 | --- virtualbox.orig/vboxdrv/r0drv/linux/memobj-r0drv-linux.c
|
|---|
| 4 | +++ virtualbox/vboxdrv/r0drv/linux/memobj-r0drv-linux.c
|
|---|
| 5 | @@ -1064,7 +1064,12 @@ DECLHIDDEN(int) rtR0MemObjNativeLockUser
|
|---|
| 6 | cPages, /* How many pages. */
|
|---|
| 7 | fWrite, /* Write to memory. */
|
|---|
| 8 | &pMemLnx->apPages[0], /* Page array. */
|
|---|
| 9 | +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 10, 0)
|
|---|
| 10 | + papVMAs, /* vmas */
|
|---|
| 11 | + NULL);
|
|---|
| 12 | +#else
|
|---|
| 13 | papVMAs); /* vmas */
|
|---|
| 14 | +#endif
|
|---|
| 15 | #elif LINUX_VERSION_CODE >= KERNEL_VERSION(4, 6, 0)
|
|---|
| 16 | if (R0Process == RTR0ProcHandleSelf())
|
|---|
| 17 | rc = get_user_pages(R3Ptr, /* Where from. */
|
|---|
| 18 | @@ -1086,7 +1091,12 @@ DECLHIDDEN(int) rtR0MemObjNativeLockUser
|
|---|
| 19 | fWrite, /* Write to memory. */
|
|---|
| 20 | fWrite, /* force write access. */
|
|---|
| 21 | &pMemLnx->apPages[0], /* Page array. */
|
|---|
| 22 | +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 10, 0)
|
|---|
| 23 | + papVMAs, /* vmas */
|
|---|
| 24 | + NULL);
|
|---|
| 25 | +#else
|
|---|
| 26 | papVMAs); /* vmas */
|
|---|
| 27 | +#endif
|
|---|
| 28 | #else /* LINUX_VERSION_CODE < KERNEL_VERSION(4, 6, 0) */
|
|---|
| 29 | rc = get_user_pages(pTask, /* Task for fault accounting. */
|
|---|
| 30 | pTask->mm, /* Whose pages. */
|
|---|
| 31 | Index: virtualbox/vboxdrv/r0drv/linux/mpnotification-r0drv-linux.c
|
|---|
| 32 | ===================================================================
|
|---|
| 33 | --- virtualbox.orig/vboxdrv/r0drv/linux/mpnotification-r0drv-linux.c
|
|---|
| 34 | +++ virtualbox/vboxdrv/r0drv/linux/mpnotification-r0drv-linux.c
|
|---|
| 35 | @@ -39,8 +39,41 @@
|
|---|
| 36 |
|
|---|
| 37 |
|
|---|
| 38 | #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 5, 71) && defined(CONFIG_SMP)
|
|---|
| 39 | +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 10, 0)
|
|---|
| 40 | +/* This hack allows VB to build under kernel 4.10 and later, but it
|
|---|
| 41 | + * should be replaced with a version that uses the hotplug state machine
|
|---|
| 42 | + */
|
|---|
| 43 |
|
|---|
| 44 | +static DEFINE_MUTEX(cpu_add_remove_lock);
|
|---|
| 45 | +static RAW_NOTIFIER_HEAD(cpu_chain);
|
|---|
| 46 | +static void vb_cpu_maps_update_begin(void)
|
|---|
| 47 | +{
|
|---|
| 48 | + mutex_lock(&cpu_add_remove_lock);
|
|---|
| 49 | +}
|
|---|
| 50 |
|
|---|
| 51 | +static void vb_cpu_maps_update_done(void)
|
|---|
| 52 | +{
|
|---|
| 53 | + mutex_unlock(&cpu_add_remove_lock);
|
|---|
| 54 | +}
|
|---|
| 55 | +
|
|---|
| 56 | +/* Need to know about CPUs going up/down? */
|
|---|
| 57 | +int register_cpu_notifier(struct notifier_block *nb)
|
|---|
| 58 | +{
|
|---|
| 59 | + int ret;
|
|---|
| 60 | + vb_cpu_maps_update_begin();
|
|---|
| 61 | + ret = raw_notifier_chain_register(&cpu_chain, nb);
|
|---|
| 62 | + vb_cpu_maps_update_done();
|
|---|
| 63 | + return ret;
|
|---|
| 64 | +}
|
|---|
| 65 | +
|
|---|
| 66 | +/* Need to know about CPUs going up/down? */
|
|---|
| 67 | +void unregister_cpu_notifier(struct notifier_block *nb)
|
|---|
| 68 | +{
|
|---|
| 69 | + vb_cpu_maps_update_begin();
|
|---|
| 70 | + raw_notifier_chain_unregister(&cpu_chain, nb);
|
|---|
| 71 | + vb_cpu_maps_update_done();
|
|---|
| 72 | +}
|
|---|
| 73 | +#endif
|
|---|
| 74 | /*********************************************************************************************************************************
|
|---|
| 75 | * Internal Functions *
|
|---|
| 76 | *********************************************************************************************************************************/
|
|---|