Re: [RFC 08/16] KVM: SVM: include CR3 in initial VMSA state for SEV-ES guests

From: Paolo Bonzini
Date: Thu Oct 21 2021 - 12:43:43 EST


On 06/10/21 22:37, Michael Roth wrote:
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index c1a2dd0024b2..d724fa185bef 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -10400,8 +10400,7 @@ static int __set_sregs_common(struct kvm_vcpu *vcpu, struct kvm_sregs *sregs,
vcpu->arch.cr2 = sregs->cr2;
*mmu_reset_needed |= kvm_read_cr3(vcpu) != sregs->cr3;
- vcpu->arch.cr3 = sregs->cr3;
- kvm_register_mark_available(vcpu, VCPU_EXREG_CR3);
+ static_call(kvm_x86_set_cr3)(vcpu, sregs->cr3);
kvm_set_cr8(vcpu, sregs->cr8);


Can you instead make the hook "post_set_sregs", and keep these two lines in __set_sregs_common?

Thanks,

Paolo