summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFabio Rossi <rossi.f@inwind.it>2019-03-23 18:48:21 +0100
committerFabio Rossi <rossi.f@inwind.it>2019-03-23 18:48:21 +0100
commite3d5fb6635dbafe0fa65ec9c5902f7f5741492a1 (patch)
tree0e4ce754dc854a29ead7c90daab505171c9dbc3e
parentapp-emulation/vmware-modules: use M= instead of SUBDIRS= (diff)
downloadvmware-e3d5fb6635dbafe0fa65ec9c5902f7f5741492a1.tar.gz
vmware-e3d5fb6635dbafe0fa65ec9c5902f7f5741492a1.tar.bz2
vmware-e3d5fb6635dbafe0fa65ec9c5902f7f5741492a1.zip
app-emulation/vmware-modules: add support to kernel 5.0
this closes bug #679734 and issue #45 on github
-rw-r--r--app-emulation/vmware-modules/files/308-5.00-00-totalram_pages.patch16
-rw-r--r--app-emulation/vmware-modules/files/308-5.00-01-access_ok.patch42
-rw-r--r--app-emulation/vmware-modules/files/308-5.00-02-do_gettimeofday.patch108
-rw-r--r--app-emulation/vmware-modules/vmware-modules-308.5.9.ebuild3
4 files changed, 169 insertions, 0 deletions
diff --git a/app-emulation/vmware-modules/files/308-5.00-00-totalram_pages.patch b/app-emulation/vmware-modules/files/308-5.00-00-totalram_pages.patch
new file mode 100644
index 0000000..d5e8eb6
--- /dev/null
+++ b/app-emulation/vmware-modules/files/308-5.00-00-totalram_pages.patch
@@ -0,0 +1,16 @@
+--- ./vmmon-only/linux/hostif.c 2019-03-19 23:19:56.087316621 +0100
++++ ./vmmon-only/linux/hostif.c.new 2019-03-19 23:41:53.902419159 +0100
+@@ -1575,9 +1575,13 @@
+ * since at least 2.6.0.
+ */
+
++#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 0, 0)
+ extern unsigned long totalram_pages;
+
+ unsigned int totalPhysicalPages = totalram_pages;
++#else
++ unsigned int totalPhysicalPages = totalram_pages();
++#endif
+
+ #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 28)
+ return MemDefaults_CalcMaxLockedPages(totalPhysicalPages);
diff --git a/app-emulation/vmware-modules/files/308-5.00-01-access_ok.patch b/app-emulation/vmware-modules/files/308-5.00-01-access_ok.patch
new file mode 100644
index 0000000..b2da87b
--- /dev/null
+++ b/app-emulation/vmware-modules/files/308-5.00-01-access_ok.patch
@@ -0,0 +1,42 @@
+--- ./vmmon-only/linux/hostif.c 2019-03-21 23:28:27.735722426 +0100
++++ ./vmmon-only/linux/hostif.c.new 2019-03-21 23:40:55.262780590 +0100
+@@ -3597,7 +3597,11 @@
+
+ ASSERT(handle);
+
++#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 0, 0)
+ if (!access_ok(VERIFY_WRITE, p, size)) {
++#else
++ if (!access_ok(p, size)) {
++#endif
+ printk(KERN_ERR "%s: Couldn't verify write to uva 0x%p with size %"
+ FMTSZ"u\n", __func__, p, size);
+
+--- ./vmnet-only/userif.c 2018-01-09 08:13:21.000000000 +0100
++++ ./vmnet-only/userif.c.new 2019-03-22 00:09:58.432916225 +0100
+@@ -157,7 +157,11 @@
+ struct page **p, // OUT: locked page
+ void **ptr) // OUT: kernel mapped pointer
+ {
++#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 0, 0)
+ if (!access_ok(VERIFY_WRITE, (void *)uAddr, size) ||
++#else
++ if (!access_ok((void *)uAddr, size) ||
++#endif
+ (((uAddr + size - 1) & ~(PAGE_SIZE - 1)) !=
+ (uAddr & ~(PAGE_SIZE - 1)))) {
+ return -EINVAL;
+--- ./vmci-only/linux/driver.c 2019-03-22 00:10:40.166919472 +0100
++++ ./vmci-only/linux/driver.c.new 2019-03-22 00:11:52.528925103 +0100
+@@ -1439,7 +1439,11 @@
+ VMCIUserVAInvalidPointer(VA uva, // IN:
+ size_t size) // IN:
+ {
++#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 0, 0)
+ return !access_ok(VERIFY_WRITE, (void *)uva, size);
++#else
++ return !access_ok((void *)uva, size);
++#endif
+ }
+
+
diff --git a/app-emulation/vmware-modules/files/308-5.00-02-do_gettimeofday.patch b/app-emulation/vmware-modules/files/308-5.00-02-do_gettimeofday.patch
new file mode 100644
index 0000000..dfd4410
--- /dev/null
+++ b/app-emulation/vmware-modules/files/308-5.00-02-do_gettimeofday.patch
@@ -0,0 +1,108 @@
+--- ./vmmon-only/linux/hostif.c 2019-03-21 23:45:15.452800836 +0100
++++ ./vmmon-only/linux/hostif.c.new 2019-03-21 23:55:42.963849662 +0100
+@@ -1709,7 +1709,11 @@
+ static uint64
+ HostIFReadUptimeWork(unsigned long *j) // OUT: current jiffies
+ {
++#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 0, 0)
+ struct timeval tv;
++#else
++ struct timespec64 ts;
++#endif
+ uint64 monotime, uptime, upBase, monoBase;
+ int64 diff;
+ uint32 version;
+@@ -1727,13 +1731,21 @@
+ monoBase = uptimeState.monotimeBase;
+ } while (!VersionedAtomic_EndTryRead(&uptimeState.version, version));
+
++#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 0, 0)
+ do_gettimeofday(&tv);
++#else
++ ktime_get_real_ts64(&ts);
++#endif
+ upBase = Atomic_Read64(&uptimeState.uptimeBase);
+
+ monotime = (uint64)(jifs - jifBase) * (UPTIME_FREQ / HZ);
+ monotime += monoBase;
+
++#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 0, 0)
+ uptime = tv.tv_usec * (UPTIME_FREQ / 1000000) + tv.tv_sec * UPTIME_FREQ;
++#else
++ uptime = ts.tv_nsec / NSEC_PER_USEC * (UPTIME_FREQ / 1000000) + ts.tv_sec * UPTIME_FREQ;
++#endif
+ uptime += upBase;
+
+ /*
+@@ -1842,6 +1854,7 @@
+ void
+ HostIF_InitUptime(void)
+ {
++#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 0, 0)
+ struct timeval tv;
+
+ uptimeState.jiffiesBase = jiffies;
+@@ -1849,6 +1862,15 @@
+ Atomic_Write64(&uptimeState.uptimeBase,
+ -(tv.tv_usec * (UPTIME_FREQ / 1000000) +
+ tv.tv_sec * UPTIME_FREQ));
++#else
++ struct timespec64 ts;
++
++ uptimeState.jiffiesBase = jiffies;
++ ktime_get_real_ts64(&ts);
++ Atomic_Write64(&uptimeState.uptimeBase,
++ -(ts.tv_nsec / NSEC_PER_USEC * (UPTIME_FREQ / 1000000) +
++ ts.tv_sec * UPTIME_FREQ));
++#endif
+
+ #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0)
+ timer_setup(&uptimeState.timer, HostIFUptimeResyncMono, 0);
+--- ./vmmon-only/linux/driver.c 2019-03-21 23:45:15.277800822 +0100
++++ ./vmmon-only/linux/driver.c.new 2019-03-21 23:50:55.619827304 +0100
+@@ -760,14 +760,23 @@
+ LinuxDriverWakeUp(Bool selective) // IN:
+ {
+ if (selective && linuxState.pollList != NULL) {
++#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 0, 0)
+ struct timeval tv;
++#else
++ struct timespec64 ts;
++#endif
+ VmTimeType now;
+ VMLinux *p;
+ VMLinux *next;
+
+ HostIF_PollListLock(1);
++#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 0, 0)
+ do_gettimeofday(&tv);
+ now = tv.tv_sec * 1000000ULL + tv.tv_usec;
++#else
++ ktime_get_real_ts64(&ts);
++ now = ts.tv_sec * 1000000ULL + ts.tv_nsec / NSEC_PER_USEC;
++#endif
+
+ for (p = linuxState.pollList; p != NULL; p = next) {
+ next = p->pollForw;
+@@ -834,12 +843,21 @@
+ }
+ } else {
+ if (linuxState.fastClockThread && vmLinux->pollTimeoutPtr != NULL) {
++#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 0, 0)
+ struct timeval tv;
+
+ do_gettimeofday(&tv);
+ poll_wait(filp, &vmLinux->pollQueue, wait);
+ vmLinux->pollTime = *vmLinux->pollTimeoutPtr +
+ tv.tv_sec * 1000000ULL + tv.tv_usec;
++#else
++ struct timespec64 ts;
++
++ ktime_get_real_ts64(&ts);
++ poll_wait(filp, &vmLinux->pollQueue, wait);
++ vmLinux->pollTime = *vmLinux->pollTimeoutPtr +
++ ts.tv_sec * 1000000ULL + ts.tv_nsec / NSEC_PER_USEC;
++#endif
+ if (vmLinux->pollBack == NULL) {
+ HostIF_PollListLock(2);
+ if (vmLinux->pollBack == NULL) {
diff --git a/app-emulation/vmware-modules/vmware-modules-308.5.9.ebuild b/app-emulation/vmware-modules/vmware-modules-308.5.9.ebuild
index f4ce04a..ccb687a 100644
--- a/app-emulation/vmware-modules/vmware-modules-308.5.9.ebuild
+++ b/app-emulation/vmware-modules/vmware-modules-308.5.9.ebuild
@@ -121,6 +121,9 @@ src_prepare() {
kernel_is ge 4 15 0 && epatch "${FILESDIR}/${PV_MAJOR}-4.15-00-init_timer.patch"
kernel_is ge 4 16 0 && epatch "${FILESDIR}/${PV_MAJOR}-4.16-00-vmblock-iversion.patch"
kernel_is ge 4 17 0 && epatch "${FILESDIR}/${PV_MAJOR}-4.17-00-vsock-getname.patch"
+ kernel_is ge 5 00 0 && epatch "${FILESDIR}/${PV_MAJOR}-5.00-00-totalram_pages.patch"
+ kernel_is ge 5 00 0 && epatch "${FILESDIR}/${PV_MAJOR}-5.00-01-access_ok.patch"
+ kernel_is ge 5 00 0 && epatch "${FILESDIR}/${PV_MAJOR}-5.00-02-do_gettimeofday.patch"
# Allow user patches so they can support RC kernels and whatever else
epatch_user