All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] s390x/cpumodel: enum type S390FeatGroup now gets generated
@ 2018-07-25 14:36 Michael Mueller
  2018-07-25 14:48 ` David Hildenbrand
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Michael Mueller @ 2018-07-25 14:36 UTC (permalink / raw)
  To: qemu-s390x; +Cc: qemu-devel, cohuck, borntraeger, agraf, david, Michael Mueller

The enumeration type S390FeatGroup is now generated as well.
This shall simplify the definition of new feature groups
without the requirement to modify existing code.

Signed-off-by: Michael Mueller <mimu@linux.ibm.com>
---
 target/s390x/cpu_features.c |  1 -
 target/s390x/cpu_features.h | 19 +------------------
 target/s390x/gen-features.c | 18 +++++++++++++++++-
 3 files changed, 18 insertions(+), 20 deletions(-)

diff --git a/target/s390x/cpu_features.c b/target/s390x/cpu_features.c
index 3b9e2745e9..d623db34a6 100644
--- a/target/s390x/cpu_features.c
+++ b/target/s390x/cpu_features.c
@@ -13,7 +13,6 @@
 #include "qemu/osdep.h"
 #include "qemu/module.h"
 #include "cpu_features.h"
-#include "gen-features.h"
 
 #define FEAT_INIT(_name, _type, _bit, _desc) \
     {                                                \
diff --git a/target/s390x/cpu_features.h b/target/s390x/cpu_features.h
index 968b12fdfe..effe790271 100644
--- a/target/s390x/cpu_features.h
+++ b/target/s390x/cpu_features.h
@@ -16,6 +16,7 @@
 
 #include "qemu/bitmap.h"
 #include "cpu_features_def.h"
+#include "gen-features.h"
 
 /* CPU features are announced via different ways */
 typedef enum {
@@ -64,24 +65,6 @@ void s390_add_from_feat_block(S390FeatBitmap features, S390FeatType type,
 void s390_feat_bitmap_to_ascii(const S390FeatBitmap features, void *opaque,
                                void (*fn)(const char *name, void *opaque));
 
-/* static groups that will never change */
-typedef enum {
-    S390_FEAT_GROUP_PLO,
-    S390_FEAT_GROUP_TOD_CLOCK_STEERING,
-    S390_FEAT_GROUP_GEN13_PTFF_ENH,
-    S390_FEAT_GROUP_MSA,
-    S390_FEAT_GROUP_MSA_EXT_1,
-    S390_FEAT_GROUP_MSA_EXT_2,
-    S390_FEAT_GROUP_MSA_EXT_3,
-    S390_FEAT_GROUP_MSA_EXT_4,
-    S390_FEAT_GROUP_MSA_EXT_5,
-    S390_FEAT_GROUP_MSA_EXT_6,
-    S390_FEAT_GROUP_MSA_EXT_7,
-    S390_FEAT_GROUP_MSA_EXT_8,
-    S390_FEAT_GROUP_MULTIPLE_EPOCH_PTFF,
-    S390_FEAT_GROUP_MAX,
-} S390FeatGroup;
-
 /* Definition of a CPU feature group */
 typedef struct {
     const char *name;       /* name exposed to the user */
diff --git a/target/s390x/gen-features.c b/target/s390x/gen-features.c
index 6626b6f565..2ca5ededb3 100644
--- a/target/s390x/gen-features.c
+++ b/target/s390x/gen-features.c
@@ -661,6 +661,7 @@ static CpuFeatDefSpec CpuFeatDef[] = {
 #define FEAT_GROUP_INITIALIZER(_name)                  \
     {                                                  \
         .name = "S390_FEAT_GROUP_LIST_" #_name,        \
+        .enum_name = "S390_FEAT_GROUP_" #_name,        \
         .bits =                                        \
             { .data = group_##_name,                   \
               .len = ARRAY_SIZE(group_##_name) },      \
@@ -668,6 +669,7 @@ static CpuFeatDefSpec CpuFeatDef[] = {
 
 typedef struct {
     const char *name;
+    const char *enum_name;
     BitSpec bits;
 } FeatGroupDefSpec;
 
@@ -678,7 +680,6 @@ static FeatGroupDefSpec FeatGroupDef[] = {
     FEAT_GROUP_INITIALIZER(PLO),
     FEAT_GROUP_INITIALIZER(TOD_CLOCK_STEERING),
     FEAT_GROUP_INITIALIZER(GEN13_PTFF),
-    FEAT_GROUP_INITIALIZER(MULTIPLE_EPOCH_PTFF),
     FEAT_GROUP_INITIALIZER(MSA),
     FEAT_GROUP_INITIALIZER(MSA_EXT_1),
     FEAT_GROUP_INITIALIZER(MSA_EXT_2),
@@ -688,6 +689,7 @@ static FeatGroupDefSpec FeatGroupDef[] = {
     FEAT_GROUP_INITIALIZER(MSA_EXT_6),
     FEAT_GROUP_INITIALIZER(MSA_EXT_7),
     FEAT_GROUP_INITIALIZER(MSA_EXT_8),
+    FEAT_GROUP_INITIALIZER(MULTIPLE_EPOCH_PTFF),
 };
 
 #define QEMU_FEAT_INITIALIZER(_name)                   \
@@ -810,6 +812,19 @@ static void print_feature_group_defs(void)
     }
 }
 
+static void print_feature_group_enum_type(void)
+{
+    int i;
+
+    printf("\n/* CPU feature group enum type */\n"
+           "typedef enum {\n");
+    for (i = 0; i < ARRAY_SIZE(FeatGroupDef); i++) {
+        printf("\t%s,\n", FeatGroupDef[i].enum_name);
+    }
+    printf("\tS390_FEAT_GROUP_MAX,\n"
+           "} S390FeatGroup;\n");
+}
+
 int main(int argc, char *argv[])
 {
     printf("/*\n"
@@ -826,6 +841,7 @@ int main(int argc, char *argv[])
     print_feature_defs();
     print_feature_group_defs();
     print_qemu_feature_defs();
+    print_feature_group_enum_type();
     printf("\n#endif\n");
     return 0;
 }
-- 
2.13.4

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] [PATCH] s390x/cpumodel: enum type S390FeatGroup now gets generated
  2018-07-25 14:36 [Qemu-devel] [PATCH] s390x/cpumodel: enum type S390FeatGroup now gets generated Michael Mueller
@ 2018-07-25 14:48 ` David Hildenbrand
  2018-07-25 15:32 ` [Qemu-devel] [qemu-s390x] " Christian Borntraeger
  2018-07-26 11:39 ` [Qemu-devel] " Cornelia Huck
  2 siblings, 0 replies; 4+ messages in thread
From: David Hildenbrand @ 2018-07-25 14:48 UTC (permalink / raw)
  To: Michael Mueller, qemu-s390x; +Cc: qemu-devel, cohuck, borntraeger, agraf

On 25.07.2018 16:36, Michael Mueller wrote:
> The enumeration type S390FeatGroup is now generated as well.
> This shall simplify the definition of new feature groups
> without the requirement to modify existing code.
> 
> Signed-off-by: Michael Mueller <mimu@linux.ibm.com>
> ---
>  target/s390x/cpu_features.c |  1 -
>  target/s390x/cpu_features.h | 19 +------------------
>  target/s390x/gen-features.c | 18 +++++++++++++++++-
>  3 files changed, 18 insertions(+), 20 deletions(-)
> 
> diff --git a/target/s390x/cpu_features.c b/target/s390x/cpu_features.c
> index 3b9e2745e9..d623db34a6 100644
> --- a/target/s390x/cpu_features.c
> +++ b/target/s390x/cpu_features.c
> @@ -13,7 +13,6 @@
>  #include "qemu/osdep.h"
>  #include "qemu/module.h"
>  #include "cpu_features.h"
> -#include "gen-features.h"
>  
>  #define FEAT_INIT(_name, _type, _bit, _desc) \
>      {                                                \
> diff --git a/target/s390x/cpu_features.h b/target/s390x/cpu_features.h
> index 968b12fdfe..effe790271 100644
> --- a/target/s390x/cpu_features.h
> +++ b/target/s390x/cpu_features.h
> @@ -16,6 +16,7 @@
>  
>  #include "qemu/bitmap.h"
>  #include "cpu_features_def.h"
> +#include "gen-features.h"
>  
>  /* CPU features are announced via different ways */
>  typedef enum {
> @@ -64,24 +65,6 @@ void s390_add_from_feat_block(S390FeatBitmap features, S390FeatType type,
>  void s390_feat_bitmap_to_ascii(const S390FeatBitmap features, void *opaque,
>                                 void (*fn)(const char *name, void *opaque));
>  
> -/* static groups that will never change */
> -typedef enum {
> -    S390_FEAT_GROUP_PLO,
> -    S390_FEAT_GROUP_TOD_CLOCK_STEERING,
> -    S390_FEAT_GROUP_GEN13_PTFF_ENH,
> -    S390_FEAT_GROUP_MSA,
> -    S390_FEAT_GROUP_MSA_EXT_1,
> -    S390_FEAT_GROUP_MSA_EXT_2,
> -    S390_FEAT_GROUP_MSA_EXT_3,
> -    S390_FEAT_GROUP_MSA_EXT_4,
> -    S390_FEAT_GROUP_MSA_EXT_5,
> -    S390_FEAT_GROUP_MSA_EXT_6,
> -    S390_FEAT_GROUP_MSA_EXT_7,
> -    S390_FEAT_GROUP_MSA_EXT_8,
> -    S390_FEAT_GROUP_MULTIPLE_EPOCH_PTFF,
> -    S390_FEAT_GROUP_MAX,
> -} S390FeatGroup;
> -
>  /* Definition of a CPU feature group */
>  typedef struct {
>      const char *name;       /* name exposed to the user */
> diff --git a/target/s390x/gen-features.c b/target/s390x/gen-features.c
> index 6626b6f565..2ca5ededb3 100644
> --- a/target/s390x/gen-features.c
> +++ b/target/s390x/gen-features.c
> @@ -661,6 +661,7 @@ static CpuFeatDefSpec CpuFeatDef[] = {
>  #define FEAT_GROUP_INITIALIZER(_name)                  \
>      {                                                  \
>          .name = "S390_FEAT_GROUP_LIST_" #_name,        \
> +        .enum_name = "S390_FEAT_GROUP_" #_name,        \
>          .bits =                                        \
>              { .data = group_##_name,                   \
>                .len = ARRAY_SIZE(group_##_name) },      \
> @@ -668,6 +669,7 @@ static CpuFeatDefSpec CpuFeatDef[] = {
>  
>  typedef struct {
>      const char *name;
> +    const char *enum_name;
>      BitSpec bits;
>  } FeatGroupDefSpec;
>  
> @@ -678,7 +680,6 @@ static FeatGroupDefSpec FeatGroupDef[] = {
>      FEAT_GROUP_INITIALIZER(PLO),
>      FEAT_GROUP_INITIALIZER(TOD_CLOCK_STEERING),
>      FEAT_GROUP_INITIALIZER(GEN13_PTFF),
> -    FEAT_GROUP_INITIALIZER(MULTIPLE_EPOCH_PTFF),
>      FEAT_GROUP_INITIALIZER(MSA),
>      FEAT_GROUP_INITIALIZER(MSA_EXT_1),
>      FEAT_GROUP_INITIALIZER(MSA_EXT_2),
> @@ -688,6 +689,7 @@ static FeatGroupDefSpec FeatGroupDef[] = {
>      FEAT_GROUP_INITIALIZER(MSA_EXT_6),
>      FEAT_GROUP_INITIALIZER(MSA_EXT_7),
>      FEAT_GROUP_INITIALIZER(MSA_EXT_8),
> +    FEAT_GROUP_INITIALIZER(MULTIPLE_EPOCH_PTFF),
>  };
>  
>  #define QEMU_FEAT_INITIALIZER(_name)                   \
> @@ -810,6 +812,19 @@ static void print_feature_group_defs(void)
>      }
>  }
>  
> +static void print_feature_group_enum_type(void)
> +{
> +    int i;
> +
> +    printf("\n/* CPU feature group enum type */\n"
> +           "typedef enum {\n");
> +    for (i = 0; i < ARRAY_SIZE(FeatGroupDef); i++) {
> +        printf("\t%s,\n", FeatGroupDef[i].enum_name);
> +    }
> +    printf("\tS390_FEAT_GROUP_MAX,\n"
> +           "} S390FeatGroup;\n");
> +}
> +
>  int main(int argc, char *argv[])
>  {
>      printf("/*\n"
> @@ -826,6 +841,7 @@ int main(int argc, char *argv[])
>      print_feature_defs();
>      print_feature_group_defs();
>      print_qemu_feature_defs();
> +    print_feature_group_enum_type();
>      printf("\n#endif\n");
>      return 0;
>  }
> 


Thanks!

Acked-by: David Hildenbrand <david@redhat.com>

-- 

Thanks,

David / dhildenb

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] [qemu-s390x] [PATCH] s390x/cpumodel: enum type S390FeatGroup now gets generated
  2018-07-25 14:36 [Qemu-devel] [PATCH] s390x/cpumodel: enum type S390FeatGroup now gets generated Michael Mueller
  2018-07-25 14:48 ` David Hildenbrand
@ 2018-07-25 15:32 ` Christian Borntraeger
  2018-07-26 11:39 ` [Qemu-devel] " Cornelia Huck
  2 siblings, 0 replies; 4+ messages in thread
From: Christian Borntraeger @ 2018-07-25 15:32 UTC (permalink / raw)
  To: Michael Mueller, qemu-s390x; +Cc: david, cohuck, qemu-devel, agraf

Acked-by Christian Borntraeger <borntraeger@de.ibm.com>

A quick test seems to indicate that everything is good.


On 07/25/2018 04:36 PM, Michael Mueller wrote:
> The enumeration type S390FeatGroup is now generated as well.
> This shall simplify the definition of new feature groups
> without the requirement to modify existing code.
> 
> Signed-off-by: Michael Mueller <mimu@linux.ibm.com>
> ---
>  target/s390x/cpu_features.c |  1 -
>  target/s390x/cpu_features.h | 19 +------------------
>  target/s390x/gen-features.c | 18 +++++++++++++++++-
>  3 files changed, 18 insertions(+), 20 deletions(-)
> 
> diff --git a/target/s390x/cpu_features.c b/target/s390x/cpu_features.c
> index 3b9e2745e9..d623db34a6 100644
> --- a/target/s390x/cpu_features.c
> +++ b/target/s390x/cpu_features.c
> @@ -13,7 +13,6 @@
>  #include "qemu/osdep.h"
>  #include "qemu/module.h"
>  #include "cpu_features.h"
> -#include "gen-features.h"
>  
>  #define FEAT_INIT(_name, _type, _bit, _desc) \
>      {                                                \
> diff --git a/target/s390x/cpu_features.h b/target/s390x/cpu_features.h
> index 968b12fdfe..effe790271 100644
> --- a/target/s390x/cpu_features.h
> +++ b/target/s390x/cpu_features.h
> @@ -16,6 +16,7 @@
>  
>  #include "qemu/bitmap.h"
>  #include "cpu_features_def.h"
> +#include "gen-features.h"
>  
>  /* CPU features are announced via different ways */
>  typedef enum {
> @@ -64,24 +65,6 @@ void s390_add_from_feat_block(S390FeatBitmap features, S390FeatType type,
>  void s390_feat_bitmap_to_ascii(const S390FeatBitmap features, void *opaque,
>                                 void (*fn)(const char *name, void *opaque));
>  
> -/* static groups that will never change */
> -typedef enum {
> -    S390_FEAT_GROUP_PLO,
> -    S390_FEAT_GROUP_TOD_CLOCK_STEERING,
> -    S390_FEAT_GROUP_GEN13_PTFF_ENH,
> -    S390_FEAT_GROUP_MSA,
> -    S390_FEAT_GROUP_MSA_EXT_1,
> -    S390_FEAT_GROUP_MSA_EXT_2,
> -    S390_FEAT_GROUP_MSA_EXT_3,
> -    S390_FEAT_GROUP_MSA_EXT_4,
> -    S390_FEAT_GROUP_MSA_EXT_5,
> -    S390_FEAT_GROUP_MSA_EXT_6,
> -    S390_FEAT_GROUP_MSA_EXT_7,
> -    S390_FEAT_GROUP_MSA_EXT_8,
> -    S390_FEAT_GROUP_MULTIPLE_EPOCH_PTFF,
> -    S390_FEAT_GROUP_MAX,
> -} S390FeatGroup;
> -
>  /* Definition of a CPU feature group */
>  typedef struct {
>      const char *name;       /* name exposed to the user */
> diff --git a/target/s390x/gen-features.c b/target/s390x/gen-features.c
> index 6626b6f565..2ca5ededb3 100644
> --- a/target/s390x/gen-features.c
> +++ b/target/s390x/gen-features.c
> @@ -661,6 +661,7 @@ static CpuFeatDefSpec CpuFeatDef[] = {
>  #define FEAT_GROUP_INITIALIZER(_name)                  \
>      {                                                  \
>          .name = "S390_FEAT_GROUP_LIST_" #_name,        \
> +        .enum_name = "S390_FEAT_GROUP_" #_name,        \
>          .bits =                                        \
>              { .data = group_##_name,                   \
>                .len = ARRAY_SIZE(group_##_name) },      \
> @@ -668,6 +669,7 @@ static CpuFeatDefSpec CpuFeatDef[] = {
>  
>  typedef struct {
>      const char *name;
> +    const char *enum_name;
>      BitSpec bits;
>  } FeatGroupDefSpec;
>  
> @@ -678,7 +680,6 @@ static FeatGroupDefSpec FeatGroupDef[] = {
>      FEAT_GROUP_INITIALIZER(PLO),
>      FEAT_GROUP_INITIALIZER(TOD_CLOCK_STEERING),
>      FEAT_GROUP_INITIALIZER(GEN13_PTFF),
> -    FEAT_GROUP_INITIALIZER(MULTIPLE_EPOCH_PTFF),
>      FEAT_GROUP_INITIALIZER(MSA),
>      FEAT_GROUP_INITIALIZER(MSA_EXT_1),
>      FEAT_GROUP_INITIALIZER(MSA_EXT_2),
> @@ -688,6 +689,7 @@ static FeatGroupDefSpec FeatGroupDef[] = {
>      FEAT_GROUP_INITIALIZER(MSA_EXT_6),
>      FEAT_GROUP_INITIALIZER(MSA_EXT_7),
>      FEAT_GROUP_INITIALIZER(MSA_EXT_8),
> +    FEAT_GROUP_INITIALIZER(MULTIPLE_EPOCH_PTFF),
>  };
>  
>  #define QEMU_FEAT_INITIALIZER(_name)                   \
> @@ -810,6 +812,19 @@ static void print_feature_group_defs(void)
>      }
>  }
>  
> +static void print_feature_group_enum_type(void)
> +{
> +    int i;
> +
> +    printf("\n/* CPU feature group enum type */\n"
> +           "typedef enum {\n");
> +    for (i = 0; i < ARRAY_SIZE(FeatGroupDef); i++) {
> +        printf("\t%s,\n", FeatGroupDef[i].enum_name);
> +    }
> +    printf("\tS390_FEAT_GROUP_MAX,\n"
> +           "} S390FeatGroup;\n");
> +}
> +
>  int main(int argc, char *argv[])
>  {
>      printf("/*\n"
> @@ -826,6 +841,7 @@ int main(int argc, char *argv[])
>      print_feature_defs();
>      print_feature_group_defs();
>      print_qemu_feature_defs();
> +    print_feature_group_enum_type();
>      printf("\n#endif\n");
>      return 0;
>  }
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] [PATCH] s390x/cpumodel: enum type S390FeatGroup now gets generated
  2018-07-25 14:36 [Qemu-devel] [PATCH] s390x/cpumodel: enum type S390FeatGroup now gets generated Michael Mueller
  2018-07-25 14:48 ` David Hildenbrand
  2018-07-25 15:32 ` [Qemu-devel] [qemu-s390x] " Christian Borntraeger
@ 2018-07-26 11:39 ` Cornelia Huck
  2 siblings, 0 replies; 4+ messages in thread
From: Cornelia Huck @ 2018-07-26 11:39 UTC (permalink / raw)
  To: Michael Mueller; +Cc: qemu-s390x, qemu-devel, borntraeger, agraf, david

On Wed, 25 Jul 2018 16:36:17 +0200
Michael Mueller <mimu@linux.ibm.com> wrote:

> The enumeration type S390FeatGroup is now generated as well.
> This shall simplify the definition of new feature groups
> without the requirement to modify existing code.

So can we expect new feature groups soon? :)

> 
> Signed-off-by: Michael Mueller <mimu@linux.ibm.com>
> ---
>  target/s390x/cpu_features.c |  1 -
>  target/s390x/cpu_features.h | 19 +------------------
>  target/s390x/gen-features.c | 18 +++++++++++++++++-
>  3 files changed, 18 insertions(+), 20 deletions(-)

Thanks, applied.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-07-26 11:39 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-25 14:36 [Qemu-devel] [PATCH] s390x/cpumodel: enum type S390FeatGroup now gets generated Michael Mueller
2018-07-25 14:48 ` David Hildenbrand
2018-07-25 15:32 ` [Qemu-devel] [qemu-s390x] " Christian Borntraeger
2018-07-26 11:39 ` [Qemu-devel] " Cornelia Huck

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.