[PATCH 23/39] KVM: MMU: Unify direct map 4K and large page paths

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Avi Kivity
Date: Thursday, September 25, 2008 - 4:54 am

From: Avi Kivity <avi@qumranet.com>

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>
---
 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 51d4cd7..3ee856f 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;
 		}
 
-- 
1.6.0.1

--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH 06/39] KVM: fix i8259 reset irq acking, Avi Kivity, (Thu Sep 25, 4:54 am)
[PATCH 13/39] KVM: SVM: Fix typo, Avi Kivity, (Thu Sep 25, 4:54 am)
[PATCH 19/39] KVM: Load real mode segments correctly, Avi Kivity, (Thu Sep 25, 4:54 am)
[PATCH 23/39] KVM: MMU: Unify direct map 4K and large page ..., Avi Kivity, (Thu Sep 25, 4:54 am)
[PATCH 26/39] KVM: MMU: Add generic shadow walker, Avi Kivity, (Thu Sep 25, 4:54 am)
[PATCH 37/39] KVM: add MC5_MISC msr read support, Avi Kivity, (Thu Sep 25, 4:55 am)