aboutsummaryrefslogtreecommitdiffstats
path: root/arch/s390
diff options
context:
space:
mode:
authorThomas Huth <thuth@linux.vnet.ibm.com>2014-05-07 05:44:17 -0400
committerChristian Borntraeger <borntraeger@de.ibm.com>2014-05-16 08:57:22 -0400
commitf22166dcfd30b46bb729abaf7ba3e1dd9e5d2093 (patch)
tree812186c91b28c2e8aa25b3d953dab5789d46b7ae /arch/s390
parentfa576c583d877d667d9acaed909a3dfc6b03e138 (diff)
KVM: s390: Improved MVPG partial execution handler
Use the new helper function kvm_arch_fault_in_page() for faulting-in the guest pages and only inject addressing errors when we've really hit a bad address (and return other error codes to userspace instead). Signed-off-by: Thomas Huth <thuth@linux.vnet.ibm.com> Reviewed-by: Christian Borntraeger <borntraeger@de.ibm.com> Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com> Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
Diffstat (limited to 'arch/s390')
-rw-r--r--arch/s390/kvm/intercept.c25
1 files changed, 9 insertions, 16 deletions
diff --git a/arch/s390/kvm/intercept.c b/arch/s390/kvm/intercept.c
index ddc69f5f5e19..147b87fefecd 100644
--- a/arch/s390/kvm/intercept.c
+++ b/arch/s390/kvm/intercept.c
@@ -292,33 +292,26 @@ static int handle_external_interrupt(struct kvm_vcpu *vcpu)
292 */ 292 */
293static int handle_mvpg_pei(struct kvm_vcpu *vcpu) 293static int handle_mvpg_pei(struct kvm_vcpu *vcpu)
294{ 294{
295 unsigned long hostaddr, srcaddr, dstaddr;
296 psw_t *psw = &vcpu->arch.sie_block->gpsw; 295 psw_t *psw = &vcpu->arch.sie_block->gpsw;
297 struct mm_struct *mm = current->mm; 296 unsigned long srcaddr, dstaddr;
298 int reg1, reg2, rc; 297 int reg1, reg2, rc;
299 298
300 kvm_s390_get_regs_rre(vcpu, &reg1, &reg2); 299 kvm_s390_get_regs_rre(vcpu, &reg1, &reg2);
301 srcaddr = kvm_s390_real_to_abs(vcpu, vcpu->run->s.regs.gprs[reg2]);
302 dstaddr = kvm_s390_real_to_abs(vcpu, vcpu->run->s.regs.gprs[reg1]);
303 300
304 /* Make sure that the source is paged-in */ 301 /* Make sure that the source is paged-in */
305 hostaddr = gmap_fault(srcaddr, vcpu->arch.gmap); 302 srcaddr = kvm_s390_real_to_abs(vcpu, vcpu->run->s.regs.gprs[reg2]);
306 if (IS_ERR_VALUE(hostaddr)) 303 if (kvm_is_error_gpa(vcpu->kvm, srcaddr))
307 return kvm_s390_inject_program_int(vcpu, PGM_ADDRESSING); 304 return kvm_s390_inject_program_int(vcpu, PGM_ADDRESSING);
308 down_read(&mm->mmap_sem); 305 rc = kvm_arch_fault_in_page(vcpu, srcaddr, 0);
309 rc = get_user_pages(current, mm, hostaddr, 1, 0, 0, NULL, NULL); 306 if (rc != 0)
310 up_read(&mm->mmap_sem);
311 if (rc < 0)
312 return rc; 307 return rc;
313 308
314 /* Make sure that the destination is paged-in */ 309 /* Make sure that the destination is paged-in */
315 hostaddr = gmap_fault(dstaddr, vcpu->arch.gmap); 310 dstaddr = kvm_s390_real_to_abs(vcpu, vcpu->run->s.regs.gprs[reg1]);
316 if (IS_ERR_VALUE(hostaddr)) 311 if (kvm_is_error_gpa(vcpu->kvm, dstaddr))
317 return kvm_s390_inject_program_int(vcpu, PGM_ADDRESSING); 312 return kvm_s390_inject_program_int(vcpu, PGM_ADDRESSING);
318 down_read(&mm->mmap_sem); 313 rc = kvm_arch_fault_in_page(vcpu, dstaddr, 1);
319 rc = get_user_pages(current, mm, hostaddr, 1, 1, 0, NULL, NULL); 314 if (rc != 0)
320 up_read(&mm->mmap_sem);
321 if (rc < 0)
322 return rc; 315 return rc;
323 316
324 psw->addr = __rewind_psw(*psw, 4); 317 psw->addr = __rewind_psw(*psw, 4);