Skip to content

Commit

Permalink
cpufreq: amd-pstate: add ACPI disabled check in acpi_cpc_valid()
Browse files Browse the repository at this point in the history
Add acpi function check in case ACPI is not enabled, that will cause
pstate driver failed to call cppc acpi to change perf or update epp
value for shared memory solution processors.

When CPPC or ACPI is invalid, warning log will be needed to tell
user that AMD pstate driver failed to load and what is wrong.

Signed-off-by: Perry Yuan <[email protected]>
  • Loading branch information
Perry Yuan authored and Dark-Matter7232 committed Oct 2, 2022
1 parent f51de7a commit d81ed27
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 3 deletions.
3 changes: 3 additions & 0 deletions drivers/acpi/cppc_acpi.c
Original file line number Diff line number Diff line change
Expand Up @@ -424,6 +424,9 @@ bool acpi_cpc_valid(void)
struct cpc_desc *cpc_ptr;
int cpu;

if (acpi_disabled)
return false;

for_each_present_cpu(cpu) {
cpc_ptr = per_cpu(cpc_desc_ptr, cpu);
if (!cpc_ptr)
Expand Down
2 changes: 1 addition & 1 deletion drivers/base/arch_topology.c
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,7 @@ void topology_init_cpu_capacity_cppc(void)
struct cppc_perf_caps perf_caps;
int cpu;

if (likely(acpi_disabled || !acpi_cpc_valid()))
if (likely(!acpi_cpc_valid()))
return;

raw_capacity = kcalloc(num_possible_cpus(), sizeof(*raw_capacity),
Expand Down
2 changes: 1 addition & 1 deletion drivers/cpufreq/amd-pstate.c
Original file line number Diff line number Diff line change
Expand Up @@ -661,7 +661,7 @@ static int __init amd_pstate_init(void)
return -ENODEV;

if (!acpi_cpc_valid()) {
pr_debug("the _CPC object is not present in SBIOS\n");
pr_warn_once("the _CPC object is not present in SBIOS or ACPI disabled\n");
return -ENODEV;
}

Expand Down
2 changes: 1 addition & 1 deletion drivers/cpufreq/cppc_cpufreq.c
Original file line number Diff line number Diff line change
Expand Up @@ -947,7 +947,7 @@ static int __init cppc_cpufreq_init(void)
{
int ret;

if ((acpi_disabled) || !acpi_cpc_valid())
if (!acpi_cpc_valid())
return -ENODEV;

cppc_check_hisi_workaround();
Expand Down

0 comments on commit d81ed27

Please sign in to comment.