From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38746) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bFS4J-0007nk-0K for qemu-devel@nongnu.org; Tue, 21 Jun 2016 16:14:43 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bFS4C-0007YQ-QK for qemu-devel@nongnu.org; Tue, 21 Jun 2016 16:14:41 -0400 Received: from mx1.redhat.com ([209.132.183.28]:55669) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bFS4C-0007YC-KW for qemu-devel@nongnu.org; Tue, 21 Jun 2016 16:14:36 -0400 References: <1466514153-85777-1-git-send-email-dahi@linux.vnet.ibm.com> <1466514153-85777-7-git-send-email-dahi@linux.vnet.ibm.com> From: Thomas Huth Message-ID: <5769A026.3020909@redhat.com> Date: Tue, 21 Jun 2016 22:14:30 +0200 MIME-Version: 1.0 In-Reply-To: <1466514153-85777-7-git-send-email-dahi@linux.vnet.ibm.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [RFC 06/28] s390x/cpumodel: introduce CPU feature group definitions List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: David Hildenbrand , qemu-devel@nongnu.org Cc: ehabkost@redhat.com, borntraeger@de.ibm.com, fiuczy@linux.vnet.ibm.com, cornelia.huck@de.ibm.com, imammedo@redhat.com, jdenemar@redhat.com, mimu@linux.vnet.ibm.com On 21.06.2016 15:02, David Hildenbrand wrote: > Let's use the generated groups to create feature group representations for > the user. These groups can later be used to enable/disable multiple > features in one shot and will be used to reduce the amount of reported > features to the user if all subfeatures are in place. > > Acked-by: Cornelia Huck > Signed-off-by: David Hildenbrand > --- > target-s390x/cpu_features.c | 44 +++++++++++++++++++++++++++++++++++++++++++- > target-s390x/cpu_features.h | 23 +++++++++++++++++++++++ > 2 files changed, 66 insertions(+), 1 deletion(-) > > diff --git a/target-s390x/cpu_features.c b/target-s390x/cpu_features.c > index c78a189..6ec2bfc 100644 > --- a/target-s390x/cpu_features.c > +++ b/target-s390x/cpu_features.c > @@ -12,6 +12,7 @@ > > #include "qemu/osdep.h" > #include "cpu_features.h" > +#include "gen-features.h" > > #define FEAT_INIT(_name, _type, _bit, _desc) \ > { \ > @@ -321,14 +322,55 @@ void s390_add_from_feat_block(S390FeatBitmap features, S390FeatType type, > } > } > > -void s390_feat_bitmap_to_ascii(const S390FeatBitmap bitmap, void *opaque, > +void s390_feat_bitmap_to_ascii(const S390FeatBitmap features, void *opaque, > void (*fn)(const char *name, void *opaque)) > { > + S390FeatBitmap bitmap, tmp; > + S390FeatGroup group; > S390Feat feat; > > + bitmap_copy(bitmap, features, S390_FEAT_MAX); > + > + /* process whole groups first */ > + for (group = 0; group < S390_FEAT_GROUP_MAX; group++) { > + const S390FeatGroupDef *def = s390_feat_group_def(group); > + > + bitmap_and(tmp, bitmap, def->feat, S390_FEAT_MAX); > + if (bitmap_equal(tmp, def->feat, S390_FEAT_MAX)) { > + bitmap_andnot(bitmap, bitmap, def->feat, S390_FEAT_MAX); > + (*fn)(def->name, opaque); Maybe simply write fn(dev->name, opaque); instead? Thomas