yeahuh / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone
b38b0f
From 4acb439f71797a92ad4d442becdeff28fc36c83a Mon Sep 17 00:00:00 2001
b38b0f
From: David Hildenbrand <david@redhat.com>
b38b0f
Date: Wed, 22 May 2019 08:04:01 +0100
b38b0f
Subject: [PATCH 09/12] s390x/cpumodel: add gen15 defintions
b38b0f
b38b0f
RH-Author: David Hildenbrand <david@redhat.com>
b38b0f
Message-id: <20190522080402.20173-10-david@redhat.com>
b38b0f
Patchwork-id: 88156
b38b0f
O-Subject: [RHEL8.1 qemu-kvm PATCH v2 09/10] s390x/cpumodel: add gen15 defintions
b38b0f
Bugzilla: 1660912
b38b0f
RH-Acked-by: Cornelia Huck <cohuck@redhat.com>
b38b0f
RH-Acked-by: Jens Freimann <jfreimann@redhat.com>
b38b0f
RH-Acked-by: Thomas Huth <thuth@redhat.com>
b38b0f
b38b0f
add several new features (msa9, sort, deflate, additional vector
b38b0f
instructions, new general purpose instructions) to generation 15.
b38b0f
b38b0f
Also disable csske and bpb from the default and base models >=15.
b38b0f
This will allow to migrate gen15 machines to future machines that
b38b0f
do not have these features.
b38b0f
b38b0f
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
b38b0f
Message-Id: <20190429090250.7648-9-borntraeger@de.ibm.com>
b38b0f
Reviewed-by: David Hildenbrand <david@redhat.com>
b38b0f
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
b38b0f
(cherry picked from commit caef62430fed6e732d3e43d76752d165cf02ad67)
b38b0f
b38b0f
 Conflicts:
b38b0f
	target/s390x/gen-features.c:
b38b0f
		Minor contextual conflict due to a different z14-GA2
b38b0f
		default model definition (upstream already adds these
b38b0f
		features to the z14-GA1 model).
b38b0f
b38b0f
Signed-off-by: David Hildenbrand <david@redhat.com>
b38b0f
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
b38b0f
---
b38b0f
 target/s390x/gen-features.c | 37 +++++++++++++++++++++++++++++++++++++
b38b0f
 1 file changed, 37 insertions(+)
b38b0f
b38b0f
diff --git a/target/s390x/gen-features.c b/target/s390x/gen-features.c
b38b0f
index c61bce2..818d51c 100644
b38b0f
--- a/target/s390x/gen-features.c
b38b0f
+++ b/target/s390x/gen-features.c
b38b0f
@@ -13,6 +13,7 @@
b38b0f
 
b38b0f
 #include <inttypes.h>
b38b0f
 #include <stdio.h>
b38b0f
+#include <string.h>
b38b0f
 #include "cpu_features_def.h"
b38b0f
 
b38b0f
 #define ARRAY_SIZE(array) (sizeof(array) / sizeof(array[0]))
b38b0f
@@ -419,6 +420,10 @@ static uint16_t base_GEN14_GA1[] = {
b38b0f
 
b38b0f
 #define base_GEN14_GA2 EmptyFeat
b38b0f
 
b38b0f
+static uint16_t base_GEN15_GA1[] = {
b38b0f
+    S390_FEAT_MISC_INSTRUCTION_EXT3,
b38b0f
+};
b38b0f
+
b38b0f
 /* Full features (in order of release)
b38b0f
  * Automatically includes corresponding base features.
b38b0f
  * Full features are all features this hardware supports even if kvm/QEMU do not
b38b0f
@@ -548,6 +553,16 @@ static uint16_t full_GEN14_GA1[] = {
b38b0f
 
b38b0f
 #define full_GEN14_GA2 EmptyFeat
b38b0f
 
b38b0f
+static uint16_t full_GEN15_GA1[] = {
b38b0f
+    S390_FEAT_VECTOR_ENH2,
b38b0f
+    S390_FEAT_GROUP_ENH_SORT,
b38b0f
+    S390_FEAT_GROUP_DEFLATE_CONVERSION,
b38b0f
+    S390_FEAT_VECTOR_BCD_ENH,
b38b0f
+    S390_FEAT_GROUP_MSA_EXT_9,
b38b0f
+    S390_FEAT_GROUP_MSA_EXT_9_PCKMO,
b38b0f
+    S390_FEAT_ETOKEN,
b38b0f
+};
b38b0f
+
b38b0f
 /* Default features (in order of release)
b38b0f
  * Automatically includes corresponding base features.
b38b0f
  * Default features are all features this version of QEMU supports for this
b38b0f
@@ -630,6 +645,16 @@ static uint16_t default_GEN14_GA2[] = {
b38b0f
     S390_FEAT_GROUP_MULTIPLE_EPOCH_PTFF,
b38b0f
 };
b38b0f
 
b38b0f
+static uint16_t default_GEN15_GA1[] = {
b38b0f
+    S390_FEAT_VECTOR_ENH2,
b38b0f
+    S390_FEAT_GROUP_ENH_SORT,
b38b0f
+    S390_FEAT_GROUP_DEFLATE_CONVERSION,
b38b0f
+    S390_FEAT_VECTOR_BCD_ENH,
b38b0f
+    S390_FEAT_GROUP_MSA_EXT_9,
b38b0f
+    S390_FEAT_GROUP_MSA_EXT_9_PCKMO,
b38b0f
+    S390_FEAT_ETOKEN,
b38b0f
+};
b38b0f
+
b38b0f
 /* QEMU (CPU model) features */
b38b0f
 
b38b0f
 static uint16_t qemu_V2_11[] = {
b38b0f
@@ -739,6 +764,7 @@ static CpuFeatDefSpec CpuFeatDef[] = {
b38b0f
     CPU_FEAT_INITIALIZER(GEN13_GA2),
b38b0f
     CPU_FEAT_INITIALIZER(GEN14_GA1),
b38b0f
     CPU_FEAT_INITIALIZER(GEN14_GA2),
b38b0f
+    CPU_FEAT_INITIALIZER(GEN15_GA1),
b38b0f
 };
b38b0f
 
b38b0f
 #define FEAT_GROUP_INITIALIZER(_name)                  \
b38b0f
@@ -806,6 +832,11 @@ static void set_bits(uint64_t list[], BitSpec bits)
b38b0f
     }
b38b0f
 }
b38b0f
 
b38b0f
+static inline void clear_bit(uint64_t list[], unsigned long nr)
b38b0f
+{
b38b0f
+    list[nr / 64] &= ~(1ULL << (nr % 64));
b38b0f
+}
b38b0f
+
b38b0f
 static void print_feature_defs(void)
b38b0f
 {
b38b0f
     uint64_t base_feat[S390_FEAT_MAX / 64 + 1] = {};
b38b0f
@@ -816,6 +847,12 @@ static void print_feature_defs(void)
b38b0f
     printf("\n/* CPU model feature list data */\n");
b38b0f
 
b38b0f
     for (i = 0; i < ARRAY_SIZE(CpuFeatDef); i++) {
b38b0f
+        /* With gen15 CSSKE and BPB are deprecated */
b38b0f
+        if (strcmp(CpuFeatDef[i].name, "S390_FEAT_LIST_GEN15_GA1") == 0) {
b38b0f
+            clear_bit(base_feat, S390_FEAT_CONDITIONAL_SSKE);
b38b0f
+            clear_bit(default_feat, S390_FEAT_CONDITIONAL_SSKE);
b38b0f
+            clear_bit(default_feat, S390_FEAT_BPB);
b38b0f
+        }
b38b0f
         set_bits(base_feat, CpuFeatDef[i].base_bits);
b38b0f
         /* add the base to the default features */
b38b0f
         set_bits(default_feat, CpuFeatDef[i].base_bits);
b38b0f
-- 
b38b0f
1.8.3.1
b38b0f