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

From: Avi Kivity
Date: Thu Sep 25 2008 - 08:07:32 EST


From: Avi Kivity <avi@xxxxxxxxxxxx>

The two paths are equivalent except for one argument, which is already
available. Merge the two codepaths.

Signed-off-by: Avi Kivity <avi@xxxxxxxxxxxx>
---
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

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/