mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: johannes.goede@oss.qualcomm.com
To: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>,
	Bjorn Andersson <andersson@kernel.org>,
	Abel Vesa <abelvesa@kernel.org>, Stephen Boyd <sboyd@kernel.org>,
	Brian Masney <bmasney+clk@redhat.com>,
	Jerome Brunet <jbrunet+clk@baylibre.com>,
	Joonwoo Park <joonwoop@codeaurora.org>,
	Imran Khan <kimran@codeaurora.org>,
	Rajendra Nayak <quic_rjendra@quicinc.com>,
	Jeffrey Hugo <jeffrey.l.hugo@gmail.com>,
	Maxime Ripard <mripard@kernel.org>,
	Vikash Garodia <vikash.garodia@oss.qualcomm.com>,
	Dikshita Agarwal <dikshita.agarwal@oss.qualcomm.com>,
	Bryan O'Donoghue <bod@kernel.org>,
	Mauro Carvalho Chehab <mchehab@kernel.org>,
	Ilia Lin <ilialin@codeaurora.org>,
	Loic Poulain <loic.poulain@oss.qualcomm.com>,
	Konrad Dybcio <konradybcio@kernel.org>,
	Yassine Oudjana <y.oudjana@protonmail.com>,
	Dmitry Baryshkov <lumag@kernel.org>,
	Rob Herring <robh@kernel.org>,
	Krzysztof Kozlowski <krzk+dt@kernel.org>,
	Conor Dooley <conor+dt@kernel.org>
Cc: linux-arm-msm@vger.kernel.org, linux-clk@vger.kernel.org,
	linux-kernel@vger.kernel.org, linux-media@vger.kernel.org,
	devicetree@vger.kernel.org
Subject: Re: [PATCH 04/10] clk: qcom: clk-rcg2: forward the gfx3d rate request to the parent
Date: Mon, 19 Oct 2026 16:33:28 +0200	[thread overview]
Message-ID: <48e3f967-be0c-4bd0-9e6a-a804ab2e053e@oss.qualcomm.com> (raw)
In-Reply-To: <20261019-msm8998-fix-clocks-v1-4-370949e4d8a0@oss.qualcomm.com>

Hi,

On 19-Oct-26 3:41 PM, Dmitry Baryshkov wrote:
> GPU DVFS on SDM660 never changed the GFX3D rate. clk_gfx3d_determine_rate()
> builds the parent request by hand and leaves best_parent_rate at zero, so
> the PLL is asked to determine a rate for a zero parent rate and the new
> rate is dropped on the floor.
> 
> Use clk_hw_forward_rate_request(), which fills in the parent's limits and
> rate the way the core expects them.
> 
> Fixes: af1e62f2ffe2 ("clk: qcom: clk-rcg2: Take clock boundaries into consideration for gfx3d")
> Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
> ---
>  drivers/clk/qcom/clk-rcg2.c | 21 +++++++--------------
>  1 file changed, 7 insertions(+), 14 deletions(-)
> 
> diff --git a/drivers/clk/qcom/clk-rcg2.c b/drivers/clk/qcom/clk-rcg2.c
> index c44c51d860e1..9e3d7e5c81e5 100644
> --- a/drivers/clk/qcom/clk-rcg2.c
> +++ b/drivers/clk/qcom/clk-rcg2.c
> @@ -1207,10 +1207,10 @@ EXPORT_SYMBOL_GPL(clk_pixel_ops);
>  static int clk_gfx3d_determine_rate(struct clk_hw *hw,
>  				    struct clk_rate_request *req)
>  {
> -	struct clk_rate_request parent_req = { .min_rate = 0, .max_rate = ULONG_MAX };
> +	struct clk_rate_request parent_req;

Just a random drive-by comment: You are now leaving parent_req entirely uninitialized
filling it with whatever is on the stack. Where as before all values except for
max_rate would be filled with 0.

Are you sure this is what you want ? Maybe:

	struct clk_rate_request parent_req = {};

?

Regards,

Hans




>  	struct clk_rcg2_gfx3d *cgfx = to_clk_rcg2_gfx3d(hw);
>  	struct clk_hw *xo, *p0, *p1, *p2;
> -	unsigned long p0_rate;
> +	unsigned long p0_rate, parent_rate;
>  	u8 mux_div = cgfx->div;
>  	int ret;
>  
> @@ -1234,12 +1234,12 @@ static int clk_gfx3d_determine_rate(struct clk_hw *hw,
>  	if (mux_div == 0)
>  		mux_div = 1;
>  
> -	parent_req.rate = req->rate * mux_div;
> +	parent_rate = req->rate * mux_div;
>  
>  	/* This has to be a fixed rate PLL */
>  	p0_rate = clk_hw_get_rate(p0);
>  
> -	if (parent_req.rate == p0_rate) {
> +	if (parent_rate == p0_rate) {
>  		req->rate = req->best_parent_rate = p0_rate;
>  		req->best_parent_hw = p0;
>  		return 0;
> @@ -1247,7 +1247,7 @@ static int clk_gfx3d_determine_rate(struct clk_hw *hw,
>  
>  	if (req->best_parent_hw == p0) {
>  		/* Are we going back to a previously used rate? */
> -		if (clk_hw_get_rate(p2) == parent_req.rate)
> +		if (clk_hw_get_rate(p2) == parent_rate)
>  			req->best_parent_hw = p2;
>  		else
>  			req->best_parent_hw = p1;
> @@ -1257,16 +1257,9 @@ static int clk_gfx3d_determine_rate(struct clk_hw *hw,
>  		req->best_parent_hw = p2;
>  	}
>  
> -	clk_hw_get_rate_range(req->best_parent_hw,
> -			      &parent_req.min_rate, &parent_req.max_rate);
> +	clk_hw_forward_rate_request(hw, req, req->best_parent_hw, &parent_req,
> +				    parent_rate);
>  
> -	if (req->min_rate > parent_req.min_rate)
> -		parent_req.min_rate = req->min_rate;
> -
> -	if (req->max_rate < parent_req.max_rate)
> -		parent_req.max_rate = req->max_rate;
> -
> -	parent_req.best_parent_hw = req->best_parent_hw;
>  	ret = __clk_determine_rate(req->best_parent_hw, &parent_req);
>  	if (ret)
>  		return ret;
> 


  reply	other threads:[~2026-10-19 14:33 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-19 13:40 [PATCH 00/10] clk: qcom: several fixes for stability on MSM8996/98 platforms Dmitry Baryshkov
2026-10-19 13:41 ` [PATCH 01/10] clk: qcom: gcc-msm8998: leave the GPU BIMC source and SNOC DVM clocks on Dmitry Baryshkov
2026-10-20  6:30   ` Konrad Dybcio
2026-10-19 13:41 ` [PATCH 02/10] clk: qcom: gcc-msm8998: leave the MMSS QM " Dmitry Baryshkov
2026-10-20  6:31   ` Konrad Dybcio
2026-10-19 13:41 ` [PATCH 03/10] clk: qcom: gpucc-msm8998: set the droop detector bit in the right register Dmitry Baryshkov
2026-10-20  6:32   ` Konrad Dybcio
2026-10-19 13:41 ` [PATCH 04/10] clk: qcom: clk-rcg2: forward the gfx3d rate request to the parent Dmitry Baryshkov
2026-10-19 14:33   ` johannes.goede [this message]
2026-10-19 14:34     ` Hans de Goede
2026-10-19 13:41 ` [PATCH 05/10] clk: qcom: cpu-8996: move off the ACD leg while the PLL speeds up Dmitry Baryshkov
2026-10-20  6:52   ` Konrad Dybcio
2026-10-19 13:41 ` [PATCH 06/10] clk: qcom: mmcc-msm8996: keep mmss_mmagic_maxi_clk always enabled Dmitry Baryshkov
2026-10-19 13:41 ` [PATCH 07/10] clk: qcom: cbf-msm8996: program the MSM8996 Pro post-divider Dmitry Baryshkov
2026-10-20  6:57   ` Konrad Dybcio
2026-10-19 13:41 ` [PATCH 08/10] dt-bindings: clock: qcom,msm8996-apcc: add the MSM8996 Pro compatible Dmitry Baryshkov
2026-10-19 13:41 ` [PATCH 09/10] clk: qcom: cpu-8996: program the MSM8996 Pro droop code register Dmitry Baryshkov
2026-10-20  6:55   ` Konrad Dybcio
2026-10-19 13:41 ` [PATCH 10/10] arm64: dts: qcom: msm8996pro: use the MSM8996 Pro CPU clock compatible Dmitry Baryshkov
2026-10-20  6:55   ` Konrad Dybcio

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=48e3f967-be0c-4bd0-9e6a-a804ab2e053e@oss.qualcomm.com \
    --to=johannes.goede@oss.qualcomm.com \
    --cc=abelvesa@kernel.org \
    --cc=andersson@kernel.org \
    --cc=bmasney+clk@redhat.com \
    --cc=bod@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=dikshita.agarwal@oss.qualcomm.com \
    --cc=dmitry.baryshkov@oss.qualcomm.com \
    --cc=ilialin@codeaurora.org \
    --cc=jbrunet+clk@baylibre.com \
    --cc=jeffrey.l.hugo@gmail.com \
    --cc=joonwoop@codeaurora.org \
    --cc=kimran@codeaurora.org \
    --cc=konradybcio@kernel.org \
    --cc=krzk+dt@kernel.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=loic.poulain@oss.qualcomm.com \
    --cc=lumag@kernel.org \
    --cc=mchehab@kernel.org \
    --cc=mripard@kernel.org \
    --cc=quic_rjendra@quicinc.com \
    --cc=robh@kernel.org \
    --cc=sboyd@kernel.org \
    --cc=vikash.garodia@oss.qualcomm.com \
    --cc=y.oudjana@protonmail.com \
    /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®