sparc64 four level page table support
PATCH 3/4 sparc64 four level page table support
From: bob picco <[email protected]>
This patch adds the code required for the remaining parts of the four page table scheme. We allow enable utilization of this code in a subsequent patch.
Signed-off-by Bob Picco <[email protected]>
--- arch/sparc/include/asm/page_64_lvl4.h | 21 ++++ arch/sparc/include/asm/pgalloc_64.h | 16 +++ arch/sparc/include/asm/pgtable_64.h | 2 +- arch/sparc/include/asm/pgtable_64_lvl4.h | 191 ++++++++++++++++++++++++++++++ arch/sparc/include/asm/tsb.h | 55 +++++++++ arch/sparc/kernel/smp_64.c | 7 ++ arch/sparc/mm/init_64.c | 25 +++- 7 files changed, 315 insertions(+), 2 deletions(-)
arch/sparc/include/asm/page_64_lvl4.h new file +21 -0
@@ -0,0 +1,21 @@ +#ifndef _SPARC64_PAGE_LVL4_H +#define _SPARC64_PAGE_LVL4_H + +#ifdef STRICT_MM_TYPECHECKS +/* These are used to make use of C type-checking.. */ +typedef struct {unsigned long pmd; }pmd_t ; +typedef struct {unsigned long pud; }pud_t ; +typedef struct {unsigned long pgd; }pgd_t ; + +#define __pud (x) ((pud_t) { (x) } ) + +#else +typedef unsigned long pmd_t ; +typedef unsigned long pud_t ; +typedef unsigned long pgd_t ; + +#define __pud (x) (x) + +#endif /* (STRICT_MM_TYPECHECKS) */ + +#endif /* !_SPARC64_PAGE_LVL4_H */
arch/sparc/include/asm/pgalloc_64.h +16 -0
@@ -27,6 +27,18 @@ static inline void pgd_free(struct mm_struct *mm, pgd_t *pgd)#define pud_populate (MM ,PUD ,PMD ) pud_set(PUD, PMD) +#ifdef CONFIG_SPARC_PGTABLE_LEVEL4 +static inline pud_t *pud_alloc_one (struct mm_struct *mm,unsigned long addr) +{ +return kmem_cache_alloc (pgtable_cache,GFP_KERNEL |__GFP_REPEAT); +} + +static inline void pud_free (struct mm_struct *mm,pud_t *pud) +{ +kmem_cache_free (pgtable_cache, pud); +} +#endif +static inline pmd_t *pmd_alloc_one (struct mm_struct *mm,unsigned long addr) { return kmem_cache_alloc(pgtable_cache,
@@ -91,4 +103,8 @@ static inline void __pte_free_tlb(struct mmu_gather *tlb, pte_t *pte,#define __pmd_free_tlb (tlb, pmd, addr) \ pgtable_free_tlb(tlb, pmd, false) +#ifdef CONFIG_SPARC_PGTABLE_LEVEL4 +#define __pud_free_tlb (tlb, pud, addr) \ + pgtable_free_tlb(tlb, pud, false) +#endif #endif /* _SPARC64_PGALLOC_H */
arch/sparc/include/asm/pgtable_64.h +1 -1
@@ -688,7 +688,7 @@ static inline pmd_t pmdp_get_and_clear(struct mm_struct *mm, pmd_t *pmdp) {pmd_t pmd = *pmdp; -set_pmd_at (mm, addr, pmdp,__pmd (0U )); +set_pmd_at (mm, addr, pmdp,__pmd (0UL ));return pmd; }
arch/sparc/include/asm/pgtable_64_lvl4.h new file +191 -0
191 lines not on this page · raw message
arch/sparc/include/asm/tsb.h +55 -0
79 lines not on this page · raw message
arch/sparc/kernel/smp_64.c +7 -0
@@ -1474,6 +1474,13 @@ static void __init pcpu_populate_pte(unsigned long addr)pud_t *pud;pmd_t *pmd; +if (pgd_none (*pgd)) { +pud_t *pud; + + pud =__alloc_bootmem (PAGE_SIZE ,PAGE_SIZE ,PAGE_SIZE ); +pgd_populate (&init_mm, pgd, pud); + } + pud =pud_offset (pgd, addr);if (pud_none (*pud)) {pmd_t *new;
arch/sparc/mm/init_64.c +24 -1
@@ -1376,6 +1376,14 @@ static unsigned long __ref kernel_map_range(unsigned long pstart,pmd_t *pmd;pte_t *pte; +if (pgd_none (*pgd)) { +pud_t *pud; + + pud =__alloc_bootmem (PAGE_SIZE ,PAGE_SIZE ,PAGE_SIZE ); + alloc_bytes +=PAGE_SIZE ; +pgd_populate (&init_mm, pgd, pud); + } + pud =pud_offset (pgd, vstart);if (pud_none (*pud)) {pmd_t *new;
@@ -1752,7 +1760,12 @@ static void __init sun4v_linear_pte_xor_finalize(void)/* paging_init() sets up the page tables */ static unsigned long last_valid_pfn; +#ifdef CONFIG_SPARC_PGTABLE_LEVEL4 +pgd_t swapper_pg_dir[PTRS_PER_PGD ]; +static pud_t swapper_pud_dir[PTRS_PER_PUD ]; +#else pgd_t swapper_pg_dir[2048 ]; +#endif static void sun4u_pgprot_init (void );static void sun4v_pgprot_init (void );
@@ -1853,11 +1866,21 @@ void __init paging_init(void)*/ init_mm.pgd += ((shift) / (sizeof (pgd_t))); +/* Now can init the kernel/bad page tables. */ +#ifdef CONFIG_SPARC_PGTABLE_LEVEL4 + { +pud_t *shift_pud = swapper_pud_dir + (shift /sizeof (pud_t)); +unsigned long pgdoffset =pgd_offset (&swapper_pg_dir[0 ],0UL ); +pgd_t *pgd = &swapper_pg_dir[pgdoffset]; + +pgd_set (pgd, (unsigned long ) shift_pud); + } +#else memset (swapper_low_pmd_dir,0 ,sizeof (swapper_low_pmd_dir)); -/* Now can init the kernel/bad page tables. */ pud_set (pud_offset (&swapper_pg_dir[0 ],0 ), swapper_low_pmd_dir + (shift /sizeof (pgd_t))); +#endif inherit_prom_mappings ();
Signature · 1 line
1.7.10.4