summaryrefslogtreecommitdiff
path: root/arch/x86/kvm/kvm_cache_regs.h
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2021-11-26 07:00:15 -0500
committerPaolo Bonzini <pbonzini@redhat.com>2021-12-08 04:25:03 -0500
commit41e68b6964ebf20082af55ad1394523cf86c4c6a (patch)
tree88cf9d35a980b7fbe405ffb990214171ea4dd276 /arch/x86/kvm/kvm_cache_regs.h
parentc62c7bd4f95b8f2a28098c4139a369670998aef2 (diff)
KVM: vmx, svm: clean up mass updates to regs_avail/regs_dirty bits
Document the meaning of the three combinations of regs_avail and regs_dirty. Update regs_dirty just after writeback instead of doing it later after vmexit. After vmexit, instead, we clear the regs_avail bits corresponding to lazily-loaded registers. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'arch/x86/kvm/kvm_cache_regs.h')
-rw-r--r--arch/x86/kvm/kvm_cache_regs.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/arch/x86/kvm/kvm_cache_regs.h b/arch/x86/kvm/kvm_cache_regs.h
index 6e6d0d01f18d..ac3d3bd662f4 100644
--- a/arch/x86/kvm/kvm_cache_regs.h
+++ b/arch/x86/kvm/kvm_cache_regs.h
@@ -43,6 +43,13 @@ BUILD_KVM_GPR_ACCESSORS(r14, R14)
BUILD_KVM_GPR_ACCESSORS(r15, R15)
#endif
+/*
+ * avail dirty
+ * 0 0 register in VMCS/VMCB
+ * 0 1 *INVALID*
+ * 1 0 register in vcpu->arch
+ * 1 1 register in vcpu->arch, needs to be stored back
+ */
static inline bool kvm_register_is_available(struct kvm_vcpu *vcpu,
enum kvm_reg reg)
{