diff options
author | Paul Mackerras <paulus@samba.org> | 2014-03-24 19:47:04 -0400 |
---|---|---|
committer | Paul Mackerras <paulus@samba.org> | 2014-03-29 04:58:23 -0400 |
commit | b24f36f33ea088771c2bb7c09e84d0ddea35cf55 (patch) | |
tree | 494c54ce7d7393b8b60bd84422b867b171c35356 | |
parent | a7d80d01c68ed7d3fbc7bcf4541e6fb7e6b87cd6 (diff) |
KVM: PPC: Book3S: Trim top 4 bits of physical address in RTAS code
The in-kernel emulation of RTAS functions needs to read the argument
buffer from guest memory in order to find out what function is being
requested. The guest supplies the guest physical address of the buffer,
and on a real system the code that reads that buffer would run in guest
real mode. In guest real mode, the processor ignores the top 4 bits
of the address specified in load and store instructions. In order to
emulate that behaviour correctly, we need to mask off those bits
before calling kvm_read_guest() or kvm_write_guest(). This adds that
masking.
Signed-off-by: Paul Mackerras <paulus@samba.org>
Acked-by: Scott Wood <scottwood@freescale.com>
-rw-r--r-- | arch/powerpc/kvm/book3s_rtas.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/arch/powerpc/kvm/book3s_rtas.c b/arch/powerpc/kvm/book3s_rtas.c index cf95cdef73c9..7a053157483b 100644 --- a/arch/powerpc/kvm/book3s_rtas.c +++ b/arch/powerpc/kvm/book3s_rtas.c | |||
@@ -213,8 +213,11 @@ int kvmppc_rtas_hcall(struct kvm_vcpu *vcpu) | |||
213 | gpa_t args_phys; | 213 | gpa_t args_phys; |
214 | int rc; | 214 | int rc; |
215 | 215 | ||
216 | /* r4 contains the guest physical address of the RTAS args */ | 216 | /* |
217 | args_phys = kvmppc_get_gpr(vcpu, 4); | 217 | * r4 contains the guest physical address of the RTAS args |
218 | * Mask off the top 4 bits since this is a guest real address | ||
219 | */ | ||
220 | args_phys = kvmppc_get_gpr(vcpu, 4) & KVM_PAM; | ||
218 | 221 | ||
219 | rc = kvm_read_guest(vcpu->kvm, args_phys, &args, sizeof(args)); | 222 | rc = kvm_read_guest(vcpu->kvm, args_phys, &args, sizeof(args)); |
220 | if (rc) | 223 | if (rc) |