lkml.org 
[lkml]   [2020]   [May]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 11/30] KVM: nSVM: move MMU setup to nested_prepare_vmcb_control
    Date
    Everything that is needed during nested state restore is now part of
    nested_prepare_vmcb_control.

    Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
    ---
    arch/x86/kvm/svm/nested.c | 12 ++++++------
    1 file changed, 6 insertions(+), 6 deletions(-)

    diff --git a/arch/x86/kvm/svm/nested.c b/arch/x86/kvm/svm/nested.c
    index 73be7af79453..a85cc7376a82 100644
    --- a/arch/x86/kvm/svm/nested.c
    +++ b/arch/x86/kvm/svm/nested.c
    @@ -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;
    --
    2.26.2

    \
     
     \ /
      Last update: 2020-05-29 17:44    [W:5.631 / U:0.196 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site