All of lore.kernel.org
 help / color / mirror / Atom feed
From: Peter Watkins <treestem@gmail.com>
To: linux-mips@linux-mips.org, Ralf Baechle <ralf@linux-mips.org>
Subject: [PATCH] Add cache info to /proc/cpuinfo
Date: Thu, 14 Sep 2006 11:51:37 -0400	[thread overview]
Message-ID: <45097A89.4060303@gmail.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 701 bytes --]

This patch shows you more details about the cache using /proc/cpuinfo.
It also shows the TLB page size.

For example:

system type             : MIPS Malta
processor               : 0
cpu model               : MIPS 20Kc V2.0  FPU V2.0
BogoMIPS                : 478.20
wait instruction        : no
microsecond timers      : yes
tlb_entries             : 48 64K pages
icache size             : 32K sets 256 ways 4 linesize 32
dcache size             : 32K sets 256 ways 4 linesize 32
default cache policy    : cached write-back
extra interrupt vector  : yes
hardware watchpoint     : yes
ASEs implemented        : mips3d
VCED exceptions         : not available
VCEI exceptions         : not available



[-- Attachment #2: 0001-Add-cache-info-to-cpuinfo-display.txt --]
[-- Type: text/plain, Size: 2460 bytes --]

Date: Thu, 14 Sep 2006 11:24:51 -0400
Subject: [PATCH] Add cache info to cpuinfo display.
---
 arch/mips/kernel/proc.c |   34 +++++++++++++++++++++++++++++++++-
 1 files changed, 33 insertions(+), 1 deletions(-)

diff --git a/arch/mips/kernel/proc.c b/arch/mips/kernel/proc.c
index d8beef1..54f4da3 100644
--- a/arch/mips/kernel/proc.c
+++ b/arch/mips/kernel/proc.c
@@ -92,6 +92,7 @@ static int show_cpuinfo(struct seq_file 
 	unsigned int version = current_cpu_data.processor_id;
 	unsigned int fp_vers = current_cpu_data.fpu_id;
 	unsigned long n = (unsigned long) v - 1;
+	unsigned long cache_size;
 	char fmt [64];
 
 #ifdef CONFIG_SMP
@@ -118,7 +119,38 @@ #endif
 	seq_printf(m, "wait instruction\t: %s\n", cpu_wait ? "yes" : "no");
 	seq_printf(m, "microsecond timers\t: %s\n",
 	              cpu_has_counter ? "yes" : "no");
-	seq_printf(m, "tlb_entries\t\t: %d\n", current_cpu_data.tlbsize);
+	seq_printf(m, "tlb_entries\t\t: %d %luK pages\n", current_cpu_data.tlbsize,
+			PAGE_SIZE/1024);
+	cache_size = current_cpu_data.icache.sets * 
+		     current_cpu_data.icache.ways *
+		     current_cpu_data.icache.linesz;
+	if (cache_size) {
+	    seq_printf(m, "icache size\t\t: %luK sets %d ways %d linesize %d\n",
+	              cache_size/1024, current_cpu_data.icache.sets,
+		      current_cpu_data.icache.ways, current_cpu_data.icache.linesz);
+	}
+	cache_size = current_cpu_data.dcache.sets * 
+		     current_cpu_data.dcache.ways *
+		     current_cpu_data.dcache.linesz;
+	if (cache_size) {
+	    seq_printf(m, "dcache size\t\t: %luK sets %d ways %d linesize %d\n",
+	              cache_size/1024, current_cpu_data.dcache.sets,
+		      current_cpu_data.dcache.ways, current_cpu_data.dcache.linesz);
+	}
+	cache_size = current_cpu_data.scache.sets * 
+		     current_cpu_data.scache.ways *
+		     current_cpu_data.scache.linesz;
+	if (cache_size) {
+	    seq_printf(m, "scache size\t\t: %luK sets %d ways %d linesize %d\n",
+	              cache_size/1024, current_cpu_data.scache.sets,
+		      current_cpu_data.scache.ways, current_cpu_data.scache.linesz);
+	}
+	/* In pgtable-bits.h we never use a write-through policy */
+#ifdef CONFIG_MIPS_UNCACHED
+	seq_printf(m, "default cache policy\t: uncached\n");
+#else
+	seq_printf(m, "default cache policy\t: cached write-back\n");
+#endif
 	seq_printf(m, "extra interrupt vector\t: %s\n",
 	              cpu_has_divec ? "yes" : "no");
 	seq_printf(m, "hardware watchpoint\t: %s\n",
-- 
1.4.1


             reply	other threads:[~2006-09-14 15:51 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-09-14 15:51 Peter Watkins [this message]
2006-09-15 14:10 ` [PATCH] Add cache info to /proc/cpuinfo Atsushi Nemoto

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=45097A89.4060303@gmail.com \
    --to=treestem@gmail.com \
    --cc=linux-mips@linux-mips.org \
    --cc=ralf@linux-mips.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.