[arch-commits] Commit in virtualbox/trunk (015-linux-5.6.patch PKGBUILD)

Christian Hesse eworm at archlinux.org
Wed Apr 1 11:57:06 UTC 2020


    Date: Wednesday, April 1, 2020 @ 11:57:06
  Author: eworm
Revision: 608823

upgpkg: virtualbox 6.1.4-4

include fixes for linux >= 5.6

Added:
  virtualbox/trunk/015-linux-5.6.patch
Modified:
  virtualbox/trunk/PKGBUILD

---------------------+
 015-linux-5.6.patch |  229 ++++++++++++++++++++++++++++++++++++++++++++++++++
 PKGBUILD            |    4 
 2 files changed, 232 insertions(+), 1 deletion(-)

Added: 015-linux-5.6.patch
===================================================================
--- 015-linux-5.6.patch	                        (rev 0)
+++ 015-linux-5.6.patch	2020-04-01 11:57:06 UTC (rev 608823)
@@ -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);

Modified: PKGBUILD
===================================================================
--- PKGBUILD	2020-04-01 11:57:02 UTC (rev 608822)
+++ PKGBUILD	2020-04-01 11:57:06 UTC (rev 608823)
@@ -10,7 +10,7 @@
          'virtualbox-guest-utils-nox'
          'virtualbox-ext-vnc')
 pkgver=6.1.4
-pkgrel=3
+pkgrel=4
 _vboxsf_commit='5aba938bcabd978e4615186ad7d8617d633e6f30'
 arch=('x86_64')
 url='https://virtualbox.org/'
@@ -75,6 +75,7 @@
         '012-vbglR3GuestCtrlDetectPeekGetCancelSupport.patch'
         '013-Makefile.patch'
         '014-vboxclient.patch'
+        '015-linux-5.6.patch'
         # The following patch and mount.vboxsf wrapper should be removed
         # once support for mainline-style options string gets upstreamed
         '101-vboxsf-automount.patch'
@@ -100,6 +101,7 @@
             '81900e13d36630488accd8c0bfd2ceb69563fb2c4f0f171caba1cca59d438024'
             'da7e58ed37dc23c6202aab3017864579a99e78417f3421ddcc98a198198fe2c9'
             'db617a3e7a3a94b96d5c3fe771d31c927242ef4f2cb265a22e4d5d64560a910a'
+            '7787d241e4948866b0a3f33a45fc638665b4a3e83e64c33bdf085d0043732d6b'
             'a784f3cc24652a16385cc63abac6c5178932ca5f3861be7650631b7dafa753a4'
             'f3ed6741f8977f40900c8aa372fa082df1f8723d497d4fff445153c543bc8947')
 



More information about the arch-commits mailing list