ddf19c
From ab670456375f0d9b9b2d219fd497d04ec0009e1d Mon Sep 17 00:00:00 2001
ddf19c
From: Thomas Huth <thuth@redhat.com>
ddf19c
Date: Fri, 29 May 2020 05:54:16 -0400
ddf19c
Subject: [PATCH 34/42] s390x: Add unpack facility feature to GA1
ddf19c
ddf19c
RH-Author: Thomas Huth <thuth@redhat.com>
ddf19c
Message-id: <20200529055420.16855-35-thuth@redhat.com>
ddf19c
Patchwork-id: 97052
ddf19c
O-Subject: [RHEL-8.3.0 qemu-kvm PATCH v2 34/38] s390x: Add unpack facility feature to GA1
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: Christian Borntraeger <borntraeger@de.ibm.com>
ddf19c
ddf19c
The unpack facility is an indication that diagnose 308 subcodes 8-10
ddf19c
are available to the guest. That means, that the guest can put itself
ddf19c
into protected mode.
ddf19c
ddf19c
Once it is in protected mode, the hardware stops any attempt of VM
ddf19c
introspection by the hypervisor.
ddf19c
ddf19c
Some features are currently not supported in protected mode:
ddf19c
     * vfio devices
ddf19c
     * Migration
ddf19c
     * Huge page backings
ddf19c
ddf19c
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
ddf19c
Signed-off-by: Janosch Frank <frankja@linux.ibm.com>
ddf19c
Reviewed-by: David Hildenbrand <david@redhat.com>
ddf19c
Reviewed-by: Claudio Imbrenda <imbrenda@linux.ibm.com>
ddf19c
Reviewed-by: Cornelia Huck <cohuck@redhat.com>
ddf19c
Message-Id: <20200319131921.2367-17-frankja@linux.ibm.com>
ddf19c
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
ddf19c
(cherry picked from commit 572c0826615737f1c095b1b6d9e381ec40f72eb5)
ddf19c
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
ddf19c
---
ddf19c
 target/s390x/gen-features.c | 1 +
ddf19c
 target/s390x/kvm.c          | 8 ++++++++
ddf19c
 2 files changed, 9 insertions(+)
ddf19c
ddf19c
diff --git a/target/s390x/gen-features.c b/target/s390x/gen-features.c
ddf19c
index 6278845b12..8ddeebc544 100644
ddf19c
--- a/target/s390x/gen-features.c
ddf19c
+++ b/target/s390x/gen-features.c
ddf19c
@@ -562,6 +562,7 @@ static uint16_t full_GEN15_GA1[] = {
ddf19c
     S390_FEAT_GROUP_MSA_EXT_9,
ddf19c
     S390_FEAT_GROUP_MSA_EXT_9_PCKMO,
ddf19c
     S390_FEAT_ETOKEN,
ddf19c
+    S390_FEAT_UNPACK,
ddf19c
 };
ddf19c
 
ddf19c
 /* Default features (in order of release)
ddf19c
diff --git a/target/s390x/kvm.c b/target/s390x/kvm.c
ddf19c
index 56fe60c49c..84d7cadd09 100644
ddf19c
--- a/target/s390x/kvm.c
ddf19c
+++ b/target/s390x/kvm.c
ddf19c
@@ -2407,6 +2407,14 @@ void kvm_s390_get_host_cpu_model(S390CPUModel *model, Error **errp)
ddf19c
         clear_bit(S390_FEAT_BPB, model->features);
ddf19c
     }
ddf19c
 
ddf19c
+    /*
ddf19c
+     * If we have support for protected virtualization, indicate
ddf19c
+     * the protected virtualization IPL unpack facility.
ddf19c
+     */
ddf19c
+    if (cap_protected) {
ddf19c
+        set_bit(S390_FEAT_UNPACK, model->features);
ddf19c
+    }
ddf19c
+
ddf19c
     /* We emulate a zPCI bus and AEN, therefore we don't need HW support */
ddf19c
     set_bit(S390_FEAT_ZPCI, model->features);
ddf19c
     set_bit(S390_FEAT_ADAPTER_EVENT_NOTIFICATION, model->features);
ddf19c
-- 
ddf19c
2.27.0
ddf19c