From 3d1093d637e06cc1f47464dd6f2687e0474c3b18 Mon Sep 17 00:00:00 2001 From: Ben Hutchings Date: Sat, 20 Mar 2010 18:16:01 +0000 Subject: [PATCH] eeepc-laptop: Disable CPU speed control on 701 and 702 since it can cause the system to hang (Closes: #559578) svn path=/dists/sid/linux-2.6/; revision=15428 --- debian/changelog | 2 + ...sable-cpu-speed-control-on-EeePC-701.patch | 175 ++++++++++++++++++ debian/patches/series/11 | 1 + 3 files changed, 178 insertions(+) create mode 100644 debian/patches/bugfix/x86/eeepc-laptop-disable-cpu-speed-control-on-EeePC-701.patch diff --git a/debian/changelog b/debian/changelog index c1df21f21..2c363a1b9 100644 --- a/debian/changelog +++ b/debian/changelog @@ -8,6 +8,8 @@ linux-2.6 (2.6.32-11) UNRELEASED; urgency=low * linux-base: Handle duplicates in /etc/udev/rules.d/70-persistent-cd.rules (Closes: #574630) * iwlwifi: Fix repeated warnings about tfds_in_queue (Closes: #574526) + * eeepc-laptop: Disable CPU speed control on 701 and 702 since it can + cause the system to hang (Closes: #559578) [ maximilian attems] * [alpha, hppa] Disable oprofile as tracing code is unsupported here. diff --git a/debian/patches/bugfix/x86/eeepc-laptop-disable-cpu-speed-control-on-EeePC-701.patch b/debian/patches/bugfix/x86/eeepc-laptop-disable-cpu-speed-control-on-EeePC-701.patch new file mode 100644 index 000000000..8de470754 --- /dev/null +++ b/debian/patches/bugfix/x86/eeepc-laptop-disable-cpu-speed-control-on-EeePC-701.patch @@ -0,0 +1,175 @@ +From: Alan Jenkins +Date: Wed, 6 Jan 2010 22:07:37 +0100 +Subject: [PATCH] eeepc-laptop: disable cpu speed control on EeePC 701 + +The EeePC 4G ("701") implements CFVS, but it is not supported by the +pre-installed OS, and the original option to change it in the BIOS +setup screen was removed in later versions. Judging by the lack of +"Super Hybrid Engine" on Asus product pages, this applies to all "701" +models (4G/4G Surf/2G Surf). + +So Asus made a deliberate decision not to support it on this model. +We have several reports that using it can cause the system to hang [1]. +That said, it does not happen all the time. Some users do not +experience it at all (and apparently wish to continue "right-clocking"). + +Check for the EeePC 701 using DMI. If met, then disable writes to the +"cpufv" sysfs attribute and log an explanatory message. + +Add a "cpufv_disabled" attribute which allow users to override this +policy. Writing to this attribute will log a second message. + +The sysfs attribute is more useful than a module option, because it +makes it easier for userspace scripts to provide consistent behaviour +(according to user configuration), regardless of whether the kernel +includes this change. + +[1] + +Signed-off-by: Alan Jenkins +Signed-off-by: Corentin Chary +Signed-off-by: Len Brown +[bwh: Backported to 2.6.32] + +--- a/drivers/platform/x86/eeepc-laptop.c ++++ b/drivers/platform/x86/eeepc-laptop.c +@@ -35,6 +35,7 @@ + #include + #include + #include ++#include + + #define EEEPC_LAPTOP_VERSION "0.1" + #define EEEPC_LAPTOP_NAME "Eee PC Hotkey Driver" +@@ -159,6 +160,7 @@ struct eeepc_laptop { + acpi_handle handle; /* the handle of the acpi device */ + u32 cm_supported; /* the control methods supported + by this BIOS */ ++ bool cpufv_disabled; + uint init_flag; /* Init flags */ + u16 event_count[128]; /* count for each event */ + +@@ -378,6 +380,8 @@ static ssize_t store_cpufv(struct device *dev, + struct eeepc_cpufv c; + int rv, value; + ++ if (ehotk->cpufv_disabled) ++ return -EPERM; + if (get_cpufv(&c)) + return -ENODEV; + rv = parse_arg(buf, count, &value); +@@ -389,6 +393,38 @@ static ssize_t store_cpufv(struct device *dev, + return rv; + } + ++static ssize_t show_cpufv_disabled(struct device *dev, ++ struct device_attribute *attr, ++ char *buf) ++{ ++ return sprintf(buf, "%d\n", ehotk->cpufv_disabled); ++} ++ ++static ssize_t store_cpufv_disabled(struct device *dev, ++ struct device_attribute *attr, ++ const char *buf, size_t count) ++{ ++ int rv, value; ++ ++ rv = parse_arg(buf, count, &value); ++ if (rv < 0) ++ return rv; ++ ++ switch (value) { ++ case 0: ++ if (ehotk->cpufv_disabled) ++ pr_warning("cpufv enabled (not officially supported " ++ "on this model)\n"); ++ ehotk->cpufv_disabled = false; ++ return rv; ++ case 1: ++ return -EPERM; ++ default: ++ return -EINVAL; ++ } ++} ++ ++ + static struct device_attribute dev_attr_cpufv = { + .attr = { + .name = "cpufv", +@@ -404,12 +443,22 @@ static struct device_attribute dev_attr_available_cpufv = { + .show = show_available_cpufv + }; + ++static struct device_attribute dev_attr_cpufv_disabled = { ++ .attr = { ++ .name = "cpufv_disabled", ++ .mode = 0644 }, ++ .show = show_cpufv_disabled, ++ .store = store_cpufv_disabled ++}; ++ ++ + static struct attribute *platform_attributes[] = { + &dev_attr_camera.attr, + &dev_attr_cardr.attr, + &dev_attr_disp.attr, + &dev_attr_cpufv.attr, + &dev_attr_available_cpufv.attr, ++ &dev_attr_cpufv_disabled.attr, + NULL + }; + +@@ -1261,6 +1310,42 @@ static void eeepc_acpi_notify(struct acpi_device *device, u32 event) + } + } + ++static void eeepc_dmi_check(void) ++{ ++ const char *model; ++ ++ /* ++ * Blacklist for setting cpufv (cpu speed). ++ * ++ * EeePC 4G ("701") implements CFVS, but it is not supported ++ * by the pre-installed OS, and the original option to change it ++ * in the BIOS setup screen was removed in later versions. ++ * ++ * Judging by the lack of "Super Hybrid Engine" on Asus product pages, ++ * this applies to all "701" models (4G/4G Surf/2G Surf). ++ * ++ * So Asus made a deliberate decision not to support it on this model. ++ * We have several reports that using it can cause the system to hang ++ * ++ * The hang has also been reported on a "702" (Model name "8G"?). ++ * ++ * We avoid dmi_check_system() / dmi_match(), because they use ++ * substring matching. We don't want to affect the "701SD" ++ * and "701SDX" models, because they do support S.H.E. ++ */ ++ ++ model = dmi_get_system_info(DMI_PRODUCT_NAME); ++ if (!model) ++ return; ++ ++ if (strcmp(model, "701") == 0 || strcmp(model, "702") == 0) { ++ ehotk->cpufv_disabled = true; ++ pr_info("model %s does not officially support setting cpu " ++ "speed\n", model); ++ pr_info("cpufv disabled to avoid instability\n"); ++ } ++} ++ + static void cmsg_quirk(int cm, const char *name) + { + int dummy; +@@ -1342,6 +1427,8 @@ static int __devinit eeepc_acpi_add(struct acpi_device *device) + device->driver_data = ehokt; + ehotk->device = device; + ++ eeepc_dmi_check(); ++ + result = eeepc_hotk_check(); + if (result) + goto fail_platform_driver; + diff --git a/debian/patches/series/11 b/debian/patches/series/11 index da74de6dd..4f039e364 100644 --- a/debian/patches/series/11 +++ b/debian/patches/series/11 @@ -1,3 +1,4 @@ + bugfix/all/tracing-do-not-disable-interrupts-for-trace_clock_lo.patch + bugfix/sparc/sparc-Provide-io-read-write-16-32-be.patch + bugfix/all/iwlwifi-fix-nfreed.patch ++ bugfix/x86/eeepc-laptop-disable-cpu-speed-control-on-EeePC-701.patch