]> bbs.cooldavid.org Git - net-next-2.6.git/commitdiff
KVM: MMU: Introduce kvm_pdptr_read_mmu
authorJoerg Roedel <joerg.roedel@amd.com>
Fri, 10 Sep 2010 15:30:58 +0000 (17:30 +0200)
committerAvi Kivity <avi@redhat.com>
Sun, 24 Oct 2010 08:52:42 +0000 (10:52 +0200)
This function is implemented to load the pdptr pointers of
the currently running guest (l1 or l2 guest). Therefore it
takes care about the current paging mode and can read pdptrs
out of l2 guest physical memory.

Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
arch/x86/kvm/kvm_cache_regs.h
arch/x86/kvm/mmu.c
arch/x86/kvm/paging_tmpl.h

index a37abe2ec39ad63b60197c0e8751304ee8363df8..975bb45329a102882b52d1a0cb29b95e9660dc8b 100644 (file)
@@ -45,6 +45,13 @@ static inline u64 kvm_pdptr_read(struct kvm_vcpu *vcpu, int index)
        return vcpu->arch.walk_mmu->pdptrs[index];
 }
 
+static inline u64 kvm_pdptr_read_mmu(struct kvm_vcpu *vcpu, struct kvm_mmu *mmu, int index)
+{
+       load_pdptrs(vcpu, mmu, mmu->get_cr3(vcpu));
+
+       return mmu->pdptrs[index];
+}
+
 static inline ulong kvm_read_cr0_bits(struct kvm_vcpu *vcpu, ulong mask)
 {
        ulong tmask = mask & KVM_POSSIBLE_CR0_GUEST_BITS;
index a26f13bd34e079d210998bd818a81fbd7d6d8c42..a25173a0d8b97d35c9b1b33dd5e44a0843f7e0a4 100644 (file)
@@ -2398,7 +2398,7 @@ static int mmu_alloc_roots(struct kvm_vcpu *vcpu)
 
                ASSERT(!VALID_PAGE(root));
                if (vcpu->arch.mmu.root_level == PT32E_ROOT_LEVEL) {
-                       pdptr = kvm_pdptr_read(vcpu, i);
+                       pdptr = kvm_pdptr_read_mmu(vcpu, &vcpu->arch.mmu, i);
                        if (!is_present_gpte(pdptr)) {
                                vcpu->arch.mmu.pae_root[i] = 0;
                                continue;
index f4e09d341e283ded6c400ab6ec604c0680718a75..a28f09bb76c60f2705c58d9256233770041eb7e9 100644 (file)
@@ -137,7 +137,7 @@ walk:
 
 #if PTTYPE == 64
        if (walker->level == PT32E_ROOT_LEVEL) {
-               pte = kvm_pdptr_read(vcpu, (addr >> 30) & 3);
+               pte = kvm_pdptr_read_mmu(vcpu, mmu, (addr >> 30) & 3);
                trace_kvm_mmu_paging_element(pte, walker->level);
                if (!is_present_gpte(pte)) {
                        present = false;