commit:     0f4fedb03b69af3b839d73c74a0aa87bc1132ba8
Author:     Fabio Rossi <rossi.f <AT> inwind <DOT> it>
AuthorDate: Mon Dec  4 23:03:11 2017 +0000
Commit:     Fabio Rossi <rossi.f <AT> inwind <DOT> net>
CommitDate: Mon Dec  4 23:03:11 2017 +0000
URL:        https://gitweb.gentoo.org/proj/vmware.git/commit/?id=0f4fedb0

app-emulation/vmware-modules: add support to kernel 4.15-rc2

Patch inspired to 
https://github.com/mkubecek/vmware-host-modules/commit/562121d7bc06
but I prefer to leave the sources as close as possible to the original ones.

The changes are due to kernel commits b9eaf18722221ef8b2bd6a67240ebe668622152a
and e99e88a9d2b067465adaa9c111ada99a041bef9a

 .../files/308-4.15-00-init_timer.patch             | 105 +++++++++++++++++++++
 .../vmware-modules/vmware-modules-308.5.8.ebuild   |   1 +
 2 files changed, 106 insertions(+)

diff --git a/app-emulation/vmware-modules/files/308-4.15-00-init_timer.patch 
b/app-emulation/vmware-modules/files/308-4.15-00-init_timer.patch
new file mode 100644
index 0000000..94855db
--- /dev/null
+++ b/app-emulation/vmware-modules/files/308-4.15-00-init_timer.patch
@@ -0,0 +1,105 @@
+--- vmmon-only/linux/hostif.c  2017-12-04 23:49:53.485615520 +0100
++++ vmmon-only/linux/hostif.c.orig     2017-12-04 23:54:13.982630086 +0100
+@@ -1780,7 +1780,11 @@
+  */
+ 
+ static void
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0)
++HostIFUptimeResyncMono(struct timer_list *data)  // IN: ignored
++#else
+ HostIFUptimeResyncMono(unsigned long data)  // IN: ignored
++#endif
+ {
+    unsigned long jifs;
+    uintptr_t flags;
+@@ -1842,8 +1846,12 @@
+                   -(tv.tv_usec * (UPTIME_FREQ / 1000000) + 
+                     tv.tv_sec * UPTIME_FREQ));
+ 
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0)
++   timer_setup(&uptimeState.timer, HostIFUptimeResyncMono, 0);
++#else
+    init_timer(&uptimeState.timer);
+    uptimeState.timer.function = HostIFUptimeResyncMono;
++#endif
+    mod_timer(&uptimeState.timer, jiffies + HZ);
+ }
+ 
+--- vmmon-only/linux/driver.c  2017-12-04 23:49:53.061615496 +0100
++++ vmmon-only/linux/driver.c.orig     2017-12-04 23:53:26.086627408 +0100
+@@ -115,7 +115,11 @@
+ #endif
+ static int LinuxDriverMmap(struct file *filp, struct vm_area_struct *vma);
+ 
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0)
++static void LinuxDriverPollTimeout(struct timer_list *clientData);
++#else
+ static void LinuxDriverPollTimeout(unsigned long clientData);
++#endif
+ static unsigned int LinuxDriverEstimateTSCkHz(void);
+ 
+ static struct vm_operations_struct vmuser_mops = {
+@@ -227,7 +231,11 @@
+  *----------------------------------------------------------------------
+  */
+ static void
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0)
++LinuxDriverEstimateTSCkHzDeferred(struct timer_list *data)
++#else
+ LinuxDriverEstimateTSCkHzDeferred(unsigned long data)
++#endif
+ {
+    LinuxDriverEstimateTSCkHz();
+ }
+@@ -265,9 +273,11 @@
+    }
+ 
+    Vmx86_ReadTSCAndUptime(&tsckHzStartTime);
++#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 15, 0)
+    tscTimer.function = LinuxDriverEstimateTSCkHzDeferred;
+-   tscTimer.expires  = jiffies + 4 * HZ;
+    tscTimer.data     = 0;
++#endif
++   tscTimer.expires  = jiffies + 4 * HZ;
+    add_timer(&tscTimer);
+ }
+ 
+@@ -309,9 +319,14 @@
+     */
+ 
+    init_waitqueue_head(&linuxState.pollQueue);
++
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0)
++   timer_setup(&linuxState.pollTimer, LinuxDriverPollTimeout, 0);
++#else
+    init_timer(&linuxState.pollTimer);
+    linuxState.pollTimer.data = 0;
+    linuxState.pollTimer.function = LinuxDriverPollTimeout;
++#endif
+ 
+    linuxState.fastClockThread = NULL;
+    linuxState.fastClockFile = NULL;
+@@ -360,7 +375,11 @@
+        linuxState.deviceName, linuxState.major, linuxState.minor);
+ 
+    HostIF_InitUptime();
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0)
++   timer_setup(&tscTimer, LinuxDriverEstimateTSCkHzDeferred, 0UL);
++#else
+    init_timer(&tscTimer);
++#endif
+    LinuxDriverInitTSCkHz();
+    Vmx86_InitIDList();
+ 
+@@ -858,7 +877,11 @@
+  */
+ 
+ static void
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0)
++LinuxDriverPollTimeout(struct timer_list *clientData)  // IN:
++#else
+ LinuxDriverPollTimeout(unsigned long clientData)  // IN:
++#endif
+ {
+    LinuxDriverWakeUp(FALSE);
+ }

diff --git a/app-emulation/vmware-modules/vmware-modules-308.5.8.ebuild 
b/app-emulation/vmware-modules/vmware-modules-308.5.8.ebuild
index 0f74914..e6f2999 100644
--- a/app-emulation/vmware-modules/vmware-modules-308.5.8.ebuild
+++ b/app-emulation/vmware-modules/vmware-modules-308.5.8.ebuild
@@ -114,6 +114,7 @@ src_prepare() {
        kernel_is ge 4 13 0 && epatch 
"${FILESDIR}/${PV_MAJOR}-4.13-01-vmmon-fix-page-accounting.patch"
        kernel_is ge 4 14 0 && epatch 
"${FILESDIR}/${PV_MAJOR}-4.14-00-vmmon-global-page-state.patch"
        kernel_is ge 4 14 0 && epatch 
"${FILESDIR}/${PV_MAJOR}-4.14-01-deprecated-asm-uaccess.patch"
+       kernel_is ge 4 15 0 && epatch 
"${FILESDIR}/${PV_MAJOR}-4.15-00-init_timer.patch"
 
        # Allow user patches so they can support RC kernels and whatever else
        epatch_user

Reply via email to