diff options
author | Vitaly Kuznetsov <vkuznets@redhat.com> | 2021-05-26 15:20:16 +0200 |
---|---|---|
committer | Paolo Bonzini <pbonzini@redhat.com> | 2021-06-17 13:09:48 -0400 |
commit | 1e9dfbd748f37dfa51fcdc82a7afddde1cf8d0ed (patch) | |
tree | b3853b68019dcfbdded1075fa7b763164f92bd56 /arch/x86/kvm/vmx/nested.h | |
parent | 158a48ecf776d0ebc916befcb0dc0862f136a31f (diff) | |
download | linux-next-1e9dfbd748f37dfa51fcdc82a7afddde1cf8d0ed.tar.gz |
KVM: nVMX: Use '-1' in 'hv_evmcs_vmptr' to indicate that eVMCS is not in use
Instead of checking 'vmx->nested.hv_evmcs' use '-1' in
'vmx->nested.hv_evmcs_vmptr' to indicate 'evmcs is not in use' state. This
matches how we check 'vmx->nested.current_vmptr'. Introduce EVMPTR_INVALID
and evmptr_is_valid() and use it instead of raw '-1' check as a preparation
to adding other 'special' values.
No functional change intended.
Suggested-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Message-Id: <20210526132026.270394-2-vkuznets@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'arch/x86/kvm/vmx/nested.h')
-rw-r--r-- | arch/x86/kvm/vmx/nested.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/arch/x86/kvm/vmx/nested.h b/arch/x86/kvm/vmx/nested.h index 184418baeb3c..c4397e83614d 100644 --- a/arch/x86/kvm/vmx/nested.h +++ b/arch/x86/kvm/vmx/nested.h @@ -63,7 +63,7 @@ static inline int vmx_has_valid_vmcs12(struct kvm_vcpu *vcpu) * have vmcs12 if it is true. */ return is_guest_mode(vcpu) || vmx->nested.current_vmptr != -1ull || - vmx->nested.hv_evmcs; + evmptr_is_valid(vmx->nested.hv_evmcs_vmptr); } static inline u16 nested_get_vpid02(struct kvm_vcpu *vcpu) |