a83cc2
From 5536da8458b7825b084bfc94256bfdc1ca0127a3 Mon Sep 17 00:00:00 2001
a83cc2
From: Christian Borntraeger <borntraeger@de.ibm.com>
a83cc2
Date: Tue, 22 Jun 2021 22:19:23 +0200
a83cc2
Subject: [PATCH 1/6] s390x/cpumodel: add 3931 and 3932
a83cc2
a83cc2
RH-Author: Cornelia Huck <cohuck@redhat.com>
a83cc2
RH-MergeRequest: 21: s390x/cpumodel: add 3931 and 3932
a83cc2
RH-Commit: [1/1] b678fdf9364407c615678980330e496676e04f9e (cohuck/qemu-kvm-c9s)
a83cc2
RH-Bugzilla: 1932191
a83cc2
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
a83cc2
RH-Acked-by: David Hildenbrand <david@redhat.com>
a83cc2
RH-Acked-by: Thomas Huth <thuth@redhat.com>
a83cc2
a83cc2
This defines 5 new facilities and the new 3931 and 3932 machines.
a83cc2
As before the name is not yet known and we do use gen16a and gen16b.
a83cc2
The new features are part of the full model.
a83cc2
a83cc2
The default model is still empty (same as z15) and will be added
a83cc2
in a separate patch at a later point in time.
a83cc2
a83cc2
Also add the dependencies of new facilities and as a fix for z15 add
a83cc2
a dependency from S390_FEAT_VECTOR_PACKED_DECIMAL_ENH to
a83cc2
S390_VECTOR_PACKED_DECIMAL.
a83cc2
a83cc2
[merged <20210701084348.26556-1-borntraeger@de.ibm.com>]
a83cc2
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
a83cc2
Message-Id: <20210622201923.150205-2-borntraeger@de.ibm.com>
a83cc2
Reviewed-by: David Hildenbrand <david@redhat.com>
a83cc2
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
a83cc2
(cherry picked from commit fb4a08121695a88acefcbcd86f1376df079eefee)
a83cc2
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
a83cc2
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
a83cc2
---
a83cc2
 target/s390x/cpu_features_def.h.inc |  5 +++++
a83cc2
 target/s390x/cpu_models.c           |  6 ++++++
a83cc2
 target/s390x/gen-features.c         | 14 ++++++++++++++
a83cc2
 3 files changed, 25 insertions(+)
a83cc2
a83cc2
diff --git a/target/s390x/cpu_features_def.h.inc b/target/s390x/cpu_features_def.h.inc
a83cc2
index 7db3449e04..e86662bb3b 100644
a83cc2
--- a/target/s390x/cpu_features_def.h.inc
a83cc2
+++ b/target/s390x/cpu_features_def.h.inc
a83cc2
@@ -109,6 +109,11 @@ DEF_FEAT(VECTOR_PACKED_DECIMAL_ENH, "vxpdeh", STFL, 152, "Vector-Packed-Decimal-
a83cc2
 DEF_FEAT(MSA_EXT_9, "msa9-base", STFL, 155, "Message-security-assist-extension-9 facility (excluding subfunctions)")
a83cc2
 DEF_FEAT(ETOKEN, "etoken", STFL, 156, "Etoken facility")
a83cc2
 DEF_FEAT(UNPACK, "unpack", STFL, 161, "Unpack facility")
a83cc2
+DEF_FEAT(NNPA, "nnpa", STFL, 165, "NNPA facility")
a83cc2
+DEF_FEAT(VECTOR_PACKED_DECIMAL_ENH2, "vxpdeh2", STFL, 192, "Vector-Packed-Decimal-Enhancement facility 2")
a83cc2
+DEF_FEAT(BEAR_ENH, "beareh", STFL, 193, "BEAR-enhancement facility")
a83cc2
+DEF_FEAT(RDP, "rdp", STFL, 194, "Reset-DAT-protection facility")
a83cc2
+DEF_FEAT(PAI, "pai", STFL, 196, "Processor-Activity-Instrumentation facility")
a83cc2
 
a83cc2
 /* Features exposed via SCLP SCCB Byte 80 - 98  (bit numbers relative to byte-80) */
a83cc2
 DEF_FEAT(SIE_GSLS, "gsls", SCLP_CONF_CHAR, 40, "SIE: Guest-storage-limit-suppression facility")
a83cc2
diff --git a/target/s390x/cpu_models.c b/target/s390x/cpu_models.c
a83cc2
index 9254ff46bf..3cb4d25a10 100644
a83cc2
--- a/target/s390x/cpu_models.c
a83cc2
+++ b/target/s390x/cpu_models.c
a83cc2
@@ -88,6 +88,8 @@ static S390CPUDef s390_cpu_defs[] = {
a83cc2
     CPUDEF_INIT(0x3907, 14, 1, 47, 0x08000000U, "z14ZR1", "IBM z14 Model ZR1 GA1"),
a83cc2
     CPUDEF_INIT(0x8561, 15, 1, 47, 0x08000000U, "gen15a", "IBM z15 T01 GA1"),
a83cc2
     CPUDEF_INIT(0x8562, 15, 1, 47, 0x08000000U, "gen15b", "IBM z15 T02 GA1"),
a83cc2
+    CPUDEF_INIT(0x3931, 16, 1, 47, 0x08000000U, "gen16a", "IBM 3931 GA1"),
a83cc2
+    CPUDEF_INIT(0x3932, 16, 1, 47, 0x08000000U, "gen16b", "IBM 3932 GA1"),
a83cc2
 };
a83cc2
 
a83cc2
 #define QEMU_MAX_CPU_TYPE 0x2964
a83cc2
@@ -815,6 +817,8 @@ static void check_consistency(const S390CPUModel *model)
a83cc2
         { S390_FEAT_MSA_EXT_9, S390_FEAT_MSA_EXT_4 },
a83cc2
         { S390_FEAT_MULTIPLE_EPOCH, S390_FEAT_TOD_CLOCK_STEERING },
a83cc2
         { S390_FEAT_VECTOR_PACKED_DECIMAL, S390_FEAT_VECTOR },
a83cc2
+        { S390_FEAT_VECTOR_PACKED_DECIMAL_ENH, S390_FEAT_VECTOR_PACKED_DECIMAL },
a83cc2
+        { S390_FEAT_VECTOR_PACKED_DECIMAL_ENH2, S390_FEAT_VECTOR_PACKED_DECIMAL_ENH },
a83cc2
         { S390_FEAT_VECTOR_ENH, S390_FEAT_VECTOR },
a83cc2
         { S390_FEAT_INSTRUCTION_EXEC_PROT, S390_FEAT_SIDE_EFFECT_ACCESS_ESOP2 },
a83cc2
         { S390_FEAT_SIDE_EFFECT_ACCESS_ESOP2, S390_FEAT_ESOP },
a83cc2
@@ -846,6 +850,8 @@ static void check_consistency(const S390CPUModel *model)
a83cc2
         { S390_FEAT_PTFF_STOUE, S390_FEAT_MULTIPLE_EPOCH },
a83cc2
         { S390_FEAT_AP_QUEUE_INTERRUPT_CONTROL, S390_FEAT_AP },
a83cc2
         { S390_FEAT_DIAG_318, S390_FEAT_EXTENDED_LENGTH_SCCB },
a83cc2
+        { S390_FEAT_NNPA, S390_FEAT_VECTOR },
a83cc2
+        { S390_FEAT_RDP, S390_FEAT_LOCAL_TLB_CLEARING },
a83cc2
     };
a83cc2
     int i;
a83cc2
 
a83cc2
diff --git a/target/s390x/gen-features.c b/target/s390x/gen-features.c
a83cc2
index a6ec918e90..8f99cea665 100644
a83cc2
--- a/target/s390x/gen-features.c
a83cc2
+++ b/target/s390x/gen-features.c
a83cc2
@@ -424,6 +424,8 @@ static uint16_t base_GEN15_GA1[] = {
a83cc2
     S390_FEAT_MISC_INSTRUCTION_EXT3,
a83cc2
 };
a83cc2
 
a83cc2
+#define base_GEN16_GA1 EmptyFeat
a83cc2
+
a83cc2
 /* Full features (in order of release)
a83cc2
  * Automatically includes corresponding base features.
a83cc2
  * Full features are all features this hardware supports even if kvm/QEMU do not
a83cc2
@@ -567,6 +569,15 @@ static uint16_t full_GEN15_GA1[] = {
a83cc2
     S390_FEAT_UNPACK,
a83cc2
 };
a83cc2
 
a83cc2
+static uint16_t full_GEN16_GA1[] = {
a83cc2
+    S390_FEAT_NNPA,
a83cc2
+    S390_FEAT_VECTOR_PACKED_DECIMAL_ENH2,
a83cc2
+    S390_FEAT_BEAR_ENH,
a83cc2
+    S390_FEAT_RDP,
a83cc2
+    S390_FEAT_PAI,
a83cc2
+};
a83cc2
+
a83cc2
+
a83cc2
 /* Default features (in order of release)
a83cc2
  * Automatically includes corresponding base features.
a83cc2
  * Default features are all features this version of QEMU supports for this
a83cc2
@@ -652,6 +663,8 @@ static uint16_t default_GEN15_GA1[] = {
a83cc2
     S390_FEAT_ETOKEN,
a83cc2
 };
a83cc2
 
a83cc2
+#define default_GEN16_GA1 EmptyFeat
a83cc2
+
a83cc2
 /* QEMU (CPU model) features */
a83cc2
 
a83cc2
 static uint16_t qemu_V2_11[] = {
a83cc2
@@ -782,6 +795,7 @@ static CpuFeatDefSpec CpuFeatDef[] = {
a83cc2
     CPU_FEAT_INITIALIZER(GEN14_GA1),
a83cc2
     CPU_FEAT_INITIALIZER(GEN14_GA2),
a83cc2
     CPU_FEAT_INITIALIZER(GEN15_GA1),
a83cc2
+    CPU_FEAT_INITIALIZER(GEN16_GA1),
a83cc2
 };
a83cc2
 
a83cc2
 #define FEAT_GROUP_INITIALIZER(_name)                  \
a83cc2
-- 
a83cc2
2.27.0
a83cc2