KVM: PPC: Make PAM a define
authorAlexander Graf <agraf@suse.de>
Thu, 29 Jul 2010 12:47:52 +0000 (14:47 +0200)
committerAvi Kivity <avi@redhat.com>
Sun, 24 Oct 2010 08:50:46 +0000 (10:50 +0200)
On PowerPC it's very normal to not support all of the physical RAM in real mode.
To check if we're matching on the shared page or not, we need to know the limits
so we can restrain ourselves to that range.

So let's make it a define instead of open-coding it. And while at it, let's also
increase it.

Signed-off-by: Alexander Graf <agraf@suse.de>
v2 -> v3:

  - RMO -> PAM (non-magic page)
Signed-off-by: Avi Kivity <avi@redhat.com>
arch/powerpc/include/asm/kvm_host.h
arch/powerpc/kvm/book3s.c

index 221cf85e9a6e46a5ed9ccf427dc22bfc863efa4b..1674da8134cb5a127e5b638729212528f64cb072 100644 (file)
@@ -48,6 +48,9 @@
 #define HPTEG_HASH_NUM_VPTE            (1 << HPTEG_HASH_BITS_VPTE)
 #define HPTEG_HASH_NUM_VPTE_LONG       (1 << HPTEG_HASH_BITS_VPTE_LONG)
 
+/* Physical Address Mask - allowed range of real mode RAM access */
+#define KVM_PAM                        0x0fffffffffffffffULL
+
 struct kvm;
 struct kvm_run;
 struct kvm_vcpu;
index 06229fec5c9f901111fcb9ea54daf708fe8e313e..0ed5376df82c13ab1636fb8b8ddc6b03954a38a7 100644 (file)
@@ -465,7 +465,7 @@ static int kvmppc_xlate(struct kvm_vcpu *vcpu, ulong eaddr, bool data,
                r = vcpu->arch.mmu.xlate(vcpu, eaddr, pte, data);
        } else {
                pte->eaddr = eaddr;
-               pte->raddr = eaddr & 0xffffffff;
+               pte->raddr = eaddr & KVM_PAM;
                pte->vpage = VSID_REAL | eaddr >> 12;
                pte->may_read = true;
                pte->may_write = true;
@@ -579,7 +579,7 @@ int kvmppc_handle_pagefault(struct kvm_run *run, struct kvm_vcpu *vcpu,
                pte.may_execute = true;
                pte.may_read = true;
                pte.may_write = true;
-               pte.raddr = eaddr & 0xffffffff;
+               pte.raddr = eaddr & KVM_PAM;
                pte.eaddr = eaddr;
                pte.vpage = eaddr >> 12;
        }