Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 or MIT */
0002 #ifndef _ASM_X86_VMWARE_H
0003 #define _ASM_X86_VMWARE_H
0004 
0005 #include <asm/cpufeatures.h>
0006 #include <asm/alternative.h>
0007 #include <linux/stringify.h>
0008 
0009 /*
0010  * The hypercall definitions differ in the low word of the %edx argument
0011  * in the following way: the old port base interface uses the port
0012  * number to distinguish between high- and low bandwidth versions.
0013  *
0014  * The new vmcall interface instead uses a set of flags to select
0015  * bandwidth mode and transfer direction. The flags should be loaded
0016  * into %dx by any user and are automatically replaced by the port
0017  * number if the VMWARE_HYPERVISOR_PORT method is used.
0018  *
0019  * In short, new driver code should strictly use the new definition of
0020  * %dx content.
0021  */
0022 
0023 /* Old port-based version */
0024 #define VMWARE_HYPERVISOR_PORT    0x5658
0025 #define VMWARE_HYPERVISOR_PORT_HB 0x5659
0026 
0027 /* Current vmcall / vmmcall version */
0028 #define VMWARE_HYPERVISOR_HB   BIT(0)
0029 #define VMWARE_HYPERVISOR_OUT  BIT(1)
0030 
0031 /* The low bandwidth call. The low word of edx is presumed clear. */
0032 #define VMWARE_HYPERCALL                        \
0033     ALTERNATIVE_2("movw $" __stringify(VMWARE_HYPERVISOR_PORT) ", %%dx; " \
0034               "inl (%%dx), %%eax",              \
0035               "vmcall", X86_FEATURE_VMCALL,         \
0036               "vmmcall", X86_FEATURE_VMW_VMMCALL)
0037 
0038 /*
0039  * The high bandwidth out call. The low word of edx is presumed to have the
0040  * HB and OUT bits set.
0041  */
0042 #define VMWARE_HYPERCALL_HB_OUT                     \
0043     ALTERNATIVE_2("movw $" __stringify(VMWARE_HYPERVISOR_PORT_HB) ", %%dx; " \
0044               "rep outsb",                  \
0045               "vmcall", X86_FEATURE_VMCALL,         \
0046               "vmmcall", X86_FEATURE_VMW_VMMCALL)
0047 
0048 /*
0049  * The high bandwidth in call. The low word of edx is presumed to have the
0050  * HB bit set.
0051  */
0052 #define VMWARE_HYPERCALL_HB_IN                      \
0053     ALTERNATIVE_2("movw $" __stringify(VMWARE_HYPERVISOR_PORT_HB) ", %%dx; " \
0054               "rep insb",                   \
0055               "vmcall", X86_FEATURE_VMCALL,         \
0056               "vmmcall", X86_FEATURE_VMW_VMMCALL)
0057 #endif