Re: [PATCH] powernow-k8: check for BIOS with p-state capability

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thursday 11 February 2010 07:56:59 pm Chumbalkar, Nagananda wrote:
...
> >@@ -1271,7 +1273,12 @@ static int __cpuinit powernowk8_cpu_init
> > 		 * an UP version, and is deprecated by AMD.
> > 		 */
> > 		if (num_online_cpus() != 1) {
> >-			printk_once(ACPI_PSS_BIOS_BUG_MSG);
> >+			if (dmi_check_amd_bios_driven())
>
> The DMI check will be performed for the remaining CPUs even after we come
> to know that the BIOS is driving pstates.
Yes, I did this on purpose, to keep powernow-k8 as clean as possible.
Find below a more elegant version (compile tested only)
-----
cpufreq, powernow-k8: Do not complain about missing tables when BIOS drives cpufreq

This is based on work from Nagananda.Chumbalkar@xxxxxxx
Only difference is to put the whitelist into a separate header file,
to keep powernow-k8.c clean.

Ideally HP should suggest a flag in the ACPI FADT table to the
ACPI commitee/specification which indicates that a machine's CPU frequency
is controllled by BIOS, so that the OS can easily detect this situation
and such whitelists (might also make sense for acpi-cpufreq at some time?)
need not to grow.

Signed-off-by: Thomas Renninger <trenn@xxxxxxx>
CC: Nagananda.Chumbalkar@xxxxxx
CC: davej@xxxxxxxxxx
CC: cpufreq@xxxxxxxxxxxxxxx

---
 arch/x86/kernel/cpu/cpufreq/bios_driven_whitelist.h |   68 ++++++++++++++++++++
 arch/x86/kernel/cpu/cpufreq/powernow-k8.c           |    9 ++
 2 files changed, 76 insertions(+), 1 deletion(-)

Index: cpufreq_next/arch/x86/kernel/cpu/cpufreq/bios_driven_whitelist.h
===================================================================
--- /dev/null
+++ cpufreq_next/arch/x86/kernel/cpu/cpufreq/bios_driven_whitelist.h
@@ -0,0 +1,68 @@
+#include <linux/dmi.h>
+
+/*
+ * Some BIOSes may not present P-state related ACPI information
+ * to the OS/driver on cpufreq capable machines on purpose.
+ * Do not throw a firmware bug exception for these.
+ */
+static int bios_with_pstate_cap = -1;
+
+static const struct dmi_system_id bios_cap_dmi_table[] = {
+	{
+		.ident = "HP ProLiant",
+		.matches = {
+			DMI_MATCH(DMI_SYS_VENDOR, "HP"),
+			DMI_MATCH(DMI_PRODUCT_NAME, "ProLiant DL365"),
+		},
+	},
+	{
+		.ident = "HP ProLiant",
+		.matches = {
+			DMI_MATCH(DMI_SYS_VENDOR, "HP"),
+			DMI_MATCH(DMI_PRODUCT_NAME, "ProLiant DL385"),
+		},
+	},
+	{
+		.ident = "HP ProLiant",
+		.matches = {
+			DMI_MATCH(DMI_SYS_VENDOR, "HP"),
+			DMI_MATCH(DMI_PRODUCT_NAME, "ProLiant BL465c"),
+		},
+	},
+	{
+		.ident = "HP ProLiant",
+		.matches = {
+			DMI_MATCH(DMI_SYS_VENDOR, "HP"),
+			DMI_MATCH(DMI_PRODUCT_NAME, "ProLiant BL495c"),
+		},
+	},
+	{
+		.ident = "HP ProLiant",
+		.matches = {
+			DMI_MATCH(DMI_SYS_VENDOR, "HP"),
+			DMI_MATCH(DMI_PRODUCT_NAME, "ProLiant DL585"),
+		},
+	},
+	{
+		.ident = "HP ProLiant",
+		.matches = {
+			DMI_MATCH(DMI_SYS_VENDOR, "HP"),
+			DMI_MATCH(DMI_PRODUCT_NAME, "ProLiant BL685c"),
+		},
+	},
+	{
+		.ident = "HP ProLiant",
+		.matches = {
+			DMI_MATCH(DMI_SYS_VENDOR, "HP"),
+			DMI_MATCH(DMI_PRODUCT_NAME, "ProLiant DL785"),
+		},
+	},
+	{ }
+};
+
+int dmi_check_amd_bios_driven(void)
+{
+	if (bios_with_pstate_cap == -1)
+		bios_with_pstate_cap = dmi_check_system(bios_cap_dmi_table);
+	return bios_with_pstate_cap;
+}
Index: cpufreq_next/arch/x86/kernel/cpu/cpufreq/powernow-k8.c
===================================================================
--- cpufreq_next.orig/arch/x86/kernel/cpu/cpufreq/powernow-k8.c
+++ cpufreq_next/arch/x86/kernel/cpu/cpufreq/powernow-k8.c
@@ -43,6 +43,8 @@
 #include <linux/mutex.h>
 #include <acpi/processor.h>
 
+#include "bios_driven_whitelist.h"
+
 #define PFX "powernow-k8: "
 #define VERSION "version 2.20.00"
 #include "powernow-k8.h"
@@ -1271,7 +1273,12 @@ static int __cpuinit powernowk8_cpu_init
 		 * an UP version, and is deprecated by AMD.
 		 */
 		if (num_online_cpus() != 1) {
-			printk_once(ACPI_PSS_BIOS_BUG_MSG);
+			if (dmi_check_amd_bios_driven())
+				printk_once(KERN_INFO PFX
+					    "BIOS has built-in pstate "
+					    "transitioning capability\n");
+			else
+				printk_once(ACPI_PSS_BIOS_BUG_MSG);
 			goto err_out;
 		}
 		if (pol->cpu != 0) {
--
To unsubscribe from this list: send the line "unsubscribe cpufreq" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Devel]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Forum]     [Linux SCSI]

  Powered by Linux