[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210818192645.GA28932@amd>
Date: Wed, 18 Aug 2021 21:26:45 +0200
From: Pavel Machek <pavel@...x.de>
To: Ben Hutchings <ben.hutchings@...ensium.com>
Cc: Pavel Machek <pavel@...x.de>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
linux-kernel@...r.kernel.org, stable@...r.kernel.org,
"David S. Miller" <davem@...emloft.net>,
Sasha Levin <sashal@...nel.org>
Subject: Re: [PATCH 5.10 51/96] net: dsa: microchip: Fix ksz_read64()
Hi!
> > > [ Upstream commit c34f674c8875235725c3ef86147a627f165d23b4 ]
> > >
> > > 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.
> >
> > 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.
>
> 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.
>
> > Did this get enough testing for -stable?
>
> Yes, I actually developed and tested all the ksz8795 changes in 5.10
> before forward-porting to mainline.
>
> > Is hw little endian or high endian or...?
>
> The hardware is big-endian and regmap handles any necessary
> byte-swapping for values up to 32 bits.
>
> > Note that ksz_write64() still contains the strange code, at least in
> > 5.10.
>
> 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
--
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Download attachment "signature.asc" of type "application/pgp-signature" (182 bytes)
Powered by blists - more mailing lists