KVM: PPC: Book3S: Stop PTE lookup on write errors
authorAlexander Graf <agraf@suse.de>
Thu, 10 Jul 2014 17:22:03 +0000 (19:22 +0200)
committerAlexander Graf <agraf@suse.de>
Mon, 28 Jul 2014 13:23:10 +0000 (15:23 +0200)
When a page lookup failed because we're not allowed to write to the page, we
should not overwrite that value with another lookup on the second PTEG which
will return "page not found". Instead, we should just tell the caller that we
had a permission problem.

This fixes Mac OS X guests looping endlessly in page lookup code for me.

Signed-off-by: Alexander Graf <agraf@suse.de>
arch/powerpc/kvm/book3s_32_mmu.c

index 93503bbdae43df28efe2b0ab90f52352e0600898..cd0b0730e29e511f1eb4654e7087ccd0ace4bc3b 100644 (file)
@@ -335,7 +335,7 @@ static int kvmppc_mmu_book3s_32_xlate(struct kvm_vcpu *vcpu, gva_t eaddr,
        if (r < 0)
                r = kvmppc_mmu_book3s_32_xlate_pte(vcpu, eaddr, pte,
                                                   data, iswrite, true);
-       if (r < 0)
+       if (r == -ENOENT)
                r = kvmppc_mmu_book3s_32_xlate_pte(vcpu, eaddr, pte,
                                                   data, iswrite, false);