Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

KVM: x86: introduce kvm_register_clear_available

Small refactoring that will be used in the next patch.

Signed-off-by: Maxim Levitsky <mlevitsk@redhat.com>
Message-Id: <20210607090203.133058-7-mlevitsk@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>

authored by

Maxim Levitsky and committed by
Paolo Bonzini
329675dd 0f857223

+9 -4
+7
arch/x86/kvm/kvm_cache_regs.h
··· 55 55 __set_bit(reg, (unsigned long *)&vcpu->arch.regs_avail); 56 56 } 57 57 58 + static inline void kvm_register_clear_available(struct kvm_vcpu *vcpu, 59 + enum kvm_reg reg) 60 + { 61 + __clear_bit(reg, (unsigned long *)&vcpu->arch.regs_avail); 62 + __clear_bit(reg, (unsigned long *)&vcpu->arch.regs_dirty); 63 + } 64 + 58 65 static inline void kvm_register_mark_dirty(struct kvm_vcpu *vcpu, 59 66 enum kvm_reg reg) 60 67 {
+2 -4
arch/x86/kvm/svm/svm.c
··· 3873 3873 vcpu->arch.apf.host_apf_flags = 3874 3874 kvm_read_and_reset_apf_flags(); 3875 3875 3876 - if (npt_enabled) { 3877 - vcpu->arch.regs_avail &= ~(1 << VCPU_EXREG_PDPTR); 3878 - vcpu->arch.regs_dirty &= ~(1 << VCPU_EXREG_PDPTR); 3879 - } 3876 + if (npt_enabled) 3877 + kvm_register_clear_available(vcpu, VCPU_EXREG_PDPTR); 3880 3878 3881 3879 /* 3882 3880 * We need to handle MC intercepts here before the vcpu has a chance to