From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S966164AbcIHJuO (ORCPT ); Thu, 8 Sep 2016 05:50:14 -0400 Received: from vrout10.yaziba.net ([185.56.204.32]:59606 "EHLO vrout10.yaziba.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965632AbcIHJuK (ORCPT ); Thu, 8 Sep 2016 05:50:10 -0400 Date: Thu, 8 Sep 2016 11:50:05 +0200 From: Vincent Siles To: Will Deacon Cc: Russell King , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: lsl / lsr possible confusion in v7_flush_dcache_all Message-ID: <20160908095004.GF14909@vsiles-Desktop> References: <20160908091520.GE14909@vsiles-Desktop> <20160908093801.GB1493@arm.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="dWYAkE0V1FpFQHQ3" Content-Disposition: inline In-Reply-To: <20160908093801.GB1493@arm.com> User-Agent: Mutt/1.5.21 (2010-09-15) X-DRWEB-SCAN: ok X-VRSPAM-SCORE: -100 X-VRSPAM-STATE: legit X-VRSPAM-CAUSE: gggruggvucftvghtrhhoucdtuddrfeeluddriedvgddvvdculddtuddrfeeltddrtddtmdcutefuodetggdotefrucfrrhhofhhilhgvmecuggftfghnshhusghstghrihgsvgenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhepfffhvffukfhfgggtuggjfgesghdtreertderjeenucfhrhhomhepgghinhgtvghnthcuufhilhgvshcuoehvihhntggvnhhtrdhsihhlvghssehprhhovhgvnhhruhhnrdgtohhmqeenucffohhmrghinhepkhgvrhhnvghlrdhorhhgnecukfhppeekvddrvdeftddrudekjedrudeileenucfrrghrrghmpehmohguvgepshhmthhpohhuth X-VRSPAM-EXTCAUSE: mhhouggvpehsmhhtphhouhht Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --dWYAkE0V1FpFQHQ3 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Oh, right. I missed that ! Thank you for the help. Best, Vincent On 08-09-16 10:38:01, Will Deacon wrote: > On Thu, Sep 08, 2016 at 11:15:20AM +0200, Vincent Siles wrote: > > While reading the v7_flush_dcache_all (arch/arm/mm/cache-v7.S), I > > stumbled upon this line: > >=20 > > # r10 is the current cache level > > 127: add r2, r10, r10, lsr #1 @ work out 3x current cache level > >=20 > > If we want r2 to be 3 * r10, we should compute r10 + (r10 << 1), which > > is lsl, not lsr. > >=20 > > I check for a recent kernel, the issue seems to still be here: > > repo: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linu= x.git > > revision: d71f058617564750261b673ea9b3352382b9cde4 >=20 > This code is take pretty much verbatim from the ARM ARM and, despite > being fairly obfuscated, does what it says on the tin. r10 is incremented > by 2 each time round the loop, so this is basically doing 2i + (2i / 2). >=20 > Will --dWYAkE0V1FpFQHQ3 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQEcBAEBAgAGBQJX0TRMAAoJEMXnukaOoP+CNJcH/0CP2A5f+u4TVvCLQ8C68ysW 3swQ3FUBXN01sp7SfN55H7sk77/H60/mKuYgJ8sZozsohU/ji6XtR7Ncp5HuKAhv Clgyz1fIlSVz6+mf2pnjr7sNkCr32KS7KMITaFv/bdavFWAYKNBCHn8Wcf2nuvND D0jbVyz9158b976tfwoRzwbQPoAnp13b4niMwhlebtE7ZhygNPtFUJK3RNS344iP 8vi7iX2Z62tVE4/ETPAcDdTeG9Op7rI882BtDPl9VLHubeJRJTSHavBiDnPu0yAm f5LYLdo8jp1FZpEq/9d5x411+u+31k7IKAP8LImbAurVWRpJaWdYzIGI5x0J1Co= =iwbl -----END PGP SIGNATURE----- --dWYAkE0V1FpFQHQ3--