All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Konrad Dybcio" <konradybcio@kernel.org>
Cc: linux-clk@vger.kernel.org, devicetree@vger.kernel.org,
	robh@kernel.org, conor+dt@kernel.org
Subject: Re: [PATCH RFC 12/16] clk: qcom: gdsc: Link required power domains
Date: Wed, 14 Oct 2026 12:32:53 +0000	[thread overview]
Message-ID: <sashiko-outbox-171282@kernel.org> (raw)
In-Reply-To: <20261014-topic-qc_clk_dvfs-v1-12-3041b788e9f7@oss.qualcomm.com>

Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [High] clk: qcom: gdsc: Unbalanced hardware state on GenPD unlink leaves GDSCs powered without required rails
- [Low] clk: qcom: gdsc: Redundant wait_for_off logic for non-votable domains
--

commit a3b8e242fc8ba2eae7b378662d9af778b3739733
Author: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>

clk: qcom: gdsc: Link required power domains

This commit models enable-only requirements for GDSCs as GenPD subdomain
links without propagating the GDSC performance state to the rail. It allows
GDSCs to specify only the power-domain endpoints they require while powered.

> diff --git a/drivers/clk/qcom/gdsc.c b/drivers/clk/qcom/gdsc.c
> index 2d0803e1eb3b1..73054c600c29a 100644
> --- a/drivers/clk/qcom/gdsc.c
> +++ b/drivers/clk/qcom/gdsc.c
[ ... ]
> @@ -379,7 +384,10 @@ static int gdsc_disable(struct generic_pm_domain *domain)
>  	if (sc->pwrsts == PWRSTS_RET_ON)
>  		return 0;
>  
> -	ret = gdsc_toggle_logic(sc, GDSC_OFF, domain->synced_poweroff);
> +	if (sc->num_required_pds && !(sc->flags & VOTABLE))
> +		wait_for_off = true;
> +
> +	ret = gdsc_toggle_logic(sc, GDSC_OFF, wait_for_off);

[Severity: Low]
This isn't a bug, but is setting wait_for_off here redundant for non-votable
domains?

Looking at gdsc_toggle_logic(), the wait parameter appears to only affect
the execution path when sc->flags & VOTABLE is true:

static int gdsc_toggle_logic(...) {
    ...
    /* If disabling votable gdscs, don't poll on status */
    if ((sc->flags & VOTABLE) && status == GDSC_OFF && !wait) {
        udelay(TIMEOUT_US);
        return 0;
    }
    ...
    ret = gdsc_poll_status(sc, status);
}

Since gdsc_toggle_logic() falls through to gdsc_poll_status() for all
non-votable domains regardless of the wait parameter, does overriding it
here have any effect?

[ ... ]
> @@ -669,13 +779,25 @@ int gdsc_register(struct gdsc_desc *desc,
>  			ret = gdsc_add_subdomain_list(desc->pd_list, &scs[i]->pd);
>  
>  		if (ret)
> -			goto err_pm_subdomain_remove;
> +			goto err_remove_parents;
>  	}
>  
> -	return of_genpd_add_provider_onecell(dev->of_node, data);
> +	ret = of_genpd_add_provider_onecell(dev->of_node, data);
> +	if (!ret)
> +		return 0;
>  
> -err_pm_subdomain_remove:
> +err_remove_parents:
>  	gdsc_pm_subdomain_remove(desc, i);
> +err_remove_domains:
> +	while (linked--) {
> +		if (scs[linked])
> +			gdsc_remove_required_subdomains(desc, scs[linked],
> +							scs[linked]->num_required_pds);
> +	}
> +	while (initialized--) {
> +		if (scs[initialized])
> +			pm_genpd_remove(&scs[initialized]->pd);
> +	}

[Severity: High]
Does this error path leave initialized GDSCs physically powered ON while
their required supply rails are powered OFF?

During initialization, gdsc_get_rail_voters() powers ON the required rails
via pm_runtime_resume_and_get(). Then gdsc_init() turns ON the GDSC
hardware, and gdsc_add_required_subdomains() links the rails as parents,
transferring the power vote to GenPD. Finally, gdsc_put_rail_voters()
drops the explicit pm_runtime vote.

If we take this err_remove_domains path, gdsc_remove_required_subdomains()
removes the GenPD links. This drops the GenPD power vote, causing the
required rails to physically power OFF.

However, the loop then calls pm_genpd_remove() without physically powering
OFF the GDSCs. Will this violate hardware power sequencing constraints by
leaving the GDSCs powered ON without their required rails?

>  
>  	return ret;
>  }

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261014-topic-qc_clk_dvfs-v1-0-3041b788e9f7@oss.qualcomm.com?part=12

  reply	other threads:[~2026-10-14 12:32 UTC|newest]

Thread overview: 57+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-14 12:19 [RFC PATCH 00/16] Centralize the ownership of power rail votes for Qualcomm clocks Konrad Dybcio
2026-10-14 12:19 ` [PATCH RFC 01/16] clk: Propagate rate programming failures Konrad Dybcio
2026-10-14 12:35   ` sashiko-bot
2026-10-14 13:25   ` Dmitry Baryshkov
2026-10-14 12:19 ` [PATCH RFC 02/16] clk: Acquire resources for clock transitions Konrad Dybcio
2026-10-14 12:40   ` sashiko-bot
2026-10-14 12:19 ` [PATCH RFC 03/16] OPP: Retry failed default single-clock transitions Konrad Dybcio
2026-10-14 12:34   ` sashiko-bot
2026-10-14 13:35   ` Dmitry Baryshkov
2026-10-14 16:14     ` Konrad Dybcio
2026-10-14 16:32       ` Dmitry Baryshkov
2026-10-14 12:19 ` [PATCH RFC 04/16] pmdomain: core: Support named indexed virtual attachments Konrad Dybcio
2026-10-14 12:19 ` [PATCH RFC 05/16] pmdomain: core: Support subdomains without pstate propagation Konrad Dybcio
2026-10-14 12:41   ` sashiko-bot
2026-10-14 12:19 ` [PATCH RFC 06/16] pmdomain: core: Support indexed power-domain attachment lists Konrad Dybcio
2026-10-14 12:19 ` [PATCH RFC 07/16] clk: qcom: Add clock-owned GenPD DVFS aggregation Konrad Dybcio
2026-10-14 12:35   ` sashiko-bot
2026-10-14 14:36   ` Dmitry Baryshkov
2026-10-14 15:26     ` Konrad Dybcio
2026-10-14 16:30       ` Dmitry Baryshkov
2026-10-14 16:45         ` Konrad Dybcio
2026-10-14 17:31           ` Dmitry Baryshkov
2026-10-14 12:19 ` [PATCH RFC 08/16] clk: qcom: dvfs: Add debugfs Konrad Dybcio
2026-10-14 12:37   ` sashiko-bot
2026-10-14 12:19 ` [PATCH RFC 09/16] clk: qcom: clk-alpha-pll: Add DVFS (un)prepare Konrad Dybcio
2026-10-14 12:19 ` [PATCH RFC 10/16] clk: qcom: clk-alpha-pll: Vote for the PLL calibration frequency Konrad Dybcio
2026-10-14 12:34   ` sashiko-bot
2026-10-14 12:19 ` [PATCH RFC 11/16] clk: qcom: gdsc: Make GDSC parenting optional Konrad Dybcio
2026-10-14 12:30   ` sashiko-bot
2026-10-14 14:17   ` Dmitry Baryshkov
2026-10-14 14:20     ` Konrad Dybcio
2026-10-14 14:34       ` Dmitry Baryshkov
2026-10-14 14:36         ` Konrad Dybcio
2026-10-14 12:19 ` [PATCH RFC 12/16] clk: qcom: gdsc: Link required power domains Konrad Dybcio
2026-10-14 12:32   ` sashiko-bot [this message]
2026-10-14 12:19 ` [PATCH DNM RFC 13/16] arm64: dts: qcom: sm8650: Describe clock controller power rails Konrad Dybcio
2026-10-14 12:41   ` sashiko-bot
2026-10-14 14:19   ` Dmitry Baryshkov
2026-10-14 14:20     ` Konrad Dybcio
2026-10-14 14:33       ` Dmitry Baryshkov
2026-10-14 14:36         ` Konrad Dybcio
2026-10-14 15:01           ` Dmitry Baryshkov
2026-10-14 15:23             ` Konrad Dybcio
2026-10-14 12:19 ` [PATCH DNM RFC 14/16] clk: qcom: Enable clk-dvfs on SM8650 Konrad Dybcio
2026-10-14 12:36   ` sashiko-bot
2026-10-14 14:40   ` Dmitry Baryshkov
2026-10-14 15:22     ` Konrad Dybcio
2026-10-14 16:35       ` Dmitry Baryshkov
2026-10-14 16:42         ` Konrad Dybcio
2026-10-14 12:19 ` [PATCH DNM RFC 15/16] arm64: dts: qcom: sm8650: Drop required-opps Konrad Dybcio
2026-10-14 12:39   ` sashiko-bot
2026-10-14 14:23   ` Dmitry Baryshkov
2026-10-14 14:33     ` Konrad Dybcio
2026-10-14 12:19 ` [PATCH DNM RFC 16/16] pmdomain: qcom: rpmhpd: Stop forwarding MMCX pstate to CX Konrad Dybcio
2026-10-14 12:37   ` sashiko-bot
2026-10-14 14:37 ` [RFC PATCH 00/16] Centralize the ownership of power rail votes for Qualcomm clocks Dmitry Baryshkov
2026-10-14 16:19   ` 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=sashiko-outbox-171282@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=konradybcio@kernel.org \
    --cc=linux-clk@vger.kernel.org \
    --cc=robh@kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.