Blob Blame Raw
From 10ed4f6ad687d98f0bfe06d75775e8c541da80a0 Mon Sep 17 00:00:00 2001
From: Thomas Huth <>
Date: Fri, 29 May 2020 05:54:07 -0400
Subject: [PATCH 25/42] s390x: protvirt: KVM intercept changes

RH-Author: Thomas Huth <>
Message-id: <>
Patchwork-id: 97035
O-Subject: [RHEL-8.3.0 qemu-kvm PATCH v2 25/38] s390x: protvirt: KVM intercept changes
Bugzilla: 1828317
RH-Acked-by: Claudio Imbrenda <>
RH-Acked-by: Cornelia Huck <>
RH-Acked-by: David Hildenbrand <>

From: Janosch Frank <>

Protected VMs no longer intercept with code 4 for an instruction
interception. Instead they have codes 104 and 108 for protected
instruction interception and protected instruction notification

The 104 mirrors the 4 interception.

The 108 is a notification interception to let KVM and QEMU know that
something changed and we need to update tracking information or
perform specific tasks. It's currently taken for the following

* spx (To inform about the changed prefix location)
* sclp (On incorrect SCCB values, so we can inject a IRQ)
* sigp (All but "stop and store status")
* diag308 (Subcodes 0/1)

Of these exits only sclp errors, state changing sigps and diag308 will
reach QEMU. QEMU will do its parts of the job, while the ultravisor
has done the instruction part of the job.

Signed-off-by: Janosch Frank <>
Reviewed-by: David Hildenbrand <>
Reviewed-by: Christian Borntraeger <>
Reviewed-by: Claudio Imbrenda <>
Reviewed-by: Cornelia Huck <>
Message-Id: <>
Signed-off-by: Cornelia Huck <>
(cherry picked from commit 2585e507ffa1da01b57dbea26b1e1fe507d27198)
Signed-off-by: Danilo C. L. de Paula <>
 target/s390x/kvm.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/target/s390x/kvm.c b/target/s390x/kvm.c
index 9a0be13959..af50b2c253 100644
--- a/target/s390x/kvm.c
+++ b/target/s390x/kvm.c
@@ -115,6 +115,8 @@
 #define ICPT_CPU_STOP                   0x28
 #define ICPT_OPEREXC                    0x2c
 #define ICPT_IO                         0x40
+#define ICPT_PV_INSTR                   0x68
 #define NR_LOCAL_IRQS 32
@@ -1695,6 +1697,8 @@ static int handle_intercept(S390CPU *cpu)
     switch (icpt_code) {
         case ICPT_INSTRUCTION:
+        case ICPT_PV_INSTR:
             r = handle_instruction(cpu, run);
         case ICPT_PROGRAM: