mirror of https://gitee.com/openkylin/linux.git
KVM: nSVM: move MMU setup to nested_prepare_vmcb_control
Everything that is needed during nested state restore is now part of nested_prepare_vmcb_control. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
parent
f241d711b2
commit
69cb877487
|
@ -247,9 +247,6 @@ static void load_nested_vmcb_control(struct vcpu_svm *svm,
|
|||
|
||||
static void nested_prepare_vmcb_save(struct vcpu_svm *svm, struct vmcb *nested_vmcb)
|
||||
{
|
||||
if (nested_vmcb->control.nested_ctl & SVM_NESTED_CTL_NP_ENABLE)
|
||||
nested_svm_init_mmu_context(&svm->vcpu);
|
||||
|
||||
/* Load the nested guest state */
|
||||
svm->vmcb->save.es = nested_vmcb->save.es;
|
||||
svm->vmcb->save.cs = nested_vmcb->save.cs;
|
||||
|
@ -263,9 +260,6 @@ static void nested_prepare_vmcb_save(struct vcpu_svm *svm, struct vmcb *nested_v
|
|||
svm_set_cr4(&svm->vcpu, nested_vmcb->save.cr4);
|
||||
(void)kvm_set_cr3(&svm->vcpu, nested_vmcb->save.cr3);
|
||||
|
||||
/* Guest paging mode is active - reset mmu */
|
||||
kvm_mmu_reset_context(&svm->vcpu);
|
||||
|
||||
svm->vmcb->save.cr2 = svm->vcpu.arch.cr2 = nested_vmcb->save.cr2;
|
||||
kvm_rax_write(&svm->vcpu, nested_vmcb->save.rax);
|
||||
kvm_rsp_write(&svm->vcpu, nested_vmcb->save.rsp);
|
||||
|
@ -282,6 +276,12 @@ static void nested_prepare_vmcb_save(struct vcpu_svm *svm, struct vmcb *nested_v
|
|||
|
||||
static void nested_prepare_vmcb_control(struct vcpu_svm *svm, struct vmcb *nested_vmcb)
|
||||
{
|
||||
if (nested_vmcb->control.nested_ctl & SVM_NESTED_CTL_NP_ENABLE)
|
||||
nested_svm_init_mmu_context(&svm->vcpu);
|
||||
|
||||
/* Guest paging mode is active - reset mmu */
|
||||
kvm_mmu_reset_context(&svm->vcpu);
|
||||
|
||||
svm_flush_tlb(&svm->vcpu);
|
||||
if (nested_vmcb->control.int_ctl & V_INTR_MASKING_MASK)
|
||||
svm->vcpu.arch.hflags |= HF_VINTR_MASK;
|
||||
|
|
Loading…
Reference in New Issue