Blame SOURCES/kvm-s390x-cpumodel-enum-type-S390FeatGroup-now-gets-gene.patch

b38b0f
From 442feac1a3812e235baee5868d1b6096978fc62c Mon Sep 17 00:00:00 2001
b38b0f
From: David Hildenbrand <david@redhat.com>
b38b0f
Date: Wed, 22 May 2019 08:03:53 +0100
b38b0f
Subject: [PATCH 01/12] s390x/cpumodel: enum type S390FeatGroup now gets
b38b0f
 generated
b38b0f
b38b0f
RH-Author: David Hildenbrand <david@redhat.com>
b38b0f
Message-id: <20190522080402.20173-2-david@redhat.com>
b38b0f
Patchwork-id: 88153
b38b0f
O-Subject: [RHEL8.1 qemu-kvm PATCH v2 01/10] s390x/cpumodel: enum type S390FeatGroup now gets generated
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
The enumeration type S390FeatGroup is now generated as well.
b38b0f
This shall simplify the definition of new feature groups
b38b0f
without the requirement to modify existing code.
b38b0f
b38b0f
Signed-off-by: Michael Mueller <mimu@linux.ibm.com>
b38b0f
Message-Id: <20180725143617.8731-1-mimu@linux.ibm.com>
b38b0f
Acked-by: David Hildenbrand <david@redhat.com>
b38b0f
Acked-by: Christian Borntraeger <borntraeger@de.ibm.com>
b38b0f
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
b38b0f
(cherry picked from commit a5f9ecc49d63a905da6598900e0a0eeec1ef269d)
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/cpu_features.c |  1 -
b38b0f
 target/s390x/cpu_features.h | 19 +------------------
b38b0f
 target/s390x/gen-features.c | 18 +++++++++++++++++-
b38b0f
 3 files changed, 18 insertions(+), 20 deletions(-)
b38b0f
b38b0f
diff --git a/target/s390x/cpu_features.c b/target/s390x/cpu_features.c
b38b0f
index 91e40c2..1843c84 100644
b38b0f
--- a/target/s390x/cpu_features.c
b38b0f
+++ b/target/s390x/cpu_features.c
b38b0f
@@ -13,7 +13,6 @@
b38b0f
 #include "qemu/osdep.h"
b38b0f
 #include "qemu/module.h"
b38b0f
 #include "cpu_features.h"
b38b0f
-#include "gen-features.h"
b38b0f
 
b38b0f
 #define FEAT_INIT(_name, _type, _bit, _desc) \
b38b0f
     {                                                \
b38b0f
diff --git a/target/s390x/cpu_features.h b/target/s390x/cpu_features.h
b38b0f
index 968b12f..effe790 100644
b38b0f
--- a/target/s390x/cpu_features.h
b38b0f
+++ b/target/s390x/cpu_features.h
b38b0f
@@ -16,6 +16,7 @@
b38b0f
 
b38b0f
 #include "qemu/bitmap.h"
b38b0f
 #include "cpu_features_def.h"
b38b0f
+#include "gen-features.h"
b38b0f
 
b38b0f
 /* CPU features are announced via different ways */
b38b0f
 typedef enum {
b38b0f
@@ -64,24 +65,6 @@ void s390_add_from_feat_block(S390FeatBitmap features, S390FeatType type,
b38b0f
 void s390_feat_bitmap_to_ascii(const S390FeatBitmap features, void *opaque,
b38b0f
                                void (*fn)(const char *name, void *opaque));
b38b0f
 
b38b0f
-/* static groups that will never change */
b38b0f
-typedef enum {
b38b0f
-    S390_FEAT_GROUP_PLO,
b38b0f
-    S390_FEAT_GROUP_TOD_CLOCK_STEERING,
b38b0f
-    S390_FEAT_GROUP_GEN13_PTFF_ENH,
b38b0f
-    S390_FEAT_GROUP_MSA,
b38b0f
-    S390_FEAT_GROUP_MSA_EXT_1,
b38b0f
-    S390_FEAT_GROUP_MSA_EXT_2,
b38b0f
-    S390_FEAT_GROUP_MSA_EXT_3,
b38b0f
-    S390_FEAT_GROUP_MSA_EXT_4,
b38b0f
-    S390_FEAT_GROUP_MSA_EXT_5,
b38b0f
-    S390_FEAT_GROUP_MSA_EXT_6,
b38b0f
-    S390_FEAT_GROUP_MSA_EXT_7,
b38b0f
-    S390_FEAT_GROUP_MSA_EXT_8,
b38b0f
-    S390_FEAT_GROUP_MULTIPLE_EPOCH_PTFF,
b38b0f
-    S390_FEAT_GROUP_MAX,
b38b0f
-} S390FeatGroup;
b38b0f
-
b38b0f
 /* Definition of a CPU feature group */
b38b0f
 typedef struct {
b38b0f
     const char *name;       /* name exposed to the user */
b38b0f
diff --git a/target/s390x/gen-features.c b/target/s390x/gen-features.c
b38b0f
index 739d5f1..dcc5d25 100644
b38b0f
--- a/target/s390x/gen-features.c
b38b0f
+++ b/target/s390x/gen-features.c
b38b0f
@@ -680,6 +680,7 @@ static CpuFeatDefSpec CpuFeatDef[] = {
b38b0f
 #define FEAT_GROUP_INITIALIZER(_name)                  \
b38b0f
     {                                                  \
b38b0f
         .name = "S390_FEAT_GROUP_LIST_" #_name,        \
b38b0f
+        .enum_name = "S390_FEAT_GROUP_" #_name,        \
b38b0f
         .bits =                                        \
b38b0f
             { .data = group_##_name,                   \
b38b0f
               .len = ARRAY_SIZE(group_##_name) },      \
b38b0f
@@ -687,6 +688,7 @@ static CpuFeatDefSpec CpuFeatDef[] = {
b38b0f
 
b38b0f
 typedef struct {
b38b0f
     const char *name;
b38b0f
+    const char *enum_name;
b38b0f
     BitSpec bits;
b38b0f
 } FeatGroupDefSpec;
b38b0f
 
b38b0f
@@ -697,7 +699,6 @@ static FeatGroupDefSpec FeatGroupDef[] = {
b38b0f
     FEAT_GROUP_INITIALIZER(PLO),
b38b0f
     FEAT_GROUP_INITIALIZER(TOD_CLOCK_STEERING),
b38b0f
     FEAT_GROUP_INITIALIZER(GEN13_PTFF),
b38b0f
-    FEAT_GROUP_INITIALIZER(MULTIPLE_EPOCH_PTFF),
b38b0f
     FEAT_GROUP_INITIALIZER(MSA),
b38b0f
     FEAT_GROUP_INITIALIZER(MSA_EXT_1),
b38b0f
     FEAT_GROUP_INITIALIZER(MSA_EXT_2),
b38b0f
@@ -707,6 +708,7 @@ static FeatGroupDefSpec FeatGroupDef[] = {
b38b0f
     FEAT_GROUP_INITIALIZER(MSA_EXT_6),
b38b0f
     FEAT_GROUP_INITIALIZER(MSA_EXT_7),
b38b0f
     FEAT_GROUP_INITIALIZER(MSA_EXT_8),
b38b0f
+    FEAT_GROUP_INITIALIZER(MULTIPLE_EPOCH_PTFF),
b38b0f
 };
b38b0f
 
b38b0f
 #define QEMU_FEAT_INITIALIZER(_name)                   \
b38b0f
@@ -829,6 +831,19 @@ static void print_feature_group_defs(void)
b38b0f
     }
b38b0f
 }
b38b0f
 
b38b0f
+static void print_feature_group_enum_type(void)
b38b0f
+{
b38b0f
+    int i;
b38b0f
+
b38b0f
+    printf("\n/* CPU feature group enum type */\n"
b38b0f
+           "typedef enum {\n");
b38b0f
+    for (i = 0; i < ARRAY_SIZE(FeatGroupDef); i++) {
b38b0f
+        printf("\t%s,\n", FeatGroupDef[i].enum_name);
b38b0f
+    }
b38b0f
+    printf("\tS390_FEAT_GROUP_MAX,\n"
b38b0f
+           "} S390FeatGroup;\n");
b38b0f
+}
b38b0f
+
b38b0f
 int main(int argc, char *argv[])
b38b0f
 {
b38b0f
     printf("/*\n"
b38b0f
@@ -845,6 +860,7 @@ int main(int argc, char *argv[])
b38b0f
     print_feature_defs();
b38b0f
     print_feature_group_defs();
b38b0f
     print_qemu_feature_defs();
b38b0f
+    print_feature_group_enum_type();
b38b0f
     printf("\n#endif\n");
b38b0f
     return 0;
b38b0f
 }
b38b0f
-- 
b38b0f
1.8.3.1
b38b0f