diff options
author | David Hildenbrand <dahi@linux.vnet.ibm.com> | 2015-10-14 10:47:36 -0400 |
---|---|---|
committer | Christian Borntraeger <borntraeger@de.ibm.com> | 2016-09-08 03:07:51 -0400 |
commit | d6404ded303600a253e1770fa6670236adf12ce9 (patch) | |
tree | acfd998c8cf419818b2d71941cdf6694957cdaf9 /arch/s390/kvm/interrupt.c | |
parent | fa8410b355251fd30341662a40ac6b22d3e38468 (diff) |
KVM: s390: factor out actual delivery of machine checks
Let's factor this out to prepare for bigger changes. Reorder to calls to
match the logical order given in the PoP.
Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Signed-off-by: David Hildenbrand <dahi@linux.vnet.ibm.com>
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
Diffstat (limited to 'arch/s390/kvm/interrupt.c')
-rw-r--r-- | arch/s390/kvm/interrupt.c | 54 |
1 files changed, 31 insertions, 23 deletions
diff --git a/arch/s390/kvm/interrupt.c b/arch/s390/kvm/interrupt.c index 24524c0f3ef8..6e9442aef2d5 100644 --- a/arch/s390/kvm/interrupt.c +++ b/arch/s390/kvm/interrupt.c | |||
@@ -400,12 +400,40 @@ static int __must_check __deliver_pfault_init(struct kvm_vcpu *vcpu) | |||
400 | return rc ? -EFAULT : 0; | 400 | return rc ? -EFAULT : 0; |
401 | } | 401 | } |
402 | 402 | ||
403 | static int __write_machine_check(struct kvm_vcpu *vcpu, | ||
404 | struct kvm_s390_mchk_info *mchk) | ||
405 | { | ||
406 | unsigned long ext_sa_addr; | ||
407 | int rc; | ||
408 | |||
409 | /* Extended save area */ | ||
410 | rc = read_guest_lc(vcpu, __LC_VX_SAVE_AREA_ADDR, &ext_sa_addr, | ||
411 | sizeof(unsigned long)); | ||
412 | rc |= kvm_s390_vcpu_store_adtl_status(vcpu, ext_sa_addr); | ||
413 | |||
414 | /* General interruption information */ | ||
415 | rc |= write_guest_lc(vcpu, __LC_MCK_OLD_PSW, | ||
416 | &vcpu->arch.sie_block->gpsw, sizeof(psw_t)); | ||
417 | rc |= read_guest_lc(vcpu, __LC_MCK_NEW_PSW, | ||
418 | &vcpu->arch.sie_block->gpsw, sizeof(psw_t)); | ||
419 | rc |= put_guest_lc(vcpu, mchk->mcic, (u64 __user *) __LC_MCCK_CODE); | ||
420 | |||
421 | /* Register-save areas */ | ||
422 | rc |= kvm_s390_vcpu_store_status(vcpu, KVM_S390_STORE_STATUS_PREFIXED); | ||
423 | |||
424 | /* Extended interruption information */ | ||
425 | rc |= put_guest_lc(vcpu, mchk->failing_storage_address, | ||
426 | (u64 __user *) __LC_MCCK_FAIL_STOR_ADDR); | ||
427 | rc |= write_guest_lc(vcpu, __LC_PSW_SAVE_AREA, &mchk->fixed_logout, | ||
428 | sizeof(mchk->fixed_logout)); | ||
429 | return rc ? -EFAULT : 0; | ||
430 | } | ||
431 | |||
403 | static int __must_check __deliver_machine_check(struct kvm_vcpu *vcpu) | 432 | static int __must_check __deliver_machine_check(struct kvm_vcpu *vcpu) |
404 | { | 433 | { |
405 | struct kvm_s390_float_interrupt *fi = &vcpu->kvm->arch.float_int; | 434 | struct kvm_s390_float_interrupt *fi = &vcpu->kvm->arch.float_int; |
406 | struct kvm_s390_local_interrupt *li = &vcpu->arch.local_int; | 435 | struct kvm_s390_local_interrupt *li = &vcpu->arch.local_int; |
407 | struct kvm_s390_mchk_info mchk = {}; | 436 | struct kvm_s390_mchk_info mchk = {}; |
408 | unsigned long adtl_status_addr; | ||
409 | int deliver = 0; | 437 | int deliver = 0; |
410 | int rc = 0; | 438 | int rc = 0; |
411 | 439 | ||
@@ -446,29 +474,9 @@ static int __must_check __deliver_machine_check(struct kvm_vcpu *vcpu) | |||
446 | trace_kvm_s390_deliver_interrupt(vcpu->vcpu_id, | 474 | trace_kvm_s390_deliver_interrupt(vcpu->vcpu_id, |
447 | KVM_S390_MCHK, | 475 | KVM_S390_MCHK, |
448 | mchk.cr14, mchk.mcic); | 476 | mchk.cr14, mchk.mcic); |
449 | 477 | rc = __write_machine_check(vcpu, &mchk); | |
450 | rc = kvm_s390_vcpu_store_status(vcpu, | ||
451 | KVM_S390_STORE_STATUS_PREFIXED); | ||
452 | rc |= read_guest_lc(vcpu, __LC_VX_SAVE_AREA_ADDR, | ||
453 | &adtl_status_addr, | ||
454 | sizeof(unsigned long)); | ||
455 | rc |= kvm_s390_vcpu_store_adtl_status(vcpu, | ||
456 | adtl_status_addr); | ||
457 | rc |= put_guest_lc(vcpu, mchk.mcic, | ||
458 | (u64 __user *) __LC_MCCK_CODE); | ||
459 | rc |= put_guest_lc(vcpu, mchk.failing_storage_address, | ||
460 | (u64 __user *) __LC_MCCK_FAIL_STOR_ADDR); | ||
461 | rc |= write_guest_lc(vcpu, __LC_PSW_SAVE_AREA, | ||
462 | &mchk.fixed_logout, | ||
463 | sizeof(mchk.fixed_logout)); | ||
464 | rc |= write_guest_lc(vcpu, __LC_MCK_OLD_PSW, | ||
465 | &vcpu->arch.sie_block->gpsw, | ||
466 | sizeof(psw_t)); | ||
467 | rc |= read_guest_lc(vcpu, __LC_MCK_NEW_PSW, | ||
468 | &vcpu->arch.sie_block->gpsw, | ||
469 | sizeof(psw_t)); | ||
470 | } | 478 | } |
471 | return rc ? -EFAULT : 0; | 479 | return rc; |
472 | } | 480 | } |
473 | 481 | ||
474 | static int __must_check __deliver_restart(struct kvm_vcpu *vcpu) | 482 | static int __must_check __deliver_restart(struct kvm_vcpu *vcpu) |