Permalink
Browse files

vmmon: convert timers to use timer_setup()

With version 4.15-rc1, conversion to new timer interface is finished and
old interface using init_timer() is no longer available. Convert both users
to new one.
  • Loading branch information...
mkubecek committed Nov 27, 2017
1 parent 182ac91 commit 562121d7bc0606a104e876d77fd117223ee42ac3
Showing with 32 additions and 7 deletions.
  1. +26 −0 vmmon-only/include/compat_timer.h
  2. +3 −4 vmmon-only/linux/driver.c
  3. +3 −3 vmmon-only/linux/hostif.c
@@ -0,0 +1,26 @@
#ifndef __COMPAT_TIMER_H__
# define __COMPAT_TIMER_H__
#include <linux/timer.h>
#if (LINUX_VERSION_CODE < KERNEL_VERSION(4, 15, 0)) && !defined(timer_setup)
typedef unsigned long compat_timer_arg_t;
static inline void timer_setup(struct timer_list *timer,
void (*func)(compat_timer_arg_t),
unsigned int flags)
{
init_timer(timer);
timer->function = func;
timer->data = 0;
timer->flags = flags;
}
#else /* new timer interface since 4.15 */
typedef struct timer_list *compat_timer_arg_t;
#endif /* new timer interface since 4.15 */
#endif /* __COMPAT_TIMER_H__ */
@@ -21,6 +21,7 @@
#define EXPORT_SYMTAB
#include "compat_timer.h"
#include <linux/file.h>
#include <linux/highmem.h>
#include <linux/mm.h>
@@ -216,7 +217,7 @@ LinuxDriverEstimateTSCkHz(void)
*----------------------------------------------------------------------
*/
static void
LinuxDriverEstimateTSCkHzDeferred(unsigned long data)
LinuxDriverEstimateTSCkHzDeferred(compat_timer_arg_t unused)
{
LinuxDriverEstimateTSCkHz();
}
@@ -251,9 +252,7 @@ LinuxDriverInitTSCkHz(void)
}
LinuxDriverReadTSCAndUptime(&tsckHzStartTime);
tscTimer.function = LinuxDriverEstimateTSCkHzDeferred;
tscTimer.expires = jiffies + 4 * HZ;
tscTimer.data = 0;
add_timer(&tscTimer);
}
@@ -335,7 +334,7 @@ init_module(void)
linuxState.deviceName, linuxState.major, linuxState.minor);
HostIF_InitUptime();
init_timer(&tscTimer);
timer_setup(&tscTimer, LinuxDriverEstimateTSCkHzDeferred, 0);
LinuxDriverInitTSCkHz();
Vmx86_InitIDList();
@@ -29,6 +29,7 @@
#include "driver-config.h"
/* Must come before vmware.h --hpreg */
#include "compat_timer.h"
#include <linux/binfmts.h>
#include <linux/delay.h>
#include <linux/file.h>
@@ -1714,7 +1715,7 @@ HostIFReadUptimeWork(unsigned long *j) // OUT: current jiffies
*/
static void
HostIFUptimeResyncMono(unsigned long data) // IN: ignored
HostIFUptimeResyncMono(compat_timer_arg_t unused) // IN: ignored
{
unsigned long jifs;
uintptr_t flags;
@@ -1776,8 +1777,7 @@ HostIF_InitUptime(void)
-(tv.tv_usec * (UPTIME_FREQ / 1000000) +
tv.tv_sec * UPTIME_FREQ));
init_timer(&uptimeState.timer);
uptimeState.timer.function = HostIFUptimeResyncMono;
timer_setup(&uptimeState.timer, HostIFUptimeResyncMono, 0);
mod_timer(&uptimeState.timer, jiffies + HZ);
}

8 comments on commit 562121d

@gkfnf

This comment has been minimized.

Show comment
Hide comment
@gkfnf

gkfnf Apr 18, 2018

Thx a lot

gkfnf replied Apr 18, 2018

Thx a lot

@ChaunceyCheng

This comment has been minimized.

Show comment
Hide comment
@ChaunceyCheng

ChaunceyCheng May 2, 2018

Thank you very much!

ChaunceyCheng replied May 2, 2018

Thank you very much!

@konstantin999

This comment has been minimized.

Show comment
Hide comment
@konstantin999

konstantin999 May 15, 2018

Thanx!!! Worked for me, Ubuntu 18.04 Vmware 14.0.0

konstantin999 replied May 15, 2018

Thanx!!! Worked for me, Ubuntu 18.04 Vmware 14.0.0

@hamidrezabstn

This comment has been minimized.

Show comment
Hide comment
@hamidrezabstn

hamidrezabstn Jun 12, 2018

Thx!!! Works perfectly on fedora 26 kernel 4.16 Vmware 14.0.0

hamidrezabstn replied Jun 12, 2018

Thx!!! Works perfectly on fedora 26 kernel 4.16 Vmware 14.0.0

@mikeh007

This comment has been minimized.

Show comment
Hide comment
@mikeh007

mikeh007 Jul 11, 2018

Hi, may I ask for some expert guidance here.. ? do I understand correctly, the above may be the solution to the issues seen at #241
[ https://github.com/abperiasamy/rtl8812AU_8821AU_linux/issues/241 ] ?

If so could some one tell me how to get these changes into an 18.04 Ubuntu installation so that I can press on and compile new TPLINK Wifi Drivers (whose make install step falls over currently in the mode described within #241) ?

I'm not an expert developer and am unclear how/where the above three 'vmmon' files go to sort this. Does this require a complete kernel recompile ?

Many thanks in advance

Mike
London

mikeh007 replied Jul 11, 2018

Hi, may I ask for some expert guidance here.. ? do I understand correctly, the above may be the solution to the issues seen at #241
[ https://github.com/abperiasamy/rtl8812AU_8821AU_linux/issues/241 ] ?

If so could some one tell me how to get these changes into an 18.04 Ubuntu installation so that I can press on and compile new TPLINK Wifi Drivers (whose make install step falls over currently in the mode described within #241) ?

I'm not an expert developer and am unclear how/where the above three 'vmmon' files go to sort this. Does this require a complete kernel recompile ?

Many thanks in advance

Mike
London

@mkubecek

This comment has been minimized.

Show comment
Hide comment
@mkubecek

mkubecek Jul 11, 2018

Owner

The issue you refer to is just another out-of-tree driver running into the same problem as vmmon here. You cannot use the same patch; you could patch rtl8812au driver in a similar way but there is no reason to as someone else has already done this: see pull request #242 in that project.

Owner

mkubecek replied Jul 11, 2018

The issue you refer to is just another out-of-tree driver running into the same problem as vmmon here. You cannot use the same patch; you could patch rtl8812au driver in a similar way but there is no reason to as someone else has already done this: see pull request #242 in that project.

@jon-uk

This comment has been minimized.

Show comment
Hide comment
@jon-uk

jon-uk Aug 14, 2018

Would be great if the same approach is applied to VMware 12.5.9 for kernel 4.15. VMware 14 does not support CPU EPT by the looks of it.

jon-uk replied Aug 14, 2018

Would be great if the same approach is applied to VMware 12.5.9 for kernel 4.15. VMware 14 does not support CPU EPT by the looks of it.

@mkubecek

This comment has been minimized.

Show comment
Hide comment
@mkubecek

mkubecek Aug 15, 2018

Owner

I don't understand... there is analogous commit 6bf2167 in branch workstation-12.5.9

Owner

mkubecek replied Aug 15, 2018

I don't understand... there is analogous commit 6bf2167 in branch workstation-12.5.9

Please sign in to comment.