From: Sebastian Reichel <sebastian.reichel@collabora.com>
To: Carlo Caione <ccaione@baylibre.com>
Cc: "Stephen Boyd" <sboyd@kernel.org>,
"Brian Masney" <bmasney+clk@redhat.com>,
"Jerome Brunet" <jbrunet+clk@baylibre.com>,
"Brian Norris" <computersforpeace@gmail.com>,
"Maxime Coquelin" <maxime.coquelin@st.com>,
"Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>,
"Sascha Hauer" <s.hauer@pengutronix.de>,
"Michael Turquette" <mturquette@linaro.org>,
"Stephen Boyd" <sboyd@codeaurora.org>,
"David Laight" <david.laight.linux@gmail.com>,
linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 2/3] clk: divider: Fix round-closest for rates above the parent rate
Date: Thu, 12 Nov 2026 16:41:49 +0100 [thread overview]
Message-ID: <avXdsS-uYDyTLjVF@venus> (raw)
In-Reply-To: <20261112-upstream-clk-divider-large-rates-v2-2-18f3bb888b0c@baylibre.com>
[-- Attachment #1: Type: text/plain, Size: 1477 bytes --]
Hi,
On Thu, Nov 12, 2026 at 10:37:00AM +0100, Carlo Caione wrote:
> When the requested rate is above the parent rate, _div_round_closest()
> computes a down divider of 0 and divides the parent rate by it. Asking a
> CLK_DIVIDER_ROUND_CLOSEST divider without CLK_SET_RATE_PARENT for its
> maximum rate with clk_round_rate(clk, ULONG_MAX) then traps on x86.
>
> No divider goes above the parent rate, so the smallest one is the
> closest. Return it before dividing.
>
> Fixes: 26bac95aa88c ("clk: divider: fix selection of divider when rounding to closest")
> Signed-off-by: Carlo Caione <ccaione@baylibre.com>
> ---
Reviewed-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Greetings,
-- Sebastian
> drivers/clk/clk-divider.c | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/drivers/clk/clk-divider.c b/drivers/clk/clk-divider.c
> index c3f46f9ee451..ed60fa9b04fa 100644
> --- a/drivers/clk/clk-divider.c
> +++ b/drivers/clk/clk-divider.c
> @@ -254,6 +254,11 @@ static int _div_round_closest(const struct clk_div_table *table,
> int up, down;
> unsigned long up_rate, down_rate;
>
> + /* No divider goes above the parent rate: the smallest one is the closest */
> + if (rate >= parent_rate)
> + return table && !(flags & CLK_DIVIDER_POWER_OF_TWO) ?
> + _get_table_mindiv(table) : 1;
> +
> up = _get_div_round_up(parent_rate, rate);
> down = parent_rate / rate;
>
>
> --
> 2.56.0
>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
next prev parent reply other threads:[~2026-11-12 15:42 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-12 9:36 [PATCH v2 0/3] Fix clk-divider rates above 4.29 GHz on 64-bit Carlo Caione
2026-11-12 9:36 ` [PATCH v2 1/3] clk: divider: Fix the divisor for rates above 4.29 GHz Carlo Caione
2026-11-12 15:09 ` Brian Masney
2026-11-12 15:29 ` Carlo Caione
2026-11-12 15:38 ` Sebastian Reichel
2026-11-12 15:34 ` Sebastian Reichel
2026-11-12 9:37 ` [PATCH v2 2/3] clk: divider: Fix round-closest for rates above the parent rate Carlo Caione
2026-11-12 15:41 ` Sebastian Reichel [this message]
2026-11-12 9:37 ` [PATCH v2 3/3] clk: divider: test: Add tests for rates above 4.29 GHz Carlo Caione
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=avXdsS-uYDyTLjVF@venus \
--to=sebastian.reichel@collabora.com \
--cc=bmasney+clk@redhat.com \
--cc=ccaione@baylibre.com \
--cc=computersforpeace@gmail.com \
--cc=david.laight.linux@gmail.com \
--cc=jbrunet+clk@baylibre.com \
--cc=linux-clk@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=maxime.coquelin@st.com \
--cc=mturquette@linaro.org \
--cc=s.hauer@pengutronix.de \
--cc=sboyd@codeaurora.org \
--cc=sboyd@kernel.org \
--cc=u.kleine-koenig@pengutronix.de \
/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®