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

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

 



Hi and sorry for the late reply.

On Thursday 14 January 2010 06:29:33 pm Chumbalkar, Nagananda wrote:
> Comments?
I'd prefer to put this into an own header file.
This code should not bother anyone further.
What do you think about this:

------
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.
This would then also allow to detect whether the OS should do frequency
scaling (by BIOS option), but cannot identify the CPU and thus cannot export
the correct cpufreq tables.

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 |   79 ++++++++++++++++++++
 arch/x86/kernel/cpu/cpufreq/powernow-k8.c           |    9 ++
 2 files changed, 87 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,79 @@
+#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;
+
+static int bios_capability_found(const struct dmi_system_id *d)
+{
+	bios_with_pstate_cap = 1;
+	return 0;
+}
+
+static const struct dmi_system_id bios_cap_dmi_table[] = {
+	{
+		.callback = bios_capability_found,
+		.ident = "HP ProLiant",
+		.matches = {
+			DMI_MATCH(DMI_SYS_VENDOR, "HP"),
+			DMI_MATCH(DMI_PRODUCT_NAME, "ProLiant DL365"),
+		},
+	},
+	{
+		.callback = bios_capability_found,
+		.ident = "HP ProLiant",
+		.matches = {
+			DMI_MATCH(DMI_SYS_VENDOR, "HP"),
+			DMI_MATCH(DMI_PRODUCT_NAME, "ProLiant DL385"),
+		},
+	},
+	{
+		.callback = bios_capability_found,
+		.ident = "HP ProLiant",
+		.matches = {
+			DMI_MATCH(DMI_SYS_VENDOR, "HP"),
+			DMI_MATCH(DMI_PRODUCT_NAME, "ProLiant BL465c"),
+		},
+	},
+	{
+		.callback = bios_capability_found,
+		.ident = "HP ProLiant",
+		.matches = {
+			DMI_MATCH(DMI_SYS_VENDOR, "HP"),
+			DMI_MATCH(DMI_PRODUCT_NAME, "ProLiant BL495c"),
+		},
+	},
+	{
+		.callback = bios_capability_found,
+		.ident = "HP ProLiant",
+		.matches = {
+			DMI_MATCH(DMI_SYS_VENDOR, "HP"),
+			DMI_MATCH(DMI_PRODUCT_NAME, "ProLiant DL585"),
+		},
+	},
+	{
+		.callback = bios_capability_found,
+		.ident = "HP ProLiant",
+		.matches = {
+			DMI_MATCH(DMI_SYS_VENDOR, "HP"),
+			DMI_MATCH(DMI_PRODUCT_NAME, "ProLiant BL685c"),
+		},
+	},
+	{
+		.callback = bios_capability_found,
+		.ident = "HP ProLiant",
+		.matches = {
+			DMI_MATCH(DMI_SYS_VENDOR, "HP"),
+			DMI_MATCH(DMI_PRODUCT_NAME, "ProLiant DL785"),
+		},
+	},
+	{ }
+};
+
+int dmi_check_amd_bios_driven(void)
+{
+	return dmi_check_system(bios_cap_dmi_table);
+}
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