ACPI: CPPC: Add ACPI disabled check to acpi_cpc_valid()
authorPerry Yuan <Perry.Yuan@amd.com>
Sun, 14 Aug 2022 16:35:48 +0000 (00:35 +0800)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Thu, 25 Aug 2022 11:55:17 +0000 (13:55 +0200)
Make acpi_cpc_valid() check if ACPI is disabled, so that its callers
don't need to check that separately.  This will also cause the AMD
pstate driver to refuse to load right away when ACPI is disabled.

Also update the warning message in amd_pstate_init() to mention the
ACPI disabled case for completeness.

Signed-off-by: Perry Yuan <Perry.Yuan@amd.com>
[ rjw: Subject edits, new changelog ]
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
drivers/acpi/cppc_acpi.c
drivers/base/arch_topology.c
drivers/cpufreq/amd-pstate.c
drivers/cpufreq/cppc_cpufreq.c

index 1e15a9f25ae97153c780ed9a9f8996e5db76119e..c2309429146fa649ab1ce8bb9ecb85b1259cc460 100644 (file)
@@ -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)
index 0424b59b695ef0fe2d717405efbfbc7dfac2dc3a..a9ff81d3a889414fc0fa8354cc12ae9084ec4433 100644 (file)
@@ -353,7 +353,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),
index 9ac75c1cde9c22fc3bcee6885521477ea1352625..a8e386d67a18752e73ba7955c428e2b5b09a92b1 100644 (file)
@@ -673,7 +673,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;
        }
 
index 24eaf0ec344d55027beda78e77a7436db7dc4b95..9adb7612993e0c519db08f8b7c68c8c59fb878d9 100644 (file)
@@ -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();