77c23f
From 10ed4f6ad687d98f0bfe06d75775e8c541da80a0 Mon Sep 17 00:00:00 2001
77c23f
From: Thomas Huth <thuth@redhat.com>
77c23f
Date: Fri, 29 May 2020 05:54:07 -0400
77c23f
Subject: [PATCH 25/42] s390x: protvirt: KVM intercept changes
77c23f
77c23f
RH-Author: Thomas Huth <thuth@redhat.com>
77c23f
Message-id: <20200529055420.16855-26-thuth@redhat.com>
77c23f
Patchwork-id: 97035
77c23f
O-Subject: [RHEL-8.3.0 qemu-kvm PATCH v2 25/38] s390x: protvirt: KVM intercept changes
77c23f
Bugzilla: 1828317
77c23f
RH-Acked-by: Claudio Imbrenda <cimbrend@redhat.com>
77c23f
RH-Acked-by: Cornelia Huck <cohuck@redhat.com>
77c23f
RH-Acked-by: David Hildenbrand <david@redhat.com>
77c23f
77c23f
From: Janosch Frank <frankja@linux.ibm.com>
77c23f
77c23f
Protected VMs no longer intercept with code 4 for an instruction
77c23f
interception. Instead they have codes 104 and 108 for protected
77c23f
instruction interception and protected instruction notification
77c23f
respectively.
77c23f
77c23f
The 104 mirrors the 4 interception.
77c23f
77c23f
The 108 is a notification interception to let KVM and QEMU know that
77c23f
something changed and we need to update tracking information or
77c23f
perform specific tasks. It's currently taken for the following
77c23f
instructions:
77c23f
77c23f
* spx (To inform about the changed prefix location)
77c23f
* sclp (On incorrect SCCB values, so we can inject a IRQ)
77c23f
* sigp (All but "stop and store status")
77c23f
* diag308 (Subcodes 0/1)
77c23f
77c23f
Of these exits only sclp errors, state changing sigps and diag308 will
77c23f
reach QEMU. QEMU will do its parts of the job, while the ultravisor
77c23f
has done the instruction part of the job.
77c23f
77c23f
Signed-off-by: Janosch Frank <frankja@linux.ibm.com>
77c23f
Reviewed-by: David Hildenbrand <david@redhat.com>
77c23f
Reviewed-by: Christian Borntraeger <borntraeger@de.ibm.com>
77c23f
Reviewed-by: Claudio Imbrenda <imbrenda@linux.ibm.com>
77c23f
Reviewed-by: Cornelia Huck <cohuck@redhat.com>
77c23f
Message-Id: <20200319131921.2367-7-frankja@linux.ibm.com>
77c23f
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
77c23f
(cherry picked from commit 2585e507ffa1da01b57dbea26b1e1fe507d27198)
77c23f
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
77c23f
---
77c23f
 target/s390x/kvm.c | 4 ++++
77c23f
 1 file changed, 4 insertions(+)
77c23f
77c23f
diff --git a/target/s390x/kvm.c b/target/s390x/kvm.c
77c23f
index 9a0be13959..af50b2c253 100644
77c23f
--- a/target/s390x/kvm.c
77c23f
+++ b/target/s390x/kvm.c
77c23f
@@ -115,6 +115,8 @@
77c23f
 #define ICPT_CPU_STOP                   0x28
77c23f
 #define ICPT_OPEREXC                    0x2c
77c23f
 #define ICPT_IO                         0x40
77c23f
+#define ICPT_PV_INSTR                   0x68
77c23f
+#define ICPT_PV_INSTR_NOTIFICATION      0x6c
77c23f
 
77c23f
 #define NR_LOCAL_IRQS 32
77c23f
 /*
77c23f
@@ -1695,6 +1697,8 @@ static int handle_intercept(S390CPU *cpu)
77c23f
             (long)cs->kvm_run->psw_addr);
77c23f
     switch (icpt_code) {
77c23f
         case ICPT_INSTRUCTION:
77c23f
+        case ICPT_PV_INSTR:
77c23f
+        case ICPT_PV_INSTR_NOTIFICATION:
77c23f
             r = handle_instruction(cpu, run);
77c23f
             break;
77c23f
         case ICPT_PROGRAM:
77c23f
-- 
77c23f
2.27.0
77c23f