]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
KVM: VMX: Consolidate to_vmx() usage in RFLAGS accessors
authorSean Christopherson <sean.j.christopherson@intel.com>
Fri, 27 Sep 2019 21:45:18 +0000 (14:45 -0700)
committerPaolo Bonzini <pbonzini@redhat.com>
Tue, 22 Oct 2019 11:34:11 +0000 (13:34 +0200)
Capture struct vcpu_vmx in a local variable to improve the readability
of vmx_{g,s}et_rflags().

No functional change intended.

Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com>
Reviewed-by: Vitaly Kuznetsov <vkuznets@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/x86/kvm/vmx/vmx.c

index 71c7a174bdaac8d0efe57e5ade29434c4500b12b..cc83abc93f6dbdb1bd1bf745780b38e4965bbdfa 100644 (file)
@@ -1412,35 +1412,37 @@ static void vmx_decache_cr0_guest_bits(struct kvm_vcpu *vcpu);
 
 unsigned long vmx_get_rflags(struct kvm_vcpu *vcpu)
 {
+       struct vcpu_vmx *vmx = to_vmx(vcpu);
        unsigned long rflags, save_rflags;
 
        if (!test_bit(VCPU_EXREG_RFLAGS, (ulong *)&vcpu->arch.regs_avail)) {
                __set_bit(VCPU_EXREG_RFLAGS, (ulong *)&vcpu->arch.regs_avail);
                rflags = vmcs_readl(GUEST_RFLAGS);
-               if (to_vmx(vcpu)->rmode.vm86_active) {
+               if (vmx->rmode.vm86_active) {
                        rflags &= RMODE_GUEST_OWNED_EFLAGS_BITS;
-                       save_rflags = to_vmx(vcpu)->rmode.save_rflags;
+                       save_rflags = vmx->rmode.save_rflags;
                        rflags |= save_rflags & ~RMODE_GUEST_OWNED_EFLAGS_BITS;
                }
-               to_vmx(vcpu)->rflags = rflags;
+               vmx->rflags = rflags;
        }
-       return to_vmx(vcpu)->rflags;
+       return vmx->rflags;
 }
 
 void vmx_set_rflags(struct kvm_vcpu *vcpu, unsigned long rflags)
 {
+       struct vcpu_vmx *vmx = to_vmx(vcpu);
        unsigned long old_rflags = vmx_get_rflags(vcpu);
 
        __set_bit(VCPU_EXREG_RFLAGS, (ulong *)&vcpu->arch.regs_avail);
-       to_vmx(vcpu)->rflags = rflags;
-       if (to_vmx(vcpu)->rmode.vm86_active) {
-               to_vmx(vcpu)->rmode.save_rflags = rflags;
+       vmx->rflags = rflags;
+       if (vmx->rmode.vm86_active) {
+               vmx->rmode.save_rflags = rflags;
                rflags |= X86_EFLAGS_IOPL | X86_EFLAGS_VM;
        }
        vmcs_writel(GUEST_RFLAGS, rflags);
 
-       if ((old_rflags ^ to_vmx(vcpu)->rflags) & X86_EFLAGS_VM)
-               to_vmx(vcpu)->emulation_required = emulation_required(vcpu);
+       if ((old_rflags ^ vmx->rflags) & X86_EFLAGS_VM)
+               vmx->emulation_required = emulation_required(vcpu);
 }
 
 u32 vmx_get_interrupt_shadow(struct kvm_vcpu *vcpu)