Skip to content

Commit

Permalink
ACPI: CPPC: Return error if _CPC is invalid on a CPU
Browse files Browse the repository at this point in the history
Based on 8.4.7.1 section of ACPI 6.1 specification, if the platform
supports CPPC, the _CPC object must exist under all processor objects.
If cpc_desc_ptr pointer is invalid on any CPUs, acpi_get_psd_map()
should return error and CPPC cpufreq driver can not be registered.

Signed-off-by: Hoan Tran <hotran@apm.com>
Reviewed-by: Prashanth Prakash <pprakash@codeaurora.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
  • Loading branch information
Hoan Tran authored and Rafael J. Wysocki committed Jun 23, 2016
1 parent 33688ab commit 8343c40
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions drivers/acpi/cppc_acpi.c
Original file line number Diff line number Diff line change
Expand Up @@ -299,8 +299,10 @@ int acpi_get_psd_map(struct cpudata **all_cpu_data)
continue;

cpc_ptr = per_cpu(cpc_desc_ptr, i);
if (!cpc_ptr)
continue;
if (!cpc_ptr) {
retval = -EFAULT;
goto err_ret;
}

pdomain = &(cpc_ptr->domain_info);
cpumask_set_cpu(i, pr->shared_cpu_map);
Expand All @@ -322,8 +324,10 @@ int acpi_get_psd_map(struct cpudata **all_cpu_data)
continue;

match_cpc_ptr = per_cpu(cpc_desc_ptr, j);
if (!match_cpc_ptr)
continue;
if (!match_cpc_ptr) {
retval = -EFAULT;
goto err_ret;
}

match_pdomain = &(match_cpc_ptr->domain_info);
if (match_pdomain->domain != pdomain->domain)
Expand Down Expand Up @@ -353,8 +357,10 @@ int acpi_get_psd_map(struct cpudata **all_cpu_data)
continue;

match_cpc_ptr = per_cpu(cpc_desc_ptr, j);
if (!match_cpc_ptr)
continue;
if (!match_cpc_ptr) {
retval = -EFAULT;
goto err_ret;
}

match_pdomain = &(match_cpc_ptr->domain_info);
if (match_pdomain->domain != pdomain->domain)
Expand Down

0 comments on commit 8343c40

Please sign in to comment.