lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <40bf9ffc7ae98f6601122cd8850418f5@kernel.org>
Date: Wed, 30 Apr 2025 15:15:38 -0700
From: Stephen Boyd <sboyd@...nel.org>
To: Conor Dooley <conor+dt@...nel.org>, Krzysztof Kozlowski <krzk+dt@...nel.org>, Michael Turquette <mturquette@...libre.com>, Rob Herring <robh@...nel.org>, Sascha Hauer <s.hauer@...gutronix.de>
Cc: linux-clk@...r.kernel.org, linux-kernel@...r.kernel.org, devicetree@...r.kernel.org, kernel@...gutronix.de, Alvin Šipraga <alsi@...g-olufsen.dk>, Sascha Hauer <s.hauer@...gutronix.de>
Subject: Re: [PATCH v4 1/3] clk: make determine_rate optional for non reparenting clocks

Quoting Sascha Hauer (2025-04-30 02:01:34)
> With commit 326cc42f9fdc ("clk: Forbid to register a mux without
> determine_rate") it became mandatory to provide a determine_rate hook
> once a set_parent hook is provided. The determine_rate hook is only
> needed though when the clock reparents to set its rate. Clocks which do
> not reparent during set_rate do not need a determine_rate hook, so make
> the hook optional for clocks with the CLK_SET_RATE_NO_REPARENT flag.

Do you have a set_parent clk_op that you want use? But you set the flag
so that rate changes don't try to change the parent? Do you implement
a round_rate clk_op? I'm guessing round_rate isn't implemented.

We want to get rid of round_rate and move drivers to use determine_rate
everywhere because it passes a struct that we can extend in the future
to do coordinated rate changes, per-clk locking, etc.

We could change this to be something like:

 if (core->ops->round_rate && core->ops->determine_rate)
   return -EINVAL and pr_err("Pick one, not both");
 if (core->ops->set_parent && core->ops->round_rate)
   return -EINVAL and pr_err("must implement .set_parent & .determine_rate")

so that if you have a set_parent clk_op you better implement
determine_rate if you support changing the rate, regardless of the clk
flags. I worry that we have some driver that implements both round_rate
and determine_rate though. Indeed, the clk_divider_ops does that to
support being copied by other clk drivers so we'll need to make the
logic this:

 if (core->ops->set_parent && clk_core_can_round(core) && !core->ops->determine_rate)
   return -EINVAL and pr_err("must implement .set_parent & .determine_rate")

> diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
> index 0565c87656cf5..07ae3652df6c1 100644
> --- a/drivers/clk/clk.c
> +++ b/drivers/clk/clk.c
> @@ -3937,7 +3937,8 @@ static int __clk_core_init(struct clk_core *core)
>                 goto out;
>         }
>  
> -       if (core->ops->set_parent && !core->ops->determine_rate) {
> +       if (!(core->flags & CLK_SET_RATE_NO_REPARENT) &&
> +           core->ops->set_parent && !core->ops->determine_rate) {
>                 pr_err("%s: %s must implement .set_parent & .determine_rate\n",
>                         __func__, core->name);
>                 ret = -EINVAL;

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ