diff options
author | Alexander Graf <agraf@suse.de> | 2014-06-20 13:52:36 +0200 |
---|---|---|
committer | Alexander Graf <agraf@suse.de> | 2014-07-28 16:15:50 +0200 |
commit | 7d15c06f1abfe4b893c6c2c8a306b02210a6a6db (patch) | |
tree | 7c29513bfb6b32194ea7ac8c1b7c3e0048aacb12 /arch/powerpc/kvm/book3s.c | |
parent | 63fff5c1e3695ff5c9ad8c198a3b03ca4c0c73a8 (diff) | |
download | linux-7d15c06f1abfe4b893c6c2c8a306b02210a6a6db.tar.bz2 |
KVM: PPC: Implement kvmppc_xlate for all targets
We have a nice API to find the translated GPAs of a GVA including protection
flags. So far we only use it on Book3S, but there's no reason the same shouldn't
be used on BookE as well.
Implement a kvmppc_xlate() version for BookE and clean it up to make it more
readable in general.
Signed-off-by: Alexander Graf <agraf@suse.de>
Diffstat (limited to 'arch/powerpc/kvm/book3s.c')
-rw-r--r-- | arch/powerpc/kvm/book3s.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/arch/powerpc/kvm/book3s.c b/arch/powerpc/kvm/book3s.c index a3cbada114bc..0b6c84e0352d 100644 --- a/arch/powerpc/kvm/book3s.c +++ b/arch/powerpc/kvm/book3s.c @@ -380,9 +380,11 @@ pfn_t kvmppc_gpa_to_pfn(struct kvm_vcpu *vcpu, gpa_t gpa, bool writing, } EXPORT_SYMBOL_GPL(kvmppc_gpa_to_pfn); -static int kvmppc_xlate(struct kvm_vcpu *vcpu, ulong eaddr, bool data, - bool iswrite, struct kvmppc_pte *pte) +int kvmppc_xlate(struct kvm_vcpu *vcpu, ulong eaddr, enum xlate_instdata xlid, + enum xlate_readwrite xlrw, struct kvmppc_pte *pte) { + bool data = (xlid == XLATE_DATA); + bool iswrite = (xlrw == XLATE_WRITE); int relocated = (kvmppc_get_msr(vcpu) & (data ? MSR_DR : MSR_IR)); int r; @@ -434,7 +436,8 @@ int kvmppc_st(struct kvm_vcpu *vcpu, ulong *eaddr, int size, void *ptr, vcpu->stat.st++; - r = kvmppc_xlate(vcpu, *eaddr, data, true, &pte); + r = kvmppc_xlate(vcpu, *eaddr, data ? XLATE_DATA : XLATE_INST, + XLATE_WRITE, &pte); if (r < 0) return r; @@ -459,7 +462,8 @@ int kvmppc_ld(struct kvm_vcpu *vcpu, ulong *eaddr, int size, void *ptr, vcpu->stat.ld++; - rc = kvmppc_xlate(vcpu, *eaddr, data, false, &pte); + rc = kvmppc_xlate(vcpu, *eaddr, data ? XLATE_DATA : XLATE_INST, + XLATE_READ, &pte); if (rc) return rc; |