1
0
forked from pool/virtualbox
virtualbox/fixes_for_4.20.patch

146 lines
5.5 KiB
Diff

Index: VirtualBox-5.2.22/src/VBox/HostDrivers/VBoxNetAdp/linux/VBoxNetAdp-linux.c
===================================================================
--- VirtualBox-5.2.22.orig/src/VBox/HostDrivers/VBoxNetAdp/linux/VBoxNetAdp-linux.c
+++ VirtualBox-5.2.22/src/VBox/HostDrivers/VBoxNetAdp/linux/VBoxNetAdp-linux.c
@@ -84,8 +84,11 @@ static long VBoxNetAdpLinuxIOCtlUnlocked
#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 36) */
static void vboxNetAdpEthGetDrvinfo(struct net_device *dev, struct ethtool_drvinfo *info);
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 20, 0)
+static int vboxNetAdpEthGetSettings(struct net_device *pNetDev, struct ethtool_link_ksettings *link_ksettings);
+#else
static int vboxNetAdpEthGetSettings(struct net_device *dev, struct ethtool_cmd *cmd);
-
+#endif
/*********************************************************************************************************************************
* Global Variables *
@@ -129,7 +132,11 @@ static struct miscdevice g_CtlDev =
static const struct ethtool_ops gEthToolOpsVBoxNetAdp =
{
.get_drvinfo = vboxNetAdpEthGetDrvinfo,
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 20, 0)
+ .get_link_ksettings = vboxNetAdpEthGetSettings,
+#else
.get_settings = vboxNetAdpEthGetSettings,
+#endif
.get_link = ethtool_op_get_link,
};
@@ -200,8 +207,18 @@ static void vboxNetAdpEthGetDrvinfo(stru
"N/A");
}
-
/* ethtool_ops::get_settings */
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 20, 0)
+static int vboxNetAdpEthGetSettings(struct net_device *pNetDev, struct ethtool_link_ksettings *link_ksettings)
+{
+ link_ksettings->link_modes.supported[0] = 0;
+ ethtool_link_ksettings_zero_link_mode(link_ksettings, advertising);
+ link_ksettings->base.speed = SPEED_10;
+ link_ksettings->base.duplex = DUPLEX_FULL;
+ link_ksettings->base.port = PORT_TP;
+ link_ksettings->base.phy_address = 0;
+ link_ksettings->base.autoneg = AUTONEG_DISABLE;
+#else
static int vboxNetAdpEthGetSettings(struct net_device *pNetDev, struct ethtool_cmd *cmd)
{
cmd->supported = 0;
@@ -218,6 +235,7 @@ static int vboxNetAdpEthGetSettings(stru
cmd->autoneg = AUTONEG_DISABLE;
cmd->maxtxpkt = 0;
cmd->maxrxpkt = 0;
+#endif
return 0;
}
Index: VirtualBox-5.2.22/src/VBox/Runtime/r0drv/linux/time-r0drv-linux.c
===================================================================
--- VirtualBox-5.2.22.orig/src/VBox/Runtime/r0drv/linux/time-r0drv-linux.c
+++ VirtualBox-5.2.22/src/VBox/Runtime/r0drv/linux/time-r0drv-linux.c
@@ -171,11 +171,19 @@ RTDECL(PRTTIMESPEC) RTTimeNow(PRTTIMESPE
{
IPRT_LINUX_SAVE_EFL_AC();
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 16)
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 20, 0)
+ struct timespec64 Ts;
+ ktime_get_real_ts64(&Ts);
+#else
struct timespec Ts;
ktime_get_real_ts(&Ts);
+#endif
IPRT_LINUX_RESTORE_EFL_AC();
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 20, 0)
+ return RTTimeSpecSetTimespec64(pTime, &Ts);
+#else
return RTTimeSpecSetTimespec(pTime, &Ts);
-
+#endif
#else /* < 2.6.16 */
struct timeval Tv;
do_gettimeofday(&Tv);
Index: VirtualBox-5.2.22/include/iprt/time.h
===================================================================
--- VirtualBox-5.2.22.orig/include/iprt/time.h
+++ VirtualBox-5.2.22/include/iprt/time.h
@@ -54,7 +54,6 @@ typedef struct RTTIMESPEC
int64_t i64NanosecondsRelativeToUnixEpoch;
} RTTIMESPEC;
-
/** @name RTTIMESPEC methods
* @{ */
@@ -388,6 +387,7 @@ DECLINLINE(PRTTIMESPEC) RTTimeSpecSetTim
{
return RTTimeSpecAddMicro(RTTimeSpecSetSeconds(pTime, pTimeval->tv_sec), pTimeval->tv_usec);
}
+
#endif /* various ways of detecting struct timeval */
@@ -427,6 +427,25 @@ DECLINLINE(PRTTIMESPEC) RTTimeSpecSetTim
{
return RTTimeSpecAddNano(RTTimeSpecSetSeconds(pTime, pTimespec->tv_sec), pTimespec->tv_nsec);
}
+
+#ifndef _LINUX_TIME64_H
+/* With kernel 4.20+, the second argument of time routines change from
+ * struct timespec to struct timespec64. This file is built twice, once
+ * in user mode, and once in kernel mode. In user mode, the struct is
+ * undefined, thus the following definition is provided. The guard macro
+ * from the kernels include/linux/time64.h is _LINUX_TIME64_H, thus
+ * the definition of that macro determines whether the struct is defined.
+ */
+struct timespec64 {
+ long long tv_sec; /* seconds */
+ long tv_nsec; /* nanoseconds */
+};
+#endif
+
+DECLINLINE(PRTTIMESPEC) RTTimeSpecSetTimespec64(PRTTIMESPEC pTime, const struct timespec64 *pTimeval)
+{
+ return RTTimeSpecAddMicro(RTTimeSpecSetSeconds(pTime, pTimeval->tv_sec), 1000 * pTimeval->tv_nsec);
+}
#endif /* various ways of detecting struct timespec */
Index: VirtualBox-5.2.22/src/VBox/Additions/linux/drm/vbox_fb.c
===================================================================
--- VirtualBox-5.2.22.orig/src/VBox/Additions/linux/drm/vbox_fb.c
+++ VirtualBox-5.2.22/src/VBox/Additions/linux/drm/vbox_fb.c
@@ -297,8 +297,12 @@ static int vboxfb_create(struct drm_fb_h
* The last flag forces a mode set on VT switches even if the kernel
* does not think it is needed.
*/
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 20, 0)
+ info->flags = FBINFO_DEFAULT | FBINFO_MISC_ALWAYS_SETPAR;
+#else
info->flags = FBINFO_DEFAULT | FBINFO_CAN_FORCE_OUTPUT |
FBINFO_MISC_ALWAYS_SETPAR;
+#endif
info->fbops = &vboxfb_ops;
ret = fb_alloc_cmap(&info->cmap, 256, 0);