Blame SOURCES/kvm-s390x-cpumodel-Set-up-CPU-model-for-AP-device-suppor.patch

ae23c9
From f52debc0934c9f1fa9373876bbbad3c6b314bac1 Mon Sep 17 00:00:00 2001
ae23c9
From: Thomas Huth <thuth@redhat.com>
ae23c9
Date: Mon, 15 Oct 2018 10:19:27 +0100
ae23c9
Subject: [PATCH 2/6] s390x/cpumodel: Set up CPU model for AP device support
ae23c9
ae23c9
RH-Author: Thomas Huth <thuth@redhat.com>
ae23c9
Message-id: <1539598771-16223-3-git-send-email-thuth@redhat.com>
ae23c9
Patchwork-id: 82694
ae23c9
O-Subject: [RHEL-8 qemu-kvm PATCH 2/6] s390x/cpumodel: Set up CPU model for AP device support
ae23c9
Bugzilla: 1508142
ae23c9
RH-Acked-by: David Hildenbrand <david@redhat.com>
ae23c9
RH-Acked-by: Cornelia Huck <cohuck@redhat.com>
ae23c9
RH-Acked-by: Jens Freimann <jfreimann@redhat.com>
ae23c9
ae23c9
From: Tony Krowiak <akrowiak@linux.ibm.com>
ae23c9
ae23c9
A new CPU model feature and two new CPU model facilities are
ae23c9
introduced to support AP devices for a KVM guest.
ae23c9
ae23c9
CPU model features:
ae23c9
ae23c9
1. The S390_FEAT_AP CPU model feature indicates whether AP
ae23c9
   instructions are available to the guest. This feature will
ae23c9
   be enabled only if the AP instructions are available on the
ae23c9
   linux host as determined by the availability of the
ae23c9
   KVM_S390_VM_CRYPTO_ENABLE_APIE VM attribute which is exposed
ae23c9
   by KVM only if the AP instructions are available on the
ae23c9
   host.
ae23c9
ae23c9
   This feature must be turned on from userspace to execute AP
ae23c9
   instructions on the KVM guest. The QEMU command line to turn
ae23c9
   this feature on looks something like this:
ae23c9
ae23c9
	qemu-system-s390x ... -cpu xxx,ap=on ...
ae23c9
ae23c9
   This feature will be supported for zEC12 and newer CPU models.
ae23c9
   The feature will not be supported for older models because
ae23c9
   there are few older systems on which to test and the older
ae23c9
   crypto cards will be going out of service in the relatively
ae23c9
   near future.
ae23c9
ae23c9
CPU model facilities:
ae23c9
ae23c9
1. The S390_FEAT_AP_QUERY_CONFIG_INFO feature indicates whether the
ae23c9
   AP Query Configuration Information (QCI) facility is available
ae23c9
   to the guest as determined by whether the facility is available
ae23c9
   on the host. This feature will be exposed by KVM only if the
ae23c9
   QCI facility is installed on the host.
ae23c9
ae23c9
2. The S390_FEAT_AP_FACILITY_TEST feature indicates whether the AP
ae23c9
   Facility Test (APFT) facility is available to the guest as
ae23c9
   determined by whether the facility is available on the host.
ae23c9
   This feature will be exposed by KVM only if APFT is installed
ae23c9
   on the host.
ae23c9
ae23c9
Signed-off-by: Tony Krowiak <akrowiak@linux.ibm.com>
ae23c9
Tested-by: Pierre Morel <pmorel@linux.ibm.com>
ae23c9
Reviewed-by: David Hildenbrand <david@redhat.com>
ae23c9
Reviewed-by: Halil Pasic <pasic@linux.ibm.com>
ae23c9
Reviewed-by: Christian Borntraeger <borntraeger@de.ibm.com>
ae23c9
Tested-by: Christian Borntraeger <borntraeger@de.ibm.com>
ae23c9
Message-Id: <20181010170309.12045-3-akrowiak@linux.ibm.com>
ae23c9
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
ae23c9
(cherry picked from commit c5cd17afddda89376712b315a41ede96b034e4c2)
ae23c9
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
ae23c9
---
ae23c9
 target/s390x/cpu_features.c     | 3 +++
ae23c9
 target/s390x/cpu_features_def.h | 3 +++
ae23c9
 target/s390x/cpu_models.c       | 2 ++
ae23c9
 target/s390x/gen-features.c     | 3 +++
ae23c9
 4 files changed, 11 insertions(+)
ae23c9
ae23c9
diff --git a/target/s390x/cpu_features.c b/target/s390x/cpu_features.c
ae23c9
index e05e6aa..0fbee27 100644
ae23c9
--- a/target/s390x/cpu_features.c
ae23c9
+++ b/target/s390x/cpu_features.c
ae23c9
@@ -40,8 +40,10 @@ static const S390FeatDef s390_features[] = {
ae23c9
     FEAT_INIT("srs", S390_FEAT_TYPE_STFL, 9, "Sense-running-status facility"),
ae23c9
     FEAT_INIT("csske", S390_FEAT_TYPE_STFL, 10, "Conditional-SSKE facility"),
ae23c9
     FEAT_INIT("ctop", S390_FEAT_TYPE_STFL, 11, "Configuration-topology facility"),
ae23c9
+    FEAT_INIT("apqci", S390_FEAT_TYPE_STFL, 12, "Query AP Configuration Information facility"),
ae23c9
     FEAT_INIT("ipter", S390_FEAT_TYPE_STFL, 13, "IPTE-range facility"),
ae23c9
     FEAT_INIT("nonqks", S390_FEAT_TYPE_STFL, 14, "Nonquiescing key-setting facility"),
ae23c9
+    FEAT_INIT("apft", S390_FEAT_TYPE_STFL, 15, "AP Facilities Test facility"),
ae23c9
     FEAT_INIT("etf2", S390_FEAT_TYPE_STFL, 16, "Extended-translation facility 2"),
ae23c9
     FEAT_INIT("msa-base", S390_FEAT_TYPE_STFL, 17, "Message-security-assist facility (excluding subfunctions)"),
ae23c9
     FEAT_INIT("ldisp", S390_FEAT_TYPE_STFL, 18, "Long-displacement facility"),
ae23c9
@@ -130,6 +132,7 @@ static const S390FeatDef s390_features[] = {
ae23c9
 
ae23c9
     FEAT_INIT_MISC("dateh2", "DAT-enhancement facility 2"),
ae23c9
     FEAT_INIT_MISC("cmm", "Collaborative-memory-management facility"),
ae23c9
+    FEAT_INIT_MISC("ap", "AP instructions installed"),
ae23c9
 
ae23c9
     FEAT_INIT("plo-cl", S390_FEAT_TYPE_PLO, 0, "PLO Compare and load (32 bit in general registers)"),
ae23c9
     FEAT_INIT("plo-clg", S390_FEAT_TYPE_PLO, 1, "PLO Compare and load (64 bit in parameter list)"),
ae23c9
diff --git a/target/s390x/cpu_features_def.h b/target/s390x/cpu_features_def.h
ae23c9
index ac2c947..5fc7e7b 100644
ae23c9
--- a/target/s390x/cpu_features_def.h
ae23c9
+++ b/target/s390x/cpu_features_def.h
ae23c9
@@ -27,8 +27,10 @@ typedef enum {
ae23c9
     S390_FEAT_SENSE_RUNNING_STATUS,
ae23c9
     S390_FEAT_CONDITIONAL_SSKE,
ae23c9
     S390_FEAT_CONFIGURATION_TOPOLOGY,
ae23c9
+    S390_FEAT_AP_QUERY_CONFIG_INFO,
ae23c9
     S390_FEAT_IPTE_RANGE,
ae23c9
     S390_FEAT_NONQ_KEY_SETTING,
ae23c9
+    S390_FEAT_AP_FACILITIES_TEST,
ae23c9
     S390_FEAT_EXTENDED_TRANSLATION_2,
ae23c9
     S390_FEAT_MSA,
ae23c9
     S390_FEAT_LONG_DISPLACEMENT,
ae23c9
@@ -119,6 +121,7 @@ typedef enum {
ae23c9
     /* Misc */
ae23c9
     S390_FEAT_DAT_ENH_2,
ae23c9
     S390_FEAT_CMM,
ae23c9
+    S390_FEAT_AP,
ae23c9
 
ae23c9
     /* PLO */
ae23c9
     S390_FEAT_PLO_CL,
ae23c9
diff --git a/target/s390x/cpu_models.c b/target/s390x/cpu_models.c
ae23c9
index 0b5d271..3856104 100644
ae23c9
--- a/target/s390x/cpu_models.c
ae23c9
+++ b/target/s390x/cpu_models.c
ae23c9
@@ -774,6 +774,8 @@ static void check_consistency(const S390CPUModel *model)
ae23c9
         { S390_FEAT_PRNO_TRNG_QRTCR, S390_FEAT_MSA_EXT_5 },
ae23c9
         { S390_FEAT_PRNO_TRNG, S390_FEAT_MSA_EXT_5 },
ae23c9
         { S390_FEAT_SIE_KSS, S390_FEAT_SIE_F2 },
ae23c9
+        { S390_FEAT_AP_QUERY_CONFIG_INFO, S390_FEAT_AP },
ae23c9
+        { S390_FEAT_AP_FACILITIES_TEST, S390_FEAT_AP },
ae23c9
     };
ae23c9
     int i;
ae23c9
 
ae23c9
diff --git a/target/s390x/gen-features.c b/target/s390x/gen-features.c
ae23c9
index 5af042c..7302269 100644
ae23c9
--- a/target/s390x/gen-features.c
ae23c9
+++ b/target/s390x/gen-features.c
ae23c9
@@ -447,6 +447,9 @@ static uint16_t full_GEN12_GA1[] = {
ae23c9
     S390_FEAT_ADAPTER_INT_SUPPRESSION,
ae23c9
     S390_FEAT_EDAT_2,
ae23c9
     S390_FEAT_SIDE_EFFECT_ACCESS_ESOP2,
ae23c9
+    S390_FEAT_AP_QUERY_CONFIG_INFO,
ae23c9
+    S390_FEAT_AP_FACILITIES_TEST,
ae23c9
+    S390_FEAT_AP,
ae23c9
 };
ae23c9
 
ae23c9
 static uint16_t full_GEN12_GA2[] = {
ae23c9
-- 
ae23c9
1.8.3.1
ae23c9