From: Huang Rui <ray.huang@amd.com>
To: "Meng, Li (Jassmine)" <Li.Meng@amd.com>
Cc: Shuah Khan <skhan@linuxfoundation.org>,
"linux-pm@vger.kernel.org" <linux-pm@vger.kernel.org>,
"Rafael J . Wysocki" <rafael.j.wysocki@intel.com>,
"Fontenot, Nathan" <Nathan.Fontenot@amd.com>,
"Sharma, Deepak" <Deepak.Sharma@amd.com>,
"Deucher, Alexander" <Alexander.Deucher@amd.com>,
"Limonciello, Mario" <Mario.Limonciello@amd.com>,
"Su, Jinzhou (Joe)" <Jinzhou.Su@amd.com>,
"Yuan, Perry" <Perry.Yuan@amd.com>,
"Du, Xiaojian" <Xiaojian.Du@amd.com>,
Viresh Kumar <viresh.kumar@linaro.org>,
Borislav Petkov <bp@alien8.de>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH V4 1/3] cpufreq: amd-pstate: Expose struct amd_cpudata
Date: Thu, 28 Apr 2022 15:25:51 +0800 [thread overview]
Message-ID: <YmpBf45Dkku8iSkb@amd.com> (raw)
In-Reply-To: <20220427135315.3447550-2-li.meng@amd.com>
Hi Li,
On Wed, Apr 27, 2022 at 09:53:13PM +0800, Meng, Li (Jassmine) wrote:
> Expose struct amd_cpudata to AMD P-State unit test module.
>
> This data struct will be used on the following AMD P-State unit test
> (amd-pstate-ut) module. The amd-pstate-ut module can get some
> AMD infomations by this data struct. For example: highest perf,
> nominal perf, boost supported etc.
>
> Signed-off-by: Meng Li <li.meng@amd.com>
I have acked this patch at the last version.
Next time you can add my Ack here directly.
Acked-by: Huang Rui <ray.huang@amd.com>
> ---
> MAINTAINERS | 1 +
> drivers/cpufreq/amd-pstate.c | 60 +---------------------------
> include/linux/amd-pstate.h | 77 ++++++++++++++++++++++++++++++++++++
> 3 files changed, 79 insertions(+), 59 deletions(-)
> create mode 100644 include/linux/amd-pstate.h
>
> diff --git a/MAINTAINERS b/MAINTAINERS
> index 61d9f114c37f..6f814eda95b5 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -1020,6 +1020,7 @@ L: linux-pm@vger.kernel.org
> S: Supported
> F: Documentation/admin-guide/pm/amd-pstate.rst
> F: drivers/cpufreq/amd-pstate*
> +F: include/linux/amd-pstate.h
> F: tools/power/x86/amd_pstate_tracer/amd_pstate_trace.py
>
> AMD PTDMA DRIVER
> diff --git a/drivers/cpufreq/amd-pstate.c b/drivers/cpufreq/amd-pstate.c
> index 7be38bc6a673..5f7a00a64f76 100644
> --- a/drivers/cpufreq/amd-pstate.c
> +++ b/drivers/cpufreq/amd-pstate.c
> @@ -36,6 +36,7 @@
> #include <linux/delay.h>
> #include <linux/uaccess.h>
> #include <linux/static_call.h>
> +#include <linux/amd-pstate.h>
>
> #include <acpi/processor.h>
> #include <acpi/cppc_acpi.h>
> @@ -65,65 +66,6 @@ MODULE_PARM_DESC(shared_mem,
>
> static struct cpufreq_driver amd_pstate_driver;
>
> -/**
> - * struct amd_aperf_mperf
> - * @aperf: actual performance frequency clock count
> - * @mperf: maximum performance frequency clock count
> - * @tsc: time stamp counter
> - */
> -struct amd_aperf_mperf {
> - u64 aperf;
> - u64 mperf;
> - u64 tsc;
> -};
> -
> -/**
> - * struct amd_cpudata - private CPU data for AMD P-State
> - * @cpu: CPU number
> - * @req: constraint request to apply
> - * @cppc_req_cached: cached performance request hints
> - * @highest_perf: the maximum performance an individual processor may reach,
> - * assuming ideal conditions
> - * @nominal_perf: the maximum sustained performance level of the processor,
> - * assuming ideal operating conditions
> - * @lowest_nonlinear_perf: the lowest performance level at which nonlinear power
> - * savings are achieved
> - * @lowest_perf: the absolute lowest performance level of the processor
> - * @max_freq: the frequency that mapped to highest_perf
> - * @min_freq: the frequency that mapped to lowest_perf
> - * @nominal_freq: the frequency that mapped to nominal_perf
> - * @lowest_nonlinear_freq: the frequency that mapped to lowest_nonlinear_perf
> - * @cur: Difference of Aperf/Mperf/tsc count between last and current sample
> - * @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
> - *
> - * 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.
> - */
> -struct amd_cpudata {
> - int cpu;
> -
> - struct freq_qos_request req[2];
> - u64 cppc_req_cached;
> -
> - u32 highest_perf;
> - u32 nominal_perf;
> - u32 lowest_nonlinear_perf;
> - u32 lowest_perf;
> -
> - u32 max_freq;
> - u32 min_freq;
> - u32 nominal_freq;
> - u32 lowest_nonlinear_freq;
> -
> - struct amd_aperf_mperf cur;
> - struct amd_aperf_mperf prev;
> -
> - u64 freq;
> - bool boost_supported;
> -};
> -
> static inline int pstate_enable(bool enable)
> {
> return wrmsrl_safe(MSR_AMD_CPPC_ENABLE, enable);
> diff --git a/include/linux/amd-pstate.h b/include/linux/amd-pstate.h
> new file mode 100644
> index 000000000000..4dffb7db3807
> --- /dev/null
> +++ b/include/linux/amd-pstate.h
> @@ -0,0 +1,77 @@
> +/* SPDX-License-Identifier: GPL-2.0-only */
> +/*
> + * linux/include/linux/amd-pstate.h
> + *
> + * Copyright (C) 2007-2010 Advanced Micro Devices, Inc.
> + *
> + * Author: Meng Li <li.meng@amd.com>
> + */
> +
> +#ifndef _LINUX_AMD_PSTATE_H
> +#define _LINUX_AMD_PSTATE_H
> +
> +#include <linux/pm_qos.h>
> +
> +/*********************************************************************
> + * AMD P-state INTERFACE *
> + *********************************************************************/
> +/**
> + * struct amd_aperf_mperf
> + * @aperf: actual performance frequency clock count
> + * @mperf: maximum performance frequency clock count
> + * @tsc: time stamp counter
> + */
> +struct amd_aperf_mperf {
> + u64 aperf;
> + u64 mperf;
> + u64 tsc;
> +};
> +
> +/**
> + * struct amd_cpudata - private CPU data for AMD P-State
> + * @cpu: CPU number
> + * @req: constraint request to apply
> + * @cppc_req_cached: cached performance request hints
> + * @highest_perf: the maximum performance an individual processor may reach,
> + * assuming ideal conditions
> + * @nominal_perf: the maximum sustained performance level of the processor,
> + * assuming ideal operating conditions
> + * @lowest_nonlinear_perf: the lowest performance level at which nonlinear power
> + * savings are achieved
> + * @lowest_perf: the absolute lowest performance level of the processor
> + * @max_freq: the frequency that mapped to highest_perf
> + * @min_freq: the frequency that mapped to lowest_perf
> + * @nominal_freq: the frequency that mapped to nominal_perf
> + * @lowest_nonlinear_freq: the frequency that mapped to lowest_nonlinear_perf
> + * @cur: Difference of Aperf/Mperf/tsc count between last and current sample
> + * @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
> + *
> + * 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.
> + */
> +struct amd_cpudata {
> + int cpu;
> +
> + struct freq_qos_request req[2];
> + u64 cppc_req_cached;
> +
> + u32 highest_perf;
> + u32 nominal_perf;
> + u32 lowest_nonlinear_perf;
> + u32 lowest_perf;
> +
> + u32 max_freq;
> + u32 min_freq;
> + u32 nominal_freq;
> + u32 lowest_nonlinear_freq;
> +
> + struct amd_aperf_mperf cur;
> + struct amd_aperf_mperf prev;
> +
> + u64 freq;
> + bool boost_supported;
> +};
> +
> +#endif /* _LINUX_AMD_PSTATE_H */
> --
> 2.25.1
>
next prev parent reply other threads:[~2022-04-28 7:26 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-27 13:53 [PATCH V4 0/3] Add unit test module for AMD P-State driver Meng Li
2022-04-27 13:53 ` [PATCH V4 1/3] cpufreq: amd-pstate: Expose struct amd_cpudata Meng Li
2022-04-28 7:25 ` Huang Rui [this message]
2022-04-27 13:53 ` [PATCH V4 2/3] selftests: amd-pstate: Add test module for amd-pstate driver Meng Li
2022-04-28 9:55 ` Huang Rui
2022-04-27 13:53 ` [PATCH V4 3/3] Documentation: amd-pstate: Add unit test introduction Meng Li
2022-04-28 9:14 ` Huang Rui
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=YmpBf45Dkku8iSkb@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=Xiaojian.Du@amd.com \
--cc=bp@alien8.de \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=rafael.j.wysocki@intel.com \
--cc=skhan@linuxfoundation.org \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.