aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kvm/mmu.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/x86/kvm/mmu.c')
-rw-r--r--arch/x86/kvm/mmu.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c
index a215c41b5176..992fde984e25 100644
--- a/arch/x86/kvm/mmu.c
+++ b/arch/x86/kvm/mmu.c
@@ -3795,6 +3795,33 @@ int kvm_init_shadow_mmu(struct kvm_vcpu *vcpu, struct kvm_mmu *context)
3795} 3795}
3796EXPORT_SYMBOL_GPL(kvm_init_shadow_mmu); 3796EXPORT_SYMBOL_GPL(kvm_init_shadow_mmu);
3797 3797
3798int kvm_init_shadow_ept_mmu(struct kvm_vcpu *vcpu, struct kvm_mmu *context,
3799 bool execonly)
3800{
3801 ASSERT(vcpu);
3802 ASSERT(!VALID_PAGE(vcpu->arch.mmu.root_hpa));
3803
3804 context->shadow_root_level = kvm_x86_ops->get_tdp_level();
3805
3806 context->nx = true;
3807 context->new_cr3 = paging_new_cr3;
3808 context->page_fault = ept_page_fault;
3809 context->gva_to_gpa = ept_gva_to_gpa;
3810 context->sync_page = ept_sync_page;
3811 context->invlpg = ept_invlpg;
3812 context->update_pte = ept_update_pte;
3813 context->free = paging_free;
3814 context->root_level = context->shadow_root_level;
3815 context->root_hpa = INVALID_PAGE;
3816 context->direct_map = false;
3817
3818 update_permission_bitmask(vcpu, context, true);
3819 reset_rsvds_bits_mask_ept(vcpu, context, execonly);
3820
3821 return 0;
3822}
3823EXPORT_SYMBOL_GPL(kvm_init_shadow_ept_mmu);
3824
3798static int init_kvm_softmmu(struct kvm_vcpu *vcpu) 3825static int init_kvm_softmmu(struct kvm_vcpu *vcpu)
3799{ 3826{
3800 int r = kvm_init_shadow_mmu(vcpu, vcpu->arch.walk_mmu); 3827 int r = kvm_init_shadow_mmu(vcpu, vcpu->arch.walk_mmu);