aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sparc/include/asm/pgtable_64.h
diff options
context:
space:
mode:
Diffstat (limited to 'arch/sparc/include/asm/pgtable_64.h')
-rw-r--r--arch/sparc/include/asm/pgtable_64.h37
1 files changed, 32 insertions, 5 deletions
diff --git a/arch/sparc/include/asm/pgtable_64.h b/arch/sparc/include/asm/pgtable_64.h
index 3770bf5c6e1b..31ac919920a9 100644
--- a/arch/sparc/include/asm/pgtable_64.h
+++ b/arch/sparc/include/asm/pgtable_64.h
@@ -20,8 +20,6 @@
20#include <asm/page.h> 20#include <asm/page.h>
21#include <asm/processor.h> 21#include <asm/processor.h>
22 22
23#include <asm-generic/pgtable-nopud.h>
24
25/* The kernel image occupies 0x4000000 to 0x6000000 (4MB --> 96MB). 23/* The kernel image occupies 0x4000000 to 0x6000000 (4MB --> 96MB).
26 * The page copy blockops can use 0x6000000 to 0x8000000. 24 * The page copy blockops can use 0x6000000 to 0x8000000.
27 * The 8K TSB is mapped in the 0x8000000 to 0x8400000 range. 25 * The 8K TSB is mapped in the 0x8000000 to 0x8400000 range.
@@ -55,13 +53,21 @@
55#define PMD_MASK (~(PMD_SIZE-1)) 53#define PMD_MASK (~(PMD_SIZE-1))
56#define PMD_BITS (PAGE_SHIFT - 3) 54#define PMD_BITS (PAGE_SHIFT - 3)
57 55
58/* PGDIR_SHIFT determines what a third-level page table entry can map */ 56/* PUD_SHIFT determines the size of the area a third-level page
59#define PGDIR_SHIFT (PAGE_SHIFT + (PAGE_SHIFT-3) + PMD_BITS) 57 * table can map
58 */
59#define PUD_SHIFT (PMD_SHIFT + PMD_BITS)
60#define PUD_SIZE (_AC(1,UL) << PUD_SHIFT)
61#define PUD_MASK (~(PUD_SIZE-1))
62#define PUD_BITS (PAGE_SHIFT - 3)
63
64/* PGDIR_SHIFT determines what a fourth-level page table entry can map */
65#define PGDIR_SHIFT (PUD_SHIFT + PUD_BITS)
60#define PGDIR_SIZE (_AC(1,UL) << PGDIR_SHIFT) 66#define PGDIR_SIZE (_AC(1,UL) << PGDIR_SHIFT)
61#define PGDIR_MASK (~(PGDIR_SIZE-1)) 67#define PGDIR_MASK (~(PGDIR_SIZE-1))
62#define PGDIR_BITS (PAGE_SHIFT - 3) 68#define PGDIR_BITS (PAGE_SHIFT - 3)
63 69
64#if (PGDIR_SHIFT + PGDIR_BITS) != 43 70#if (PGDIR_SHIFT + PGDIR_BITS) != 53
65#error Page table parameters do not cover virtual address space properly. 71#error Page table parameters do not cover virtual address space properly.
66#endif 72#endif
67 73
@@ -93,6 +99,7 @@ static inline bool kern_addr_valid(unsigned long addr)
93/* Entries per page directory level. */ 99/* Entries per page directory level. */
94#define PTRS_PER_PTE (1UL << (PAGE_SHIFT-3)) 100#define PTRS_PER_PTE (1UL << (PAGE_SHIFT-3))
95#define PTRS_PER_PMD (1UL << PMD_BITS) 101#define PTRS_PER_PMD (1UL << PMD_BITS)
102#define PTRS_PER_PUD (1UL << PUD_BITS)
96#define PTRS_PER_PGD (1UL << PGDIR_BITS) 103#define PTRS_PER_PGD (1UL << PGDIR_BITS)
97 104
98/* Kernel has a separate 44bit address space. */ 105/* Kernel has a separate 44bit address space. */
@@ -101,6 +108,9 @@ static inline bool kern_addr_valid(unsigned long addr)
101#define pmd_ERROR(e) \ 108#define pmd_ERROR(e) \
102 pr_err("%s:%d: bad pmd %p(%016lx) seen at (%pS)\n", \ 109 pr_err("%s:%d: bad pmd %p(%016lx) seen at (%pS)\n", \
103 __FILE__, __LINE__, &(e), pmd_val(e), __builtin_return_address(0)) 110 __FILE__, __LINE__, &(e), pmd_val(e), __builtin_return_address(0))
111#define pud_ERROR(e) \
112 pr_err("%s:%d: bad pud %p(%016lx) seen at (%pS)\n", \
113 __FILE__, __LINE__, &(e), pud_val(e), __builtin_return_address(0))
104#define pgd_ERROR(e) \ 114#define pgd_ERROR(e) \
105 pr_err("%s:%d: bad pgd %p(%016lx) seen at (%pS)\n", \ 115 pr_err("%s:%d: bad pgd %p(%016lx) seen at (%pS)\n", \
106 __FILE__, __LINE__, &(e), pgd_val(e), __builtin_return_address(0)) 116 __FILE__, __LINE__, &(e), pgd_val(e), __builtin_return_address(0))
@@ -779,6 +789,11 @@ static inline int pmd_present(pmd_t pmd)
779#define pud_bad(pud) ((pud_val(pud) & ~PAGE_MASK) || \ 789#define pud_bad(pud) ((pud_val(pud) & ~PAGE_MASK) || \
780 !__kern_addr_valid(pud_val(pud))) 790 !__kern_addr_valid(pud_val(pud)))
781 791
792#define pgd_none(pgd) (!pgd_val(pgd))
793
794#define pgd_bad(pgd) ((pgd_val(pgd) & ~PAGE_MASK) || \
795 !__kern_addr_valid(pgd_val(pgd)))
796
782#ifdef CONFIG_TRANSPARENT_HUGEPAGE 797#ifdef CONFIG_TRANSPARENT_HUGEPAGE
783void set_pmd_at(struct mm_struct *mm, unsigned long addr, 798void set_pmd_at(struct mm_struct *mm, unsigned long addr,
784 pmd_t *pmdp, pmd_t pmd); 799 pmd_t *pmdp, pmd_t pmd);
@@ -815,10 +830,17 @@ static inline unsigned long __pmd_page(pmd_t pmd)
815#define pmd_clear(pmdp) (pmd_val(*(pmdp)) = 0UL) 830#define pmd_clear(pmdp) (pmd_val(*(pmdp)) = 0UL)
816#define pud_present(pud) (pud_val(pud) != 0U) 831#define pud_present(pud) (pud_val(pud) != 0U)
817#define pud_clear(pudp) (pud_val(*(pudp)) = 0UL) 832#define pud_clear(pudp) (pud_val(*(pudp)) = 0UL)
833#define pgd_page_vaddr(pgd) \
834 ((unsigned long) __va(pgd_val(pgd)))
835#define pgd_present(pgd) (pgd_val(pgd) != 0U)
836#define pgd_clear(pgdp) (pgd_val(*(pgd)) = 0UL)
818 837
819/* Same in both SUN4V and SUN4U. */ 838/* Same in both SUN4V and SUN4U. */
820#define pte_none(pte) (!pte_val(pte)) 839#define pte_none(pte) (!pte_val(pte))
821 840
841#define pgd_set(pgdp, pudp) \
842 (pgd_val(*(pgdp)) = (__pa((unsigned long) (pudp))))
843
822/* to find an entry in a page-table-directory. */ 844/* to find an entry in a page-table-directory. */
823#define pgd_index(address) (((address) >> PGDIR_SHIFT) & (PTRS_PER_PGD - 1)) 845#define pgd_index(address) (((address) >> PGDIR_SHIFT) & (PTRS_PER_PGD - 1))
824#define pgd_offset(mm, address) ((mm)->pgd + pgd_index(address)) 846#define pgd_offset(mm, address) ((mm)->pgd + pgd_index(address))
@@ -826,6 +848,11 @@ static inline unsigned long __pmd_page(pmd_t pmd)
826/* to find an entry in a kernel page-table-directory */ 848/* to find an entry in a kernel page-table-directory */
827#define pgd_offset_k(address) pgd_offset(&init_mm, address) 849#define pgd_offset_k(address) pgd_offset(&init_mm, address)
828 850
851/* Find an entry in the third-level page table.. */
852#define pud_index(address) (((address) >> PUD_SHIFT) & (PTRS_PER_PUD - 1))
853#define pud_offset(pgdp, address) \
854 ((pud_t *) pgd_page_vaddr(*(pgdp)) + pud_index(address))
855
829/* Find an entry in the second-level page table.. */ 856/* Find an entry in the second-level page table.. */
830#define pmd_offset(pudp, address) \ 857#define pmd_offset(pudp, address) \
831 ((pmd_t *) pud_page_vaddr(*(pudp)) + \ 858 ((pmd_t *) pud_page_vaddr(*(pudp)) + \