cpufreq Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>
To: davej@redhat.com
Cc: linux@dominikbrodowski.de, cpufreq@www.linux.org.uk
Subject: [PATCH] Set CONST_LOOPS flag for P4 with Enhanced Speedstep Technology
Date: Thu, 30 Dec 2004 15:11:15 -0800	[thread overview]
Message-ID: <20041230151115.A30475@unix-os.sc.intel.com> (raw)


[CPUFREQ] speedstep-centrino and acpi-cpufreq

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>

--- linux-2.6.10/arch/i386/kernel/cpu/cpufreq/acpi-cpufreq.c.org	2004-12-30 13:56:29.000000000 -0800
+++ linux-2.6.10/arch/i386/kernel/cpu/cpufreq/acpi-cpufreq.c	2004-12-30 14:02:03.000000000 -0800
@@ -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");
@@ -52,6 +54,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(
@@ -368,6 +371,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");
--- linux-2.6.10/arch/i386/kernel/cpu/cpufreq/speedstep-centrino.c.org	2004-12-30 13:42:14.000000000 -0800
+++ linux-2.6.10/arch/i386/kernel/cpu/cpufreq/speedstep-centrino.c	2004-12-30 14:03:44.000000000 -0800
@@ -32,6 +32,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>"
 
@@ -74,6 +76,8 @@ static int centrino_verify_cpu_id(const 
 static struct cpu_model *centrino_model;
 static const struct cpu_id *centrino_cpu;
 
+static struct cpufreq_driver centrino_driver;
+
 #ifdef CONFIG_X86_SPEEDSTEP_CENTRINO_TABLE
 
 /* Computes the correct form for IA32_PERF_CTL MSR for a particular
@@ -475,6 +479,10 @@ static int centrino_cpu_init(struct cpuf
 	if (i != N_IDS)
 		centrino_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;
--- linux-2.6.10/arch/i386/kernel/cpu/cpufreq/speedstep-est-common.h.org	2004-12-30 13:56:07.000000000 -0800
+++ linux-2.6.10/arch/i386/kernel/cpu/cpufreq/speedstep-est-common.h	2004-12-30 17:22:52.000000000 -0800
@@ -0,0 +1,40 @@
+/*
+ * Routines common for drivers handling Enhanced Speedstep Technology
+ *  Copyright (C) 2004 Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>
+ *
+ * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or (at
+ *  your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful, but
+ *  WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *  General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License along
+ *  with this program; if not, write to the Free Software Foundation, Inc.,
+ *  59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
+ *
+ * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ */
+
+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;
+}
+

                 reply	other threads:[~2004-12-30 23:11 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20041230151115.A30475@unix-os.sc.intel.com \
    --to=venkatesh.pallipadi@intel.com \
    --cc=cpufreq@www.linux.org.uk \
    --cc=davej@redhat.com \
    --cc=linux@dominikbrodowski.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox