powerpc/mm: Add support for SPARSEMEM_VMEMMAP on 64-bit Book3E
PATCH 19/20 powerpc/mm: Add support for SPARSEMEM_VMEMMAP on 64-bit Book3E
The base TLB support didn't include support for SPARSEMEM_VMEMMAP, though we did carve out some virtual space for it, the necessary support code wasn't there. This implements it by using 16M pages for now, though the page size could easily be changed at runtime if necessary.
Signed-off-by Benjamin Herrenschmidt <[email protected]>
---
arch/powerpc/include/asm/mmu-book3e.h | 1 arch/powerpc/include/asm/pgtable-ppc64.h | 3 + arch/powerpc/mm/init_64.c | 55 +++++++++++++++++++++++++++---- arch/powerpc/mm/mmu_decl.h | 7 +++ arch/powerpc/mm/pgtable_64.c | 2 - arch/powerpc/mm/tlb_nohash.c | 11 +++++- 6 files changed, 68 insertions(+), 11 deletions(-)
arch/powerpc/include/asm/mmu-book3e.h +1 -0
@@ -219,6 +219,7 @@ extern struct mmu_psize_def mmu_psize_de#endif extern int mmu_linear_psize; +extern int mmu_vmemmap_psize;#endif /* !__ASSEMBLY__ */
arch/powerpc/include/asm/pgtable-ppc64.h +2 -1
@@ -46,6 +46,7 @@/* * The vmalloc space starts at the beginning of that region, and * occupies half of it on hash CPUs and a quarter of it on Book3E +* (we keep a quarter for the virtual memmap) */ #define VMALLOC_START KERN_VIRT_START#ifdef CONFIG_PPC_BOOK3E
@@ -83,7 +84,7 @@#define VMALLOC_REGION_ID (REGION_ID(VMALLOC_START))#define KERNEL_REGION_ID (REGION_ID(PAGE_OFFSET)) -#define VMEMMAP_REGION_ID (0xfUL) +#define VMEMMAP_REGION_ID (0xfUL)/* Server only */ #define USER_REGION_ID (0UL)/*
arch/powerpc/mm/init_64.c +48 -7
75 lines not on this page · raw message
arch/powerpc/mm/tlb_nohash.c +10 -1
@@ -77,6 +77,7 @@ struct mmu_psize_def mmu_psize_defs[MMU_int mmu_linear_psize;/* Page size used for the linear mapping */ int mmu_pte_psize;/* Page size used for PTE pages */ +int mmu_vmemmap_psize;/* Page size used for the virtual mem map */ int book3e_htw_enabled;/* Is HW tablewalk enabled ? */ unsigned long linear_map_top;/* Top of linear mapping */
@@ -333,10 +334,18 @@ static void __early_init_mmu(int boot_cpunsigned int mas4;/* XXX This will have to be decided at runtime, but right -* now our boot and TLB miss code hard wires it +* now our boot and TLB miss code hard wires it. Ideally +* we should find out a suitable page size and patch the +* TLB miss code (either that or use the PACA to store +* the value we want) */ mmu_linear_psize =MMU_PAGE_1G ; +/* XXX This should be decided at runtime based on supported +* page sizes in the TLB, but for now let's assume 16M is +* always there and a good fit (which it probably is) +*/ + mmu_vmemmap_psize =MMU_PAGE_16M ;/* Check if HW tablewalk is present, and if yes, enable it by: *
arch/powerpc/mm/mmu_decl.h +6 -1
@@ -117,7 +117,12 @@ extern unsigned int rtas_data, rtas_sizestruct hash_pte ;extern struct hash_pte *Hash, *Hash_end;extern unsigned long Hash_size, Hash_mask; -#endif + +#endif /* CONFIG_PPC32 */ + +#ifdef CONFIG_PPC64 +extern int map_kernel_page (unsigned long ea,unsigned long pa,int flags); +#endif /* CONFIG_PPC64 */ extern unsigned long ioremap_bot;extern unsigned long __max_low_memory;
arch/powerpc/mm/pgtable_64.c +1 -1
@@ -79,7 +79,7 @@ static void *early_alloc_pgtable(unsigne* map_kernel_page adds an entry to the ioremap page table * and adds an entry to the HPT, possibly bolting it */ -static int map_kernel_page (unsigned long ea,unsigned long pa,int flags) +int map_kernel_page (unsigned long ea,unsigned long pa,int flags) {pgd_t *pgdp;pud_t *pudp;