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

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