[prev in list] [next in list] [prev in thread] [next in thread] 

List:       git-commits-head
Subject:    MIPS: print MAAR configuration during boot
From:       "Linux Kernel Mailing List" <linux-kernel () vger ! kernel ! org>
Date:       2015-09-27 22:24:16
Message-ID: 20150927222416.D4CCB661113 () gitolite ! kernel ! org
[Download RAW message or body]

Web:        https://git.kernel.org/torvalds/c/651ca7f4dab77f07fdac9cfb68bcab6bd2b7f827
Commit:     651ca7f4dab77f07fdac9cfb68bcab6bd2b7f827
Parent:     def3ab5d0a0fe53026c2495b054dcc46cf923dac
Refname:    refs/heads/master
Author:     Paul Burton <paul.burton@imgtec.com>
AuthorDate: Fri Sep 25 08:59:37 2015 -0700
Committer:  Ralf Baechle <ralf@linux-mips.org>
CommitDate: Sun Sep 27 14:14:47 2015 +0200

    MIPS: print MAAR configuration during boot
    
    Verifying that the MAAR configuration is as expected is useful when
    debugging the performance of a system. Print out the memory regions
    configured via MAAR along with their attributes.
    
    Signed-off-by: Paul Burton <paul.burton@imgtec.com>
    Cc: linux-mips@linux-mips.org
    Cc: Steven J. Hill <Steven.Hill@imgtec.com>
    Cc: David Hildenbrand <dahi@linux.vnet.ibm.com>
    Cc: linux-kernel@vger.kernel.org
    Cc: Peter Zijlstra (Intel) <peterz@infradead.org>
    Patchwork: https://patchwork.linux-mips.org/patch/11238/
    Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
---
 arch/mips/mm/init.c | 29 +++++++++++++++++++++++++++++
 1 file changed, 29 insertions(+)

diff --git a/arch/mips/mm/init.c b/arch/mips/mm/init.c
index 074ac54..023c164 100644
--- a/arch/mips/mm/init.c
+++ b/arch/mips/mm/init.c
@@ -291,6 +291,7 @@ unsigned __weak platform_maar_init(unsigned num_pairs)
 static void maar_init(void)
 {
 	unsigned num_maars, used, i;
+	phys_addr_t lower, upper, attr;
 
 	if (!cpu_has_maar)
 		return;
@@ -313,6 +314,34 @@ static void maar_init(void)
 		write_c0_maar(0);
 		back_to_back_c0_hazard();
 	}
+
+	pr_info("MAAR configuration:\n");
+	for (i = 0; i < num_maars; i += 2) {
+		write_c0_maari(i);
+		back_to_back_c0_hazard();
+		upper = read_c0_maar();
+
+		write_c0_maari(i + 1);
+		back_to_back_c0_hazard();
+		lower = read_c0_maar();
+
+		attr = lower & upper;
+		lower = (lower & MIPS_MAAR_ADDR) << 4;
+		upper = ((upper & MIPS_MAAR_ADDR) << 4) | 0xffff;
+
+		pr_info("  [%d]: ", i / 2);
+		if (!(attr & MIPS_MAAR_V)) {
+			pr_cont("disabled\n");
+			continue;
+		}
+
+		pr_cont("%pa-%pa", &lower, &upper);
+
+		if (attr & MIPS_MAAR_S)
+			pr_cont(" speculate");
+
+		pr_cont("\n");
+	}
 }
 
 #ifndef CONFIG_NEED_MULTIPLE_NODES
--
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic