aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorDave Jones <davej@redhat.com>2005-01-14 06:06:37 -0500
committerDave Jones <davej@redhat.com>2005-01-14 06:06:37 -0500
commit4e1e90fa3ac6a88102160a4b9b5a111fb3098e5a (patch)
tree4da652dbee9fc015653d3ca2b5728c9f29673da3 /arch
parenteba294f7aa7cfe6fc7f95d4679dd22771d45487e (diff)
downloadhistory-4e1e90fa3ac6a88102160a4b9b5a111fb3098e5a.tar.gz
[CPUFREQ] speedstep-centrino and acpi-cpufreq: P4 TSC rate is constant
From: "Pallipadi, Venkatesh" <venkatesh.pallipadi@intel.com> In P4, CPU tsc rate won't change with CPU frequency change while using Enhanced Speedstep Technology. Tested with both speedstep-centrino and acpi-cpufreq on both i386 and x86-64. Signed-off-by: Venkatesh Pallipadi <venkatesh.pallipadi@intel.com> Signed-off-by: Dominik Brodowski <linux@brodo.de> Signed-off-by: Dave Jones <davej@redhat.com>
Diffstat (limited to 'arch')
-rw-r--r--arch/i386/kernel/cpu/cpufreq/acpi-cpufreq.c7
-rw-r--r--arch/i386/kernel/cpu/cpufreq/speedstep-centrino.c8
-rw-r--r--arch/i386/kernel/cpu/cpufreq/speedstep-est-common.h25
3 files changed, 40 insertions, 0 deletions
diff --git a/arch/i386/kernel/cpu/cpufreq/acpi-cpufreq.c b/arch/i386/kernel/cpu/cpufreq/acpi-cpufreq.c
index 79607ef603798b..963e17aa205d60 100644
--- a/arch/i386/kernel/cpu/cpufreq/acpi-cpufreq.c
+++ b/arch/i386/kernel/cpu/cpufreq/acpi-cpufreq.c
@@ -38,6 +38,8 @@
#include <linux/acpi.h>
#include <acpi/processor.h>
+#include "speedstep-est-common.h"
+
#define dprintk(msg...) cpufreq_debug_printk(CPUFREQ_DEBUG_DRIVER, "acpi-cpufreq", msg)
MODULE_AUTHOR("Paul Diefenbaugh, Dominik Brodowski");
@@ -53,6 +55,7 @@ struct cpufreq_acpi_io {
static struct cpufreq_acpi_io *acpi_io_data[NR_CPUS];
+static struct cpufreq_driver acpi_cpufreq_driver;
static int
acpi_processor_write_port(
@@ -374,6 +377,10 @@ acpi_cpufreq_cpu_init (
if (result)
goto err_free;
+ if (is_const_loops_cpu(cpu)) {
+ acpi_cpufreq_driver.flags |= CPUFREQ_CONST_LOOPS;
+ }
+
/* capability check */
if (data->acpi_data.state_count <= 1) {
dprintk("No P-States\n");
diff --git a/arch/i386/kernel/cpu/cpufreq/speedstep-centrino.c b/arch/i386/kernel/cpu/cpufreq/speedstep-centrino.c
index 2877bbe70441e9..2dfa9b16ddb7da 100644
--- a/arch/i386/kernel/cpu/cpufreq/speedstep-centrino.c
+++ b/arch/i386/kernel/cpu/cpufreq/speedstep-centrino.c
@@ -34,6 +34,8 @@
#include <asm/processor.h>
#include <asm/cpufeature.h>
+#include "speedstep-est-common.h"
+
#define PFX "speedstep-centrino: "
#define MAINTAINER "Jeremy Fitzhardinge <jeremy@goop.org>"
@@ -76,6 +78,8 @@ static int centrino_verify_cpu_id(const struct cpuinfo_x86 *c, const struct cpu_
static struct cpu_model *centrino_model[NR_CPUS];
static const struct cpu_id *centrino_cpu[NR_CPUS];
+static struct cpufreq_driver centrino_driver;
+
#ifdef CONFIG_X86_SPEEDSTEP_CENTRINO_TABLE
/* Computes the correct form for IA32_PERF_CTL MSR for a particular
@@ -508,6 +512,10 @@ static int centrino_cpu_init(struct cpufreq_policy *policy)
if (i != N_IDS)
centrino_cpu[policy->cpu] = &cpu_ids[i];
+ if (is_const_loops_cpu(policy->cpu)) {
+ centrino_driver.flags |= CPUFREQ_CONST_LOOPS;
+ }
+
if (centrino_cpu_init_acpi(policy)) {
if (policy->cpu != 0)
return -ENODEV;
diff --git a/arch/i386/kernel/cpu/cpufreq/speedstep-est-common.h b/arch/i386/kernel/cpu/cpufreq/speedstep-est-common.h
new file mode 100644
index 00000000000000..5ce995c9d866c1
--- /dev/null
+++ b/arch/i386/kernel/cpu/cpufreq/speedstep-est-common.h
@@ -0,0 +1,25 @@
+/*
+ * Routines common for drivers handling Enhanced Speedstep Technology
+ * Copyright (C) 2004 Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>
+ *
+ * Licensed under the terms of the GNU GPL License version 2 -- see
+ * COPYING for details.
+ */
+
+static inline int is_const_loops_cpu(unsigned int cpu)
+{
+ struct cpuinfo_x86 *c = cpu_data + cpu;
+
+ if (c->x86_vendor != X86_VENDOR_INTEL || !cpu_has(c, X86_FEATURE_EST))
+ return 0;
+
+ /*
+ * on P-4s, the TSC runs with constant frequency independent of cpu freq
+ * when we use EST
+ */
+ if (c->x86 == 0xf)
+ return 1;
+
+ return 0;
+}
+