From: Huang Rui <ray.huang@amd.com>
To: "Yuan, Perry" <Perry.Yuan@amd.com>
Cc: "rafael.j.wysocki@intel.com" <rafael.j.wysocki@intel.com>,
"viresh.kumar@linaro.org" <viresh.kumar@linaro.org>,
"Sharma, Deepak" <Deepak.Sharma@amd.com>,
"Limonciello, Mario" <Mario.Limonciello@amd.com>,
"Fontenot, Nathan" <Nathan.Fontenot@amd.com>,
"Deucher, Alexander" <Alexander.Deucher@amd.com>,
"Su, Jinzhou (Joe)" <Jinzhou.Su@amd.com>,
"Huang, Shimmer" <Shimmer.Huang@amd.com>,
"Du, Xiaojian" <Xiaojian.Du@amd.com>,
"Meng, Li (Jassmine)" <Li.Meng@amd.com>,
"linux-pm@vger.kernel.org" <linux-pm@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v4 04/13] cpufreq: amd-pstate: prefetch cppc_req_cached value in amd_pstate_cpu_init()
Date: Tue, 19 Jul 2022 08:48:34 +0800 [thread overview]
Message-ID: <YtX/YgJyzG3U8OUN@amd.com> (raw)
In-Reply-To: <686bc72b4dc3a663c00126c852e3b4774a280700.1657876961.git.Perry.Yuan@amd.com>
On Fri, Jul 15, 2022 at 06:04:23PM +0800, Yuan, Perry wrote:
> This cppc_req_cached valued should be prefetched during
> amd_pstate_cpu_init call period, then the amd_pstate_update() will get
> correct cached value before updating the perf to change the cpu perf
> level.The cached values are read through MSR interface, so here use
> shared_mem flag to check the registers are accessible
>
> Also the core performance boost state will be initialized through
> hardware configuration register
>
> * shared_mem flag is used for the shared memory type CPPC implementation
> which dose not support MSR interface operation
Please check the comment of patch 2.
>
> Signed-off-by: Perry Yuan <Perry.Yuan@amd.com>
> ---
> drivers/cpufreq/amd-pstate.c | 18 +++++++++++++-----
> 1 file changed, 13 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/cpufreq/amd-pstate.c b/drivers/cpufreq/amd-pstate.c
> index 43e6df9f67f6..d8c4153dbe4f 100644
> --- a/drivers/cpufreq/amd-pstate.c
> +++ b/drivers/cpufreq/amd-pstate.c
> @@ -92,6 +92,8 @@ struct amd_aperf_mperf {
> * @prev: Last Aperf/Mperf/tsc count value read from register
> * @freq: current cpu frequency value
> * @boost_supported: check whether the Processor or SBIOS supports boost mode
> + * @precision_boost_off: the core performance boost disabled state
> + * @cppc_hw_conf_cached: the cached hardware configuration register
> *
> * The amd_cpudata is key private data for each CPU thread in AMD P-State, and
> * represents all the attributes and goals that AMD P-State requests at runtime.
> @@ -117,6 +119,7 @@ struct amd_cpudata {
>
> u64 freq;
> bool boost_supported;
> + bool precision_boost_off;
> u64 cppc_hw_conf_cached;
> };
>
> @@ -547,12 +550,17 @@ static int amd_pstate_cpu_init(struct cpufreq_policy *policy)
> cpudata->lowest_nonlinear_freq = lowest_nonlinear_freq;
>
> policy->driver_data = cpudata;
> + if (!shared_mem) {
> + ret = rdmsrl_on_cpu(cpudata->cpu, MSR_AMD_CPPC_HW_CTL, &value);
> + if (ret)
> + return ret;
> + cpudata->precision_boost_off = value & AMD_CPPC_PRECISION_BOOST_ENABLED;
>
> - ret = rdmsrl_on_cpu(cpudata->cpu, MSR_AMD_CPPC_HW_CTL, &value);
> - if (ret)
> - return ret;
> - WRITE_ONCE(cpudata->cppc_hw_conf_cached, value);
> -
> + ret = rdmsrl_on_cpu(cpudata->cpu, MSR_AMD_CPPC_REQ, &value);
> + if (ret)
> + return ret;
> + WRITE_ONCE(cpudata->cppc_req_cached, value);
> + }
> amd_pstate_boost_init(cpudata);
>
> return 0;
> --
> 2.32.0
>
next prev parent reply other threads:[~2022-07-19 0:49 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-15 10:03 [PATCH v4 00/13] AMD Pstate Enhancement And Issue Fixs Perry Yuan
2022-07-15 10:04 ` [PATCH v4 01/13] x86/msr: Add the MSR definition for AMD CPPC hardware control Perry Yuan
2022-07-19 0:25 ` Huang Rui
2022-07-15 10:04 ` [PATCH v4 02/13] cpufreq: amd-pstate: enable AMD Precision Boost mode switch Perry Yuan
2022-07-19 0:45 ` Huang Rui
2022-07-21 9:15 ` Yuan, Perry
2022-07-15 10:04 ` [PATCH v4 03/13] cpufreq: amd-pstate: cleanup the unused and duplicated headers declaration Perry Yuan
2022-07-19 0:46 ` Huang Rui
2022-07-15 10:04 ` [PATCH v4 04/13] cpufreq: amd-pstate: prefetch cppc_req_cached value in amd_pstate_cpu_init() Perry Yuan
2022-07-19 0:48 ` Huang Rui [this message]
2022-07-15 10:04 ` [PATCH v4 05/13] cpufreq: amd-pstate: simplify cpudata pointer assignment Perry Yuan
2022-07-19 0:49 ` Huang Rui
2022-07-15 10:04 ` [PATCH v4 06/13] cpufreq: amd_pstate: fix wrong lowest perf fetch Perry Yuan
2022-07-19 0:50 ` Huang Rui
2022-07-15 10:04 ` [PATCH v4 07/13] cpufreq: amd_pstate: map desired perf into pstate scope for powersave governor Perry Yuan
2022-07-19 0:56 ` Huang Rui
2022-07-15 10:04 ` [PATCH v4 08/13] cpufreq: amd-pstate: fix white-space Perry Yuan
2022-07-19 0:58 ` Huang Rui
2022-07-15 10:04 ` [PATCH v4 09/13] cpufreq: amd-pstate: update pstate frequency transition delay time Perry Yuan
2022-07-15 10:04 ` [PATCH v4 10/13] cpufreq: amd-pstate: add ACPI disabled check in acpi_cpc_valid() Perry Yuan
2022-07-15 10:04 ` [PATCH v4 11/13] cpufreq: amd_pstate: update transition delay time to 1ms Perry Yuan
2022-07-19 1:04 ` Huang Rui
2022-07-19 6:33 ` Yuan, Perry
2022-07-15 10:04 ` [PATCH v4 12/13] arch_topology: remove the acpi_disabled check Perry Yuan
2022-07-15 10:04 ` [PATCH v4 13/13] cpufreq: CPPC: " Perry Yuan
2022-07-19 1:07 ` Huang Rui
2022-07-19 6:32 ` Yuan, Perry
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=YtX/YgJyzG3U8OUN@amd.com \
--to=ray.huang@amd.com \
--cc=Alexander.Deucher@amd.com \
--cc=Deepak.Sharma@amd.com \
--cc=Jinzhou.Su@amd.com \
--cc=Li.Meng@amd.com \
--cc=Mario.Limonciello@amd.com \
--cc=Nathan.Fontenot@amd.com \
--cc=Perry.Yuan@amd.com \
--cc=Shimmer.Huang@amd.com \
--cc=Xiaojian.Du@amd.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=rafael.j.wysocki@intel.com \
--cc=viresh.kumar@linaro.org \
/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