Skip to contentSkip to conversation

KVM: VMX: Add VMX_FEATURE_USR_WAIT_PAUSE

PATCH In review Xiaoyao Li 3 participants 4 messages Feb 16, 2020 – Feb 17, 2020

Subsystems (3)
lore
Share & tools
lore

Xiaoyao Li

author
#0 lore raw

PATCH 1/1 KVM: VMX: Add VMX_FEATURE_USR_WAIT_PAUSE

Commit 159348784ff0 ("x86/vmx: Introduce VMX_FEATURES_*") missed bit 26 (enable user wait and pause) of Secondary Processor-based VM-Execution Controls.

Add VMX_FEATURE_USR_WAIT_PAUSE flag and use it to define SECONDARY_EXEC_ENABLE_USR_WAIT_PAUSE to make them uniformly.

---
 arch/x86/include/asm/vmx.h         | 2 +-
 arch/x86/include/asm/vmxfeatures.h | 1 +
 2 files changed, 2 insertions(+), 1 deletion(-)
arch/x86/include/asm/vmx.h +1 -1
index 2a85287b3685..8521af3fef27 100644
@@ -72,7 +72,7 @@
 #define SECONDARY_EXEC_MODE_BASED_EPT_EXEC	VMCS_CONTROL_BIT(MODE_BASED_EPT_EXEC)
 #define SECONDARY_EXEC_PT_USE_GPA		VMCS_CONTROL_BIT(PT_USE_GPA)
 #define SECONDARY_EXEC_TSC_SCALING              VMCS_CONTROL_BIT(TSC_SCALING)
-#define SECONDARY_EXEC_ENABLE_USR_WAIT_PAUSE	0x04000000
+#define SECONDARY_EXEC_ENABLE_USR_WAIT_PAUSE	VMCS_CONTROL_BIT(USR_WAIT_PAUSE)
 
 #define PIN_BASED_EXT_INTR_MASK                 VMCS_CONTROL_BIT(INTR_EXITING)
 #define PIN_BASED_NMI_EXITING                   VMCS_CONTROL_BIT(NMI_EXITING)
arch/x86/include/asm/vmxfeatures.h +1 -0
index a50e4a0de315..1408f526bd90 100644
@@ -81,6 +81,7 @@
 #define VMX_FEATURE_MODE_BASED_EPT_EXEC	( 2*32+ 22) /* "ept_mode_based_exec" Enable separate EPT EXEC bits for supervisor vs. user */
 #define VMX_FEATURE_PT_USE_GPA		( 2*32+ 24) /* "" Processor Trace logs GPAs */
 #define VMX_FEATURE_TSC_SCALING		( 2*32+ 25) /* Scale hardware TSC when read in guest */
+#define VMX_FEATURE_USR_WAIT_PAUSE	( 2*32+ 26) /* "" Enable TPAUSE, UMONITOR, UMWATI in guest */
 #define VMX_FEATURE_ENCLV_EXITING	( 2*32+ 28) /* "" VM-Exit on ENCLV (leaf dependent) */
 
 #endif /* _ASM_X86_VMXFEATURES_H */
Signature · 1 line
2.19.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 31 lines · Xiaoyao Li

Commit 159348784ff0 ("x86/vmx: Introduce VMX_FEATURES_*") missed bit 26 (enable user wait and pause) of Secondary Processor-based VM-Execution Controls.

Add VMX_FEATURE_USR_WAIT_PAUSE flag and use it to define SECONDARY_EXEC_ENABLE_USR_WAIT_PAUSE to make them uniformly.

---
 arch/x86/include/asm/vmx.h         | 2 +-
 arch/x86/include/asm/vmxfeatures.h | 1 +
 2 files changed, 2 insertions(+), 1 deletion(-)
arch/x86/include/asm/vmx.h +1 -1
index 2a85287b3685..8521af3fef27 100644
@@ -72,7 +72,7 @@
 #define SECONDARY_EXEC_MODE_BASED_EPT_EXEC	VMCS_CONTROL_BIT(MODE_BASED_EPT_EXEC)
 #define SECONDARY_EXEC_PT_USE_GPA		VMCS_CONTROL_BIT(PT_USE_GPA)
 #define SECONDARY_EXEC_TSC_SCALING              VMCS_CONTROL_BIT(TSC_SCALING)
-#define SECONDARY_EXEC_ENABLE_USR_WAIT_PAUSE	0x04000000
+#define SECONDARY_EXEC_ENABLE_USR_WAIT_PAUSE	VMCS_CONTROL_BIT(USR_WAIT_PAUSE)
 
 #define PIN_BASED_EXT_INTR_MASK                 VMCS_CONTROL_BIT(INTR_EXITING)
 #define PIN_BASED_NMI_EXITING                   VMCS_CONTROL_BIT(NMI_EXITING)
arch/x86/include/asm/vmxfeatures.h +0 -0
index a50e4a0de315..1408f526bd90 100644

arch/x86/include/asm/vmxfeatures.h line 84

Quoted 4 lines
arch/x86/include/asm/vmxfeatures.h +1 -0
@@ -81,6 +81,7 @@
 #define VMX_FEATURE_MODE_BASED_EPT_EXEC	( 2*32+ 22) /* "ept_mode_based_exec" Enable separate EPT EXEC bits for supervisor vs. user */
 #define VMX_FEATURE_PT_USE_GPA		( 2*32+ 24) /* "" Processor Trace logs GPAs */
 #define VMX_FEATURE_TSC_SCALING		( 2*32+ 25) /* Scale hardware TSC when read in guest */
+#define VMX_FEATURE_USR_WAIT_PAUSE	( 2*32+ 26) /* "" Enable TPAUSE, UMONITOR, UMWATI in guest */

"UMWAIT"

arch/x86/include/asm/vmxfeatures.h line 87

Quoted 3 lines
arch/x86/include/asm/vmxfeatures.h +0 -0
 #define VMX_FEATURE_ENCLV_EXITING	( 2*32+ 28) /* "" VM-Exit on ENCLV (leaf dependent) */
 
 #endif /* _ASM_X86_VMXFEATURES_H */

With the typo fixed (likely upon commit),

Signature · 1 line
Vitaly
author
#2 lore raw
Quoted 26 lines · Vitaly Kuznetsov
Quoted 24 lines · Xiaoyao Li

Commit 159348784ff0 ("x86/vmx: Introduce VMX_FEATURES_*") missed bit 26 (enable user wait and pause) of Secondary Processor-based VM-Execution Controls.

Add VMX_FEATURE_USR_WAIT_PAUSE flag and use it to define SECONDARY_EXEC_ENABLE_USR_WAIT_PAUSE to make them uniformly.

---
  arch/x86/include/asm/vmx.h         | 2 +-
  arch/x86/include/asm/vmxfeatures.h | 1 +
  2 files changed, 2 insertions(+), 1 deletion(-)
arch/x86/include/asm/vmx.h +1 -1
index 2a85287b3685..8521af3fef27 100644
@@ -72,7 +72,7 @@
  #define SECONDARY_EXEC_MODE_BASED_EPT_EXEC	VMCS_CONTROL_BIT(MODE_BASED_EPT_EXEC)
  #define SECONDARY_EXEC_PT_USE_GPA		VMCS_CONTROL_BIT(PT_USE_GPA)
  #define SECONDARY_EXEC_TSC_SCALING              VMCS_CONTROL_BIT(TSC_SCALING)
-#define SECONDARY_EXEC_ENABLE_USR_WAIT_PAUSE	0x04000000
+#define SECONDARY_EXEC_ENABLE_USR_WAIT_PAUSE	VMCS_CONTROL_BIT(USR_WAIT_PAUSE)
 
Quoted 13 lines

arch/x86/include/asm/vmxfeatures.h line 84

Quoted 11 lines
arch/x86/include/asm/vmx.h +0 -0
  #define PIN_BASED_EXT_INTR_MASK                 VMCS_CONTROL_BIT(INTR_EXITING)
  #define PIN_BASED_NMI_EXITING                   VMCS_CONTROL_BIT(NMI_EXITING)
arch/x86/include/asm/vmxfeatures.h +1 -0
index a50e4a0de315..1408f526bd90 100644
@@ -81,6 +81,7 @@
  #define VMX_FEATURE_MODE_BASED_EPT_EXEC	( 2*32+ 22) /* "ept_mode_based_exec" Enable separate EPT EXEC bits for supervisor vs. user */
  #define VMX_FEATURE_PT_USE_GPA		( 2*32+ 24) /* "" Processor Trace logs GPAs */
  #define VMX_FEATURE_TSC_SCALING		( 2*32+ 25) /* Scale hardware TSC when read in guest */
+#define VMX_FEATURE_USR_WAIT_PAUSE	( 2*32+ 26) /* "" Enable TPAUSE, UMONITOR, UMWATI in guest */

"UMWAIT"

What an uncareful typo. Thanks!

Quoted 8 lines

arch/x86/include/asm/vmxfeatures.h line 87

Quoted 3 lines
arch/x86/include/asm/vmxfeatures.h +0 -0
  #define VMX_FEATURE_ENCLV_EXITING	( 2*32+ 28) /* "" VM-Exit on ENCLV (leaf dependent) */
 
  #endif /* _ASM_X86_VMXFEATURES_H */

With the typo fixed (likely upon commit),

maintainer
#3 lore raw
Quoted 1 line · Xiaoyao Li

What an uncareful typo. Thanks!

No problem, queued.

Paolo

Quoted 8 lines
Quoted 8 lines
Quoted 3 lines

  #define VMX_FEATURE_ENCLV_EXITING    ( 2*32+ 28) /* "" VM-Exit on ENCLV (leaf dependent) */
    #endif /* _ASM_X86_VMXFEATURES_H */

With the typo fixed (likely upon commit),