mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Sumit Gupta <sumitg@nvidia.com>
To: Zhongqiu Han <zhongqiu.han@oss.qualcomm.com>,
	rafael@kernel.org, viresh.kumar@linaro.org, robh@kernel.org,
	krzk+dt@kernel.org, conor+dt@kernel.org, treding@nvidia.com,
	jonathanh@nvidia.com, linux-pm@vger.kernel.org,
	linux-tegra@vger.kernel.org, linux-kernel@vger.kernel.org,
	devicetree@vger.kernel.org
Cc: bbasu@nvidia.com
Subject: Re: [PATCH v2 8/9] cpufreq: tegra194: Add support for Tegra264
Date: Thu, 19 Nov 2026 16:11:29 +0530	[thread overview]
Message-ID: <357545af-dff5-4836-92a3-4576af0a64c8@nvidia.com> (raw)
In-Reply-To: <6452ab41-2d7c-4995-9f6f-1e8207767cdb@oss.qualcomm.com>



On 18/11/26 09:17, Zhongqiu Han wrote:
> External email: Use caution opening links or attachments
> 
> 
> On 11/17/2026 11:49 PM, Sumit Gupta wrote:
>> Add cpufreq support for Tegra264. It requests and reads the CPU
>> frequency differently from earlier SoCs.
>>
>> To request a frequency, the driver writes NDIV to a core_freq_req
>> register in the CCPLEX register space. Two clusters share a clock and
>> its register, so they always run at the same frequency. The driver
>> exposes each pair as one performance domain and one cpufreq policy.
>> Each CPU's "performance-domains" property gives the domain index, which
>> selects the register. If the CCPLEX node declares
>> "#performance-domain-cells", probe fails if any CPU lacks the property.
>>
>> To read the frequency, the driver samples the per-CPU 64-bit AMU
>> counters through system registers. The AMU constant counter is the
>> reference. It ticks at the system counter rate, so the driver takes the
>> reference rate from CNTFRQ instead of the fixed 408 MHz clock. Probe
>> fails if CONFIG_ARM64_AMU_EXTN is disabled or a CPU lacks AMU.
>>
>> Signed-off-by: Sumit Gupta <sumitg@nvidia.com>
>> ---
>>   drivers/cpufreq/Kconfig.arm        |   4 +-
>>   drivers/cpufreq/tegra194-cpufreq.c | 161 ++++++++++++++++++++++++++++-
>>   2 files changed, 158 insertions(+), 7 deletions(-)
>> +}
>> +
>> +/*
>> + * The AMU counters are per-CPU system registers, so this must run on 
>> the CPU
>> + * it samples. tegra194_calculate_speed() queues it there with 
>> queue_work_on().
>> + */
>> +static void tegra264_sample_counters(struct tegra194_cpufreq_data *data,
>> +                                  struct tegra_cpu_ctr *c)
>> +{
>> +     c->coreclk_cnt = read_sysreg_s(SYS_AMEVCNTR0_CORE_EL0);
>> +     c->refclk_cnt = read_sysreg_s(SYS_AMEVCNTR0_CONST_EL0);
> 
> 
> The core cycle counter and the constant counter are read separately
> here, with interrupts enabled. An interrupt, or a preemption after it,
> between the two reads skews the pair, and the resulting error in the
> computed frequency becomes more significant as the gap increases. How
> about reading both with local_irq_save(), like arm64 does in
> amu_read_core_const_ctrs()?
> 
> 
> 
> 
> 
> -- 
> Thx and BRs,
> Zhongqiu Han

Good point. Will add it in v3.

Thanks,
Sumit


  reply	other threads:[~2026-11-19 10:41 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-17 15:49 [PATCH v2 0/9] cpufreq: tegra194: add Tegra264 support Sumit Gupta
2026-11-17 15:49 ` [PATCH v2 1/9] cpufreq: tegra194: move MPIDR read to CPU hotplug callback Sumit Gupta
2026-11-17 15:49 ` [PATCH v2 2/9] cpufreq: tegra194: remove duplicate counter sampling loops Sumit Gupta
2026-11-17 15:49 ` [PATCH v2 3/9] cpufreq: tegra194: add tegra_counter_delta helper Sumit Gupta
2026-11-17 15:49 ` [PATCH v2 4/9] cpufreq: tegra194: add per-SoC counter mask Sumit Gupta
2026-11-17 15:49 ` [PATCH v2 5/9] cpufreq: tegra194: split MMIO mapping from ACTMON offset Sumit Gupta
2026-11-17 15:49 ` [PATCH v2 6/9] dt-bindings: arm: nvidia: Document the Tegra264 CCPLEX cluster Sumit Gupta
2026-11-17 15:49 ` [PATCH v2 7/9] cpufreq: tegra194: derive frequency domain from device tree Sumit Gupta
2026-11-17 15:49 ` [PATCH v2 8/9] cpufreq: tegra194: Add support for Tegra264 Sumit Gupta
2026-11-18  3:47   ` Zhongqiu Han
2026-11-19 10:41     ` Sumit Gupta [this message]
2026-11-17 15:49 ` [PATCH v2 9/9] arm64: tegra: Add CCPLEX cluster node " Sumit Gupta
2026-11-18  3:55 ` [PATCH v2 0/9] cpufreq: tegra194: add Tegra264 support Zhongqiu Han

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=357545af-dff5-4836-92a3-4576af0a64c8@nvidia.com \
    --to=sumitg@nvidia.com \
    --cc=bbasu@nvidia.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=jonathanh@nvidia.com \
    --cc=krzk+dt@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=linux-tegra@vger.kernel.org \
    --cc=rafael@kernel.org \
    --cc=robh@kernel.org \
    --cc=treding@nvidia.com \
    --cc=viresh.kumar@linaro.org \
    --cc=zhongqiu.han@oss.qualcomm.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®