Linux 5.7.6
[linux/fpc-iii.git] / arch / x86 / include / asm / vmware.h
blobac9fc51e2b1862f5dff7264a1978f3d399b5c847
1 /* SPDX-License-Identifier: GPL-2.0 or MIT */
2 #ifndef _ASM_X86_VMWARE_H
3 #define _ASM_X86_VMWARE_H
5 #include <asm/cpufeatures.h>
6 #include <asm/alternative.h>
7 #include <linux/stringify.h>
9 /*
10 * The hypercall definitions differ in the low word of the %edx argument
11 * in the following way: the old port base interface uses the port
12 * number to distinguish between high- and low bandwidth versions.
14 * The new vmcall interface instead uses a set of flags to select
15 * bandwidth mode and transfer direction. The flags should be loaded
16 * into %dx by any user and are automatically replaced by the port
17 * number if the VMWARE_HYPERVISOR_PORT method is used.
19 * In short, new driver code should strictly use the new definition of
20 * %dx content.
23 /* Old port-based version */
24 #define VMWARE_HYPERVISOR_PORT 0x5658
25 #define VMWARE_HYPERVISOR_PORT_HB 0x5659
27 /* Current vmcall / vmmcall version */
28 #define VMWARE_HYPERVISOR_HB BIT(0)
29 #define VMWARE_HYPERVISOR_OUT BIT(1)
31 /* The low bandwidth call. The low word of edx is presumed clear. */
32 #define VMWARE_HYPERCALL \
33 ALTERNATIVE_2("movw $" __stringify(VMWARE_HYPERVISOR_PORT) ", %%dx; " \
34 "inl (%%dx), %%eax", \
35 "vmcall", X86_FEATURE_VMCALL, \
36 "vmmcall", X86_FEATURE_VMW_VMMCALL)
39 * The high bandwidth out call. The low word of edx is presumed to have the
40 * HB and OUT bits set.
42 #define VMWARE_HYPERCALL_HB_OUT \
43 ALTERNATIVE_2("movw $" __stringify(VMWARE_HYPERVISOR_PORT_HB) ", %%dx; " \
44 "rep outsb", \
45 "vmcall", X86_FEATURE_VMCALL, \
46 "vmmcall", X86_FEATURE_VMW_VMMCALL)
49 * The high bandwidth in call. The low word of edx is presumed to have the
50 * HB bit set.
52 #define VMWARE_HYPERCALL_HB_IN \
53 ALTERNATIVE_2("movw $" __stringify(VMWARE_HYPERVISOR_PORT_HB) ", %%dx; " \
54 "rep insb", \
55 "vmcall", X86_FEATURE_VMCALL, \
56 "vmmcall", X86_FEATURE_VMW_VMMCALL)
57 #endif