Skip to content

Commit 6fee2a0

Browse files
thomashvmwIngo Molnar
authored andcommitted
x86/cpu/vmware: Fix platform detection VMWARE_PORT macro
The platform detection VMWARE_PORT macro uses the VMWARE_HYPERVISOR_PORT definition, but expects it to be an integer. However, when it was moved to the new vmware.h include file, it was changed to be a string to better fit into the VMWARE_HYPERCALL set of macros. This obviously breaks the platform detection VMWARE_PORT functionality. Change the VMWARE_HYPERVISOR_PORT and VMWARE_HYPERVISOR_PORT_HB definitions to be integers, and use __stringify() for their stringified form when needed. Signed-off-by: Thomas Hellstrom <[email protected]> Cc: Borislav Petkov <[email protected]> Cc: H. Peter Anvin <[email protected]> Cc: Linus Torvalds <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Sean Christopherson <[email protected]> Cc: Thomas Gleixner <[email protected]> Fixes: b4dd4f6 ("Add a header file for hypercall definitions") Link: https://lkml.kernel.org/r/[email protected] Signed-off-by: Ingo Molnar <[email protected]>
1 parent db633a4 commit 6fee2a0

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

arch/x86/include/asm/vmware.h

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
#include <asm/cpufeatures.h>
66
#include <asm/alternative.h>
7+
#include <linux/stringify.h>
78

89
/*
910
* The hypercall definitions differ in the low word of the %edx argument
@@ -20,16 +21,16 @@
2021
*/
2122

2223
/* Old port-based version */
23-
#define VMWARE_HYPERVISOR_PORT "0x5658"
24-
#define VMWARE_HYPERVISOR_PORT_HB "0x5659"
24+
#define VMWARE_HYPERVISOR_PORT 0x5658
25+
#define VMWARE_HYPERVISOR_PORT_HB 0x5659
2526

2627
/* Current vmcall / vmmcall version */
2728
#define VMWARE_HYPERVISOR_HB BIT(0)
2829
#define VMWARE_HYPERVISOR_OUT BIT(1)
2930

3031
/* The low bandwidth call. The low word of edx is presumed clear. */
3132
#define VMWARE_HYPERCALL \
32-
ALTERNATIVE_2("movw $" VMWARE_HYPERVISOR_PORT ", %%dx; " \
33+
ALTERNATIVE_2("movw $" __stringify(VMWARE_HYPERVISOR_PORT) ", %%dx; " \
3334
"inl (%%dx), %%eax", \
3435
"vmcall", X86_FEATURE_VMCALL, \
3536
"vmmcall", X86_FEATURE_VMW_VMMCALL)
@@ -39,7 +40,8 @@
3940
* HB and OUT bits set.
4041
*/
4142
#define VMWARE_HYPERCALL_HB_OUT \
42-
ALTERNATIVE_2("movw $" VMWARE_HYPERVISOR_PORT_HB ", %%dx; rep outsb", \
43+
ALTERNATIVE_2("movw $" __stringify(VMWARE_HYPERVISOR_PORT_HB) ", %%dx; " \
44+
"rep outsb", \
4345
"vmcall", X86_FEATURE_VMCALL, \
4446
"vmmcall", X86_FEATURE_VMW_VMMCALL)
4547

@@ -48,7 +50,8 @@
4850
* HB bit set.
4951
*/
5052
#define VMWARE_HYPERCALL_HB_IN \
51-
ALTERNATIVE_2("movw $" VMWARE_HYPERVISOR_PORT_HB ", %%dx; rep insb", \
53+
ALTERNATIVE_2("movw $" __stringify(VMWARE_HYPERVISOR_PORT_HB) ", %%dx; " \
54+
"rep insb", \
5255
"vmcall", X86_FEATURE_VMCALL, \
5356
"vmmcall", X86_FEATURE_VMW_VMMCALL)
5457
#endif

0 commit comments

Comments
 (0)