diff options
author | Heiko Carstens <heiko.carstens@de.ibm.com> | 2014-01-01 16:47:12 +0100 |
---|---|---|
committer | Christian Borntraeger <borntraeger@de.ibm.com> | 2014-04-22 13:24:42 +0200 |
commit | 665170cb47acbddc202df0d8487ca867b64e1604 (patch) | |
tree | 05f5034f64d609a977435c940e88c050a5b9dec8 /arch/s390/kvm/priv.c | |
parent | d0bce6054a1759f1b2c86bf553801c77dcaca745 (diff) | |
download | op-kernel-dev-665170cb47acbddc202df0d8487ca867b64e1604.zip op-kernel-dev-665170cb47acbddc202df0d8487ca867b64e1604.tar.gz |
KVM: s390: convert __sigp_set_prefix()/handle_set_prefix()
Convert __sigp_set_prefix() and handle_set_prefix() 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 | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/arch/s390/kvm/priv.c b/arch/s390/kvm/priv.c index 7066fc5..dd6ad84 100644 --- a/arch/s390/kvm/priv.c +++ b/arch/s390/kvm/priv.c @@ -65,8 +65,8 @@ static int handle_set_clock(struct kvm_vcpu *vcpu) static int handle_set_prefix(struct kvm_vcpu *vcpu) { u64 operand2; - u32 address = 0; - u8 tmp; + u32 address; + int rc; vcpu->stat.instruction_spx++; @@ -80,14 +80,18 @@ static int handle_set_prefix(struct kvm_vcpu *vcpu) return kvm_s390_inject_program_int(vcpu, PGM_SPECIFICATION); /* get the value */ - if (get_guest(vcpu, address, (u32 __user *) operand2)) - return kvm_s390_inject_program_int(vcpu, PGM_ADDRESSING); + rc = read_guest(vcpu, operand2, &address, sizeof(address)); + if (rc) + return kvm_s390_inject_prog_cond(vcpu, rc); - address = address & 0x7fffe000u; + address &= 0x7fffe000u; - /* make sure that the new value is valid memory */ - if (copy_from_guest_absolute(vcpu, &tmp, address, 1) || - (copy_from_guest_absolute(vcpu, &tmp, address + PAGE_SIZE, 1))) + /* + * Make sure the new value is valid memory. We only need to check the + * first page, since address is 8k aligned and memory pieces are always + * at least 1MB aligned and have at least a size of 1MB. + */ + if (kvm_is_error_gpa(vcpu->kvm, address)) return kvm_s390_inject_program_int(vcpu, PGM_ADDRESSING); kvm_s390_set_prefix(vcpu, address); |