mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-01-09 14:50:19 +00:00
KVM: s390: Fix pfmf and conditional skey emulation
We should not return with a lock. We also have to increase the address when we do page clearing. Fixes: bd096f644319 ("KVM: s390: Add skey emulation fault handling") Signed-off-by: Janosch Frank <frankja@linux.ibm.com> Message-Id: <20180830081355.59234-1-frankja@linux.ibm.com> Reviewed-by: David Hildenbrand <david@redhat.com> Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
This commit is contained in:
parent
57361846b5
commit
a11bdb1a6b
@ -280,9 +280,11 @@ retry:
|
|||||||
goto retry;
|
goto retry;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (rc)
|
|
||||||
return kvm_s390_inject_program_int(vcpu, PGM_ADDRESSING);
|
|
||||||
up_read(¤t->mm->mmap_sem);
|
up_read(¤t->mm->mmap_sem);
|
||||||
|
if (rc == -EFAULT)
|
||||||
|
return kvm_s390_inject_program_int(vcpu, PGM_ADDRESSING);
|
||||||
|
if (rc < 0)
|
||||||
|
return rc;
|
||||||
vcpu->run->s.regs.gprs[reg1] &= ~0xff;
|
vcpu->run->s.regs.gprs[reg1] &= ~0xff;
|
||||||
vcpu->run->s.regs.gprs[reg1] |= key;
|
vcpu->run->s.regs.gprs[reg1] |= key;
|
||||||
return 0;
|
return 0;
|
||||||
@ -324,9 +326,11 @@ retry:
|
|||||||
goto retry;
|
goto retry;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (rc < 0)
|
|
||||||
return kvm_s390_inject_program_int(vcpu, PGM_ADDRESSING);
|
|
||||||
up_read(¤t->mm->mmap_sem);
|
up_read(¤t->mm->mmap_sem);
|
||||||
|
if (rc == -EFAULT)
|
||||||
|
return kvm_s390_inject_program_int(vcpu, PGM_ADDRESSING);
|
||||||
|
if (rc < 0)
|
||||||
|
return rc;
|
||||||
kvm_s390_set_psw_cc(vcpu, rc);
|
kvm_s390_set_psw_cc(vcpu, rc);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -390,12 +394,12 @@ static int handle_sske(struct kvm_vcpu *vcpu)
|
|||||||
FAULT_FLAG_WRITE, &unlocked);
|
FAULT_FLAG_WRITE, &unlocked);
|
||||||
rc = !rc ? -EAGAIN : rc;
|
rc = !rc ? -EAGAIN : rc;
|
||||||
}
|
}
|
||||||
|
up_read(¤t->mm->mmap_sem);
|
||||||
if (rc == -EFAULT)
|
if (rc == -EFAULT)
|
||||||
return kvm_s390_inject_program_int(vcpu, PGM_ADDRESSING);
|
return kvm_s390_inject_program_int(vcpu, PGM_ADDRESSING);
|
||||||
|
if (rc < 0)
|
||||||
up_read(¤t->mm->mmap_sem);
|
return rc;
|
||||||
if (rc >= 0)
|
start += PAGE_SIZE;
|
||||||
start += PAGE_SIZE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m3 & (SSKE_MC | SSKE_MR)) {
|
if (m3 & (SSKE_MC | SSKE_MR)) {
|
||||||
@ -1002,13 +1006,15 @@ static int handle_pfmf(struct kvm_vcpu *vcpu)
|
|||||||
FAULT_FLAG_WRITE, &unlocked);
|
FAULT_FLAG_WRITE, &unlocked);
|
||||||
rc = !rc ? -EAGAIN : rc;
|
rc = !rc ? -EAGAIN : rc;
|
||||||
}
|
}
|
||||||
|
up_read(¤t->mm->mmap_sem);
|
||||||
if (rc == -EFAULT)
|
if (rc == -EFAULT)
|
||||||
return kvm_s390_inject_program_int(vcpu, PGM_ADDRESSING);
|
return kvm_s390_inject_program_int(vcpu, PGM_ADDRESSING);
|
||||||
|
if (rc == -EAGAIN)
|
||||||
up_read(¤t->mm->mmap_sem);
|
continue;
|
||||||
if (rc >= 0)
|
if (rc < 0)
|
||||||
start += PAGE_SIZE;
|
return rc;
|
||||||
}
|
}
|
||||||
|
start += PAGE_SIZE;
|
||||||
}
|
}
|
||||||
if (vcpu->run->s.regs.gprs[reg1] & PFMF_FSC) {
|
if (vcpu->run->s.regs.gprs[reg1] & PFMF_FSC) {
|
||||||
if (psw_bits(vcpu->arch.sie_block->gpsw).eaba == PSW_BITS_AMODE_64BIT) {
|
if (psw_bits(vcpu->arch.sie_block->gpsw).eaba == PSW_BITS_AMODE_64BIT) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user