diff --git a/hardware/virtualization/virtualbox/files/linux-5.6.patch b/hardware/virtualization/virtualbox/files/linux-5.6.patch new file mode 100644 index 0000000000..f4ff7c537a --- /dev/null +++ b/hardware/virtualization/virtualbox/files/linux-5.6.patch @@ -0,0 +1,229 @@ +Index: a/include/iprt/time.h +=================================================================== +--- a/include/iprt/time.h (revision 82968) ++++ a/include/iprt/time.h (revision 83471) +@@ -359,6 +359,12 @@ + /* PORTME: Add struct timeval guard macro here. */ + #if defined(RTTIME_INCL_TIMEVAL) || defined(_STRUCT_TIMEVAL) || defined(_SYS__TIMEVAL_H_) || defined(_SYS_TIME_H) || defined(_TIMEVAL) || defined(_LINUX_TIME_H) \ + || (defined(RT_OS_NETBSD) && defined(_SYS_TIME_H_)) ++/* ++ * Starting with Linux kernel version 5.6-rc3, the struct timeval is no longer ++ * available to kernel code and must not be used in kernel code. ++ * Only 64-bit time-interfaces are allowed into the kernel. ++ */ ++# if defined(RT_OS_LINUX) && (!defined(__KERNEL__) || !defined(_LINUX_TIME64_H)) + /** + * Gets the time as POSIX timeval. + * +@@ -392,6 +398,7 @@ + { + return RTTimeSpecAddMicro(RTTimeSpecSetSeconds(pTime, pTimeval->tv_sec), pTimeval->tv_usec); + } ++# endif /* RT_OS_LINUX ... */ + #endif /* various ways of detecting struct timeval */ + + +@@ -431,15 +438,19 @@ + { + return RTTimeSpecAddNano(RTTimeSpecSetSeconds(pTime, pTimespec->tv_sec), pTimespec->tv_nsec); + } +- +- +-# ifdef _LINUX_TIME64_H ++#endif /* various ways of detecting struct timespec */ ++ ++#if defined(RT_OS_LINUX) && defined(_LINUX_TIME64_H) ++/* ++ * Starting with Linux kernel version 5.6-rc3, the _STRUCT_TIMESPEC is only defined ++ * under !__KERNEL__ guard and _LINUX_TIME64_H does not define a corresponding ++ * _STRUCT_TIMESPEC64. Only 64-bit time-interfaces are now allowed into the kernel. ++ */ + DECLINLINE(PRTTIMESPEC) RTTimeSpecSetTimespec64(PRTTIMESPEC pTime, const struct timespec64 *pTimeval) + { + return RTTimeSpecAddNano(RTTimeSpecSetSeconds(pTime, pTimeval->tv_sec), pTimeval->tv_nsec); + } +-# endif +-#endif /* various ways of detecting struct timespec */ ++#endif /* RT_OS_LINUX && _LINUX_TIME64_H */ + + + +Index: a/src/VBox/Runtime/r0drv/linux/memobj-r0drv-linux.c +=================================================================== +--- a/src/VBox/Runtime/r0drv/linux/memobj-r0drv-linux.c (revision 82968) ++++ a/src/VBox/Runtime/r0drv/linux/memobj-r0drv-linux.c (revision 83471) +@@ -1461,9 +1461,19 @@ + * MMIO / physical memory. + */ + Assert(pMemLnxToMap->Core.enmType == RTR0MEMOBJTYPE_PHYS && !pMemLnxToMap->Core.u.Phys.fAllocated); ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 25) ++ /* ++ * ioremap() defaults to no caching since the 2.6 kernels. ++ * ioremap_nocache() has been removed finally in 5.6-rc1. ++ */ ++ pMemLnx->Core.pv = pMemLnxToMap->Core.u.Phys.uCachePolicy == RTMEM_CACHE_POLICY_MMIO ++ ? ioremap(pMemLnxToMap->Core.u.Phys.PhysBase + offSub, cbSub) ++ : ioremap_cache(pMemLnxToMap->Core.u.Phys.PhysBase + offSub, cbSub); ++#else /* KERNEL_VERSION < 2.6.25 */ + pMemLnx->Core.pv = pMemLnxToMap->Core.u.Phys.uCachePolicy == RTMEM_CACHE_POLICY_MMIO + ? ioremap_nocache(pMemLnxToMap->Core.u.Phys.PhysBase + offSub, cbSub) + : ioremap(pMemLnxToMap->Core.u.Phys.PhysBase + offSub, cbSub); ++#endif /* KERNEL_VERSION < 2.6.25 */ + if (pMemLnx->Core.pv) + { + /** @todo fix protection. */ +Index: a/src/VBox/Runtime/r0drv/linux/time-r0drv-linux.c +=================================================================== +--- a/src/VBox/Runtime/r0drv/linux/time-r0drv-linux.c (revision 82968) ++++ a/src/VBox/Runtime/r0drv/linux/time-r0drv-linux.c (revision 83471) +@@ -38,12 +38,24 @@ + + DECLINLINE(uint64_t) rtTimeGetSystemNanoTS(void) + { +-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 16) /* This must match timer-r0drv-linux.c! */ ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 6, 0) ++ /* ++ * Starting with kernel version 5.6-rc3 only 64-bit time interfaces ++ * are allowed in the kernel. ++ */ ++ uint64_t u64; ++ struct timespec64 Ts = { 0, 0 }; ++ ++ ktime_get_ts64(&Ts); ++ u64 = Ts.tv_sec * RT_NS_1SEC_64 + Ts.tv_nsec; ++ return u64; ++ ++#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 16) /* This must match timer-r0drv-linux.c! */ + /* + * Use ktime_get_ts, this is also what clock_gettime(CLOCK_MONOTONIC,) is using. + */ + uint64_t u64; +- struct timespec Ts; ++ struct timespec Ts = { 0, 0 }; + ktime_get_ts(&Ts); + u64 = Ts.tv_sec * RT_NS_1SEC_64 + Ts.tv_nsec; + return u64; +Index: a/src/VBox/HostDrivers/VBoxPci/linux/VBoxPci-linux.c +=================================================================== +--- a/src/VBox/HostDrivers/VBoxPci/linux/VBoxPci-linux.c (revision 82968) ++++ a/src/VBox/HostDrivers/VBoxPci/linux/VBoxPci-linux.c (revision 83471) +@@ -842,15 +842,27 @@ + rcLnx = pci_request_region(pPciDev, iRegion, "vboxpci"); + if (!rcLnx) + { ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 25) ++ /* ++ * ioremap() defaults to no caching since the 2.6 kernels. ++ * ioremap_nocache() has been removed finally in 5.6-rc1. ++ */ ++ RTR0PTR R0PtrMapping = ioremap(pci_resource_start(pPciDev, iRegion), ++ pci_resource_len(pPciDev, iRegion)); ++#else /* KERNEL_VERSION < 2.6.25 */ + /* For now no caching, try to optimize later. */ + RTR0PTR R0PtrMapping = ioremap_nocache(pci_resource_start(pPciDev, iRegion), + pci_resource_len(pPciDev, iRegion)); +- ++#endif /* KERNEL_VERSION < 2.6.25 */ + if (R0PtrMapping != NIL_RTR0PTR) + pIns->aRegionR0Mapping[iRegion] = R0PtrMapping; + else + { ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 25) ++ vbpci_printk(KERN_DEBUG, pPciDev, "ioremap() failed\n"); ++#else + vbpci_printk(KERN_DEBUG, pPciDev, "ioremap_nocache() failed\n"); ++#endif + pci_release_region(pPciDev, iRegion); + rc = VERR_MAP_FAILED; + } +Index: a/include/iprt/time.h +=================================================================== +--- a/include/iprt/time.h (revision 83471) ++++ a/include/iprt/time.h (revision 83473) +@@ -357,14 +357,18 @@ + + + /* PORTME: Add struct timeval guard macro here. */ +-#if defined(RTTIME_INCL_TIMEVAL) || defined(_STRUCT_TIMEVAL) || defined(_SYS__TIMEVAL_H_) || defined(_SYS_TIME_H) || defined(_TIMEVAL) || defined(_LINUX_TIME_H) \ +- || (defined(RT_OS_NETBSD) && defined(_SYS_TIME_H_)) + /* + * Starting with Linux kernel version 5.6-rc3, the struct timeval is no longer + * available to kernel code and must not be used in kernel code. + * Only 64-bit time-interfaces are allowed into the kernel. + */ +-# if defined(RT_OS_LINUX) && (!defined(__KERNEL__) || !defined(_LINUX_TIME64_H)) ++#if defined(RT_OS_LINUX) && (defined(__KERNEL__) || defined(_LINUX_TIME64_H)) ++#define RTTIME_NO_TIMEVAL ++#endif ++#if !defined(RTTIME_NO_TIMEVAL) \ ++ && (defined(RTTIME_INCL_TIMEVAL) || defined(_STRUCT_TIMEVAL) || defined(_SYS__TIMEVAL_H_) \ ++ || defined(_SYS_TIME_H) || defined(_TIMEVAL) || defined(_LINUX_TIME_H) \ ++ || (defined(RT_OS_NETBSD) && defined(_SYS_TIME_H_))) + /** + * Gets the time as POSIX timeval. + * +@@ -398,7 +402,6 @@ + { + return RTTimeSpecAddMicro(RTTimeSpecSetSeconds(pTime, pTimeval->tv_sec), pTimeval->tv_usec); + } +-# endif /* RT_OS_LINUX ... */ + #endif /* various ways of detecting struct timeval */ + + +Index: a/include/iprt/time.h +=================================================================== +--- a/include/iprt/time.h (revision 83473) ++++ a/include/iprt/time.h (revision 83484) +@@ -406,8 +406,20 @@ + + + /* PORTME: Add struct timespec guard macro here. */ +-#if defined(RTTIME_INCL_TIMESPEC) || defined(_STRUCT_TIMESPEC) || defined(_SYS__TIMESPEC_H_) || defined(TIMEVAL_TO_TIMESPEC) || defined(_TIMESPEC) \ +- || (defined(RT_OS_NETBSD) && defined(_SYS_TIME_H_)) ++/* ++ * Starting with Linux kernel version 5.6-rc3, the _STRUCT_TIMESPEC is only defined ++ * under !__KERNEL__ guard and _LINUX_TIME64_H does not define a corresponding ++ * _STRUCT_TIMESPEC64. Only 64-bit time-interfaces are now allowed into the kernel. ++ * We have to keep it for __KERNEL__ though to support older guest kernels (2.6.X) ++ * without _LINUX_TIME64_H. ++ */ ++#if defined(RT_OS_LINUX) && defined(_LINUX_TIME64_H) ++#define RTTIME_NO_TIMESPEC ++#endif ++#if !defined(RTTIME_NO_TIMESPEC) \ ++ && (defined(RTTIME_INCL_TIMESPEC) || defined(_STRUCT_TIMESPEC) || defined(_SYS__TIMESPEC_H_) \ ++ || defined(TIMEVAL_TO_TIMESPEC) || defined(_TIMESPEC) \ ++ || (defined(RT_OS_NETBSD) && defined(_SYS_TIME_H_))) + /** + * Gets the time as POSIX timespec. + * +@@ -443,12 +455,7 @@ + } + #endif /* various ways of detecting struct timespec */ + +-#if defined(RT_OS_LINUX) && defined(_LINUX_TIME64_H) +-/* +- * Starting with Linux kernel version 5.6-rc3, the _STRUCT_TIMESPEC is only defined +- * under !__KERNEL__ guard and _LINUX_TIME64_H does not define a corresponding +- * _STRUCT_TIMESPEC64. Only 64-bit time-interfaces are now allowed into the kernel. +- */ ++#if defined(RTTIME_NO_TIMESPEC) + DECLINLINE(PRTTIMESPEC) RTTimeSpecSetTimespec64(PRTTIMESPEC pTime, const struct timespec64 *pTimeval) + { + return RTTimeSpecAddNano(RTTimeSpecSetSeconds(pTime, pTimeval->tv_sec), pTimeval->tv_nsec); +Index: a/src/VBox/Runtime/r0drv/linux/time-r0drv-linux.c +=================================================================== +--- a/src/VBox/Runtime/r0drv/linux/time-r0drv-linux.c (revision 83471) ++++ a/src/VBox/Runtime/r0drv/linux/time-r0drv-linux.c (revision 83484) +@@ -194,9 +194,9 @@ + IPRT_LINUX_RESTORE_EFL_AC(); + # ifdef _LINUX_TIME64_H + return RTTimeSpecSetTimespec64(pTime, &Ts); +-#else ++# else + return RTTimeSpecSetTimespec(pTime, &Ts); +-#endif ++# endif + #else /* < 2.6.16 */ + struct timeval Tv; + do_gettimeofday(&Tv); diff --git a/hardware/virtualization/virtualbox/pspec.xml b/hardware/virtualization/virtualbox/pspec.xml index c889fc3d6f..b19cd3f06f 100644 --- a/hardware/virtualization/virtualbox/pspec.xml +++ b/hardware/virtualization/virtualbox/pspec.xml @@ -70,6 +70,7 @@ 013-Makefile.patch VirtualBox-6.1.2-disable-update.patch 0001-VBoxServiceAutoMount-Change-Linux-mount-code-to-use-.patch + linux-5.6.patch @@ -195,6 +196,13 @@ + + 2020-04-13 + 6.1.4 + Rebuild + İdris Kalp + idriskalp@gmail.com + 2020-04-09 6.1.4