diff options
author | Avi Kivity <avi@qumranet.com> | 2008-08-22 20:14:17 +0400 |
---|---|---|
committer | Avi Kivity <avi@qumranet.com> | 2008-10-15 12:15:22 +0400 |
commit | 6e37d3dc3e358dbf907f8b96a51282966934124b (patch) | |
tree | 9a759cc77d4ca952b4c2aca2f10d8b4239f682a3 | |
parent | 135f8c2b078533cc74e75f696e73d47304a61125 (diff) | |
download | linux-6e37d3dc3e358dbf907f8b96a51282966934124b.tar.xz |
KVM: MMU: Unify direct map 4K and large page paths
The two paths are equivalent except for one argument, which is already
available. Merge the two codepaths.
Signed-off-by: Avi Kivity <avi@qumranet.com>
-rw-r--r-- | arch/x86/kvm/mmu.c | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c index 51d4cd7ae4f9..3ee856f6812d 100644 --- a/arch/x86/kvm/mmu.c +++ b/arch/x86/kvm/mmu.c @@ -1240,15 +1240,10 @@ static int __direct_map(struct kvm_vcpu *vcpu, gpa_t v, int write, ASSERT(VALID_PAGE(table_addr)); table = __va(table_addr); - if (level == 1) { + if (level == 1 || (largepage && level == 2)) { mmu_set_spte(vcpu, &table[index], ACC_ALL, ACC_ALL, - 0, write, 1, &pt_write, 0, gfn, pfn, false); - return pt_write; - } - - if (largepage && level == 2) { - mmu_set_spte(vcpu, &table[index], ACC_ALL, ACC_ALL, - 0, write, 1, &pt_write, 1, gfn, pfn, false); + 0, write, 1, &pt_write, largepage, + gfn, pfn, false); return pt_write; } |