aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kvm/mmu.c
diff options
context:
space:
mode:
authorAvi Kivity <avi@qumranet.com>2008-08-26 09:16:08 -0400
committerAvi Kivity <avi@qumranet.com>2008-10-15 04:15:22 -0400
commit6c41f428b72afe5a581b967590c12538db31d399 (patch)
tree8b1cd1520469b23d033d7046db2d03ef727d54a4 /arch/x86/kvm/mmu.c
parent0be9e929e398d6da6406183a8732dbfd0937fafe (diff)
KVM: MMU: Infer shadow root level in direct_map()
In all cases the shadow root level is available in mmu.shadow_root_level, so there is no need to pass it as a parameter. Signed-off-by: Avi Kivity <avi@qumranet.com>
Diffstat (limited to 'arch/x86/kvm/mmu.c')
-rw-r--r--arch/x86/kvm/mmu.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c
index 3ee856f6812d..72f739aa8623 100644
--- a/arch/x86/kvm/mmu.c
+++ b/arch/x86/kvm/mmu.c
@@ -1227,11 +1227,11 @@ static void nonpaging_new_cr3(struct kvm_vcpu *vcpu)
1227} 1227}
1228 1228
1229static int __direct_map(struct kvm_vcpu *vcpu, gpa_t v, int write, 1229static int __direct_map(struct kvm_vcpu *vcpu, gpa_t v, int write,
1230 int largepage, gfn_t gfn, pfn_t pfn, 1230 int largepage, gfn_t gfn, pfn_t pfn)
1231 int level)
1232{ 1231{
1233 hpa_t table_addr = vcpu->arch.mmu.root_hpa; 1232 hpa_t table_addr = vcpu->arch.mmu.root_hpa;
1234 int pt_write = 0; 1233 int pt_write = 0;
1234 int level = vcpu->arch.mmu.shadow_root_level;
1235 1235
1236 for (; ; level--) { 1236 for (; ; level--) {
1237 u32 index = PT64_INDEX(v, level); 1237 u32 index = PT64_INDEX(v, level);
@@ -1299,8 +1299,7 @@ static int nonpaging_map(struct kvm_vcpu *vcpu, gva_t v, int write, gfn_t gfn)
1299 if (mmu_notifier_retry(vcpu, mmu_seq)) 1299 if (mmu_notifier_retry(vcpu, mmu_seq))
1300 goto out_unlock; 1300 goto out_unlock;
1301 kvm_mmu_free_some_pages(vcpu); 1301 kvm_mmu_free_some_pages(vcpu);
1302 r = __direct_map(vcpu, v, write, largepage, gfn, pfn, 1302 r = __direct_map(vcpu, v, write, largepage, gfn, pfn);
1303 PT32E_ROOT_LEVEL);
1304 spin_unlock(&vcpu->kvm->mmu_lock); 1303 spin_unlock(&vcpu->kvm->mmu_lock);
1305 1304
1306 1305
@@ -1455,7 +1454,7 @@ static int tdp_page_fault(struct kvm_vcpu *vcpu, gva_t gpa,
1455 goto out_unlock; 1454 goto out_unlock;
1456 kvm_mmu_free_some_pages(vcpu); 1455 kvm_mmu_free_some_pages(vcpu);
1457 r = __direct_map(vcpu, gpa, error_code & PFERR_WRITE_MASK, 1456 r = __direct_map(vcpu, gpa, error_code & PFERR_WRITE_MASK,
1458 largepage, gfn, pfn, kvm_x86_ops->get_tdp_level()); 1457 largepage, gfn, pfn);
1459 spin_unlock(&vcpu->kvm->mmu_lock); 1458 spin_unlock(&vcpu->kvm->mmu_lock);
1460 1459
1461 return r; 1460 return r;