Skip to content

Commit f24ffde

Browse files
kiryltorvalds
authored andcommitted
parisc: expose number of page table levels on Kconfig level
We would want to use number of page table level to define mm_struct. Let's expose it as CONFIG_PGTABLE_LEVELS. Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com> Cc: "James E.J. Bottomley" <jejb@parisc-linux.org> Cc: Helge Deller <deller@gmx.de> Tested-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent a728ab5 commit f24ffde

6 files changed

Lines changed: 18 additions & 15 deletions

File tree

‎arch/parisc/Kconfig‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,11 @@ config ARCH_MAY_HAVE_PC_FDC
103103
depends on BROKEN
104104
default y
105105

106+
config PGTABLE_LEVELS
107+
int
108+
default 3 if 64BIT && PARISC_PAGE_SIZE_4KB
109+
default 2
110+
106111
source "init/Kconfig"
107112

108113
source "kernel/Kconfig.freezer"

‎arch/parisc/include/asm/pgalloc.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ static inline void pgd_free(struct mm_struct *mm, pgd_t *pgd)
5151
free_pages((unsigned long)pgd, PGD_ALLOC_ORDER);
5252
}
5353

54-
#if PT_NLEVELS == 3
54+
#if CONFIG_PGTABLE_LEVELS == 3
5555

5656
/* Three Level Page Table Support for pmd's */
5757

‎arch/parisc/include/asm/pgtable.h‎

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -68,13 +68,11 @@ extern void purge_tlb_entries(struct mm_struct *, unsigned long);
6868
#define KERNEL_INITIAL_ORDER 24 /* 0 to 1<<24 = 16MB */
6969
#define KERNEL_INITIAL_SIZE (1 << KERNEL_INITIAL_ORDER)
7070

71-
#if defined(CONFIG_64BIT) && defined(CONFIG_PARISC_PAGE_SIZE_4KB)
72-
#define PT_NLEVELS 3
71+
#if CONFIG_PGTABLE_LEVELS == 3
7372
#define PGD_ORDER 1 /* Number of pages per pgd */
7473
#define PMD_ORDER 1 /* Number of pages per pmd */
7574
#define PGD_ALLOC_ORDER 2 /* first pgd contains pmd */
7675
#else
77-
#define PT_NLEVELS 2
7876
#define PGD_ORDER 1 /* Number of pages per pgd */
7977
#define PGD_ALLOC_ORDER PGD_ORDER
8078
#endif
@@ -93,7 +91,7 @@ extern void purge_tlb_entries(struct mm_struct *, unsigned long);
9391
#define PMD_SHIFT (PLD_SHIFT + BITS_PER_PTE)
9492
#define PMD_SIZE (1UL << PMD_SHIFT)
9593
#define PMD_MASK (~(PMD_SIZE-1))
96-
#if PT_NLEVELS == 3
94+
#if CONFIG_PGTABLE_LEVELS == 3
9795
#define BITS_PER_PMD (PAGE_SHIFT + PMD_ORDER - BITS_PER_PMD_ENTRY)
9896
#else
9997
#define __PAGETABLE_PMD_FOLDED
@@ -277,7 +275,7 @@ extern unsigned long *empty_zero_page;
277275
#define pgd_flag(x) (pgd_val(x) & PxD_FLAG_MASK)
278276
#define pgd_address(x) ((unsigned long)(pgd_val(x) &~ PxD_FLAG_MASK) << PxD_VALUE_SHIFT)
279277

280-
#if PT_NLEVELS == 3
278+
#if CONFIG_PGTABLE_LEVELS == 3
281279
/* The first entry of the permanent pmd is not there if it contains
282280
* the gateway marker */
283281
#define pmd_none(x) (!pmd_val(x) || pmd_flag(x) == PxD_FLAG_ATTACHED)
@@ -287,7 +285,7 @@ extern unsigned long *empty_zero_page;
287285
#define pmd_bad(x) (!(pmd_flag(x) & PxD_FLAG_VALID))
288286
#define pmd_present(x) (pmd_flag(x) & PxD_FLAG_PRESENT)
289287
static inline void pmd_clear(pmd_t *pmd) {
290-
#if PT_NLEVELS == 3
288+
#if CONFIG_PGTABLE_LEVELS == 3
291289
if (pmd_flag(*pmd) & PxD_FLAG_ATTACHED)
292290
/* This is the entry pointing to the permanent pmd
293291
* attached to the pgd; cannot clear it */
@@ -299,7 +297,7 @@ static inline void pmd_clear(pmd_t *pmd) {
299297

300298

301299

302-
#if PT_NLEVELS == 3
300+
#if CONFIG_PGTABLE_LEVELS == 3
303301
#define pgd_page_vaddr(pgd) ((unsigned long) __va(pgd_address(pgd)))
304302
#define pgd_page(pgd) virt_to_page((void *)pgd_page_vaddr(pgd))
305303

@@ -309,7 +307,7 @@ static inline void pmd_clear(pmd_t *pmd) {
309307
#define pgd_bad(x) (!(pgd_flag(x) & PxD_FLAG_VALID))
310308
#define pgd_present(x) (pgd_flag(x) & PxD_FLAG_PRESENT)
311309
static inline void pgd_clear(pgd_t *pgd) {
312-
#if PT_NLEVELS == 3
310+
#if CONFIG_PGTABLE_LEVELS == 3
313311
if(pgd_flag(*pgd) & PxD_FLAG_ATTACHED)
314312
/* This is the permanent pmd attached to the pgd; cannot
315313
* free it */
@@ -393,7 +391,7 @@ static inline pte_t pte_modify(pte_t pte, pgprot_t newprot)
393391

394392
/* Find an entry in the second-level page table.. */
395393

396-
#if PT_NLEVELS == 3
394+
#if CONFIG_PGTABLE_LEVELS == 3
397395
#define pmd_offset(dir,address) \
398396
((pmd_t *) pgd_page_vaddr(*(dir)) + (((address)>>PMD_SHIFT) & (PTRS_PER_PMD-1)))
399397
#else

‎arch/parisc/kernel/entry.S‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -398,7 +398,7 @@
398398
* can address up to 1TB
399399
*/
400400
.macro L2_ptep pmd,pte,index,va,fault
401-
#if PT_NLEVELS == 3
401+
#if CONFIG_PGTABLE_LEVELS == 3
402402
extru \va,31-ASM_PMD_SHIFT,ASM_BITS_PER_PMD,\index
403403
#else
404404
# if defined(CONFIG_64BIT)
@@ -436,7 +436,7 @@
436436
* all ILP32 processes and all the kernel for machines with
437437
* under 4GB of memory) */
438438
.macro L3_ptep pgd,pte,index,va,fault
439-
#if PT_NLEVELS == 3 /* we might have a 2-Level scheme, e.g. with 16kb page size */
439+
#if CONFIG_PGTABLE_LEVELS == 3 /* we might have a 2-Level scheme, e.g. with 16kb page size */
440440
extrd,u \va,63-ASM_PGDIR_SHIFT,ASM_BITS_PER_PGD,\index
441441
copy %r0,\pte
442442
extrd,u,*= \va,63-ASM_PGDIR_SHIFT,64-ASM_PGDIR_SHIFT,%r0

‎arch/parisc/kernel/head.S‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ $bss_loop:
7474
mtctl %r4,%cr24 /* Initialize kernel root pointer */
7575
mtctl %r4,%cr25 /* Initialize user root pointer */
7676

77-
#if PT_NLEVELS == 3
77+
#if CONFIG_PGTABLE_LEVELS == 3
7878
/* Set pmd in pgd */
7979
load32 PA(pmd0),%r5
8080
shrd %r5,PxD_VALUE_SHIFT,%r3
@@ -97,7 +97,7 @@ $bss_loop:
9797
stw %r3,0(%r4)
9898
ldo (PAGE_SIZE >> PxD_VALUE_SHIFT)(%r3),%r3
9999
addib,> -1,%r1,1b
100-
#if PT_NLEVELS == 3
100+
#if CONFIG_PGTABLE_LEVELS == 3
101101
ldo ASM_PMD_ENTRY_SIZE(%r4),%r4
102102
#else
103103
ldo ASM_PGD_ENTRY_SIZE(%r4),%r4

‎arch/parisc/mm/init.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
extern int data_start;
3535
extern void parisc_kernel_start(void); /* Kernel entry point in head.S */
3636

37-
#if PT_NLEVELS == 3
37+
#if CONFIG_PGTABLE_LEVELS == 3
3838
/* NOTE: This layout exactly conforms to the hybrid L2/L3 page table layout
3939
* with the first pmd adjacent to the pgd and below it. gcc doesn't actually
4040
* guarantee that global objects will be laid out in memory in the same order

0 commit comments

Comments
 (0)