Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp721127pxb; Wed, 18 Aug 2021 12:31:18 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxZy084ZzfGstaDxKmpHlkRuzi9YX3k3IA8YYfdq+RmCylVuKcUCPvvlKBvD5Y6M8Qa/6/Y X-Received: by 2002:a17:906:774f:: with SMTP id o15mr11383472ejn.200.1629315078419; Wed, 18 Aug 2021 12:31:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629315078; cv=none; d=google.com; s=arc-20160816; b=1E23DlHKXRlvSnGULixoQ6ODkSd7kCtAnCAcoHSYXJj+qH2vYlE6TLl9nBJmz/SSOY uMgLoIPRpQCoDSfjdYnxVdrzLD/TPMQJJkhz+3HS3NX9vI+LfZz/kP3uZdmTkPxaWo+1 1oUubMLgHEiQZjVCrfEengO3BzID7Dper4dbg2cQ87/3+pVBJz5Fg7KrmYwTAaGZaSeS PbNFkE1oMkRLvdQzIUEiGnjlDnYE9HbrGAeDg4zhF1fM46hYuzGmWQSSgHk4XT2Ww+WH sRulcrGFlyDui1Inq4IX0FPNd4VXg0mXVbkRDVLFF2C4HKprZGgijAV1KeVKjm8fJRph ympA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=z2CtbXZhSYwHBnmApJNmVAPZdssIw3jecW+N0mt9heo=; b=zIInq5pIOrPi9h1cweJCf4U7wn6zzTeGMunOg9aTj5PMVQspfwQbuAP5sma/e1D0ZN YJwtR/krcxRb4Lre7FlAhaxiYStjFqDR0fjYmGIrWUmMBL1mJPu0LDs2Xz7kytIVUyzf L3ZG/ewyyoOrAuInNMO4TE38riAi2ITO7YERoktlkeVn39muraUS/7u1PcCviewyzljo 9FfMh+IkChV4Zd4mL1dr73dYmWOPoZy/S+TDFcWxtJrW6DWfAcwSAHO8IfmC7fePT6XZ 2lVtWDwsk9rt+QjWgOOpsgDnKaWl7AiOrrfUgQEkML2DRxHJaOr88N0TNC0mjtNAoPdH uy0g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ca23si594140edb.455.2021.08.18.12.30.44; Wed, 18 Aug 2021 12:31:18 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233074AbhHRT1X (ORCPT + 99 others); Wed, 18 Aug 2021 15:27:23 -0400 Received: from jabberwock.ucw.cz ([46.255.230.98]:33320 "EHLO jabberwock.ucw.cz" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229965AbhHRT1V (ORCPT ); Wed, 18 Aug 2021 15:27:21 -0400 Received: by jabberwock.ucw.cz (Postfix, from userid 1017) id 903D91C0B7A; Wed, 18 Aug 2021 21:26:45 +0200 (CEST) Date: Wed, 18 Aug 2021 21:26:45 +0200 From: Pavel Machek To: Ben Hutchings Cc: Pavel Machek , Greg Kroah-Hartman , linux-kernel@vger.kernel.org, stable@vger.kernel.org, "David S. Miller" , Sasha Levin Subject: Re: [PATCH 5.10 51/96] net: dsa: microchip: Fix ksz_read64() Message-ID: <20210818192645.GA28932@amd> References: <20210816125434.948010115@linuxfoundation.org> <20210816125436.659359567@linuxfoundation.org> <20210817175630.GB30136@amd> <20210817182040.GA12678@cephalopod> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="oyUTqETQ0mS9luUI" Content-Disposition: inline In-Reply-To: <20210817182040.GA12678@cephalopod> User-Agent: Mutt/1.5.23 (2014-03-12) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --oyUTqETQ0mS9luUI Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi! > > > [ Upstream commit c34f674c8875235725c3ef86147a627f165d23b4 ] > > >=20 > > > ksz_read64() currently does some dubious byte-swapping on the two > > > halves of a 64-bit register, and then only returns the high bits. > > > Replace this with a straightforward expression. > >=20 > > The code indeed is very strange, but there are just 2 users, and they > > will now receive byteswapped values, right? If it worked before, it > > will be broken. >=20 > The old code swaps the bytes within each 32-bit word, attempts to > concatenate them into a 64-bit word, then swaps the bytes within the > 64-bit word. There is no need for byte-swapping, only (on little- > endian platforms) a word-swap, which is what the new code does. >=20 > > Did this get enough testing for -stable? >=20 > Yes, I actually developed and tested all the ksz8795 changes in 5.10 > before forward-porting to mainline. >=20 > > Is hw little endian or high endian or...? >=20 > The hardware is big-endian and regmap handles any necessary > byte-swapping for values up to 32 bits. >=20 > > Note that ksz_write64() still contains the strange code, at least in > > 5.10. >=20 > It's unnecessarily complex, but it does work. Thanks for the explanations and sorry for the noise. Indeed ksz_write64() is quite obfuscated, but I can't see a problem. Best regards, Pavel =09 --=20 DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany --oyUTqETQ0mS9luUI Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iEYEARECAAYFAmEdXvUACgkQMOfwapXb+vI8TQCdFSWUkNVyfdY4AfE9eIc8Xvh/ GyQAnjouAa8AXfoFoEXhTvUXUq7npQcu =ZUWL -----END PGP SIGNATURE----- --oyUTqETQ0mS9luUI--