aboutsummaryrefslogtreecommitdiffstats
path: root/arch/s390/kvm/priv.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/s390/kvm/priv.c')
-rw-r--r--arch/s390/kvm/priv.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/arch/s390/kvm/priv.c b/arch/s390/kvm/priv.c
index 72bb2dd8b9cd..f47cb0c6d906 100644
--- a/arch/s390/kvm/priv.c
+++ b/arch/s390/kvm/priv.c
@@ -156,21 +156,25 @@ static int handle_store_cpu_address(struct kvm_vcpu *vcpu)
156 return 0; 156 return 0;
157} 157}
158 158
159static void __skey_check_enable(struct kvm_vcpu *vcpu) 159static int __skey_check_enable(struct kvm_vcpu *vcpu)
160{ 160{
161 int rc = 0;
161 if (!(vcpu->arch.sie_block->ictl & (ICTL_ISKE | ICTL_SSKE | ICTL_RRBE))) 162 if (!(vcpu->arch.sie_block->ictl & (ICTL_ISKE | ICTL_SSKE | ICTL_RRBE)))
162 return; 163 return rc;
163 164
164 s390_enable_skey(); 165 rc = s390_enable_skey();
165 trace_kvm_s390_skey_related_inst(vcpu); 166 trace_kvm_s390_skey_related_inst(vcpu);
166 vcpu->arch.sie_block->ictl &= ~(ICTL_ISKE | ICTL_SSKE | ICTL_RRBE); 167 vcpu->arch.sie_block->ictl &= ~(ICTL_ISKE | ICTL_SSKE | ICTL_RRBE);
168 return rc;
167} 169}
168 170
169 171
170static int handle_skey(struct kvm_vcpu *vcpu) 172static int handle_skey(struct kvm_vcpu *vcpu)
171{ 173{
172 __skey_check_enable(vcpu); 174 int rc = __skey_check_enable(vcpu);
173 175
176 if (rc)
177 return rc;
174 vcpu->stat.instruction_storage_key++; 178 vcpu->stat.instruction_storage_key++;
175 179
176 if (vcpu->arch.sie_block->gpsw.mask & PSW_MASK_PSTATE) 180 if (vcpu->arch.sie_block->gpsw.mask & PSW_MASK_PSTATE)
@@ -683,7 +687,10 @@ static int handle_pfmf(struct kvm_vcpu *vcpu)
683 } 687 }
684 688
685 if (vcpu->run->s.regs.gprs[reg1] & PFMF_SK) { 689 if (vcpu->run->s.regs.gprs[reg1] & PFMF_SK) {
686 __skey_check_enable(vcpu); 690 int rc = __skey_check_enable(vcpu);
691
692 if (rc)
693 return rc;
687 if (set_guest_storage_key(current->mm, useraddr, 694 if (set_guest_storage_key(current->mm, useraddr,
688 vcpu->run->s.regs.gprs[reg1] & PFMF_KEY, 695 vcpu->run->s.regs.gprs[reg1] & PFMF_KEY,
689 vcpu->run->s.regs.gprs[reg1] & PFMF_NQ)) 696 vcpu->run->s.regs.gprs[reg1] & PFMF_NQ))