diff options
author | Xiaoyao Li <xiaoyao.li@intel.com> | 2023-04-10 15:50:16 +0300 |
---|---|---|
committer | Sean Christopherson <seanjc@google.com> | 2023-05-26 23:41:43 +0300 |
commit | 334006b78ca84b7619d7dd313d5b6b39007e9528 (patch) | |
tree | 1c7f21d294646f24be8206fbf590c757b1d0bb1d /arch/x86/kvm/vmx | |
parent | b9846a698c9aff4eb2214a06ac83638ad098f33f (diff) | |
download | linux-334006b78ca84b7619d7dd313d5b6b39007e9528.tar.xz |
KVM: VMX: Use kvm_read_cr4() to get cr4 value
Directly use vcpu->arch.cr4 is not recommended since it gets stale value
if the cr4 is not available.
Use kvm_read_cr4() instead to ensure correct value.
Signed-off-by: Xiaoyao Li <xiaoyao.li@intel.com>
Link: https://lore.kernel.org/r/20230410125017.1305238-2-xiaoyao.li@intel.com
Signed-off-by: Sean Christopherson <seanjc@google.com>
Diffstat (limited to 'arch/x86/kvm/vmx')
-rw-r--r-- | arch/x86/kvm/vmx/vmx.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/arch/x86/kvm/vmx/vmx.c b/arch/x86/kvm/vmx/vmx.c index 44fb619803b8..4335d4b9cb2e 100644 --- a/arch/x86/kvm/vmx/vmx.c +++ b/arch/x86/kvm/vmx/vmx.c @@ -3387,7 +3387,7 @@ static bool vmx_is_valid_cr4(struct kvm_vcpu *vcpu, unsigned long cr4) void vmx_set_cr4(struct kvm_vcpu *vcpu, unsigned long cr4) { - unsigned long old_cr4 = vcpu->arch.cr4; + unsigned long old_cr4 = kvm_read_cr4(vcpu); struct vcpu_vmx *vmx = to_vmx(vcpu); /* * Pass through host's Machine Check Enable value to hw_cr4, which |