ACK: [PATCH V2] cpufreq: Add support to read boost frequencies

ivanhu ivan.hu at canonical.com
Wed Apr 11 07:41:06 UTC 2018



On 04/05/2018 02:02 PM, Shilpasri G Bhat wrote:
> POWER8+ and POWER9 have boost frequencies given by the cpufreq sysfs
> file 'scaling_boost_frequencies'. The boost frequencies are greater
> than the freqeuncies provided in 'scaling_available_frequencies'.
> This patch adds support to add the boost frequencies to the list of
> frequencies.
>
> Signed-off-by: Shilpasri G Bhat <shilpa.bhat at linux.vnet.ibm.com>
> ---
> Changes from V1:
> - Remove changes from maxfreq.c which applies only for x86
>
>  src/cpu/cpufreq/cpufreq.c | 24 +++++++++++++++++++++---
>  1 file changed, 21 insertions(+), 3 deletions(-)
>
> diff --git a/src/cpu/cpufreq/cpufreq.c b/src/cpu/cpufreq/cpufreq.c
> index 8bee1dd..6cd7014 100644
> --- a/src/cpu/cpufreq/cpufreq.c
> +++ b/src/cpu/cpufreq/cpufreq.c
> @@ -749,7 +749,7 @@ static int parse_cpu_info(fwts_framework *fw,
>  {
>  	char *end, path[PATH_MAX+1], *str, *tmp;
>  	struct stat statbuf;
> -	int rc;
> +	int rc, i = 0;
>  
>  	strcpy(cpu->sysfs_path, dir->d_name);
>  	cpu->idx = strtoul(cpu->sysfs_path + strlen("cpu"), &end, 10);
> @@ -783,8 +783,6 @@ static int parse_cpu_info(fwts_framework *fw,
>  
>  	/* cpu driver like intel_pstate has no scaling_available_frequencies */
>  	if (str != NULL) {
> -		int i = 0;
> -
>  		for (tmp = str; ; tmp = NULL) {
>  			char *tok = strtok(tmp, " ");
>  			if (!tok)
> @@ -800,6 +798,26 @@ static int parse_cpu_info(fwts_framework *fw,
>  
>  	free(str);
>  
> +	/* parse boost frequencies */
> +	cpu_mkpath(path, sizeof(path), cpu, "scaling_boost_frequencies");
> +	str = fwts_get(path);
> +
> +	if (str) {
> +		for (tmp = str; ; tmp = NULL) {
> +			char *tok = strtok(tmp, " ");
> +
> +			if (!tok)
> +				break;
> +			if (!isdigit(tok[0]))
> +				continue;
> +			cpu->freqs[i++].Hz = strtoull(tok, NULL, 10);
> +		}
> +		cpu->n_freqs = i;
> +		qsort(cpu->freqs, cpu->n_freqs, sizeof(cpu->freqs[0]),
> +		      cpu_freq_compare);
> +	}
> +
> +	free(str);
>  	return FWTS_OK;
>  }
>  
Acked-by: Ivan Hu <ivan.hu at canonical.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ubuntu.com/archives/fwts-devel/attachments/20180411/a8a489da/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: OpenPGP digital signature
URL: <https://lists.ubuntu.com/archives/fwts-devel/attachments/20180411/a8a489da/attachment.sig>


More information about the fwts-devel mailing list