From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 68B4F2D3226; Fri, 2 Jan 2026 07:55:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767340518; cv=none; b=nblQ8cYTLkXhiLIXE6PNZNl7uHXmSAHbhIeqpWc+LuIX+C+zpH/HsUsxU2dJC/8qdzSgtBTlVEu5zJdRkw3FWDGCjWq3nKcNrf6bm9Ms0TmLdSRm5pAasWx9nIcrgsp3D+Vu1eyj4cUajPc6QxfG7ZUNQHmKULhtdwk+ok7YL/o= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767340518; c=relaxed/simple; bh=pOnKyluOFkW2N+u900uU1w6ot1ZQJr+Jq/KOEnjgfZU=; h=Mime-Version:Content-Type:Date:Message-Id:Subject:Cc:From:To: References:In-Reply-To; b=JvhYpiMdl/lo0POO69W3SiW2iq2x0nBJv13USsCUkGMJJyieQe0F9DRpFEmyDaIBZn0WEVZ6gDr5cMckl2ax4hcrIFKuQSp08+gqkAKRYP/lm+Z+XvHDBbxteg8gG+o/iCi/p7kutrn75cx1w9kuDPUgtQVK4uv6o6WX3NRPeEw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=NdgqqMWX; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="NdgqqMWX" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7F83AC116B1; Fri, 2 Jan 2026 07:55:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1767340518; bh=pOnKyluOFkW2N+u900uU1w6ot1ZQJr+Jq/KOEnjgfZU=; h=Date:Subject:Cc:From:To:References:In-Reply-To:From; b=NdgqqMWXvqkjNpDjD8aQSm+E5nZXDdEbJTJ1qQ5erI4m+6RsR4CQ32EKznn+4kSXV aY56PD7oxNvBUOr6ZUwhqe3nfj93uX+zsZrPsM2pR34X9GHZf31J5/Akb7ZHgR4UBK XTx8D2836y/iG0zXPKBArfeBjG0oBjuX9UkkLhOpxqRT2pJf7atCZA8xD2EWtRAXBx I/0VbIgMmSkNOoBe5H6StvBs6oZIEd9vqIK5US1EyifRP3D/WkpQYCa/Q57BDTWPzy MgYf8L4uXhj2N5DPwTPBpzmKxXoGdWPCF9+KMFCQ5oyya29ZLm/HcI/0nCu+BYm6j0 QfueNXF+FND+A== Precedence: bulk X-Mailing-List: devicetree@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 Content-Type: multipart/signed; boundary=1b07cf6eaa5d19226fd67d51c3e66b8bf06a0a75186b45da8bdf50e1e5cb; micalg=pgp-sha384; protocol="application/pgp-signature" Date: Fri, 02 Jan 2026 08:55:13 +0100 Message-Id: Subject: Re: [PATCH v2 2/4] clk: keystone: don't cache clock rate Cc: "Frank Binns" , "Matt Coster" , "Maarten Lankhorst" , "Maxime Ripard" , "Thomas Zimmermann" , "David Airlie" , "Simona Vetter" , "Rob Herring" , "Krzysztof Kozlowski" , "Conor Dooley" , "Vignesh Raghavendra" , "Tero Kristo" , "Andrew Davis" , "Santosh Shilimkar" , "Michael Turquette" , "Stephen Boyd" , "Kevin Hilman" , "Randolph Sapp" , , , , , From: "Michael Walle" To: "Nishanth Menon" X-Mailer: aerc 0.20.0 References: <20251223124729.2482877-1-mwalle@kernel.org> <20251223124729.2482877-3-mwalle@kernel.org> <20251230201233.n36d5fiensqyb6fc@splice> In-Reply-To: <20251230201233.n36d5fiensqyb6fc@splice> --1b07cf6eaa5d19226fd67d51c3e66b8bf06a0a75186b45da8bdf50e1e5cb Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=UTF-8 On Tue Dec 30, 2025 at 9:12 PM CET, Nishanth Menon wrote: > On 13:47-20251223, Michael Walle wrote: >> The TISCI firmware will return 0 if the clock or consumer is not >> enabled although there is a stored value in the firmware. IOW a call to >> set rate will work but at get rate will always return 0 if the clock is >> disabled. >> The clk framework will try to cache the clock rate when it's requested >> by a consumer. If the clock or consumer is not enabled at that point, >> the cached value is 0, which is wrong. Thus, disable the cache >> altogether. >>=20 >> Signed-off-by: Michael Walle >> Reviewed-by: Kevin Hilman >> Reviewed-by: Randolph Sapp >> --- >> drivers/clk/keystone/sci-clk.c | 8 ++++++++ >> 1 file changed, 8 insertions(+) >>=20 >> diff --git a/drivers/clk/keystone/sci-clk.c b/drivers/clk/keystone/sci-c= lk.c >> index 9d5071223f4c..0a1565fdbb3b 100644 >> --- a/drivers/clk/keystone/sci-clk.c >> +++ b/drivers/clk/keystone/sci-clk.c >> @@ -333,6 +333,14 @@ static int _sci_clk_build(struct sci_clk_provider *= provider, >> =20 >> init.ops =3D &sci_clk_ops; >> init.num_parents =3D sci_clk->num_parents; >> + >> + /* >> + * A clock rate query to the SCI firmware will return 0 if either the >> + * clock itself is disabled or the attached device/consumer is disable= d. >> + * This makes it inherently unsuitable for the caching of the clk >> + * framework. >> + */ >> + init.flags =3D CLK_GET_RATE_NOCACHE; >> sci_clk->hw.init =3D &init; >> =20 >> ret =3D devm_clk_hw_register(provider->dev, &sci_clk->hw); >> --=20 >> 2.47.3 >>=20 > > Reviewed-by: Nishanth Menon > > I wish there was a better scheme, but inherently, just like SCMI and > other systems where power management co-processor controls clocks, there > is no real feasible caching scheme I can think of. I wonder if Stephen > or others have a thought on this? > > That said, I wonder if we need fixes tag to this? I am sure there are > other clocks susceptible to this as well. I wonder if > commit 3c13933c6033 ("clk: keystone: sci-clk: add support for > dynamically probing clocks") is the appropriate tag? >From my previous versions of this patch: > Regarding a Fixes: tag. I didn't include one because it might have a > slight performance impact because the firmware has to be queried > every time now and it doesn't have been a problem for now. OTOH I've > enabled tracing during boot and there were just a handful > clock_{get/set}_rate() calls. I'm still undecided if this needs a Fixes tag or not. Strictly speaking it would need one. Although, I'm not sure it's the one you mentioned, because the culprit is the "we return 0 if the clock or it's consumer is disabled", which then caches the wrong value. So it is probably the very first commit b745c0794e2f ("clk: keystone: Add sci-clk driver support"). -michael --1b07cf6eaa5d19226fd67d51c3e66b8bf06a0a75186b45da8bdf50e1e5cb Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iKgEABMJADAWIQTIVZIcOo5wfU/AngkSJzzuPgIf+AUCaVd54hIcbXdhbGxlQGtl cm5lbC5vcmcACgkQEic87j4CH/gcUQGAg2jdevhmzIo3MpxW/fmQhTzma7f+Pz6n 47sV9LU70CQ37MlbGTA2td+AP2lBAewMAYCpZT5T5yRgVP3N00Tn5GVG4Ag10GUP WDnpYZrhnC6qDHRhIUdH2Nn1H0y4a99g1XY= =VIxe -----END PGP SIGNATURE----- --1b07cf6eaa5d19226fd67d51c3e66b8bf06a0a75186b45da8bdf50e1e5cb--