[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20190818143316.4906-3-thomas_os@shipmail.org>
Date: Sun, 18 Aug 2019 16:33:14 +0200
From: Thomas Hellström (VMware)
<thomas_os@...pmail.org>
To: linux-kernel@...r.kernel.org, pv-drivers@...are.com
Cc: Thomas Hellstrom <thellstrom@...are.com>,
Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>, Borislav Petkov <bp@...en8.de>,
"H. Peter Anvin" <hpa@...or.com>, x86@...nel.org,
Doug Covelli <dcovelli@...are.com>
Subject: [PATCH 2/4] x86/vmware: Add a header file for hypercall definitions
From: Thomas Hellstrom <thellstrom@...are.com>
This is intended to be used by drivers using the backdoor, and
we follow the kvm example using alternatives self-patching to
choose between vmcall, vmmcall and inl instructions.
This patch defines two new x86 cpu feature flags.
Cc: Thomas Gleixner <tglx@...utronix.de>
Cc: Ingo Molnar <mingo@...hat.com>
Cc: Borislav Petkov <bp@...en8.de>
Cc: "H. Peter Anvin" <hpa@...or.com>
Cc: <x86@...nel.org>
Signed-off-by: Thomas Hellstrom <thellstrom@...are.com>
Reviewed-by: Doug Covelli <dcovelli@...are.com>
---
MAINTAINERS | 1 +
arch/x86/include/asm/cpufeatures.h | 2 ++
arch/x86/include/asm/vmware.h | 13 +++++++++++++
3 files changed, 16 insertions(+)
create mode 100644 arch/x86/include/asm/vmware.h
diff --git a/MAINTAINERS b/MAINTAINERS
index 1bd7b9c2d146..412206747270 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -17203,6 +17203,7 @@ M: "VMware, Inc." <pv-drivers@...are.com>
L: virtualization@...ts.linux-foundation.org
S: Supported
F: arch/x86/kernel/cpu/vmware.c
+F: arch/x86/include/asm/vmware.h
VMWARE PVRDMA DRIVER
M: Adit Ranadive <aditr@...are.com>
diff --git a/arch/x86/include/asm/cpufeatures.h b/arch/x86/include/asm/cpufeatures.h
index 998c2cc08363..69cecc3bc9cb 100644
--- a/arch/x86/include/asm/cpufeatures.h
+++ b/arch/x86/include/asm/cpufeatures.h
@@ -232,6 +232,8 @@
#define X86_FEATURE_VMMCALL ( 8*32+15) /* Prefer VMMCALL to VMCALL */
#define X86_FEATURE_XENPV ( 8*32+16) /* "" Xen paravirtual guest */
#define X86_FEATURE_EPT_AD ( 8*32+17) /* Intel Extended Page Table access-dirty bit */
+#define X86_FEATURE_VMW_VMCALL ( 8*32+18) /* VMware prefers VMCALL hypercall instruction */
+#define X86_FEATURE_VMW_VMMCALL ( 8*32+19) /* VMware prefers VMMCALL hypercall instruction */
/* Intel-defined CPU features, CPUID level 0x00000007:0 (EBX), word 9 */
#define X86_FEATURE_FSGSBASE ( 9*32+ 0) /* RDFSBASE, WRFSBASE, RDGSBASE, WRGSBASE instructions*/
diff --git a/arch/x86/include/asm/vmware.h b/arch/x86/include/asm/vmware.h
new file mode 100644
index 000000000000..22d2dbfba90f
--- /dev/null
+++ b/arch/x86/include/asm/vmware.h
@@ -0,0 +1,13 @@
+/* SPDX-License-Identifier: GPL-2.0 or MIT */
+#ifndef _ASM_X86_VMWARE_H
+#define _ASM_X86_VMWARE_H
+
+#include <asm/cpufeatures.h>
+#include <asm/alternative.h>
+
+#define VMWARE_HYPERCALL \
+ ALTERNATIVE_2(".byte 0xed", \
+ ".byte 0x0f, 0x01, 0xc1", X86_FEATURE_VMW_VMCALL, \
+ ".byte 0x0f, 0x01, 0xd9", X86_FEATURE_VMW_VMMCALL)
+
+#endif
--
2.20.1
Powered by blists - more mailing lists