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>
This commit is contained in:
parent
135f8c2b07
commit
6e37d3dc3e
@ -1240,15 +1240,10 @@ static int __direct_map(struct kvm_vcpu *vcpu, gpa_t v, int write,
|
|||||||
ASSERT(VALID_PAGE(table_addr));
|
ASSERT(VALID_PAGE(table_addr));
|
||||||
table = __va(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,
|
mmu_set_spte(vcpu, &table[index], ACC_ALL, ACC_ALL,
|
||||||
0, write, 1, &pt_write, 0, gfn, pfn, false);
|
0, write, 1, &pt_write, largepage,
|
||||||
return pt_write;
|
gfn, pfn, false);
|
||||||
}
|
|
||||||
|
|
||||||
if (largepage && level == 2) {
|
|
||||||
mmu_set_spte(vcpu, &table[index], ACC_ALL, ACC_ALL,
|
|
||||||
0, write, 1, &pt_write, 1, gfn, pfn, false);
|
|
||||||
return pt_write;
|
return pt_write;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user