We currently use cr3, which is a random number for direct maps. Use zero instead (the start of the linear range mapped by the root). Signed-off-by: Avi Kivity <avi@xxxxxxxxxx> --- arch/x86/kvm/mmu.c | 9 +++++---- 1 files changed, 5 insertions(+), 4 deletions(-) diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c index 4da4ff1..6e925b3 100644 --- a/arch/x86/kvm/mmu.c +++ b/arch/x86/kvm/mmu.c @@ -2070,16 +2070,17 @@ static int mmu_alloc_roots(struct kvm_vcpu *vcpu) for (i = 0; i < nr_roots; ++i) { root = rootp[i]; ASSERT(!VALID_PAGE(root)); - if (vcpu->arch.mmu.root_level == PT32E_ROOT_LEVEL) { + + if (direct) + root_gfn = 0; + else if (vcpu->arch.mmu.root_level == PT32E_ROOT_LEVEL) { pdptr = kvm_pdptr_read(vcpu, i); if (!is_present_gpte(pdptr)) { rootp[i] = 0; continue; } root_gfn = pdptr >> PAGE_SHIFT; - } else if (vcpu->arch.mmu.root_level == 0) - root_gfn = 0; - else + } else root_gfn = vcpu->arch.cr3 >> PAGE_SHIFT; if (mmu_check_root(vcpu, root_gfn)) -- 1.7.0.4 -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html