linux-doc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ionela Voinescu <ionela.voinescu@arm.com>
To: Sumit Gupta <sumitg@nvidia.com>
Cc: rafael@kernel.org, viresh.kumar@linaro.org, lenb@kernel.org,
	robert.moore@intel.com, corbet@lwn.net, pierre.gondois@arm.com,
	zhenglifeng1@huawei.com, rdunlap@infradead.org,
	ray.huang@amd.com, gautham.shenoy@amd.com,
	mario.limonciello@amd.com, perry.yuan@amd.com,
	linux-pm@vger.kernel.org, linux-acpi@vger.kernel.org,
	linux-doc@vger.kernel.org, acpica-devel@lists.linux.dev,
	linux-kernel@vger.kernel.org, linux-tegra@vger.kernel.org,
	treding@nvidia.com, jonathanh@nvidia.com, vsethi@nvidia.com,
	ksitaraman@nvidia.com, sanjayc@nvidia.com, bbasu@nvidia.com
Subject: Re: [PATCH v3 3/8] ACPI: CPPC: extend APIs to support auto_sel and epp
Date: Wed, 22 Oct 2025 10:12:55 +0100	[thread overview]
Message-ID: <aPigDd0QTiRjey7K@arm.com> (raw)
In-Reply-To: <20251001150104.1275188-4-sumitg@nvidia.com>

Hi Sumit,

On Wednesday 01 Oct 2025 at 20:30:59 (+0530), Sumit Gupta wrote:
> - Add auto_sel read support in cppc_get_perf_caps().
> - Add write of both auto_sel and energy_perf in cppc_set_epp_perf().
> - Remove redundant energy_perf field from 'struct cppc_perf_caps' as
>   the same is available in 'struct cppc_perf_ctrls' which is used.
> 
> Signed-off-by: Sumit Gupta <sumitg@nvidia.com>
> ---
[..]
> @@ -1555,6 +1559,8 @@ int cppc_set_epp_perf(int cpu, struct cppc_perf_ctrls *perf_ctrls, bool enable)
>  	struct cpc_register_resource *auto_sel_reg;
>  	struct cpc_desc *cpc_desc = per_cpu(cpc_desc_ptr, cpu);
>  	struct cppc_pcc_data *pcc_ss_data = NULL;
> +	bool autosel_support_in_ffh_or_sysmem;
> +	bool epp_support_in_ffh_or_sysmem;
>  	int ret;
>  
>  	if (!cpc_desc) {
> @@ -1565,6 +1571,11 @@ int cppc_set_epp_perf(int cpu, struct cppc_perf_ctrls *perf_ctrls, bool enable)
>  	auto_sel_reg = &cpc_desc->cpc_regs[AUTO_SEL_ENABLE];
>  	epp_set_reg = &cpc_desc->cpc_regs[ENERGY_PERF];
>  
> +	epp_support_in_ffh_or_sysmem = CPC_SUPPORTED(epp_set_reg) &&
> +				(CPC_IN_FFH(epp_set_reg) || CPC_IN_SYSTEM_MEMORY(epp_set_reg));
> +	autosel_support_in_ffh_or_sysmem = CPC_SUPPORTED(auto_sel_reg) &&
> +				(CPC_IN_FFH(auto_sel_reg) || CPC_IN_SYSTEM_MEMORY(auto_sel_reg));
> +
>  	if (CPC_IN_PCC(epp_set_reg) || CPC_IN_PCC(auto_sel_reg)) {
>  		if (pcc_ss_id < 0) {
>  			pr_debug("Invalid pcc_ss_id for CPU:%d\n", cpu);
> @@ -1590,8 +1601,19 @@ int cppc_set_epp_perf(int cpu, struct cppc_perf_ctrls *perf_ctrls, bool enable)
>  		ret = send_pcc_cmd(pcc_ss_id, CMD_WRITE);
>  		up_write(&pcc_ss_data->pcc_lock);
>  	} else if (osc_cpc_flexible_adr_space_confirmed &&
> -		   CPC_SUPPORTED(epp_set_reg) && CPC_IN_FFH(epp_set_reg)) {
> +		   epp_support_in_ffh_or_sysmem && autosel_support_in_ffh_or_sysmem) {

Isn't this problematic for when auto-select is an integer set to 1 or it's
not present at all? In those cases the EPP register won't be written and
-ENOTSUPP will be returned.

I suppose for the case when auto-select is not present at all in _CPC
(it's an optional attribute) it's not very clear what one should do
regarding writing the EPP register. The specification mentions that
"Writes to this register only have meaning when Autonomous Selection
is enabled.". From my perspective the OS should not block writes to the
EPP register for this case, as autonomous selection might still be
enabled but not exposed to the OS. 

Thanks,
Ionela.

> +		ret = cpc_write(cpu, auto_sel_reg, enable);
> +		if (ret) {
> +			pr_debug("Failed to write auto_sel=%d for CPU:%d\n", enable, cpu);
> +			return ret;
> +		}
> +
>  		ret = cpc_write(cpu, epp_set_reg, perf_ctrls->energy_perf);
> +		if (ret) {
> +			pr_debug("Failed to write energy_perf=%u for CPU:%d\n",
> +				 perf_ctrls->energy_perf, cpu);
> +			return ret;
> +		}
>  	} else {
>  		ret = -ENOTSUPP;
>  		pr_debug("_CPC in PCC and _CPC in FFH are not supported\n");
[..]

  reply	other threads:[~2025-10-22  9:12 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-01 15:00 [PATCH v3 0/8] Enhanced autonomous selection and improvements Sumit Gupta
2025-10-01 15:00 ` [PATCH v3 1/8] cpufreq: CPPC: Add generic helpers for sysfs show/store Sumit Gupta
2025-10-10  3:24   ` Jie Zhan
2025-10-13 12:51     ` Sumit Gupta
2025-10-01 15:00 ` [PATCH v3 2/8] ACPI: CPPC: Add cppc_get_perf() API to read performance controls Sumit Gupta
2025-10-01 15:00 ` [PATCH v3 3/8] ACPI: CPPC: extend APIs to support auto_sel and epp Sumit Gupta
2025-10-22  9:12   ` Ionela Voinescu [this message]
2025-10-24 13:12     ` Sumit Gupta
2025-10-01 15:01 ` [PATCH v3 4/8] ACPI: CPPC: add APIs and sysfs interface for min/max_perf Sumit Gupta
2025-10-22 10:58   ` Ionela Voinescu
2025-10-24 13:22     ` Sumit Gupta
2025-10-01 15:01 ` [PATCH v3 5/8] ACPI: CPPC: add APIs and sysfs interface for perf_limited register Sumit Gupta
2025-10-01 15:01 ` [PATCH v3 6/8] cpufreq: CPPC: Add sysfs for min/max_perf and perf_limited Sumit Gupta
2025-10-01 17:03   ` Mario Limonciello
2025-10-08 10:16     ` Sumit Gupta
2025-10-10  3:29   ` Jie Zhan
2025-10-13 11:59     ` Sumit Gupta
2025-10-22 12:02   ` Ionela Voinescu
2025-10-24 13:32     ` Sumit Gupta
2025-10-01 15:01 ` [PATCH v3 7/8] cpufreq: CPPC: update policy min/max when toggling auto_select Sumit Gupta
2025-10-01 15:01 ` [PATCH v3 8/8] cpufreq: CPPC: add autonomous mode boot parameter support Sumit Gupta

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=aPigDd0QTiRjey7K@arm.com \
    --to=ionela.voinescu@arm.com \
    --cc=acpica-devel@lists.linux.dev \
    --cc=bbasu@nvidia.com \
    --cc=corbet@lwn.net \
    --cc=gautham.shenoy@amd.com \
    --cc=jonathanh@nvidia.com \
    --cc=ksitaraman@nvidia.com \
    --cc=lenb@kernel.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=linux-tegra@vger.kernel.org \
    --cc=mario.limonciello@amd.com \
    --cc=perry.yuan@amd.com \
    --cc=pierre.gondois@arm.com \
    --cc=rafael@kernel.org \
    --cc=ray.huang@amd.com \
    --cc=rdunlap@infradead.org \
    --cc=robert.moore@intel.com \
    --cc=sanjayc@nvidia.com \
    --cc=sumitg@nvidia.com \
    --cc=treding@nvidia.com \
    --cc=viresh.kumar@linaro.org \
    --cc=vsethi@nvidia.com \
    --cc=zhenglifeng1@huawei.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;
as well as URLs for NNTP newsgroup(s).