intercept.c (74a439ef7b67d89d29ec7485c3aeca20a64449c5) intercept.c (ba853a4e1c7addc631df55535bf0b04c62dc79d8)
1// SPDX-License-Identifier: GPL-2.0
2/*
3 * in-kernel handling for sie intercepts
4 *
5 * Copyright IBM Corp. 2008, 2020
6 *
7 * Author(s): Carsten Otte <cotte@de.ibm.com>
8 * Christian Borntraeger <borntraeger@de.ibm.com>

--- 569 unchanged lines hidden (view full) ---

578 ret = kvm_s390_handle_sigp_pei(vcpu);
579 if (!ret)
580 return ret;
581 }
582
583 return handle_instruction(vcpu);
584}
585
1// SPDX-License-Identifier: GPL-2.0
2/*
3 * in-kernel handling for sie intercepts
4 *
5 * Copyright IBM Corp. 2008, 2020
6 *
7 * Author(s): Carsten Otte <cotte@de.ibm.com>
8 * Christian Borntraeger <borntraeger@de.ibm.com>

--- 569 unchanged lines hidden (view full) ---

578 ret = kvm_s390_handle_sigp_pei(vcpu);
579 if (!ret)
580 return ret;
581 }
582
583 return handle_instruction(vcpu);
584}
585
586static bool should_handle_per_ifetch(const struct kvm_vcpu *vcpu, int rc)
587{
588 /* Process PER, also if the instruction is processed in user space. */
589 if (!(vcpu->arch.sie_block->icptstatus & 0x02))
590 return false;
591 if (rc != 0 && rc != -EOPNOTSUPP)
592 return false;
593 if (guestdbg_sstep_enabled(vcpu) && vcpu->arch.local_int.pending_irqs)
594 /* __vcpu_run() will exit after delivering the interrupt. */
595 return false;
596 return true;
597}
598
586int kvm_handle_sie_intercept(struct kvm_vcpu *vcpu)
587{
588 int rc, per_rc = 0;
589
590 if (kvm_is_ucontrol(vcpu->kvm))
591 return -EOPNOTSUPP;
592
593 switch (vcpu->arch.sie_block->icptcode) {

--- 46 unchanged lines hidden (view full) ---

640 kvm_s390_get_prefix(vcpu));
641 gmap_convert_to_secure(vcpu->arch.gmap,
642 kvm_s390_get_prefix(vcpu) + PAGE_SIZE);
643 break;
644 default:
645 return -EOPNOTSUPP;
646 }
647
599int kvm_handle_sie_intercept(struct kvm_vcpu *vcpu)
600{
601 int rc, per_rc = 0;
602
603 if (kvm_is_ucontrol(vcpu->kvm))
604 return -EOPNOTSUPP;
605
606 switch (vcpu->arch.sie_block->icptcode) {

--- 46 unchanged lines hidden (view full) ---

653 kvm_s390_get_prefix(vcpu));
654 gmap_convert_to_secure(vcpu->arch.gmap,
655 kvm_s390_get_prefix(vcpu) + PAGE_SIZE);
656 break;
657 default:
658 return -EOPNOTSUPP;
659 }
660
648 /* process PER, also if the instruction is processed in user space */
649 if (vcpu->arch.sie_block->icptstatus & 0x02 &&
650 (!rc || rc == -EOPNOTSUPP))
661 if (should_handle_per_ifetch(vcpu, rc))
651 per_rc = kvm_s390_handle_per_ifetch_icpt(vcpu);
652 return per_rc ? per_rc : rc;
653}
662 per_rc = kvm_s390_handle_per_ifetch_icpt(vcpu);
663 return per_rc ? per_rc : rc;
664}