mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-23 07:01:23 +00:00
powerpc: powernv: Framework to show the correct clock in /proc/cpuinfo
Currently, the code in setup-common.c for powerpc assumes that all clock rates are same in a smp system. This value is cached in the variable named ppc_proc_freq and is the value that is reported in /proc/cpuinfo. However on the PowerNV platform, the clock rate is same only across the threads of the same core. Hence the value that is reported in /proc/cpuinfo is incorrect on PowerNV platforms. We need a better way to query and report the correct value of the processor clock in /proc/cpuinfo. The patch achieves this by creating a machdep_call named get_proc_freq() which is expected to returns the frequency in Hz. The code in show_cpuinfo() can invoke this method to display the correct clock rate on platforms that have implemented this method. On the other powerpc platforms it can use the value cached in ppc_proc_freq. Signed-off-by: Gautham R. Shenoy <ego@linux.vnet.ibm.com> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
This commit is contained in:
parent
2196c6f1ed
commit
2299d03a63
2 changed files with 14 additions and 4 deletions
|
@ -113,6 +113,8 @@ struct machdep_calls {
|
||||||
/* Optional, may be NULL. */
|
/* Optional, may be NULL. */
|
||||||
void (*show_cpuinfo)(struct seq_file *m);
|
void (*show_cpuinfo)(struct seq_file *m);
|
||||||
void (*show_percpuinfo)(struct seq_file *m, int i);
|
void (*show_percpuinfo)(struct seq_file *m, int i);
|
||||||
|
/* Returns the current operating frequency of "cpu" in Hz */
|
||||||
|
unsigned long (*get_proc_freq)(unsigned int cpu);
|
||||||
|
|
||||||
void (*init_IRQ)(void);
|
void (*init_IRQ)(void);
|
||||||
|
|
||||||
|
|
|
@ -212,6 +212,7 @@ static int show_cpuinfo(struct seq_file *m, void *v)
|
||||||
{
|
{
|
||||||
unsigned long cpu_id = (unsigned long)v - 1;
|
unsigned long cpu_id = (unsigned long)v - 1;
|
||||||
unsigned int pvr;
|
unsigned int pvr;
|
||||||
|
unsigned long proc_freq;
|
||||||
unsigned short maj;
|
unsigned short maj;
|
||||||
unsigned short min;
|
unsigned short min;
|
||||||
|
|
||||||
|
@ -263,12 +264,19 @@ static int show_cpuinfo(struct seq_file *m, void *v)
|
||||||
#endif /* CONFIG_TAU */
|
#endif /* CONFIG_TAU */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Assume here that all clock rates are the same in a
|
* Platforms that have variable clock rates, should implement
|
||||||
* smp system. -- Cort
|
* the method ppc_md.get_proc_freq() that reports the clock
|
||||||
|
* rate of a given cpu. The rest can use ppc_proc_freq to
|
||||||
|
* report the clock rate that is same across all cpus.
|
||||||
*/
|
*/
|
||||||
if (ppc_proc_freq)
|
if (ppc_md.get_proc_freq)
|
||||||
|
proc_freq = ppc_md.get_proc_freq(cpu_id);
|
||||||
|
else
|
||||||
|
proc_freq = ppc_proc_freq;
|
||||||
|
|
||||||
|
if (proc_freq)
|
||||||
seq_printf(m, "clock\t\t: %lu.%06luMHz\n",
|
seq_printf(m, "clock\t\t: %lu.%06luMHz\n",
|
||||||
ppc_proc_freq / 1000000, ppc_proc_freq % 1000000);
|
proc_freq / 1000000, proc_freq % 1000000);
|
||||||
|
|
||||||
if (ppc_md.show_percpuinfo != NULL)
|
if (ppc_md.show_percpuinfo != NULL)
|
||||||
ppc_md.show_percpuinfo(m, cpu_id);
|
ppc_md.show_percpuinfo(m, cpu_id);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue