diff mbox

CPPC: Initialize and check CPUFreq CPU co-ord type correctly

Message ID 1447947607-10822-1-git-send-email-ashwin.chaugule@linaro.org (mailing list archive)
State Accepted, archived
Delegated to: Rafael Wysocki
Headers show

Commit Message

Ashwin Chaugule Nov. 19, 2015, 3:40 p.m. UTC
The CPU policy struct indicates the co-ordination type
for all CPUs of a common freq domain. Initialize it
correctly using the CPU specific data gathered from
CPPC ACPI lib via acpi_get_psd_map().

The PSD object is optional, so the cpu->shared_type
can also be 0. So instead of assuming any value other
than SW_ANY(0xFD) is unsupported, explictly check
if shared_type is SW_ALL and then bail.

Signed-off-by: Ashwin Chaugule <ashwin.chaugule@linaro.org>
---
 drivers/cpufreq/cppc_cpufreq.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Rafael J. Wysocki Nov. 19, 2015, 10:17 p.m. UTC | #1
On Thursday, November 19, 2015 10:40:07 AM Ashwin Chaugule wrote:
> The CPU policy struct indicates the co-ordination type
> for all CPUs of a common freq domain. Initialize it
> correctly using the CPU specific data gathered from
> CPPC ACPI lib via acpi_get_psd_map().
> 
> The PSD object is optional, so the cpu->shared_type
> can also be 0. So instead of assuming any value other
> than SW_ANY(0xFD) is unsupported, explictly check
> if shared_type is SW_ALL and then bail.
> 
> Signed-off-by: Ashwin Chaugule <ashwin.chaugule@linaro.org>

I'm assiming that this is a replacement for https://patchwork.kernel.org/patch/7607581/
so I'm going to replace that patch with this one, but that means it will go
into -rc3 instead.

> ---
>  drivers/cpufreq/cppc_cpufreq.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/cpufreq/cppc_cpufreq.c b/drivers/cpufreq/cppc_cpufreq.c
> index e8cb334..7c0bdfb 100644
> --- a/drivers/cpufreq/cppc_cpufreq.c
> +++ b/drivers/cpufreq/cppc_cpufreq.c
> @@ -98,10 +98,11 @@ static int cppc_cpufreq_cpu_init(struct cpufreq_policy *policy)
>  	policy->max = cpu->perf_caps.highest_perf;
>  	policy->cpuinfo.min_freq = policy->min;
>  	policy->cpuinfo.max_freq = policy->max;
> +	policy->shared_type = cpu->shared_type;
>  
>  	if (policy->shared_type == CPUFREQ_SHARED_TYPE_ANY)
>  		cpumask_copy(policy->cpus, cpu->shared_cpu_map);
> -	else {
> +	else if (policy->shared_type == CPUFREQ_SHARED_TYPE_ALL) {
>  		/* Support only SW_ANY for now. */
>  		pr_debug("Unsupported CPU co-ord type\n");
>  		return -EFAULT;
> 

Thanks,
Rafael

--
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Ashwin Chaugule Nov. 20, 2015, 12:10 a.m. UTC | #2
On 19 November 2015 at 17:17, Rafael J. Wysocki <rjw@rjwysocki.net> wrote:
> On Thursday, November 19, 2015 10:40:07 AM Ashwin Chaugule wrote:
>> The CPU policy struct indicates the co-ordination type
>> for all CPUs of a common freq domain. Initialize it
>> correctly using the CPU specific data gathered from
>> CPPC ACPI lib via acpi_get_psd_map().
>>
>> The PSD object is optional, so the cpu->shared_type
>> can also be 0. So instead of assuming any value other
>> than SW_ANY(0xFD) is unsupported, explictly check
>> if shared_type is SW_ALL and then bail.
>>
>> Signed-off-by: Ashwin Chaugule <ashwin.chaugule@linaro.org>
>
> I'm assiming that this is a replacement for https://patchwork.kernel.org/patch/7607581/
> so I'm going to replace that patch with this one, but that means it will go
> into -rc3 instead.
>

Replacement is correct. I guess I didn't realize you had pulled it in
already. :)

Thanks,
Ashwin.
--
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/cpufreq/cppc_cpufreq.c b/drivers/cpufreq/cppc_cpufreq.c
index e8cb334..7c0bdfb 100644
--- a/drivers/cpufreq/cppc_cpufreq.c
+++ b/drivers/cpufreq/cppc_cpufreq.c
@@ -98,10 +98,11 @@  static int cppc_cpufreq_cpu_init(struct cpufreq_policy *policy)
 	policy->max = cpu->perf_caps.highest_perf;
 	policy->cpuinfo.min_freq = policy->min;
 	policy->cpuinfo.max_freq = policy->max;
+	policy->shared_type = cpu->shared_type;
 
 	if (policy->shared_type == CPUFREQ_SHARED_TYPE_ANY)
 		cpumask_copy(policy->cpus, cpu->shared_cpu_map);
-	else {
+	else if (policy->shared_type == CPUFREQ_SHARED_TYPE_ALL) {
 		/* Support only SW_ANY for now. */
 		pr_debug("Unsupported CPU co-ord type\n");
 		return -EFAULT;