yeahuh / rpms / qemu-kvm

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