All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] acpi: cppc: add cpufreq device
@ 2020-12-10 14:21 Mian Yousaf Kaukab
  2020-12-10 14:21 ` [PATCH 2/2] cpufreq: cppc: convert to a platform driver Mian Yousaf Kaukab
  2020-12-10 14:32 ` [PATCH 1/2] acpi: cppc: add cpufreq device Rafael J. Wysocki
  0 siblings, 2 replies; 8+ messages in thread
From: Mian Yousaf Kaukab @ 2020-12-10 14:21 UTC (permalink / raw)
  To: rjw, lenb, viresh.kumar, ionela.voinescu
  Cc: linux-acpi, linux-kernel, linux-pm, Mian Yousaf Kaukab, Petr Cervinka

From: Mian Yousaf Kaukab <ykaukab@suse.de>

Since commit 28f06f770454 ("cppc_cpufreq: replace per-cpu structures with
lists"), cppc-cpufreq driver doesn't check availability of PSD data before
registering with cpufreq core. As a result on a ThunderX2 platform when
CPPC is disabled from BIOS, kernel log is spammed with following messages:

[  180.974166] CPPC Cpufreq: Error in acquiring _CPC/_PSD data for CPUxx

acpi_cppc_processor_probe() never succeed in this case because
acpi_evaluate_object_typed("_CPC") always returns AE_NOT_FOUND. When
cpufreq core calls cppc_cpufreq_cpu_init(), driver fails to obtain PSD data
and print error messages.

Convert cppc-cpufreq driver to a platform driver (done in a separate patch)
and add cppc-cpufreq device when acpi_cppc_processor_probe() succeeds.

Fixes: 28f06f770454 ("cppc_cpufreq: replace per-cpu structures with lists")
Reported-by: Petr Cervinka <pcervinka@suse.com>
Signed-off-by: Mian Yousaf Kaukab <ykaukab@suse.de>
---
 drivers/acpi/cppc_acpi.c | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/drivers/acpi/cppc_acpi.c b/drivers/acpi/cppc_acpi.c
index 4e478f751ff7..adf9ca3be9fe 100644
--- a/drivers/acpi/cppc_acpi.c
+++ b/drivers/acpi/cppc_acpi.c
@@ -39,6 +39,7 @@
 #include <linux/ktime.h>
 #include <linux/rwsem.h>
 #include <linux/wait.h>
+#include <linux/platform_device.h>
 
 #include <acpi/cppc_acpi.h>
 
@@ -606,6 +607,23 @@ static bool is_cppc_supported(int revision, int num_ent)
 	return true;
 }
 
+static void add_cppc_cpufreq_dev(void)
+{
+	static bool already_added;
+
+	if (!already_added) {
+		struct platform_device *pdev;
+
+		pdev = platform_device_register_simple("cppc-cpufreq", -1,
+				NULL, 0);
+		if (IS_ERR(pdev))
+			pr_err("Couldn't register cppc-cpufreq err=%ld\n",
+					PTR_ERR(pdev));
+		else
+			already_added = true;
+	}
+}
+
 /*
  * An example CPC table looks like the following.
  *
@@ -815,6 +833,9 @@ int acpi_cppc_processor_probe(struct acpi_processor *pr)
 	}
 
 	kfree(output.pointer);
+
+	add_cppc_cpufreq_dev();
+
 	return 0;
 
 out_free:
-- 
2.26.2


^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2020-12-10 18:55 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-10 14:21 [PATCH 1/2] acpi: cppc: add cpufreq device Mian Yousaf Kaukab
2020-12-10 14:21 ` [PATCH 2/2] cpufreq: cppc: convert to a platform driver Mian Yousaf Kaukab
2020-12-10 14:32 ` [PATCH 1/2] acpi: cppc: add cpufreq device Rafael J. Wysocki
2020-12-10 15:02   ` Ionela Voinescu
2020-12-10 15:04   ` Mian Yousaf Kaukab
2020-12-10 16:55     ` Rafael J. Wysocki
2020-12-10 17:23       ` Ionela Voinescu
2020-12-10 18:54         ` Rafael J. Wysocki

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.