Commit da24a0cc authored by Janosch Frank's avatar Janosch Frank Committed by Christian Borntraeger
Browse files

KVM: s390: protvirt: Instruction emulation



We have two new SIE exit codes dealing with instructions.
104 (0x68) for a secure instruction interception, on which the SIE needs
hypervisor action to complete the instruction. We can piggy-back on the
existing instruction handlers.

108 which is merely a notification and provides data for tracking and
management. For example this is used to tell the host about a new value
for the prefix register. As there will be several special case handlers
in later patches, we handle this in a separate function.

Signed-off-by: default avatarJanosch Frank <frankja@linux.ibm.com>
Reviewed-by: default avatarDavid Hildenbrand <david@redhat.com>
Reviewed-by: default avatarCornelia Huck <cohuck@redhat.com>
Reviewed-by: default avatarThomas Huth <thuth@redhat.com>
[borntraeger@de.ibm.com: patch merging, splitting, fixing]
Signed-off-by: default avatarChristian Borntraeger <borntraeger@de.ibm.com>
parent 49710db0
Loading
Loading
Loading
Loading
+2 −0
Original line number Original line Diff line number Diff line
@@ -217,6 +217,8 @@ struct kvm_s390_sie_block {
#define ICPT_KSS	0x5c
#define ICPT_KSS	0x5c
#define ICPT_MCHKREQ	0x60
#define ICPT_MCHKREQ	0x60
#define ICPT_INT_ENABLE	0x64
#define ICPT_INT_ENABLE	0x64
#define ICPT_PV_INSTR	0x68
#define ICPT_PV_NOTIFY	0x6c
	__u8	icptcode;		/* 0x0050 */
	__u8	icptcode;		/* 0x0050 */
	__u8	icptstatus;		/* 0x0051 */
	__u8	icptstatus;		/* 0x0051 */
	__u16	ihcpu;			/* 0x0052 */
	__u16	ihcpu;			/* 0x0052 */
+11 −0
Original line number Original line Diff line number Diff line
@@ -444,6 +444,11 @@ static int handle_operexc(struct kvm_vcpu *vcpu)
	return kvm_s390_inject_program_int(vcpu, PGM_OPERATION);
	return kvm_s390_inject_program_int(vcpu, PGM_OPERATION);
}
}


static int handle_pv_notification(struct kvm_vcpu *vcpu)
{
	return handle_instruction(vcpu);
}

int kvm_handle_sie_intercept(struct kvm_vcpu *vcpu)
int kvm_handle_sie_intercept(struct kvm_vcpu *vcpu)
{
{
	int rc, per_rc = 0;
	int rc, per_rc = 0;
@@ -489,6 +494,12 @@ int kvm_handle_sie_intercept(struct kvm_vcpu *vcpu)
		 */
		 */
		rc = 0;
		rc = 0;
		break;
		break;
	case ICPT_PV_INSTR:
		rc = handle_instruction(vcpu);
		break;
	case ICPT_PV_NOTIFY:
		rc = handle_pv_notification(vcpu);
		break;
	default:
	default:
		return -EOPNOTSUPP;
		return -EOPNOTSUPP;
	}
	}