diff options
author | Avi Kivity <avi@qumranet.com> | 2008-08-22 12:14:17 -0400 |
---|---|---|
committer | Avi Kivity <avi@qumranet.com> | 2008-10-15 04:15:22 -0400 |
commit | 6e37d3dc3e358dbf907f8b96a51282966934124b (patch) | |
tree | 9a759cc77d4ca952b4c2aca2f10d8b4239f682a3 /arch/x86/kvm/mmu.c | |
parent | 135f8c2b078533cc74e75f696e73d47304a61125 (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/x86/kvm/mmu.c')
-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, | |||
1240 | ASSERT(VALID_PAGE(table_addr)); | 1240 | ASSERT(VALID_PAGE(table_addr)); |
1241 | table = __va(table_addr); | 1241 | table = __va(table_addr); |
1242 | 1242 | ||
1243 | if (level == 1) { | 1243 | if (level == 1 || (largepage && level == 2)) { |
1244 | mmu_set_spte(vcpu, &table[index], ACC_ALL, ACC_ALL, | 1244 | mmu_set_spte(vcpu, &table[index], ACC_ALL, ACC_ALL, |
1245 | 0, write, 1, &pt_write, 0, gfn, pfn, false); | 1245 | 0, write, 1, &pt_write, largepage, |
1246 | return pt_write; | 1246 | gfn, pfn, false); |
1247 | } | ||
1248 | |||
1249 | if (largepage && level == 2) { | ||
1250 | mmu_set_spte(vcpu, &table[index], ACC_ALL, ACC_ALL, | ||
1251 | 0, write, 1, &pt_write, 1, gfn, pfn, false); | ||
1252 | return pt_write; | 1247 | return pt_write; |
1253 | } | 1248 | } |
1254 | 1249 | ||