thebeanogamer / rpms / qemu-kvm

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