aboutsummaryrefslogtreecommitdiffstats
path: root/include/asm-s390/pgtable.h
diff options
context:
space:
mode:
authorMartin Schwidefsky <schwidefsky@de.ibm.com>2008-02-09 12:24:36 -0500
committerMartin Schwidefsky <schwidefsky@de.ibm.com>2008-02-09 12:24:40 -0500
commit5a216a20837c5f5fa1ca4b8ae8991ffd96b08e6f (patch)
treedde54e28497e920fa460cc95dadb6b38f1b2dbe0 /include/asm-s390/pgtable.h
parent146e4b3c8b92071b18f0b2e6f47165bad4f9e825 (diff)
[S390] Add four level page tables for CONFIG_64BIT=y.
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Diffstat (limited to 'include/asm-s390/pgtable.h')
-rw-r--r--include/asm-s390/pgtable.h57
1 files changed, 45 insertions, 12 deletions
diff --git a/include/asm-s390/pgtable.h b/include/asm-s390/pgtable.h
index 4fc937711482..8f473a718111 100644
--- a/include/asm-s390/pgtable.h
+++ b/include/asm-s390/pgtable.h
@@ -63,15 +63,15 @@ extern char empty_zero_page[PAGE_SIZE];
63#else /* __s390x__ */ 63#else /* __s390x__ */
64# define PMD_SHIFT 20 64# define PMD_SHIFT 20
65# define PUD_SHIFT 31 65# define PUD_SHIFT 31
66# define PGDIR_SHIFT 31 66# define PGDIR_SHIFT 42
67#endif /* __s390x__ */ 67#endif /* __s390x__ */
68 68
69#define PMD_SIZE (1UL << PMD_SHIFT) 69#define PMD_SIZE (1UL << PMD_SHIFT)
70#define PMD_MASK (~(PMD_SIZE-1)) 70#define PMD_MASK (~(PMD_SIZE-1))
71#define PUD_SIZE (1UL << PUD_SHIFT) 71#define PUD_SIZE (1UL << PUD_SHIFT)
72#define PUD_MASK (~(PUD_SIZE-1)) 72#define PUD_MASK (~(PUD_SIZE-1))
73#define PGDIR_SIZE (1UL << PGDIR_SHIFT) 73#define PGDIR_SIZE (1UL << PGDIR_SHIFT)
74#define PGDIR_MASK (~(PGDIR_SIZE-1)) 74#define PGDIR_MASK (~(PGDIR_SIZE-1))
75 75
76/* 76/*
77 * entries per page directory level: the S390 is two-level, so 77 * entries per page directory level: the S390 is two-level, so
@@ -82,10 +82,11 @@ extern char empty_zero_page[PAGE_SIZE];
82#define PTRS_PER_PTE 256 82#define PTRS_PER_PTE 256
83#ifndef __s390x__ 83#ifndef __s390x__
84#define PTRS_PER_PMD 1 84#define PTRS_PER_PMD 1
85#define PTRS_PER_PUD 1
85#else /* __s390x__ */ 86#else /* __s390x__ */
86#define PTRS_PER_PMD 2048 87#define PTRS_PER_PMD 2048
88#define PTRS_PER_PUD 2048
87#endif /* __s390x__ */ 89#endif /* __s390x__ */
88#define PTRS_PER_PUD 1
89#define PTRS_PER_PGD 2048 90#define PTRS_PER_PGD 2048
90 91
91#define FIRST_USER_ADDRESS 0 92#define FIRST_USER_ADDRESS 0
@@ -418,9 +419,23 @@ static inline int pud_bad(pud_t pud) { return 0; }
418 419
419#else /* __s390x__ */ 420#else /* __s390x__ */
420 421
421static inline int pgd_present(pgd_t pgd) { return 1; } 422static inline int pgd_present(pgd_t pgd)
422static inline int pgd_none(pgd_t pgd) { return 0; } 423{
423static inline int pgd_bad(pgd_t pgd) { return 0; } 424 return (pgd_val(pgd) & _REGION_ENTRY_ORIGIN) != 0UL;
425}
426
427static inline int pgd_none(pgd_t pgd)
428{
429 return (pgd_val(pgd) & _REGION_ENTRY_INV) != 0UL;
430}
431
432static inline int pgd_bad(pgd_t pgd)
433{
434 unsigned long mask =
435 ~_REGION_ENTRY_ORIGIN & ~_REGION_ENTRY_INV &
436 ~_REGION_ENTRY_TYPE_MASK & ~_REGION_ENTRY_LENGTH;
437 return (pgd_val(pgd) & mask) != 0;
438}
424 439
425static inline int pud_present(pud_t pud) 440static inline int pud_present(pud_t pud)
426{ 441{
@@ -434,8 +449,10 @@ static inline int pud_none(pud_t pud)
434 449
435static inline int pud_bad(pud_t pud) 450static inline int pud_bad(pud_t pud)
436{ 451{
437 unsigned long mask = ~_REGION_ENTRY_ORIGIN & ~_REGION_ENTRY_INV; 452 unsigned long mask =
438 return (pud_val(pud) & mask) != _REGION3_ENTRY; 453 ~_REGION_ENTRY_ORIGIN & ~_REGION_ENTRY_INV &
454 ~_REGION_ENTRY_TYPE_MASK & ~_REGION_ENTRY_LENGTH;
455 return (pud_val(pud) & mask) != 0;
439} 456}
440 457
441#endif /* __s390x__ */ 458#endif /* __s390x__ */
@@ -516,7 +533,19 @@ static inline int pte_young(pte_t pte)
516 533
517#else /* __s390x__ */ 534#else /* __s390x__ */
518 535
519#define pgd_clear(pgd) do { } while (0) 536static inline void pgd_clear_kernel(pgd_t * pgd)
537{
538 pgd_val(*pgd) = _REGION2_ENTRY_EMPTY;
539}
540
541static inline void pgd_clear(pgd_t * pgd)
542{
543 pgd_t *shadow = get_shadow_table(pgd);
544
545 pgd_clear_kernel(pgd);
546 if (shadow)
547 pgd_clear_kernel(shadow);
548}
520 549
521static inline void pud_clear_kernel(pud_t *pud) 550static inline void pud_clear_kernel(pud_t *pud)
522{ 551{
@@ -808,9 +837,13 @@ static inline pte_t mk_pte(struct page *page, pgprot_t pgprot)
808 837
809#define pmd_deref(pmd) (pmd_val(pmd) & _SEGMENT_ENTRY_ORIGIN) 838#define pmd_deref(pmd) (pmd_val(pmd) & _SEGMENT_ENTRY_ORIGIN)
810#define pud_deref(pud) (pud_val(pud) & _REGION_ENTRY_ORIGIN) 839#define pud_deref(pud) (pud_val(pud) & _REGION_ENTRY_ORIGIN)
811#define pgd_deref(pgd) ({ BUG(); 0UL; }) 840#define pgd_deref(pgd) (pgd_val(pgd) & _REGION_ENTRY_ORIGIN)
812 841
813#define pud_offset(pgd, address) ((pud_t *) pgd) 842static inline pud_t *pud_offset(pgd_t *pgd, unsigned long address)
843{
844 pud_t *pud = (pud_t *) pgd_deref(*pgd);
845 return pud + pud_index(address);
846}
814 847
815static inline pmd_t *pmd_offset(pud_t *pud, unsigned long address) 848static inline pmd_t *pmd_offset(pud_t *pud, unsigned long address)
816{ 849{