diff options
author | Heiko Carstens <heiko.carstens@de.ibm.com> | 2014-01-01 10:57:42 -0500 |
---|---|---|
committer | Christian Borntraeger <borntraeger@de.ibm.com> | 2014-04-22 07:24:45 -0400 |
commit | 2d8bcaeda1576ddd970629a6afb9a188c83cd409 (patch) | |
tree | a3b78791ba34fcdaab7866404d9a6c763e6d737a /arch/s390/kvm/priv.c | |
parent | 2f32d4ea280c35d5f3a43fe7724020cb4824fffa (diff) |
KVM: s390: convert handle_lpsw[e]()
Convert handle_lpsw[e]() to new guest access functions.
Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Reviewed-by: Thomas Huth <thuth@linux.vnet.ibm.com>
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
Diffstat (limited to 'arch/s390/kvm/priv.c')
-rw-r--r-- | arch/s390/kvm/priv.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/arch/s390/kvm/priv.c b/arch/s390/kvm/priv.c index f4451f09b9ed..2de74543bd07 100644 --- a/arch/s390/kvm/priv.c +++ b/arch/s390/kvm/priv.c | |||
@@ -381,6 +381,7 @@ int kvm_s390_handle_lpsw(struct kvm_vcpu *vcpu) | |||
381 | psw_t *gpsw = &vcpu->arch.sie_block->gpsw; | 381 | psw_t *gpsw = &vcpu->arch.sie_block->gpsw; |
382 | psw_compat_t new_psw; | 382 | psw_compat_t new_psw; |
383 | u64 addr; | 383 | u64 addr; |
384 | int rc; | ||
384 | 385 | ||
385 | if (gpsw->mask & PSW_MASK_PSTATE) | 386 | if (gpsw->mask & PSW_MASK_PSTATE) |
386 | return kvm_s390_inject_program_int(vcpu, PGM_PRIVILEGED_OP); | 387 | return kvm_s390_inject_program_int(vcpu, PGM_PRIVILEGED_OP); |
@@ -388,8 +389,10 @@ int kvm_s390_handle_lpsw(struct kvm_vcpu *vcpu) | |||
388 | addr = kvm_s390_get_base_disp_s(vcpu); | 389 | addr = kvm_s390_get_base_disp_s(vcpu); |
389 | if (addr & 7) | 390 | if (addr & 7) |
390 | return kvm_s390_inject_program_int(vcpu, PGM_SPECIFICATION); | 391 | return kvm_s390_inject_program_int(vcpu, PGM_SPECIFICATION); |
391 | if (copy_from_guest(vcpu, &new_psw, addr, sizeof(new_psw))) | 392 | |
392 | return kvm_s390_inject_program_int(vcpu, PGM_ADDRESSING); | 393 | rc = read_guest(vcpu, addr, &new_psw, sizeof(new_psw)); |
394 | if (rc) | ||
395 | return kvm_s390_inject_prog_cond(vcpu, rc); | ||
393 | if (!(new_psw.mask & PSW32_MASK_BASE)) | 396 | if (!(new_psw.mask & PSW32_MASK_BASE)) |
394 | return kvm_s390_inject_program_int(vcpu, PGM_SPECIFICATION); | 397 | return kvm_s390_inject_program_int(vcpu, PGM_SPECIFICATION); |
395 | gpsw->mask = (new_psw.mask & ~PSW32_MASK_BASE) << 32; | 398 | gpsw->mask = (new_psw.mask & ~PSW32_MASK_BASE) << 32; |
@@ -405,6 +408,7 @@ static int handle_lpswe(struct kvm_vcpu *vcpu) | |||
405 | { | 408 | { |
406 | psw_t new_psw; | 409 | psw_t new_psw; |
407 | u64 addr; | 410 | u64 addr; |
411 | int rc; | ||
408 | 412 | ||
409 | if (vcpu->arch.sie_block->gpsw.mask & PSW_MASK_PSTATE) | 413 | if (vcpu->arch.sie_block->gpsw.mask & PSW_MASK_PSTATE) |
410 | return kvm_s390_inject_program_int(vcpu, PGM_PRIVILEGED_OP); | 414 | return kvm_s390_inject_program_int(vcpu, PGM_PRIVILEGED_OP); |
@@ -412,8 +416,9 @@ static int handle_lpswe(struct kvm_vcpu *vcpu) | |||
412 | addr = kvm_s390_get_base_disp_s(vcpu); | 416 | addr = kvm_s390_get_base_disp_s(vcpu); |
413 | if (addr & 7) | 417 | if (addr & 7) |
414 | return kvm_s390_inject_program_int(vcpu, PGM_SPECIFICATION); | 418 | return kvm_s390_inject_program_int(vcpu, PGM_SPECIFICATION); |
415 | if (copy_from_guest(vcpu, &new_psw, addr, sizeof(new_psw))) | 419 | rc = read_guest(vcpu, addr, &new_psw, sizeof(new_psw)); |
416 | return kvm_s390_inject_program_int(vcpu, PGM_ADDRESSING); | 420 | if (rc) |
421 | return kvm_s390_inject_prog_cond(vcpu, rc); | ||
417 | vcpu->arch.sie_block->gpsw = new_psw; | 422 | vcpu->arch.sie_block->gpsw = new_psw; |
418 | if (!is_valid_psw(&vcpu->arch.sie_block->gpsw)) | 423 | if (!is_valid_psw(&vcpu->arch.sie_block->gpsw)) |
419 | return kvm_s390_inject_program_int(vcpu, PGM_SPECIFICATION); | 424 | return kvm_s390_inject_program_int(vcpu, PGM_SPECIFICATION); |