@@ -30,6 +30,11 @@ extern struct mmu_psize_def mmu_psize_defs[MMU_PAGE_COUNT];
#ifndef __ASSEMBLY__
/*
+ * current MMU mode
+ */
+extern unsigned int current_mmu_mode;
+
+/*
* ISA 3.0 partiton and process table entry format
*/
struct prtb_entry {
@@ -2,6 +2,12 @@
#define _ASM_POWERPC_BOOK3S_64_PGTABLE_H_
/*
+ * Possible MMU modes
+ */
+#define HASH_MMU_MODE 0
+#define RADIX_MMU_MODE 1
+
+/*
* Common bits between hash and Radix page table
*/
#define _PAGE_BIT_SWAP_TYPE 0
@@ -77,6 +77,9 @@ void arch_crash_save_vmcoreinfo(void)
VMCOREINFO_SYMBOL(contig_page_data);
#endif
#if defined(CONFIG_PPC64) && defined(CONFIG_SPARSEMEM_VMEMMAP)
+#ifdef CONFIG_PPC_BOOK3S
+ VMCOREINFO_SYMBOL(current_mmu_mode);
+#endif
VMCOREINFO_SYMBOL(vmemmap_list);
VMCOREINFO_SYMBOL(mmu_vmemmap_psize);
VMCOREINFO_SYMBOL(mmu_psize_defs);
@@ -886,6 +886,8 @@ void __init hash__early_init_devtree(void)
void __init hash__early_init_mmu(void)
{
+ current_mmu_mode = HASH_MMU_MODE;
+
htab_init_page_sizes();
/*
@@ -298,6 +298,8 @@ void __init radix__early_init_mmu(void)
{
unsigned long lpcr;
+ current_mmu_mode = RADIX_MMU_MODE;
+
#ifdef CONFIG_PPC_64K_PAGES
/* PAGE_SIZE mappings */
mmu_virtual_psize = MMU_PAGE_64K;
@@ -63,6 +63,12 @@
#ifdef CONFIG_PPC_BOOK3S_64
/*
+ * current MMU mode
+ */
+unsigned int current_mmu_mode;
+EXPORT_SYMBOL(current_mmu_mode);
+
+/*
* partition table and process table for ISA 3.0
*/
struct prtb_entry *process_tb;
The kernel now supports both radix and hash MMU modes. Tools like crash and makedumpfile need to know, the current MMU mode the kernel is using to debug/analyze the kernel. The current MMU mode depends on H/W support and also whether disable_radix cmdline parameter is passed to the kernel. The mmu_features member of cpu_spec structure holds the current MMU mode a cpu is using. But the above mentioned tools need to know, the MMU mode early in their init process when they have no access to offset info of structure members. A hard-coded offset may help but it won't be robust. This patch introduces a new global variable, which holds the current MMU mode the kernel is running in and can be accessed by tools early in thier init process, helping tools to initialize accurately for each MMU mode. Signed-off-by: Hari Bathini <hbathini@linux.vnet.ibm.com> --- arch/powerpc/include/asm/book3s/64/mmu.h | 5 +++++ arch/powerpc/include/asm/book3s/64/pgtable.h | 6 ++++++ arch/powerpc/kernel/machine_kexec.c | 3 +++ arch/powerpc/mm/hash_utils_64.c | 2 ++ arch/powerpc/mm/pgtable-radix.c | 2 ++ arch/powerpc/mm/pgtable_64.c | 6 ++++++ 6 files changed, 24 insertions(+)