cryptospore / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone

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

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