aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Huth <thuth@linux.vnet.ibm.com>2015-01-07 10:27:02 -0500
committerChristian Borntraeger <borntraeger@de.ibm.com>2015-01-23 07:25:38 -0500
commit3cfad02380f761af99770f22c327e5eedfad3934 (patch)
treeb40e34867c56a40cb498df6e02e08dea9a47131d
parent69a8d456263849152826542c7cb0a164b90e68a8 (diff)
KVM: s390: Take addressing mode into account for MVPG interception
The handler for MVPG partial execution interception does not take the current CPU addressing mode into account yet, so addresses are always treated as 64-bit addresses. For correct behaviour, we should properly handle 24-bit and 31-bit addresses, too. Since MVPG is defined to work with logical addresses, we can simply use guest_translate_address() to achieve the required behaviour (since DAT is disabled here, guest_translate_address() skips the MMU translation and only translates the address via kvm_s390_logical_to_effective() and kvm_s390_real_to_abs(), which is exactly what we want here). Signed-off-by: Thomas Huth <thuth@linux.vnet.ibm.com> Acked-by: Cornelia Huck <cornelia.huck@de.ibm.com> Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
-rw-r--r--arch/s390/kvm/intercept.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/arch/s390/kvm/intercept.c b/arch/s390/kvm/intercept.c
index 7c868a991411..bebd2157edd0 100644
--- a/arch/s390/kvm/intercept.c
+++ b/arch/s390/kvm/intercept.c
@@ -318,17 +318,19 @@ static int handle_mvpg_pei(struct kvm_vcpu *vcpu)
318 kvm_s390_get_regs_rre(vcpu, &reg1, &reg2); 318 kvm_s390_get_regs_rre(vcpu, &reg1, &reg2);
319 319
320 /* Make sure that the source is paged-in */ 320 /* Make sure that the source is paged-in */
321 srcaddr = kvm_s390_real_to_abs(vcpu, vcpu->run->s.regs.gprs[reg2]); 321 rc = guest_translate_address(vcpu, vcpu->run->s.regs.gprs[reg2],
322 if (kvm_is_error_gpa(vcpu->kvm, srcaddr)) 322 &srcaddr, 0);
323 return kvm_s390_inject_program_int(vcpu, PGM_ADDRESSING); 323 if (rc)
324 return kvm_s390_inject_prog_cond(vcpu, rc);
324 rc = kvm_arch_fault_in_page(vcpu, srcaddr, 0); 325 rc = kvm_arch_fault_in_page(vcpu, srcaddr, 0);
325 if (rc != 0) 326 if (rc != 0)
326 return rc; 327 return rc;
327 328
328 /* Make sure that the destination is paged-in */ 329 /* Make sure that the destination is paged-in */
329 dstaddr = kvm_s390_real_to_abs(vcpu, vcpu->run->s.regs.gprs[reg1]); 330 rc = guest_translate_address(vcpu, vcpu->run->s.regs.gprs[reg1],
330 if (kvm_is_error_gpa(vcpu->kvm, dstaddr)) 331 &dstaddr, 1);
331 return kvm_s390_inject_program_int(vcpu, PGM_ADDRESSING); 332 if (rc)
333 return kvm_s390_inject_prog_cond(vcpu, rc);
332 rc = kvm_arch_fault_in_page(vcpu, dstaddr, 1); 334 rc = kvm_arch_fault_in_page(vcpu, dstaddr, 1);
333 if (rc != 0) 335 if (rc != 0)
334 return rc; 336 return rc;