Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755029AbbBTTfS (ORCPT ); Fri, 20 Feb 2015 14:35:18 -0500 Received: from e06smtp16.uk.ibm.com ([195.75.94.112]:43407 "EHLO e06smtp16.uk.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754408AbbBTTfP (ORCPT ); Fri, 20 Feb 2015 14:35:15 -0500 Date: Fri, 20 Feb 2015 20:35:05 +0100 From: Michael Mueller To: Alexander Graf Cc: Richard Henderson , "qemu-devel@nongnu.org" , "kvm@vger.kernel.org" , "linux-s390@vger.kernel.org" , "linux-kernel@vger.kernel.org" , Gleb Natapov , Christian Borntraeger , "Jason J. Herne" , Cornelia Huck , Paolo Bonzini , Andreas Faerber Subject: Re: [Qemu-devel] [RFC PATCH v2 10/15] cpu-model/s390: Add cpu class initialization routines Message-ID: <20150220203505.68a47992@bee> In-Reply-To: <5F2B0AC8-FE9F-4107-90DA-B2E6A3C262EC@suse.de> References: <1424183053-4310-1-git-send-email-mimu@linux.vnet.ibm.com> <1424183053-4310-11-git-send-email-mimu@linux.vnet.ibm.com> <54E778EB.5050301@twiddle.net> <20150220195928.6388e017@bee> <5F2B0AC8-FE9F-4107-90DA-B2E6A3C262EC@suse.de> Organization: IBM X-Mailer: Claws Mail 3.9.3 (GTK+ 2.24.23; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 15022019-0025-0000-0000-000003F85937 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1794 Lines: 60 On Fri, 20 Feb 2015 20:21:45 +0100 Alexander Graf wrote: > > > > > Am 20.02.2015 um 19:59 schrieb Michael Mueller : > > > > On Fri, 20 Feb 2015 10:11:55 -0800 > > Richard Henderson wrote: > > > >>> +static inline uint64_t big_endian_bit(unsigned long nr) > >>> +{ > >>> + return 1ul << (BITS_PER_LONG - (nr % BITS_PER_LONG)); > >>> +}; > >> > >> This is buggy. NR=0 should map to 63, not 64. > > > > I'm sure I was asked to replace my constant 64 and 63 with that defines and at the end I > > messed it up... :-( > > > >> > >>> + return !!(*ptr & big_endian_bit(nr)); > >> > >> Personally I dislike !! as an idiom. Given that big_endian_bit isn't used > >> anywhere else, can we integrate it and change this to > >> > >> static inline int test_facility(unsigned long nr, uint64_t *fac_list) > >> { > >> unsigned long word = nr / BITS_PER_LONG; > >> unsigned long be_bit = 63 - (nr % BITS_PER_LONG); > >> return (fac_list[word] >> be_bit) & 1; > >> } > > > > Yes, I just use it in this context. I will integrate your version. > > > > BTW I changed the whole facility defining code to be generated by an external helper at > > compile time. That is more simple and safe to change. I will send it with v3. See attachment > > for an example of the generated header file. > > Please make sure to use ULL with constants and uint64_t on variables. Long is almost always > wrong in QEMU. yep > > Alex > > > > > Thanks, > > Michael > > > > > -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/