aboutsummaryrefslogtreecommitdiff
path: root/arch
diff options
context:
space:
mode:
authorAvi Kivity <avi@qumranet.com>2008-08-22 19:14:17 +0300
committerAvi Kivity <avi@qumranet.com>2008-10-15 10:15:22 +0200
commit6e37d3dc3e358dbf907f8b96a51282966934124b (patch)
tree9a759cc77d4ca952b4c2aca2f10d8b4239f682a3 /arch
parent135f8c2b078533cc74e75f696e73d47304a61125 (diff)
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>
Diffstat (limited to 'arch')
-rw-r--r--arch/x86/kvm/mmu.c11
1 files changed, 3 insertions, 8 deletions
diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c
index 51d4cd7ae4f..3ee856f6812 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;
}