Commit Graph
36 Commits
Author SHA1 Message Date
Michal Kubecek 4fdf7a77bb vmmon: fix return type of vm_operations_struct::fault handler
Commit 3d3539018d2c ("mm: create the new vm_fault_t type") in mainline
5.1-rc1 changed the definition of vm_fault_t type to unsigned to catch
vm_operations_struct::fault handlers which still have int as return value.
LinuxDriverFault() in vmmon module is one of those.

As handler return type was changed by commit 1c8f422059ae ("mm: change
return type to vm_fault_t") in 4.17-rc1, make LinuxDriverFault() always
return vm_fault_t and define vm_fault_t as int when building against
a pre-4.17 kernel.
w14.1.5-k5.1 w14.1.5-k5.2 w14.1.6-k5.1 w14.1.6-k5.2 w14.1.7-k5.1 w14.1.7-k5.2
2019-03-17 21:27:42 +01:00
Michal Kubecek 96ea9011f7 vmmon: use KERNEL_DS rather than get_ds()
Commit 736706bee329 ("get rid of legacy 'get_ds()' function") in v5.1-rc1
removed get_ds() helper. As this helper always returned KERNEL_DS on x86_64
since the architecture was introduced (and even on i386, it did so since
v2.1.0), simply use KERNEL_DS regardless of kernel version.
2019-03-17 21:24:50 +01:00
Michal Kubecek 47992d417d modules: handle access_ok() with two arguments
Since commit 96d4f267e40f ("Remove 'type' argument from access_ok()
function") in v5.0-rc1, the type argument of access_ok() was dropped.
The same commit also dropped macros VERIFY_READ and VERIFY_WRITE so check
for their existence on pre-5.0 kernels to allow build against kernels with
this change backported.
w14.1.5-k5.0 w14.1.6-k5.0 w14.1.7-k5.0
2019-01-07 13:38:07 +01:00
Michal Kubecek 7f8b6e259e vmmon: bring back the do_gettimeofday() helper
The do_gettimeofday() helper was removed by commit e4b92b108c6c
("timekeeping: remove obsolete time accessors") in v5.0-rc1. Bring it back
for users in vmmon-only/linux/hostif.c.

This feels like a quick and clumsy band aid to allow build with post-4.20
kernels. On a closer look, the whole gymnastics around uptimeState and
HostIFReadUptimeWork() with jiffies and wall time checking and correcting
each other seems to be a workaround for an absence of high resolution
monotonic time. Considering ktime_get_ts64() is available since 3.17 and
before that, ktime_get_ts() since 2.6.17, perhaps the time has come to
clean all this machinery up. But something like this would be beyond the
scope of this repository.
2019-01-07 13:38:07 +01:00
Michal Kubecek ad6da41255 vmmon: totalram_pages is a function since 5.0
Since commit ca79b0c211af ("mm: convert totalram_pages and totalhigh_pages
variables to atomic") in v5.0-rc1, totalram_pages() is an accessor function
and the actual variable is an atomic.
2019-01-07 13:38:07 +01:00
Michal Kubecek 4ab7664585 modules: replace SUBDIRS with M
Since commit 0126be38d988 ("kbuild: announce removal of SUBDIRS if used")
in v5.0-rc1, using SUBDIRS when building out of tree modules produces
a deprecation warning. As M used to work since pretty much ever, use it
unconditionally.
2019-01-07 13:38:07 +01:00
Michal Kubecek 4311b091e4 vmmon: check presence of file_operations::poll()
Commit 11c5ad0ec441 ("eventpoll: switch to ->poll_mask") in v4.18-rc1, made
eventpoll switch from ->poll() to ->poll_mask(), resulting in a null
pointer dereference as vmmon calls the callback directly without checking
its availability.

Rather than calling the callback directly (which would result in null
pointer dereference), use vfs_poll() wrapper. As this wrapper is only
available since 4.18-rc1 cycle as well, provide a copy to use when building
against older kernels.

Note: even if the commit revealing the problem was reverted in 4.18-rc3
(and is unlikely to go back in the same form) so that vmmon no longer
crashes with 4.18 kernel, calling the callback without a check is a bad
practice so let's keep the patch in place.
w14.1.3-k4.18 w14.1.3-k4.19 w14.1.3-k4.20 w14.1.4-k4.18 w14.1.4-k4.19 w14.1.4-k4.20 w14.1.5-k4.18 w14.1.5-k4.19 w14.1.5-k4.20 w14.1.6-k4.18 w14.1.6-k4.19 w14.1.6-k4.20 w14.1.7-k4.18 w14.1.7-k4.19 w14.1.7-k4.20
2018-08-20 07:57:39 +02:00
Michal Kubecek db066be09b vmmon: fix indirect call with retpoline build
Build against kernel with retpoline support issues warning

  objtool: Task_Switch()+0x425: indirect call found in RETPOLINE build

This is because an indirect call in TaskSwitchToMonitor() is encoded using
inline assembler so that it bypasses retpoline generation. For this
purpose, macro CALL_NOSPEC exists since v4.15-rc8 (and has been backported
into some distribution kernels with the rest of retpoline support). Use the
macro if available and fallback to the original code if not.
w14.1.3-k4.16 w14.1.3-k4.17 w14.1.4-k4.16 w14.1.4-k4.17 w14.1.5-k4.16 w14.1.5-k4.17 w14.1.6-k4.16 w14.1.6-k4.17 w14.1.7-k4.16 w14.1.7-k4.17
2018-08-20 07:57:39 +02:00
Michal Kubecek 036bbbe820 vmmon: fix always_inline attribute usage
Function declared with __attribute__((always_inline)) should also be
declared as inline, otherwise gcc issues a warning "always_inline function
might not be inlinable". It's just cosmetic but getting rid of known
harmless warnings makes it easier to spot actual problems. Use the
__always_inline macro for LinuxDriverSyncReadTSCs() as this is how always
inline functions should be declared in kernel code.
2018-08-20 07:57:39 +02:00
Michal Kubecek 18254c1bdf vmmon: use standard definition of MSR_K7_HWCR_SMMLOCK if available
The MSR_K7_HWCR_SMMLOCK macro is defined in mainline since commit
18c71ce9c882 ("x86/CPU/AMD: Add the Secure Encrypted Virtualization CPU
feature") in v4.16-rc1.
2018-08-20 07:57:39 +02:00
Theo Bertacchini 457ae29811 modules: remove .cache.mk on make clean
Remove .cache.mk inside vmmon-only and vmnet-only when executing
"make clean". This file can cause issues when upgrading gcc as make will
still look for includes inside older gcc includes directory.

File .cache.mk with cache of generated variables is created by build since
kernel v4.15-rc1, commit 3298b690b21c ("kbuild: Add a cache for generated
variables").
w14.1.3-k4.15 w14.1.4-k4.15 w14.1.5-k4.15 w14.1.6-k4.15 w14.1.7-k4.15
2018-08-20 07:57:39 +02:00
Michal Kubecek 4dc79c5e97 vmmon: quick workaround for objtool warnings
As discussed in

  https://bugzilla.suse.com/show_bug.cgi?id=1059674

the reason for multiple objtool warnings is the fact that vmmon module
defines its own Panic() function which never returns. While it is marked as
such which is used by the compiler for optimization, there is no way to
find this from object file.

While this seems innocuous, it might result in problems with unwinder
later. The quickest way around is to replace vmmon's own Panic() with
standard kernel panic() until a cleaner solution is found.
w14.1.3-k4.14 w14.1.4-k4.14 w14.1.5-k4.14 w14.1.6-k4.14 w14.1.7-k4.14
2018-08-20 07:57:39 +02:00
Michal Kubecek 1d6e4154c3 vmmon: use standard definition of CR3_PCID_MASK if available
The CR3_PCID_MASK is defined in mainline asm/processor-flags.h since
commit 6c690ee1039b ("x86/mm: Split read_cr3() into read_cr3_pa() and
__read_cr3()") in v4.13-rc1.
w14.1.3-k4.13 w14.1.4-k4.13 w14.1.5-k4.13 w14.1.6-k4.13 w14.1.7-k4.13
2018-08-20 07:57:39 +02:00
Michal Kubecek c27c9adc99 vmmon: use standard definition of MSR_MISC_FEATURES_ENABLES if available
The MSR_MISC_FEATURES_ENABLES macro is defined in mainline since commit
ab6d9468631a ("x86/msr: Rename MISC_FEATURE_ENABLES to
MISC_FEATURES_ENABLES") in v4.12-rc1.

The MSR_MISC_FEATURES_ENABLES_CPUID_FAULT macro is defined in mainline
since commit e9ea1e7f53b8 ("x86/arch_prctl: Add ARCH_[GET|SET]_CPUID") in
v4.12-rc1.
w14.1.3-k4.12 w14.1.4-k4.12 w14.1.5-k4.12 w14.1.6-k4.12 w14.1.7-k4.12
2018-08-20 07:57:39 +02:00
Michal Kubecek 8416dacd5e vmnet: use standard definition of PCI_VENDOR_ID_VMWARE_VMXNET3 if available
The PCI_DEVICE_ID_VMWARE_VMXNET3 macro is defined in mainline pci_ids.h
since commit b1226c7db1d9 ("vmxnet3: Move PCI Id to pci_ids.h") in
v4.10-rc1.
w14.1.3-k4.10 w14.1.3-k4.11 w14.1.4-k4.10 w14.1.4-k4.11 w14.1.5-k4.10 w14.1.5-k4.11 w14.1.6-k4.10 w14.1.6-k4.11 w14.1.7-k4.10 w14.1.7-k4.11
2018-08-20 07:57:39 +02:00
Michal Kubecek 5c073f9eda vmnet: use standard definition of PCI_VENDOR_ID_VMWARE if available
The PCI_VENDOR_ID_VMWARE macro is defined in mainline pci_ids.h since
commit 94e57fea6202 ("PCI: Move PCI_VENDOR_ID_VMWARE to pci_ids.h")
in v3.18-rc1.
w14.1.3-k4.9 w14.1.4-k4.9 w14.1.5-k4.9 w14.1.6-k4.9 w14.1.7-k4.9
2018-08-20 07:57:39 +02:00
Michal Kubecek 3f188d0a76 import Workstation 14.1.3 module sources w14.1.3 w14.1.4 w14.1.5 w14.1.6 w14.1.7 2018-08-20 07:30:12 +02:00
Michal Kubecek 454cbd7b96 Merge branch 'master' into workstation 2018-05-27 16:13:45 +02:00
Michal Kubecek 16c49e52d4 misc: clean copies of vmmon.o and vmnet.o in top level makefile
Makefiles in *-only copy the object file module is created from into the
parent directory but do not delete them on "make clean". Clean these files
up in "clean" target of top level makefile.
2018-05-27 16:08:30 +02:00
Michal Kubecek 2749950c5f import Workstation 14.1.2 module sources w14.1.2 2018-05-23 18:49:52 +02:00
Michal Kubecek 7fa9cbe769 Merge branch 'master' into workstation 2018-04-02 15:37:06 +02:00
Michal Kubecek 77a6966b97 misc: warn if branch is marked as retired
When "make" or "make install is issued on branch marked as retired, warn
user about the fact.
2018-04-02 15:31:34 +02:00
Michal Kubecek cb66161bb5 Merge branch 'master' into workstation 2018-02-04 21:50:23 +01:00
Michal Kubecek 625084e96a misc: add INSTALL document
Add file INSTALL explaining how to use the repository (get patched sources,
build the modules and install them).
2018-02-04 21:48:58 +01:00
Michal Kubecek 1d91cc5b6a misc: add top level makefile
Add a top level makefile to make common tasks easier. Supported targets:

  make           - build modules
  make install   - install modules (honors DESTDIR)
  make clean     - clean up
  make tarballs  - create source tarballs from current HEAD

Note: "make tarballs" uses "git archive" so that it only works in a local
copy of the git repository, not in a directory created by unpacking
a tarball.

Add *.tar to .gitignore to hide tarballs created by "make tarballs".
2018-02-04 21:48:58 +01:00
Michal Kubecek 6fd497d954 misc: update README
Fix a type and clarify the part about building against older kernels.
2018-02-02 18:09:09 +01:00
Michal Kubecek 3fc524fd27 misc: ignore .cache.mk
Add .cache.mk files to .gitignore.
2018-02-02 18:08:41 +01:00
Michal Kubecek 876363be72 import Workstation 14.1.1 module sources w14.1.1 2018-01-12 13:51:07 +01:00
Michal Kubecek f78dd5288e import Workstation 14.1.0 module sources w14.1.0 2017-12-25 10:06:21 +01:00
Michal Kubecek e4df7e3461 import Workstation 14.0.0 module sources w14.0.0 2017-09-30 21:05:11 +02:00
Michal Kubecek 2bd541e265 import Workstation 12.5.7 module sources w12.5.7 2017-06-23 09:12:56 +02:00
Michal Kubecek 2a214307b9 import Workstation 12.5.6 module sources w12.5.6 2017-05-31 10:17:49 +02:00
Michal Kubecek 755b521dd1 import Workstation 12.5.5 module sources w12.5.5 2017-05-31 09:36:09 +02:00
Michal Kubecek 42b8a690c5 misc: add README 2017-05-31 09:18:08 +02:00
Michal Kubecek fdbf9db517 misc: add .gitignore 2017-05-31 08:48:52 +02:00
Michal Kubeček f0d7d2e384 Initial commit 2017-05-31 08:45:16 +02:00