From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43626) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bFbW1-0006CO-EO for qemu-devel@nongnu.org; Wed, 22 Jun 2016 02:19:58 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bFbVx-0000dw-3m for qemu-devel@nongnu.org; Wed, 22 Jun 2016 02:19:56 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:28315) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bFbVw-0000dj-QE for qemu-devel@nongnu.org; Wed, 22 Jun 2016 02:19:53 -0400 Received: from pps.filterd (m0098394.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.11/8.16.0.11) with SMTP id u5M6Dtei060836 for ; Wed, 22 Jun 2016 02:19:51 -0400 Received: from e06smtp17.uk.ibm.com (e06smtp17.uk.ibm.com [195.75.94.113]) by mx0a-001b2d01.pphosted.com with ESMTP id 23qcxdw6ya-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Wed, 22 Jun 2016 02:19:51 -0400 Received: from localhost by e06smtp17.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 22 Jun 2016 07:19:48 +0100 Received: from b06cxnps4076.portsmouth.uk.ibm.com (d06relay13.portsmouth.uk.ibm.com [9.149.109.198]) by d06dlp02.portsmouth.uk.ibm.com (Postfix) with ESMTP id 21AE0219004D for ; Wed, 22 Jun 2016 07:19:17 +0100 (BST) Received: from d06av09.portsmouth.uk.ibm.com (d06av09.portsmouth.uk.ibm.com [9.149.37.250]) by b06cxnps4076.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id u5M6JkJq8257832 for ; Wed, 22 Jun 2016 06:19:46 GMT Received: from d06av09.portsmouth.uk.ibm.com (localhost [127.0.0.1]) by d06av09.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id u5M6Jjl5024670 for ; Wed, 22 Jun 2016 00:19:46 -0600 Date: Wed, 22 Jun 2016 08:19:44 +0200 From: David Hildenbrand In-Reply-To: <5769A026.3020909@redhat.com> References: <1466514153-85777-1-git-send-email-dahi@linux.vnet.ibm.com> <1466514153-85777-7-git-send-email-dahi@linux.vnet.ibm.com> <5769A026.3020909@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Message-Id: <20160622081944.14c497d1@thinkpad-w530> 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: Thomas Huth Cc: qemu-devel@nongnu.org, 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? Will that work? As fn is a pointer I am not a 100% sure. If so, I'll change it! Thanks! David