Received: from eggs.gnu.org ([2001:4830:134:3::10]:58815) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XoAkD-00089z-OM for qemu-devel@nongnu.org; Tue, 11 Nov 2014 07:40:34 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XoAk2-00048B-Vc for qemu-devel@nongnu.org; Tue, 11 Nov 2014 07:40:25 -0500 Received: from e06smtp16.uk.ibm.com ([195.75.94.112]:52483) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XoAk2-00047v-MZ for qemu-devel@nongnu.org; Tue, 11 Nov 2014 07:40:14 -0500 Received: from /spool/local by e06smtp16.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 11 Nov 2014 12:40:13 -0000 Received: from b06cxnps4074.portsmouth.uk.ibm.com (d06relay11.portsmouth.uk.ibm.com [9.149.109.196]) by d06dlp03.portsmouth.uk.ibm.com (Postfix) with ESMTP id 3137A1B0804B for ; Tue, 11 Nov 2014 12:40:20 +0000 (GMT) Received: from d06av12.portsmouth.uk.ibm.com (d06av12.portsmouth.uk.ibm.com [9.149.37.247]) by b06cxnps4074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id sABCeBp711076036 for ; Tue, 11 Nov 2014 12:40:11 GMT Received: from d06av12.portsmouth.uk.ibm.com (localhost [127.0.0.1]) by d06av12.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id sABCeA3s006241 for ; Tue, 11 Nov 2014 05:40:11 -0700 Date: Tue, 11 Nov 2014 13:40:08 +0100 From: Frank Blaschka Message-ID: <20141111124008.GB16205@tuxmaker.boeblingen.de.ibm.com> References: <1415629216-59652-1-git-send-email-blaschka@linux.vnet.ibm.com> <1415629216-59652-3-git-send-email-blaschka@linux.vnet.ibm.com> <5460E025.60004@suse.de> <20141111121015.GA35338@tuxmaker.boeblingen.de.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Subject: Re: [Qemu-devel] [PATCH 2/3] s390: implement pci instructions List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Maydell Cc: Frank Blaschka , James Hogan , Marcelo Tosatti , Alexander Graf , QEMU Developers , Christian Borntraeger , Cornelia Huck , Paolo Bonzini , Richard Henderson On Tue, Nov 11, 2014 at 12:17:17PM +0000, Peter Maydell wrote: > On 11 November 2014 12:10, Frank Blaschka wrote: > > On Mon, Nov 10, 2014 at 04:56:21PM +0100, Alexander Graf wrote: > >> > +static uint8_t barsize(uint64_t size) > >> > +{ > >> > + uint64_t mask = 1; > >> > + int i; > >> > + > >> > + if (!size) { > >> > + return 0; > >> > + } > >> > + > >> > + for (i = 0; i < 64; i++) { > >> > + if (size & mask) { > >> > + break; > >> > + } > >> > + mask = (mask << 1); > >> > + } > >> > + > >> > + return i; > >> > +} > >> > >> Isn't there an existing helper for this in the PCI layer? > >> > > > > Did not find one, this function is used to fill a s390 specific len > > in an instruction intercept (architecture specific encoding of the len). > > If you do need to implement this here then you should probably > be using ctz64(). I think what you have here is equivalent to > > return size ? ctz64(size) : 0; > > but you should check that. will do thx! > > thanks > -- PMM >