From: Dominik Brodowski Subject: Re: speedstep capability checks Date: Mon, 15 Mar 2004 15:15:17 +0100 Sender: cpufreq-bounces@www.linux.org.uk Message-ID: <20040315141517.GG8636@dominikbrodowski.de> References: <20040314152016.0B04B3F04@latitude.mynet.no-ip.org> Mime-Version: 1.0 Return-path: Content-Disposition: inline In-Reply-To: <20040314152016.0B04B3F04@latitude.mynet.no-ip.org> List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: cpufreq-bounces+glkc-cpufreq=gmane.org@www.linux.org.uk Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: aeriksson@fastmail.fm, davej@redhat.com, Arjan van de Ven Cc: cpufreq@www.linux.org.uk I like this patch -- I've modified it a bit so that it applies to 2.6.4 and also handles Arjan's strange 0x07 Tualatin. Please apply, Dave. Thanks, Dominik On Sun, Mar 14, 2004 at 04:20:15PM +0100, aeriksson@fastmail.fm wrote: > > Hi, > > I'm one of the few who has a laptop (Dell L400) which doesn't announce > its speedstep capability to the OS the way is should. I made this > patch which turns my workaround into a compile time config option > which, if enabled, need to be explicitly enabled with a module > parameter. That should be non-invasive enough to allow it to be > included (I think). > > Please have a look at the attached patch (against current cvs), and > indicate which improvements may be needed to allow it to be included. > > /Anders A few SpeedStep-capable systems don't perform according to specification: the CPUID and/or some MSRs don't tell us the CPU is SpeedStep capable even though it definitely is. Allow a relaxed checking for two of these issues (Anders' and Arjan's notebooks) by a module parameter only available if a config option is turned on. This is done to avoid the risk of doing invalid speedstep instructions on systems which do not support it, and which might even lead to (hardware) failure. Patch originally from Andres Aeriksson (?) aeriksson at fastmail (dot) fm diff -ruN linux-original/arch/i386/kernel/cpu/cpufreq/Kconfig linux/arch/i386/kernel/cpu/cpufreq/Kconfig --- linux-original/arch/i386/kernel/cpu/cpufreq/Kconfig 2004-03-15 13:44:04.186706640 +0100 +++ linux/arch/i386/kernel/cpu/cpufreq/Kconfig 2004-03-15 14:20:56.278417584 +0100 @@ -176,6 +176,16 @@ depends on (X86_SPEEDSTEP_ICH || X86_SPEEDSTEP_SMI || X86_P4_CLOCKMOD) default (X86_SPEEDSTEP_ICH || X86_SPEEDSTEP_SMI || X86_P4_CLOCKMOD) +config X86_SPEEDSTEP_RELAXED_CAP_CHECK + bool "Relaxed speedstep capability checks" + depends on (X86_SPEEDSTEP_SMI || X86_SPEEDSTEP_ICH) + help + Don't perform all checks for a speedstep capable system which would + normally be done. Some ancient or strange systems, though speedstep + capable, don't always indicate that they are speedstep capable. This + option let's the probing code bypass some of those checks if the + parameter "relaxed_check=1" is passed to the module. + config X86_LONGRUN tristate "Transmeta LongRun" depends on CPU_FREQ diff -ruN linux-original/arch/i386/kernel/cpu/cpufreq/speedstep-lib.c linux/arch/i386/kernel/cpu/cpufreq/speedstep-lib.c --- linux-original/arch/i386/kernel/cpu/cpufreq/speedstep-lib.c 2004-03-15 09:20:50.000000000 +0100 +++ linux/arch/i386/kernel/cpu/cpufreq/speedstep-lib.c 2004-03-15 14:15:46.835460064 +0100 @@ -10,6 +10,7 @@ #include #include +#include #include #include #include @@ -30,6 +31,12 @@ #define dprintk(msg...) do { } while(0) #endif +#ifdef CONFIG_X86_SPEEDSTEP_RELAXED_CAP_CHECK +static int relaxed_check = 0; +#else +#define relaxed_check 0 +#endif + /********************************************************************* * GET PROCESSOR CORE SPEED IN KHZ * *********************************************************************/ @@ -265,6 +272,12 @@ ebx = cpuid_ebx(0x00000001); ebx &= 0x000000FF; + + /* Arjan reported a strange mobile PIII-M where ebx is + 0x07 */ + if ((ebx == 0x07) && relaxed_check) + return SPEEDSTEP_PROCESSOR_PIII_T; + if (ebx != 0x06) return 0; @@ -292,7 +305,7 @@ */ rdmsr(MSR_IA32_PLATFORM_ID, msr_lo, msr_hi); dprintk(KERN_DEBUG "cpufreq: Coppermine: MSR_IA32_PLATFORM ID is 0x%x, 0x%x\n", msr_lo, msr_hi); - if ((msr_hi & (1<<18)) && (msr_hi & (3<<24))) { + if ((msr_hi & (1<<18)) && (relaxed_check ? 1 : (msr_hi & (3<<24)))) { if (c->x86_mask == 0x01) return SPEEDSTEP_PROCESSOR_PIII_C_EARLY; else @@ -362,6 +375,11 @@ } EXPORT_SYMBOL_GPL(speedstep_get_freqs); +#ifdef CONFIG_X86_SPEEDSTEP_RELAXED_CAP_CHECK +module_param(relaxed_check, int, 0444); +MODULE_PARM_DESC(relaxed_check, "Don't do all checks for speedstep capability."); +#endif + MODULE_AUTHOR ("Dominik Brodowski "); MODULE_DESCRIPTION ("Library for Intel SpeedStep 1 or 2 cpufreq drivers."); MODULE_LICENSE ("GPL");