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