From: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
To: Sebastian Reichel <sebastian.reichel@collabora.com>,
Michael Turquette <mturquette@baylibre.com>,
Stephen Boyd <sboyd@kernel.org>,
linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: Christopher Obbard <chris.obbard@collabora.com>,
David Laight <David.Laight@ACULAB.COM>,
kernel@collabora.com, stable@vger.kernel.org
Subject: Re: [PATCH v2 1/2] clk: composite: Fix handling of high clock rates
Date: Mon, 29 May 2023 10:50:50 +0200 [thread overview]
Message-ID: <89b3e3bb-d725-1f92-7a0d-b5bc1109dafc@collabora.com> (raw)
In-Reply-To: <20230526171057.66876-2-sebastian.reichel@collabora.com>
Il 26/05/23 19:10, Sebastian Reichel ha scritto:
> ULONG_MAX is used by a few drivers to figure out the highest available
> clock rate via clk_round_rate(clk, ULONG_MAX). Since abs() takes a
> signed value as input, the current logic effectively calculates with
> ULONG_MAX = -1, which results in the worst parent clock being chosen
> instead of the best one.
>
> For example on Rockchip RK3588 the eMMC driver tries to figure out
> the highest available clock rate. There are three parent clocks
> available resulting in the following rate diffs with the existing
> logic:
>
> GPLL: abs(18446744073709551615 - 1188000000) = 1188000001
> CPLL: abs(18446744073709551615 - 1500000000) = 1500000001
> XIN24M: abs(18446744073709551615 - 24000000) = 24000001
>
> As a result the clock framework will promote a maximum supported
> clock rate of 24 MHz, even though 1.5GHz are possible. With the
> updated logic any casting between signed and unsigned is avoided
> and the numbers look like this instead:
>
> GPLL: 18446744073709551615 - 1188000000 = 18446744072521551615
> CPLL: 18446744073709551615 - 1500000000 = 18446744072209551615
> XIN24M: 18446744073709551615 - 24000000 = 18446744073685551615
>
> As a result the parent with the highest acceptable rate is chosen
> instead of the parent clock with the lowest one.
>
> Cc: stable@vger.kernel.org
> Fixes: 49502408007b ("mmc: sdhci-of-dwcmshc: properly determine max clock on Rockchip")
> Tested-by: Christopher Obbard <chris.obbard@collabora.com>
> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
next prev parent reply other threads:[~2023-05-29 8:51 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-05-26 17:10 [PATCH v2 0/2] Fix 64 bit issues in common clock framework Sebastian Reichel
2023-05-26 17:10 ` [PATCH v2 1/2] clk: composite: Fix handling of high clock rates Sebastian Reichel
2023-05-29 8:50 ` AngeloGioacchino Del Regno [this message]
2023-06-13 0:10 ` Stephen Boyd
2023-06-13 12:14 ` Maxime Ripard
2023-06-13 18:25 ` Stephen Boyd
2023-06-14 10:28 ` Maxime Ripard
2023-05-26 17:10 ` [PATCH v2 2/2] clk: divider: Fix divisions Sebastian Reichel
2023-05-29 8:50 ` AngeloGioacchino Del Regno
2023-06-13 0:41 ` Stephen Boyd
2023-06-13 8:05 ` David Laight
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=89b3e3bb-d725-1f92-7a0d-b5bc1109dafc@collabora.com \
--to=angelogioacchino.delregno@collabora.com \
--cc=David.Laight@ACULAB.COM \
--cc=chris.obbard@collabora.com \
--cc=kernel@collabora.com \
--cc=linux-clk@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mturquette@baylibre.com \
--cc=sboyd@kernel.org \
--cc=sebastian.reichel@collabora.com \
--cc=stable@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®