public inbox for linux-arm-kernel@lists.infradead.org
 help / color / mirror / Atom feed
From: Cristian Marussi <cristian.marussi@arm.com>
To: Nicolas Frattaroli <nicolas.frattaroli@collabora.com>
Cc: 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,
	Cristian Marussi <cristian.marussi@arm.com>,
	sudeep.holla@arm.com, 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: Fri, 24 Apr 2026 14:32:05 +0100	[thread overview]
Message-ID: <aetw1WcSCDxk11AV@pluto> (raw)
In-Reply-To: <WNCeTzosRbKm_zGsbSPx8w@collabora.com>

On Fri, Apr 24, 2026 at 02:07:59PM +0200, Nicolas Frattaroli wrote:
> On Tuesday, 10 March 2026 19:40:25 Central European Summer Time Cristian Marussi wrote:
> > Add proper error handling on failure to enumerate clocks features or
> > rates.
> > 

Hi,

> > Signed-off-by: Cristian Marussi <cristian.marussi@arm.com>
> > ---
> >  drivers/firmware/arm_scmi/clock.c | 22 ++++++++++++++++------
> >  1 file changed, 16 insertions(+), 6 deletions(-)
> > 
> > diff --git a/drivers/firmware/arm_scmi/clock.c b/drivers/firmware/arm_scmi/clock.c
> > index c9b62edce4fd..bf956305a8fe 100644
> > --- a/drivers/firmware/arm_scmi/clock.c
> > +++ b/drivers/firmware/arm_scmi/clock.c
> > @@ -402,10 +402,16 @@ static int scmi_clock_attributes_get(const struct scmi_protocol_handle *ph,
> >  		    SUPPORTS_RATE_CHANGE_REQUESTED_NOTIF(attributes))
> >  			clk->rate_change_requested_notifications = true;
> >  		if (PROTOCOL_REV_MAJOR(ph->version) >= 0x3) {
> > -			if (SUPPORTS_PARENT_CLOCK(attributes))
> > -				scmi_clock_possible_parents(ph, clk_id, cinfo);
> > -			if (SUPPORTS_GET_PERMISSIONS(attributes))
> > -				scmi_clock_get_permissions(ph, clk_id, clk);
> > +			if (SUPPORTS_PARENT_CLOCK(attributes)) {
> > +				ret = scmi_clock_possible_parents(ph, clk_id, cinfo);
> > +				if (ret)
> > +					return ret;
> > +			}
> > +			if (SUPPORTS_GET_PERMISSIONS(attributes)) {
> > +				ret = scmi_clock_get_permissions(ph, clk_id, clk);
> > +				if (ret)
> > +					return ret;
> > +			}
> >  			if (SUPPORTS_EXTENDED_CONFIG(attributes))
> >  				clk->extended_config = true;
> >  		}
> > @@ -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;
> > +
> > +		ret = scmi_clock_describe_rates_get(ph, clkid, cinfo);
> > +		if (ret)
> > +			return ret;
> >  	}
> >  
> >  	if (PROTOCOL_REV_MAJOR(ph->version) >= 0x3) {
> > 
> 
> I see that a quirk is being added for this, but I thought I should chime
> in with my opinion for future approaches in this direction.
> 
> I don't see how this hardens anything. All this does is break platforms
> that were previously working by returning early. At most, this should

Certainly the naming in the subject was chosen badly (by me!)...indeed it
should be more something like "Enforce strict protocol compliance",
because at the end all of the broken platforms really run a slighly odd
out of spec SCMI firmware that does NOT implement one or more of the SCMI
mandatory command...

> be a warning (as in not WARN but pr_warn/dev_warn/...). If firmware
> returns nonsense, a clock driver should imho try its best to work
> around the nonsense in a safe way, because the alternative is that
> a major part of the system (and thus likely the entire system) no

..well yes we definitely dont want to break deployed platforms BUT also
we dont want to legalize this kind of out of spec behaviour in future
firmwares...hence (a number ?) of quirks an FW_BUG warns probably to
let already broken deployed platforms survive while discouraging such
implementation in future fw implementations...

These firmware most certainly wont pass the SCMI compliance test suite [1],
which indeed we do not mandate, but the reason these bugs happened is
exactly because the kernel SCMI stack was buggy and left that door open...

More specifically these kind of out-of-spec behaviours are not really just
a matter being 'picky', the problem is that any resource set in any
SCMI protocol is defined by the spec such as to be described by a
contiguos set of IDs and the drivers are designed anyway under that
assumption from the allocation point of view, so allowing a clock ID to
just fail one of the mandatory commands and skip a domain would jeopardize
all of this and, even if clearly is NOT a problem here, seems a fragile
assumption.

> longer works. It's basically the same reason why we avoid BUG(): sure,
> you prevented a problem, but you tore down the entire system to tell
> the user about it.

No I feel this is a lot different from the BUG() scenario: we'll never
merge this like this without enough quirks to let survive all the
existing impacted platforms, but the shout here is for the fw-developer
of a new un-deployed firmware: that WILL fail and no quirk will be accepted
if they plan to design a future FW out of spec from scratch because they
think is better....well...they can anyway of course but they will have
to keep their own quirks donwstream forever :P

Thanks,
Cristian

[1]: https://gitlab.arm.com/tests/scmi-tests/-/commits/master?ref_type=heads



  reply	other threads:[~2026-04-24 13:32 UTC|newest]

Thread overview: 42+ 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
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-30  5:54         ` Cristian Marussi
2026-04-24 12:07   ` Nicolas Frattaroli
2026-04-24 13:32     ` Cristian Marussi [this message]
2026-04-24 13:55       ` Geert Uytterhoeven
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=aetw1WcSCDxk11AV@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=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=nicolas.frattaroli@collabora.com \
    --cc=peng.fan@oss.nxp.com \
    --cc=philip.radford@arm.com \
    --cc=sudeep.holla@arm.com \
    --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