Re: [PATCH 7/8] cppc_cpufreq: expose information on frequency domains
From: Viresh Kumar
Date: Mon Nov 09 2020 - 02:09:38 EST
On 05-11-20, 12:55, Ionela Voinescu wrote:
> Use the existing sysfs attribute "freqdomain_cpus" to expose
> information to userspace about CPUs in the same frequency domain.
>
> Signed-off-by: Ionela Voinescu <ionela.voinescu@xxxxxxx>
> Cc: Rafael J. Wysocki <rjw@xxxxxxxxxxxxx>
> Cc: Viresh Kumar <viresh.kumar@xxxxxxxxxx>
> ---
> Documentation/ABI/testing/sysfs-devices-system-cpu | 3 ++-
> drivers/cpufreq/cppc_cpufreq.c | 14 ++++++++++++++
> 2 files changed, 16 insertions(+), 1 deletion(-)
>
> diff --git a/Documentation/ABI/testing/sysfs-devices-system-cpu b/Documentation/ABI/testing/sysfs-devices-system-cpu
> index 1a04ca8162ad..0eee30b27ab6 100644
> --- a/Documentation/ABI/testing/sysfs-devices-system-cpu
> +++ b/Documentation/ABI/testing/sysfs-devices-system-cpu
> @@ -264,7 +264,8 @@ Description: Discover CPUs in the same CPU frequency coordination domain
> attribute is useful for user space DVFS controllers to get better
> power/performance results for platforms using acpi-cpufreq.
>
> - This file is only present if the acpi-cpufreq driver is in use.
> + This file is only present if the acpi-cpufreq or the cppc-cpufreq
> + drivers are in use.
>
>
> What: /sys/devices/system/cpu/cpu*/cache/index3/cache_disable_{0,1}
> diff --git a/drivers/cpufreq/cppc_cpufreq.c b/drivers/cpufreq/cppc_cpufreq.c
> index 60ac7f8049b5..b4edeeb57d04 100644
> --- a/drivers/cpufreq/cppc_cpufreq.c
> +++ b/drivers/cpufreq/cppc_cpufreq.c
> @@ -483,6 +483,19 @@ static int cppc_cpufreq_set_boost(struct cpufreq_policy *policy, int state)
> return 0;
> }
>
> +static ssize_t show_freqdomain_cpus(struct cpufreq_policy *policy, char *buf)
> +{
> + struct cppc_cpudata *cpu_data = policy->driver_data;
> +
> + return cpufreq_show_cpus(cpu_data->domain->shared_cpu_map, buf);
> +}
> +cpufreq_freq_attr_ro(freqdomain_cpus);
> +
> +static struct freq_attr *cppc_cpufreq_attr[] = {
> + &freqdomain_cpus,
> + NULL,
> +};
> +
> static struct cpufreq_driver cppc_cpufreq_driver = {
> .flags = CPUFREQ_CONST_LOOPS,
> .verify = cppc_verify_policy,
> @@ -491,6 +504,7 @@ static struct cpufreq_driver cppc_cpufreq_driver = {
> .init = cppc_cpufreq_cpu_init,
> .stop_cpu = cppc_cpufreq_stop_cpu,
> .set_boost = cppc_cpufreq_set_boost,
> + .attr = cppc_cpufreq_attr,
> .name = "cppc_cpufreq",
> };
Acked-by: Viresh Kumar <viresh.kumar@xxxxxxxxxx>
--
viresh