[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <42d6eefa-2875-ff4d-c972-71fe405aec98@redhat.com>
Date: Wed, 8 Jul 2020 13:25:06 +0200
From: Paolo Bonzini <pbonzini@...hat.com>
To: Vitaly Kuznetsov <vkuznets@...hat.com>, kvm@...r.kernel.org
Cc: Sean Christopherson <sean.j.christopherson@...el.com>,
Wanpeng Li <wanpengli@...cent.com>,
Jim Mattson <jmattson@...gle.com>,
Junaid Shahid <junaids@...gle.com>,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2 1/3] KVM: nSVM: split kvm_init_shadow_npt_mmu() from
kvm_init_shadow_mmu()
On 08/07/20 11:36, Vitaly Kuznetsov wrote:
> @@ -4973,7 +4969,28 @@ void kvm_init_shadow_mmu(struct kvm_vcpu *vcpu, u32 cr0, u32 cr4, u32 efer)
> context->mmu_role.as_u64 = new_role.as_u64;
> reset_shadow_zero_bits_mask(vcpu, context);
> }
> -EXPORT_SYMBOL_GPL(kvm_init_shadow_mmu);
> +
> +static void kvm_init_shadow_mmu(struct kvm_vcpu *vcpu, u32 cr0, u32 cr4, u32 efer)
> +{
> + struct kvm_mmu *context = vcpu->arch.mmu;
> + union kvm_mmu_role new_role =
> + kvm_calc_shadow_mmu_root_page_role(vcpu, false);
> +
> + if (new_role.as_u64 != context->mmu_role.as_u64)
> + shadow_mmu_init_context(vcpu, cr0, cr4, efer, new_role);
> +}
> +
> +void kvm_init_shadow_npt_mmu(struct kvm_vcpu *vcpu, u32 cr0, u32 cr4, u32 efer,
> + gpa_t nested_cr3)
> +{
> + struct kvm_mmu *context = vcpu->arch.mmu;
> + union kvm_mmu_role new_role =
> + kvm_calc_shadow_mmu_root_page_role(vcpu, false);
> +
> + if (new_role.as_u64 != context->mmu_role.as_u64)
> + shadow_mmu_init_context(vcpu, cr0, cr4, efer, new_role);
> +}
> +EXPORT_SYMBOL_GPL(kvm_init_shadow_npt_mmu);
>
> static union kvm_mmu_role
As a follow up, the assignments to context should stop using
vcpu->arch.mmu in favor of root_mmu/guest_mmu.
Paolo
Powered by blists - more mailing lists