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