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