Commit c51f068c authored by Heiko Carstens's avatar Heiko Carstens Committed by Gleb Natapov

KVM: s390: fix stsi exception handling

In case of an exception the guest psw condition code should be left alone.
Signed-off-by: default avatarHeiko Carstens <heiko.carstens@de.ibm.com>
Acked-By: default avatarCornelia Huck <cornelia.huck@de.ibm.com>
Signed-off-by: default avatarCornelia Huck <cornelia.huck@de.ibm.com>
Signed-off-by: default avatarGleb Natapov <gleb@redhat.com>
parent db4a29cb
...@@ -343,8 +343,8 @@ static int handle_stsi(struct kvm_vcpu *vcpu) ...@@ -343,8 +343,8 @@ static int handle_stsi(struct kvm_vcpu *vcpu)
int fc = (vcpu->run->s.regs.gprs[0] & 0xf0000000) >> 28; int fc = (vcpu->run->s.regs.gprs[0] & 0xf0000000) >> 28;
int sel1 = vcpu->run->s.regs.gprs[0] & 0xff; int sel1 = vcpu->run->s.regs.gprs[0] & 0xff;
int sel2 = vcpu->run->s.regs.gprs[1] & 0xffff; int sel2 = vcpu->run->s.regs.gprs[1] & 0xffff;
unsigned long mem = 0;
u64 operand2; u64 operand2;
unsigned long mem;
int rc = 0; int rc = 0;
vcpu->stat.instruction_stsi++; vcpu->stat.instruction_stsi++;
...@@ -364,36 +364,36 @@ static int handle_stsi(struct kvm_vcpu *vcpu) ...@@ -364,36 +364,36 @@ static int handle_stsi(struct kvm_vcpu *vcpu)
case 2: case 2:
mem = get_zeroed_page(GFP_KERNEL); mem = get_zeroed_page(GFP_KERNEL);
if (!mem) if (!mem)
goto out_fail; goto out_no_data;
if (stsi((void *) mem, fc, sel1, sel2)) if (stsi((void *) mem, fc, sel1, sel2))
goto out_mem; goto out_no_data;
break; break;
case 3: case 3:
if (sel1 != 2 || sel2 != 2) if (sel1 != 2 || sel2 != 2)
goto out_fail; goto out_no_data;
mem = get_zeroed_page(GFP_KERNEL); mem = get_zeroed_page(GFP_KERNEL);
if (!mem) if (!mem)
goto out_fail; goto out_no_data;
handle_stsi_3_2_2(vcpu, (void *) mem); handle_stsi_3_2_2(vcpu, (void *) mem);
break; break;
default: default:
goto out_fail; goto out_no_data;
} }
if (copy_to_guest_absolute(vcpu, operand2, (void *) mem, PAGE_SIZE)) { if (copy_to_guest_absolute(vcpu, operand2, (void *) mem, PAGE_SIZE)) {
rc = kvm_s390_inject_program_int(vcpu, PGM_ADDRESSING); rc = kvm_s390_inject_program_int(vcpu, PGM_ADDRESSING);
goto out_mem; goto out_exception;
} }
trace_kvm_s390_handle_stsi(vcpu, fc, sel1, sel2, operand2); trace_kvm_s390_handle_stsi(vcpu, fc, sel1, sel2, operand2);
free_page(mem); free_page(mem);
vcpu->arch.sie_block->gpsw.mask &= ~(3ul << 44); vcpu->arch.sie_block->gpsw.mask &= ~(3ul << 44);
vcpu->run->s.regs.gprs[0] = 0; vcpu->run->s.regs.gprs[0] = 0;
return 0; return 0;
out_mem: out_no_data:
free_page(mem);
out_fail:
/* condition code 3 */ /* condition code 3 */
vcpu->arch.sie_block->gpsw.mask |= 3ul << 44; vcpu->arch.sie_block->gpsw.mask |= 3ul << 44;
out_exception:
free_page(mem);
return rc; return rc;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment