public inbox for linuxppc-dev@ozlabs.org 
 help / color / mirror / Atom feed
From: olof@lixom•net (Olof Johansson)
To: paulus@samba•org
Cc: linuxppc-dev@ozlabs•org
Subject: [PATCH v2] powerpc: Show current speed in /proc/cpuinfo
Date: Sun, 29 Apr 2007 22:53:39 -0500	[thread overview]
Message-ID: <20070430035339.GA15771@lixom.net> (raw)
In-Reply-To: <20070427084118.GA8842@lixom.net>

On other architectures, the frequency in /proc/cpuinfo moves with cpufreq
changes. It makes sense to do the same on powerpc to keep users from
getting confused.

Change the format to three decimals, having full Hz granularity is silly
these days. Also specify in output if it's cpufreq or firmware-reported:

clock           : 1250.000MHz (from firmware)
or:
clock           : 2500.000MHz (actual speed)


Signed-off-by: Olof Johansson <olof@lixom•net>


Index: powerpc/arch/powerpc/kernel/setup-common.c
===================================================================
--- powerpc.orig/arch/powerpc/kernel/setup-common.c
+++ powerpc/arch/powerpc/kernel/setup-common.c
@@ -29,6 +29,7 @@
 #include <linux/root_dev.h>
 #include <linux/notifier.h>
 #include <linux/cpu.h>
+#include <linux/cpufreq.h>
 #include <linux/unistd.h>
 #include <linux/serial.h>
 #include <linux/serial_8250.h>
@@ -160,6 +161,7 @@ static int show_cpuinfo(struct seq_file 
 	unsigned int pvr;
 	unsigned short maj;
 	unsigned short min;
+	unsigned int freq;
 
 	if (cpu_id == NR_CPUS) {
 #if defined(CONFIG_SMP) && defined(CONFIG_PPC32)
@@ -226,13 +228,16 @@ static int show_cpuinfo(struct seq_file 
 	}
 #endif /* CONFIG_TAU */
 
-	/*
-	 * Assume here that all clock rates are the same in a
-	 * smp system.  -- Cort
-	 */
-	if (ppc_proc_freq)
-		seq_printf(m, "clock\t\t: %lu.%06luMHz\n",
-			   ppc_proc_freq / 1000000, ppc_proc_freq % 1000000);
+	/* cpufreq_quick_get() is in kHz */
+	freq = cpufreq_quick_get(cpu_id);
+
+	if (freq)
+		seq_printf(m, "clock\t\t: %u.%03uMHz (actual speed)\n",
+			   freq / 1000, freq % 1000);
+	else if (ppc_proc_freq)
+		seq_printf(m, "clock\t\t: %lu.%03luMHz (from firmware)\n",
+			   ppc_proc_freq / 1000000,
+			   (ppc_proc_freq / 1000) % 1000);
 
 	if (ppc_md.show_percpuinfo != NULL)
 		ppc_md.show_percpuinfo(m, cpu_id);

  parent reply	other threads:[~2007-04-30  3:52 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-04-27  8:41 [PATCH] powerpc: Show current speed in /proc/cpuinfo Olof Johansson
2007-04-27  9:00 ` Matt Sealey
2007-04-27  9:25   ` Benjamin Herrenschmidt
2007-04-27 18:14   ` Olof Johansson
2007-04-27  9:24 ` Benjamin Herrenschmidt
2007-04-27 17:51   ` Olof Johansson
2007-04-30  3:53 ` Olof Johansson [this message]
2007-05-01 23:48   ` [PATCH v2] " Arnd Bergmann
2007-05-04  3:15     ` Olof Johansson
2007-05-04  3:16   ` [PATCH v3] " Olof Johansson
2007-05-04  3:39     ` Stephen Rothwell
2007-05-04  3:46       ` Olof Johansson
2007-05-04  4:00     ` Paul Mackerras
2007-05-04  4:39       ` [PATCH] pasemi: update ppc_proc_freq from cpufreq driver Olof Johansson

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=20070430035339.GA15771@lixom.net \
    --to=olof@lixom$(echo .)net \
    --cc=linuxppc-dev@ozlabs$(echo .)org \
    --cc=paulus@samba$(echo .)org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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