mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Gautham R. Shenoy" <gautham.shenoy@amd.com>
To: Perry Yuan <perry.yuan@amd.com>
Cc: rafael.j.wysocki@intel.com, Mario.Limonciello@amd.com,
	viresh.kumar@linaro.org, Ray.Huang@amd.com,
	Borislav.Petkov@amd.com, Alexander.Deucher@amd.com,
	Xinmei.Huang@amd.com, Xiaojian.Du@amd.com, Li.Meng@amd.com,
	linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/7] cpufreq: amd-pstate: initialize new core precision boost state
Date: Wed, 14 Feb 2024 12:07:11 +0530	[thread overview]
Message-ID: <Zcxfl7Pqob70ghDi@BLR-5CG11610CF.amd.com> (raw)
In-Reply-To: <0409d40c500eeb8d4d84ecb028b73f2eee147822.1706255676.git.perry.yuan@amd.com>

Hello Perry,

On Fri, Jan 26, 2024 at 04:08:05PM +0800, Perry Yuan wrote:
> From: Perry Yuan <Perry.Yuan@amd.com>

[..snip..]

> @@ -632,18 +645,27 @@ static int amd_get_lowest_nonlinear_freq(struct amd_cpudata *cpudata)
>  	return lowest_nonlinear_freq * 1000;
>  }
>  
> -static void amd_pstate_boost_init(struct amd_cpudata *cpudata)
> +static int amd_pstate_boost_init(struct amd_cpudata *cpudata)
>  {
> -	u32 highest_perf, nominal_perf;
> +	u64 boost_state, boost_val;


> +	int ret;
>  
> -	highest_perf = READ_ONCE(cpudata->highest_perf);
> -	nominal_perf = READ_ONCE(cpudata->nominal_perf);
> +	ret = rdmsrl_on_cpu(cpudata->cpu, MSR_K7_HWCR, &boost_val);

Use hwcr_val instead of boost_val ?

> +	if (ret) {
> +		pr_err_once("failed to read initial CPU boost state!\n");
> +		return ret;
> +	}
>  
> -	if (highest_perf <= nominal_perf)
> -		return;
> +	boost_state = (boost_val >> 25) & 0x1;

How about the following ?

        boost_disabled = (hwcr_val & MSR_K7_HWCR_CPB_DIS);



> +	if (!boost_state) {

        if (!boost_disabled) {

> +		global.cpb_supported = true;
> +		global.cpb_boost = true;
> +	} else {
> +		global.cpb_supported = false;
> +		global.cpb_boost = false;
> +	}
>  
> -	cpudata->boost_supported = true;
> -	current_pstate_driver->boost_enabled = true;
> +	return ret;
>  }
>  
>  static void amd_perf_ctl_reset(unsigned int cpu)
> @@ -676,6 +698,9 @@ static int amd_pstate_cpu_init(struct cpufreq_policy *policy)
>  	if (ret)
>  		goto free_cpudata1;
>  
> +	/* initialize cpu cores boot state */
> +	amd_pstate_boost_init(cpudata);
> +
>  	min_freq = amd_get_min_freq(cpudata);
>  	max_freq = amd_get_max_freq(cpudata);
>  	nominal_freq = amd_get_nominal_freq(cpudata);
> @@ -725,7 +750,6 @@ static int amd_pstate_cpu_init(struct cpufreq_policy *policy)
>  
>  	policy->driver_data = cpudata;
>  
> -	amd_pstate_boost_init(cpudata);
>  	if (!current_pstate_driver->adjust_perf)
>  		current_pstate_driver->adjust_perf = amd_pstate_adjust_perf;
>  
> @@ -1093,6 +1117,9 @@ static int amd_pstate_epp_cpu_init(struct cpufreq_policy *policy)
>  	if (ret)
>  		goto free_cpudata1;
>  
> +	/* initialize cpu cores boot state */
> +	amd_pstate_boost_init(cpudata);
> +
>  	min_freq = amd_get_min_freq(cpudata);
>  	max_freq = amd_get_max_freq(cpudata);
>  	nominal_freq = amd_get_nominal_freq(cpudata);
> @@ -1143,7 +1170,6 @@ static int amd_pstate_epp_cpu_init(struct cpufreq_policy *policy)
>  			return ret;
>  		WRITE_ONCE(cpudata->cppc_cap1_cached, value);
>  	}
> -	amd_pstate_boost_init(cpudata);
>  
>  	return 0;
>  
> diff --git a/include/linux/amd-pstate.h b/include/linux/amd-pstate.h
> index 446394f84606..66d939a344b1 100644
> --- a/include/linux/amd-pstate.h
> +++ b/include/linux/amd-pstate.h
> @@ -80,7 +80,6 @@ struct amd_cpudata {
>  	struct amd_aperf_mperf prev;
>  
>  	u64	freq;
> -	bool	boost_supported;
>  
>  	/* EPP feature related attributes*/
>  	s16	epp_policy;
> -- 
> 2.34.1
> 

Otherwise looks good to me.
--
Thanks and Regards
gautham.

  parent reply	other threads:[~2024-02-14  6:37 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-26  8:08 [PATCH 0/7] AMD Pstate Driver Core Performance Boost Perry Yuan
2024-01-26  8:08 ` [PATCH 1/7] cpufreq: amd-pstate: remove set_boost callback for passive mode Perry Yuan
2024-01-26 15:45   ` Mario Limonciello
2024-01-29  4:46     ` Yuan, Perry
2024-01-26  8:08 ` [PATCH 2/7] cpufreq: amd-pstate: initialize new core precision boost state Perry Yuan
2024-01-26 16:01   ` Mario Limonciello
2024-01-27 19:01   ` kernel test robot
2024-02-11 18:19   ` kernel test robot
2024-02-14  6:37   ` Gautham R. Shenoy [this message]
2024-01-26  8:08 ` [PATCH 3/7] cpufreq: amd-pstate: implement cpb_boost sysfs entry for boost control Perry Yuan
2024-01-26 15:56   ` Mario Limonciello
2024-01-29  5:22     ` Yuan, Perry
2024-01-26  8:08 ` [PATCH 4/7] cpufreq: amd-pstate: fix max_perf calculation for amd_get_max_freq() Perry Yuan
2024-01-26 15:54   ` Mario Limonciello
2024-01-29  5:16     ` Yuan, Perry
2024-01-26  8:08 ` [PATCH 5/7] cpufreq: amd-pstate: fix the MSR highest perf will be reset issue while cpb boost off Perry Yuan
2024-01-26  8:08 ` [PATCH 6/7] cpufreq:amd-pstate: add suspend and resume callback for passive mode Perry Yuan
2024-01-26 15:52   ` Mario Limonciello
2024-01-26  8:08 ` [PATCH 7/7] Documentation: cpufreq: amd-pstate: introduce the new cpu boost control method Perry Yuan
2024-01-26 15:47   ` Mario Limonciello
2024-01-29  5:07     ` 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=Zcxfl7Pqob70ghDi@BLR-5CG11610CF.amd.com \
    --to=gautham.shenoy@amd.com \
    --cc=Alexander.Deucher@amd.com \
    --cc=Borislav.Petkov@amd.com \
    --cc=Li.Meng@amd.com \
    --cc=Mario.Limonciello@amd.com \
    --cc=Ray.Huang@amd.com \
    --cc=Xiaojian.Du@amd.com \
    --cc=Xinmei.Huang@amd.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=perry.yuan@amd.com \
    --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

all inboxes | Powered by JetHome®