From: Cristian Marussi <cristian.marussi@arm.com>
To: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Cristian Marussi <cristian.marussi@arm.com>,
Sudeep Holla <sudeep.holla@kernel.org>,
linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org, arm-scmi@vger.kernel.org,
linux-clk@vger.kernel.org, linux-renesas-soc@vger.kernel.org,
philip.radford@arm.com, james.quinlan@broadcom.com,
f.fainelli@gmail.com, vincent.guittot@linaro.org,
etienne.carriere@foss.st.com, peng.fan@oss.nxp.com,
michal.simek@amd.com, dan.carpenter@linaro.org,
geert+renesas@glider.be, kuninori.morimoto.gx@renesas.com,
marek.vasut+renesas@gmail.com
Subject: Re: [PATCH v2 08/13] firmware: arm_scmi: Harden clock protocol initialization
Date: Mon, 16 Mar 2026 16:38:53 +0000 [thread overview]
Message-ID: <abgyHXo6XeGTGyqf@pluto> (raw)
In-Reply-To: <CAMuHMdU1Z9NiQOd10zsimMcOfSC=dVYbfjAKKT4aD3Zx9KttVQ@mail.gmail.com>
On Mon, Mar 16, 2026 at 05:35:26PM +0100, Geert Uytterhoeven wrote:
> Hi Cristian,
>
> On Mon, 16 Mar 2026 at 17:14, Cristian Marussi <cristian.marussi@arm.com> wrote:
> > On Mon, Mar 16, 2026 at 04:50:17PM +0100, Geert Uytterhoeven wrote:
> > > On Thu, 12 Mar 2026 at 17:36, Cristian Marussi <cristian.marussi@arm.com> wrote:
> > > > On Thu, Mar 12, 2026 at 03:33:52PM +0000, Sudeep Holla wrote:
> > > > > On Wed, Mar 11, 2026 at 06:45:41PM +0000, Cristian Marussi wrote:
> > > > > > On Wed, Mar 11, 2026 at 05:59:43PM +0100, Geert Uytterhoeven wrote:
> > > > > > > On Tue, 10 Mar 2026 at 19:56, Cristian Marussi <cristian.marussi@arm.com> wrote:
> > > > > > > > Add proper error handling on failure to enumerate clocks features or
> > > > > > > > rates.
> > > > > > > >
> > > > > > > > Signed-off-by: Cristian Marussi <cristian.marussi@arm.com>
>
> > > > > > > > --- a/drivers/firmware/arm_scmi/clock.c
> > > > > > > > +++ b/drivers/firmware/arm_scmi/clock.c
> > > > > > >
> > > > > > > > @@ -1143,8 +1149,12 @@ static int scmi_clock_protocol_init(const struct scmi_protocol_handle *ph)
> > > > > > > > for (clkid = 0; clkid < cinfo->num_clocks; clkid++) {
> > > > > > > > cinfo->clkds[clkid].id = clkid;
> > > > > > > > ret = scmi_clock_attributes_get(ph, clkid, cinfo);
> > > > > > > > - if (!ret)
> > > > > > > > - scmi_clock_describe_rates_get(ph, clkid, cinfo);
> > > > > > > > + if (ret)
> > > > > > > > + return ret;
> > > > > > >
> > > > > > > This change breaks R-Car X5H with SCP FW SDKv4.28.0, as some clocks
> > > > > > > do not support the SCMI CLOCK_ATTRIBUTES command.
> > >
> > > Apparently it is not just CLOCK_ATTRIBUTES, but also
> > > CLOCK_DESCRIBE_RATES.
> >
> > I was indeed suspicious that I could have opened a can of worms by
> > more strictly enfrocing these...
> >
> > > > > > > Before, these clocks were still instantiated, but were further unusable.
> > > > > > > After, the whole clock driver fails to initialize, and no SCMI clocks
> > > > > > > are available at all.
> > > > > >
> > > > > > ...and this is exactly what I feared while doing this sort of hardening :P
> > > > > >
> > > > > > So there are a few possible solutions (beside reverting this straight away)
> > > > > >
> > > > > > The easy fix would be instead change the above in a
> > > > > >
> > > > > > if (ret)
> > > > > > continue;
> > > > > >
> > > > > > ...with a bit of annoying accompanying FW_BUG logs, of course, to cause future
> > > > > > FW releases to fix this :D
> > > > > >
> > > > > > Another option could be leave it as it is, since indeed it is the correct enforced
> > > > > > behaviour, being CLOCK_ATTRIBUTES a mandatory command, BUT add on top an ad-hoc SCMI
> > > > > > quirk targeting the affected FW releases...
> > > > > >
> > > > > > This latter option, though, while enforcing the correct behaviour AND
> > > > > > fixing your R-Car issue, leaves open the door for a number of possible
> > > > > > failures of other unknowingly buggy Vendors similarly deployed firmwares...
> > > > > >
> > > > > > ...that could be solved with more quirks of course...but...worth it ?
> > > > > >
> > > > > > Thoughts ?
> > > > > >
> > > > > > Let's see also what @Sudeep thinks about this...
> > > > >
> > > > > I prefer to fix it as a quirk to prevent similar issues on newer platforms if
> > > > > the firmware baselines are derived from it. In the worst case, we can relax
> > > > > the hardening until we figure out a proper quirk-based solution.
> > > >
> > > > Ok, I can post a V3 with a dummy quirk 'template' RFC to be filled by
> > > > Geert with proper versioning....so I can check that there are no
> > > > surprises round the (quirked) corner...
> > >
> > > Unfortunately you cannot "continue" from a quirk, without resorting
> > > to a goto, so I sent a fix: "[PATCH] firmware: arm_scmi: Support loop
> > > control in quirk code snippets"[1].
> >
> > Yes ... just realized that this afternoon when trying to draft a
> > quirk... (see other thread)
> >
> > > Then I came up with the following preliminary (have to check more
> > > firmware versions) quirk (Gmail whitespace-damaged):
> > >
> > > diff --git a/drivers/firmware/arm_scmi/clock.c
> > > b/drivers/firmware/arm_scmi/clock.c
> > > index f62f9492bd42afbc..6f2af6e9084836c6 100644
> > > --- a/drivers/firmware/arm_scmi/clock.c
> > > +++ b/drivers/firmware/arm_scmi/clock.c
> > > @@ -1230,6 +1230,18 @@ static const struct scmi_protocol_events
> > > clk_protocol_events = {
> > > .num_events = ARRAY_SIZE(clk_events),
> > > };
> > >
> > > +#define QUIRK_RCAR_X5H_NO_ATTRIBUTES \
> > > + ({ \
> > > + if (ret == -EREMOTEIO || ret == -EOPNOTSUPP) \
> > > + continue; \
> > > + })
> > > +
> > > +#define QUIRK_RCAR_X5H_NO_RATES
> > > \
> > > + ({ \
> > > + if (ret == -EOPNOTSUPP) \
> > > + ret = 0; \
> > > + })
> > > +
> > > static int scmi_clock_protocol_init(const struct scmi_protocol_handle *ph)
> > > {
> > > int clkid, ret;
> > > @@ -1254,10 +1266,12 @@ static int scmi_clock_protocol_init(const
> > > struct scmi_protocol_handle *ph)
> > > for (clkid = 0; clkid < cinfo->num_clocks; clkid++) {
> > > cinfo->clkds[clkid].id = clkid;
> > > ret = scmi_clock_attributes_get(ph, clkid, cinfo);
> > > + SCMI_QUIRK(clock_rcar_x5h_no_attributes,
> > > QUIRK_RCAR_X5H_NO_ATTRIBUTES);
> > > if (ret)
> > > return ret;
> > >
> > > ret = scmi_clock_describe_rates_get(ph, clkid, cinfo);
> > > + SCMI_QUIRK(clock_rcar_x5h_no_attributes,
> > > QUIRK_RCAR_X5H_NO_RATES);
> > > if (ret)
> > > return ret;
> > > }
>
> > > Does that look like what you have in mind?
> > > Thanks!
> >
> > Yes in quirk I was only addressing NOT_ATTRIBUTES and mimicing the old
> > behaviour with continue, BUT if the set of clocks not supporting attributes
> > and the set of clocks not suppporting rates is disjoint, I feel we need your
> > double quirks :P
>
> I could have used
>
> SCMI_QUIRK(clock_rcar_x5h_no_attributes, QUIRK_RCAR_X5H_NO_ATTRIBUTES);
>
> after both scmi_clock_attributes_get() and
> scmi_clock_describe_rates_get(), but I wanted to keep the check as
> strict as possible: the former returns two error codes to ignore,
> the latter only one.
>
> > If you are still finding out the exact FW versions that are failing maybe
> > it is better if you carry on and test the quirk-framework fix above together
> > with your quirks and we can make sure to pick all up together...
>
> It is not urgent, as R-Car X5H SCMI support is not yet upstream.
Ah ok.
>
> > ...OR maybe better I can also drop for now my offending patch that breaks
> > your FW from my V3 series and you can pick it up and post it later with
> > your quirks and the Quirk framework fix you propsoed so that we are sure
> > that we dont break anything while fixing all of this...
>
> While there is indeed a chance that this hardening regresses on
> platforms that are already upstream...
Yes indeed...
>
> > Also because we are already in V4 and I dont want to risk to post the
> > breaking fix (that was at the end broke since forever) BUT not the quirks...
>
> s/in V4/at rc4/?
yep... -rc4 I meant..
>
> > Let's see what @Sudeep thinks
>
> OK.
>
Thanks,
Cristian
next prev parent reply other threads:[~2026-03-16 16:38 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-10 18:40 [PATCH v2 00/13] SCMI Clock rates discovery rework Cristian Marussi
2026-03-10 18:40 ` [PATCH v2 01/13] clk: scmi: Fix clock rate rounding Cristian Marussi
2026-03-11 11:30 ` Geert Uytterhoeven
2026-03-11 18:33 ` Cristian Marussi
2026-03-10 18:40 ` [PATCH v2 02/13] firmware: arm_scmi: Add clock determine_rate operation Cristian Marussi
2026-03-10 18:40 ` [PATCH v2 03/13] clk: scmi: Use new determine_rate clock operation Cristian Marussi
2026-03-10 18:40 ` [PATCH v2 04/13] firmware: arm_scmi: Simplify clock rates exposed interface Cristian Marussi
2026-03-17 7:38 ` Peng Fan
2026-03-10 18:40 ` [PATCH v2 05/13] clk: scmi: Use new simplified per-clock rate properties Cristian Marussi
2026-03-18 15:29 ` Sudeep Holla
2026-03-10 18:40 ` [PATCH v2 06/13] firmware: arm_scmi: Drop unused clock rate interfaces Cristian Marussi
2026-03-10 18:40 ` [PATCH v2 07/13] firmware: arm_scmi: Make clock rates allocation dynamic Cristian Marussi
2026-03-17 7:28 ` Peng Fan
2026-03-10 18:40 ` [PATCH v2 08/13] firmware: arm_scmi: Harden clock protocol initialization Cristian Marussi
2026-03-11 16:59 ` Geert Uytterhoeven
2026-03-11 18:45 ` Cristian Marussi
2026-03-12 15:33 ` Sudeep Holla
2026-03-12 16:36 ` Cristian Marussi
2026-03-16 15:50 ` Geert Uytterhoeven
2026-03-16 16:14 ` Cristian Marussi
2026-03-16 16:35 ` Geert Uytterhoeven
2026-03-16 16:38 ` Cristian Marussi [this message]
2026-03-24 13:43 ` Geert Uytterhoeven
2026-03-25 11:02 ` Marek Szyprowski
2026-03-25 12:27 ` Cristian Marussi
2026-03-26 8:55 ` Alexander Stein
2026-03-26 10:16 ` Sudeep Holla
2026-03-10 18:40 ` [PATCH v2 09/13] firmware: arm_scmi: Harden clock parents discovery Cristian Marussi
2026-03-17 7:29 ` Peng Fan
2026-03-10 18:40 ` [PATCH v2 10/13] firmware: arm_scmi: Refactor iterators internal allocation Cristian Marussi
2026-03-17 7:35 ` Peng Fan
2026-03-10 18:40 ` [PATCH v2 11/13] firmware: arm_scmi: Add bound iterators support Cristian Marussi
2026-03-17 7:44 ` Peng Fan
2026-03-17 9:22 ` Cristian Marussi
2026-03-10 18:40 ` [PATCH v2 12/13] firmware: arm_scmi: Use bound iterators to minimize discovered rates Cristian Marussi
2026-03-10 18:40 ` [PATCH v2 13/13] firmware: arm_scmi: Introduce all_rates_get clock operation Cristian Marussi
2026-03-17 7:34 ` Peng Fan
2026-03-17 8:20 ` [PATCH v2 00/13] SCMI Clock rates discovery rework Geert Uytterhoeven
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=abgyHXo6XeGTGyqf@pluto \
--to=cristian.marussi@arm.com \
--cc=arm-scmi@vger.kernel.org \
--cc=dan.carpenter@linaro.org \
--cc=etienne.carriere@foss.st.com \
--cc=f.fainelli@gmail.com \
--cc=geert+renesas@glider.be \
--cc=geert@linux-m68k.org \
--cc=james.quinlan@broadcom.com \
--cc=kuninori.morimoto.gx@renesas.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-clk@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-renesas-soc@vger.kernel.org \
--cc=marek.vasut+renesas@gmail.com \
--cc=michal.simek@amd.com \
--cc=peng.fan@oss.nxp.com \
--cc=philip.radford@arm.com \
--cc=sudeep.holla@kernel.org \
--cc=vincent.guittot@linaro.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