diff options
Diffstat (limited to 'arch')
-rw-r--r-- | arch/x86/include/asm/vmx.h | 2 | ||||
-rw-r--r-- | arch/x86/kvm/vmx.c | 8 |
2 files changed, 9 insertions, 1 deletions
diff --git a/arch/x86/include/asm/vmx.h b/arch/x86/include/asm/vmx.h index 104cf86a7562..b4e28400c9ff 100644 --- a/arch/x86/include/asm/vmx.h +++ b/arch/x86/include/asm/vmx.h | |||
@@ -376,6 +376,8 @@ enum vmcs_field { | |||
376 | #define VMX_EPT_EXTENT_CONTEXT_BIT (1ull << 25) | 376 | #define VMX_EPT_EXTENT_CONTEXT_BIT (1ull << 25) |
377 | #define VMX_EPT_EXTENT_GLOBAL_BIT (1ull << 26) | 377 | #define VMX_EPT_EXTENT_GLOBAL_BIT (1ull << 26) |
378 | 378 | ||
379 | #define VMX_VPID_EXTENT_SINGLE_CONTEXT_BIT (1ull << 9) /* (41 - 32) */ | ||
380 | |||
379 | #define VMX_EPT_DEFAULT_GAW 3 | 381 | #define VMX_EPT_DEFAULT_GAW 3 |
380 | #define VMX_EPT_MAX_GAW 0x4 | 382 | #define VMX_EPT_MAX_GAW 0x4 |
381 | #define VMX_EPT_MT_EPTE_SHIFT 3 | 383 | #define VMX_EPT_MT_EPTE_SHIFT 3 |
diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c index 2201e3816205..945265361885 100644 --- a/arch/x86/kvm/vmx.c +++ b/arch/x86/kvm/vmx.c | |||
@@ -360,6 +360,11 @@ static inline bool cpu_has_vmx_invept_global(void) | |||
360 | return vmx_capability.ept & VMX_EPT_EXTENT_GLOBAL_BIT; | 360 | return vmx_capability.ept & VMX_EPT_EXTENT_GLOBAL_BIT; |
361 | } | 361 | } |
362 | 362 | ||
363 | static inline bool cpu_has_vmx_invvpid_single(void) | ||
364 | { | ||
365 | return vmx_capability.vpid & VMX_VPID_EXTENT_SINGLE_CONTEXT_BIT; | ||
366 | } | ||
367 | |||
363 | static inline bool cpu_has_vmx_ept(void) | 368 | static inline bool cpu_has_vmx_ept(void) |
364 | { | 369 | { |
365 | return vmcs_config.cpu_based_2nd_exec_ctrl & | 370 | return vmcs_config.cpu_based_2nd_exec_ctrl & |
@@ -504,7 +509,8 @@ static inline void vpid_sync_vcpu_all(struct vcpu_vmx *vmx) | |||
504 | if (vmx->vpid == 0) | 509 | if (vmx->vpid == 0) |
505 | return; | 510 | return; |
506 | 511 | ||
507 | __invvpid(VMX_VPID_EXTENT_SINGLE_CONTEXT, vmx->vpid, 0); | 512 | if (cpu_has_vmx_invvpid_single()) |
513 | __invvpid(VMX_VPID_EXTENT_SINGLE_CONTEXT, vmx->vpid, 0); | ||
508 | } | 514 | } |
509 | 515 | ||
510 | static inline void ept_sync_global(void) | 516 | static inline void ept_sync_global(void) |