diff options
author | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2010-07-09 01:34:50 -0400 |
---|---|---|
committer | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2010-07-14 00:13:52 -0400 |
commit | 03247157f73912c98baa918cf46b98ee5483d7f8 (patch) | |
tree | 9ef0f92b29c866c9581911f5329f743390bef286 /arch/powerpc/xmon | |
parent | ff82c319e6327b12cd94c5c57754abff243ab3e4 (diff) |
powerpc/book3e: Add TLB dump in xmon for Book3E
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Diffstat (limited to 'arch/powerpc/xmon')
-rw-r--r-- | arch/powerpc/xmon/xmon.c | 152 |
1 files changed, 152 insertions, 0 deletions
diff --git a/arch/powerpc/xmon/xmon.c b/arch/powerpc/xmon/xmon.c index 8bad7d5f32af..0554445200bf 100644 --- a/arch/powerpc/xmon/xmon.c +++ b/arch/powerpc/xmon/xmon.c | |||
@@ -155,6 +155,9 @@ static int do_spu_cmd(void); | |||
155 | #ifdef CONFIG_44x | 155 | #ifdef CONFIG_44x |
156 | static void dump_tlb_44x(void); | 156 | static void dump_tlb_44x(void); |
157 | #endif | 157 | #endif |
158 | #ifdef CONFIG_PPC_BOOK3E | ||
159 | static void dump_tlb_book3e(void); | ||
160 | #endif | ||
158 | 161 | ||
159 | static int xmon_no_auto_backtrace; | 162 | static int xmon_no_auto_backtrace; |
160 | 163 | ||
@@ -888,6 +891,11 @@ cmds(struct pt_regs *excp) | |||
888 | dump_tlb_44x(); | 891 | dump_tlb_44x(); |
889 | break; | 892 | break; |
890 | #endif | 893 | #endif |
894 | #ifdef CONFIG_PPC_BOOK3E | ||
895 | case 'u': | ||
896 | dump_tlb_book3e(); | ||
897 | break; | ||
898 | #endif | ||
891 | default: | 899 | default: |
892 | printf("Unrecognized command: "); | 900 | printf("Unrecognized command: "); |
893 | do { | 901 | do { |
@@ -2701,6 +2709,150 @@ static void dump_tlb_44x(void) | |||
2701 | } | 2709 | } |
2702 | #endif /* CONFIG_44x */ | 2710 | #endif /* CONFIG_44x */ |
2703 | 2711 | ||
2712 | #ifdef CONFIG_PPC_BOOK3E | ||
2713 | static void dump_tlb_book3e(void) | ||
2714 | { | ||
2715 | u32 mmucfg, pidmask, lpidmask; | ||
2716 | u64 ramask; | ||
2717 | int i, tlb, ntlbs, pidsz, lpidsz, rasz, lrat = 0; | ||
2718 | int mmu_version; | ||
2719 | static const char *pgsz_names[] = { | ||
2720 | " 1K", | ||
2721 | " 2K", | ||
2722 | " 4K", | ||
2723 | " 8K", | ||
2724 | " 16K", | ||
2725 | " 32K", | ||
2726 | " 64K", | ||
2727 | "128K", | ||
2728 | "256K", | ||
2729 | "512K", | ||
2730 | " 1M", | ||
2731 | " 2M", | ||
2732 | " 4M", | ||
2733 | " 8M", | ||
2734 | " 16M", | ||
2735 | " 32M", | ||
2736 | " 64M", | ||
2737 | "128M", | ||
2738 | "256M", | ||
2739 | "512M", | ||
2740 | " 1G", | ||
2741 | " 2G", | ||
2742 | " 4G", | ||
2743 | " 8G", | ||
2744 | " 16G", | ||
2745 | " 32G", | ||
2746 | " 64G", | ||
2747 | "128G", | ||
2748 | "256G", | ||
2749 | "512G", | ||
2750 | " 1T", | ||
2751 | " 2T", | ||
2752 | }; | ||
2753 | |||
2754 | /* Gather some infos about the MMU */ | ||
2755 | mmucfg = mfspr(SPRN_MMUCFG); | ||
2756 | mmu_version = (mmucfg & 3) + 1; | ||
2757 | ntlbs = ((mmucfg >> 2) & 3) + 1; | ||
2758 | pidsz = ((mmucfg >> 6) & 0x1f) + 1; | ||
2759 | lpidsz = (mmucfg >> 24) & 0xf; | ||
2760 | rasz = (mmucfg >> 16) & 0x7f; | ||
2761 | if ((mmu_version > 1) && (mmucfg & 0x10000)) | ||
2762 | lrat = 1; | ||
2763 | printf("Book3E MMU MAV=%d.0,%d TLBs,%d-bit PID,%d-bit LPID,%d-bit RA\n", | ||
2764 | mmu_version, ntlbs, pidsz, lpidsz, rasz); | ||
2765 | pidmask = (1ul << pidsz) - 1; | ||
2766 | lpidmask = (1ul << lpidsz) - 1; | ||
2767 | ramask = (1ull << rasz) - 1; | ||
2768 | |||
2769 | for (tlb = 0; tlb < ntlbs; tlb++) { | ||
2770 | u32 tlbcfg; | ||
2771 | int nent, assoc, new_cc = 1; | ||
2772 | printf("TLB %d:\n------\n", tlb); | ||
2773 | switch(tlb) { | ||
2774 | case 0: | ||
2775 | tlbcfg = mfspr(SPRN_TLB0CFG); | ||
2776 | break; | ||
2777 | case 1: | ||
2778 | tlbcfg = mfspr(SPRN_TLB1CFG); | ||
2779 | break; | ||
2780 | case 2: | ||
2781 | tlbcfg = mfspr(SPRN_TLB2CFG); | ||
2782 | break; | ||
2783 | case 3: | ||
2784 | tlbcfg = mfspr(SPRN_TLB3CFG); | ||
2785 | break; | ||
2786 | default: | ||
2787 | printf("Unsupported TLB number !\n"); | ||
2788 | continue; | ||
2789 | } | ||
2790 | nent = tlbcfg & 0xfff; | ||
2791 | assoc = (tlbcfg >> 24) & 0xff; | ||
2792 | for (i = 0; i < nent; i++) { | ||
2793 | u32 mas0 = MAS0_TLBSEL(tlb); | ||
2794 | u32 mas1 = MAS1_TSIZE(BOOK3E_PAGESZ_4K); | ||
2795 | u64 mas2 = 0; | ||
2796 | u64 mas7_mas3; | ||
2797 | int esel = i, cc = i; | ||
2798 | |||
2799 | if (assoc != 0) { | ||
2800 | cc = i / assoc; | ||
2801 | esel = i % assoc; | ||
2802 | mas2 = cc * 0x1000; | ||
2803 | } | ||
2804 | |||
2805 | mas0 |= MAS0_ESEL(esel); | ||
2806 | mtspr(SPRN_MAS0, mas0); | ||
2807 | mtspr(SPRN_MAS1, mas1); | ||
2808 | mtspr(SPRN_MAS2, mas2); | ||
2809 | asm volatile("tlbre 0,0,0" : : : "memory"); | ||
2810 | mas1 = mfspr(SPRN_MAS1); | ||
2811 | mas2 = mfspr(SPRN_MAS2); | ||
2812 | mas7_mas3 = mfspr(SPRN_MAS7_MAS3); | ||
2813 | if (assoc && (i % assoc) == 0) | ||
2814 | new_cc = 1; | ||
2815 | if (!(mas1 & MAS1_VALID)) | ||
2816 | continue; | ||
2817 | if (assoc == 0) | ||
2818 | printf("%04x- ", i); | ||
2819 | else if (new_cc) | ||
2820 | printf("%04x-%c", cc, 'A' + esel); | ||
2821 | else | ||
2822 | printf(" |%c", 'A' + esel); | ||
2823 | new_cc = 0; | ||
2824 | printf(" %016llx %04x %s %c%c AS%c", | ||
2825 | mas2 & ~0x3ffull, | ||
2826 | (mas1 >> 16) & 0x3fff, | ||
2827 | pgsz_names[(mas1 >> 7) & 0x1f], | ||
2828 | mas1 & MAS1_IND ? 'I' : ' ', | ||
2829 | mas1 & MAS1_IPROT ? 'P' : ' ', | ||
2830 | mas1 & MAS1_TS ? '1' : '0'); | ||
2831 | printf(" %c%c%c%c%c%c%c", | ||
2832 | mas2 & MAS2_X0 ? 'a' : ' ', | ||
2833 | mas2 & MAS2_X1 ? 'v' : ' ', | ||
2834 | mas2 & MAS2_W ? 'w' : ' ', | ||
2835 | mas2 & MAS2_I ? 'i' : ' ', | ||
2836 | mas2 & MAS2_M ? 'm' : ' ', | ||
2837 | mas2 & MAS2_G ? 'g' : ' ', | ||
2838 | mas2 & MAS2_E ? 'e' : ' '); | ||
2839 | printf(" %016llx", mas7_mas3 & ramask & ~0x7ffull); | ||
2840 | if (mas1 & MAS1_IND) | ||
2841 | printf(" %s\n", | ||
2842 | pgsz_names[(mas7_mas3 >> 1) & 0x1f]); | ||
2843 | else | ||
2844 | printf(" U%c%c%c S%c%c%c\n", | ||
2845 | mas7_mas3 & MAS3_UX ? 'x' : ' ', | ||
2846 | mas7_mas3 & MAS3_UW ? 'w' : ' ', | ||
2847 | mas7_mas3 & MAS3_UR ? 'r' : ' ', | ||
2848 | mas7_mas3 & MAS3_SX ? 'x' : ' ', | ||
2849 | mas7_mas3 & MAS3_SW ? 'w' : ' ', | ||
2850 | mas7_mas3 & MAS3_SR ? 'r' : ' '); | ||
2851 | } | ||
2852 | } | ||
2853 | } | ||
2854 | #endif /* CONFIG_PPC_BOOK3E */ | ||
2855 | |||
2704 | static void xmon_init(int enable) | 2856 | static void xmon_init(int enable) |
2705 | { | 2857 | { |
2706 | #ifdef CONFIG_PPC_ISERIES | 2858 | #ifdef CONFIG_PPC_ISERIES |