aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Miller <davem@davemloft.net>2012-10-08 19:34:23 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2012-10-09 03:23:05 -0400
commitdbc9fdf063dc4f12af71d7858bd216170129822e (patch)
tree3950c72a8820f630fdd6d4ced3412de913391346
parentc460bec78d9257a54bcc5f9d5fadf89f8c70dbd1 (diff)
sparc64: Document PGD and PMD layout.
We're going to be messing around with the PMD interpretation and layout for the sake of transparent huge pages, so we better clearly document what we're starting with. Signed-off-by: David S. Miller <davem@davemloft.net> Cc: Andrea Arcangeli <aarcange@redhat.com> Cc: Johannes Weiner <hannes@cmpxchg.org> Cc: Gerald Schaefer <gerald.schaefer@de.ibm.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r--arch/sparc/include/asm/pgtable_64.h16
-rw-r--r--arch/sparc/include/asm/tsb.h8
2 files changed, 16 insertions, 8 deletions
diff --git a/arch/sparc/include/asm/pgtable_64.h b/arch/sparc/include/asm/pgtable_64.h
index a7b5091f3b13..af3cd7a9e9ac 100644
--- a/arch/sparc/include/asm/pgtable_64.h
+++ b/arch/sparc/include/asm/pgtable_64.h
@@ -63,6 +63,14 @@
63#error Page table parameters do not cover virtual address space properly. 63#error Page table parameters do not cover virtual address space properly.
64#endif 64#endif
65 65
66/* PMDs point to PTE tables which are 4K aligned. */
67#define PMD_PADDR _AC(0xfffffffe,UL)
68#define PMD_PADDR_SHIFT _AC(11,UL)
69
70/* PGDs point to PMD tables which are 8K aligned. */
71#define PGD_PADDR _AC(0xfffffffc,UL)
72#define PGD_PADDR_SHIFT _AC(11,UL)
73
66#ifndef __ASSEMBLY__ 74#ifndef __ASSEMBLY__
67 75
68#include <linux/sched.h> 76#include <linux/sched.h>
@@ -581,14 +589,14 @@ static inline unsigned long pte_special(pte_t pte)
581} 589}
582 590
583#define pmd_set(pmdp, ptep) \ 591#define pmd_set(pmdp, ptep) \
584 (pmd_val(*(pmdp)) = (__pa((unsigned long) (ptep)) >> 11UL)) 592 (pmd_val(*(pmdp)) = (__pa((unsigned long) (ptep)) >> PMD_PADDR_SHIFT))
585#define pud_set(pudp, pmdp) \ 593#define pud_set(pudp, pmdp) \
586 (pud_val(*(pudp)) = (__pa((unsigned long) (pmdp)) >> 11UL)) 594 (pud_val(*(pudp)) = (__pa((unsigned long) (pmdp)) >> PGD_PADDR_SHIFT))
587#define __pmd_page(pmd) \ 595#define __pmd_page(pmd) \
588 ((unsigned long) __va((((unsigned long)pmd_val(pmd))<<11UL))) 596 ((unsigned long) __va((((unsigned long)pmd_val(pmd))<<PMD_PADDR_SHIFT)))
589#define pmd_page(pmd) virt_to_page((void *)__pmd_page(pmd)) 597#define pmd_page(pmd) virt_to_page((void *)__pmd_page(pmd))
590#define pud_page_vaddr(pud) \ 598#define pud_page_vaddr(pud) \
591 ((unsigned long) __va((((unsigned long)pud_val(pud))<<11UL))) 599 ((unsigned long) __va((((unsigned long)pud_val(pud))<<PGD_PADDR_SHIFT)))
592#define pud_page(pud) virt_to_page((void *)pud_page_vaddr(pud)) 600#define pud_page(pud) virt_to_page((void *)pud_page_vaddr(pud))
593#define pmd_none(pmd) (!pmd_val(pmd)) 601#define pmd_none(pmd) (!pmd_val(pmd))
594#define pmd_bad(pmd) (0) 602#define pmd_bad(pmd) (0)
diff --git a/arch/sparc/include/asm/tsb.h b/arch/sparc/include/asm/tsb.h
index 6435924b4514..ef8cd1a174f1 100644
--- a/arch/sparc/include/asm/tsb.h
+++ b/arch/sparc/include/asm/tsb.h
@@ -147,13 +147,13 @@ extern struct tsb_phys_patch_entry __tsb_phys_patch, __tsb_phys_patch_end;
147 brz,pn REG1, FAIL_LABEL; \ 147 brz,pn REG1, FAIL_LABEL; \
148 sllx VADDR, 64 - (PMD_SHIFT + PMD_BITS), REG2; \ 148 sllx VADDR, 64 - (PMD_SHIFT + PMD_BITS), REG2; \
149 srlx REG2, 64 - PAGE_SHIFT, REG2; \ 149 srlx REG2, 64 - PAGE_SHIFT, REG2; \
150 sllx REG1, 11, REG1; \ 150 sllx REG1, PGD_PADDR_SHIFT, REG1; \
151 andn REG2, 0x3, REG2; \ 151 andn REG2, 0x3, REG2; \
152 lduwa [REG1 + REG2] ASI_PHYS_USE_EC, REG1; \ 152 lduwa [REG1 + REG2] ASI_PHYS_USE_EC, REG1; \
153 brz,pn REG1, FAIL_LABEL; \ 153 brz,pn REG1, FAIL_LABEL; \
154 sllx VADDR, 64 - PMD_SHIFT, REG2; \ 154 sllx VADDR, 64 - PMD_SHIFT, REG2; \
155 srlx REG2, 64 - (PAGE_SHIFT - 1), REG2; \ 155 srlx REG2, 64 - (PAGE_SHIFT - 1), REG2; \
156 sllx REG1, 11, REG1; \ 156 sllx REG1, PMD_PADDR_SHIFT, REG1; \
157 andn REG2, 0x7, REG2; \ 157 andn REG2, 0x7, REG2; \
158 add REG1, REG2, REG1; 158 add REG1, REG2, REG1;
159 159
@@ -172,13 +172,13 @@ extern struct tsb_phys_patch_entry __tsb_phys_patch, __tsb_phys_patch_end;
172 brz,pn REG1, FAIL_LABEL; \ 172 brz,pn REG1, FAIL_LABEL; \
173 sllx VADDR, 64 - (PMD_SHIFT + PMD_BITS), REG2; \ 173 sllx VADDR, 64 - (PMD_SHIFT + PMD_BITS), REG2; \
174 srlx REG2, 64 - PAGE_SHIFT, REG2; \ 174 srlx REG2, 64 - PAGE_SHIFT, REG2; \
175 sllx REG1, 11, REG1; \ 175 sllx REG1, PGD_PADDR_SHIFT, REG1; \
176 andn REG2, 0x3, REG2; \ 176 andn REG2, 0x3, REG2; \
177 lduwa [REG1 + REG2] ASI_PHYS_USE_EC, REG1; \ 177 lduwa [REG1 + REG2] ASI_PHYS_USE_EC, REG1; \
178 brz,pn REG1, FAIL_LABEL; \ 178 brz,pn REG1, FAIL_LABEL; \
179 sllx VADDR, 64 - PMD_SHIFT, REG2; \ 179 sllx VADDR, 64 - PMD_SHIFT, REG2; \
180 srlx REG2, 64 - (PAGE_SHIFT - 1), REG2; \ 180 srlx REG2, 64 - (PAGE_SHIFT - 1), REG2; \
181 sllx REG1, 11, REG1; \ 181 sllx REG1, PMD_PADDR_SHIFT, REG1; \
182 andn REG2, 0x7, REG2; \ 182 andn REG2, 0x7, REG2; \
183 add REG1, REG2, REG1; 183 add REG1, REG2, REG1;
184 184