aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVineet Gupta <vgupta@synopsys.com>2016-02-09 20:22:07 -0500
committerVineet Gupta <vgupta@synopsys.com>2016-02-12 01:40:25 -0500
commit37eda9df5bd8444263418495632ea6ec750f03f9 (patch)
tree2336e3a18d082fda05e907158b61fa34e2bcde7c
parentdec2b2849cfccf09822d6ce3f9bc84b8c8611152 (diff)
ARC: mm: Introduce explicit super page size support
MMUv4 supports 2 concurrent page sizes: Normal and Super [4K to 16M] So far Linux supported a single super page size for a given Normal page, depending on the software page walking address split. e.g. we had 11:8:13 address split for 8K page, which meant super page was 2 ^(8+13) = 2M (given that THP size has to be PMD_SHIFT) Now we turn this around, by allowing multiple Super Pages in Kconfig (currently 2M and 16M only) and forcing page walker address split to PGDIR_SHIFT and PAGE_SHIFT For configs without Super page, things are same as before and PGDIR_SHIFT can be hacked to get non default address split The motivation for this change is a customer who needs 16M super page and a 8K Normal page combo. Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
-rw-r--r--arch/arc/Kconfig19
-rw-r--r--arch/arc/include/asm/pgtable.h45
2 files changed, 45 insertions, 19 deletions
diff --git a/arch/arc/Kconfig b/arch/arc/Kconfig
index bb15e8062b1f..63979c7eede5 100644
--- a/arch/arc/Kconfig
+++ b/arch/arc/Kconfig
@@ -341,6 +341,19 @@ config ARC_PAGE_SIZE_4K
341 341
342endchoice 342endchoice
343 343
344choice
345 prompt "MMU Super Page Size"
346 depends on ISA_ARCV2 && TRANSPARENT_HUGEPAGE
347 default ARC_HUGEPAGE_2M
348
349config ARC_HUGEPAGE_2M
350 bool "2MB"
351
352config ARC_HUGEPAGE_16M
353 bool "16MB"
354
355endchoice
356
344if ISA_ARCOMPACT 357if ISA_ARCOMPACT
345 358
346config ARC_COMPACT_IRQ_LEVELS 359config ARC_COMPACT_IRQ_LEVELS
@@ -569,6 +582,12 @@ endmenu
569endmenu # "ARC Architecture Configuration" 582endmenu # "ARC Architecture Configuration"
570 583
571source "mm/Kconfig" 584source "mm/Kconfig"
585
586config FORCE_MAX_ZONEORDER
587 int "Maximum zone order"
588 default "12" if ARC_HUGEPAGE_16M
589 default "11"
590
572source "net/Kconfig" 591source "net/Kconfig"
573source "drivers/Kconfig" 592source "drivers/Kconfig"
574source "fs/Kconfig" 593source "fs/Kconfig"
diff --git a/arch/arc/include/asm/pgtable.h b/arch/arc/include/asm/pgtable.h
index 57af2f05ae84..d426d4215513 100644
--- a/arch/arc/include/asm/pgtable.h
+++ b/arch/arc/include/asm/pgtable.h
@@ -179,37 +179,44 @@
179#define __S111 PAGE_U_X_W_R 179#define __S111 PAGE_U_X_W_R
180 180
181/**************************************************************** 181/****************************************************************
182 * Page Table Lookup split 182 * 2 tier (PGD:PTE) software page walker
183 * 183 *
184 * We implement 2 tier paging and since this is all software, we are free 184 * [31] 32 bit virtual address [0]
185 * to customize the span of a PGD / PTE entry to suit us
186 *
187 * 32 bit virtual address
188 * ------------------------------------------------------- 185 * -------------------------------------------------------
189 * | BITS_FOR_PGD | BITS_FOR_PTE | BITS_IN_PAGE | 186 * | | <------------ PGDIR_SHIFT ----------> |
187 * | | |
188 * | BITS_FOR_PGD | BITS_FOR_PTE | <-- PAGE_SHIFT --> |
190 * ------------------------------------------------------- 189 * -------------------------------------------------------
191 * | | | 190 * | | |
192 * | | --> off in page frame 191 * | | --> off in page frame
193 * | |
194 * | ---> index into Page Table 192 * | ---> index into Page Table
195 * |
196 * ----> index into Page Directory 193 * ----> index into Page Directory
194 *
195 * In a single page size configuration, only PAGE_SHIFT is fixed
196 * So both PGD and PTE sizing can be tweaked
197 * e.g. 8K page (PAGE_SHIFT 13) can have
198 * - PGDIR_SHIFT 21 -> 11:8:13 address split
199 * - PGDIR_SHIFT 24 -> 8:11:13 address split
200 *
201 * If Super Page is configured, PGDIR_SHIFT becomes fixed too,
202 * so the sizing flexibility is gone.
197 */ 203 */
198 204
199#define BITS_IN_PAGE PAGE_SHIFT 205#if defined(CONFIG_ARC_HUGEPAGE_16M)
200 206#define PGDIR_SHIFT 24
201/* Optimal Sizing of Pg Tbl - based on MMU page size */ 207#elif defined(CONFIG_ARC_HUGEPAGE_2M)
202#if defined(CONFIG_ARC_PAGE_SIZE_8K) 208#define PGDIR_SHIFT 21
203#define BITS_FOR_PTE 8 /* 11:8:13 */ 209#else
204#elif defined(CONFIG_ARC_PAGE_SIZE_16K) 210/*
205#define BITS_FOR_PTE 8 /* 10:8:14 */ 211 * Only Normal page support so "hackable" (see comment above)
206#elif defined(CONFIG_ARC_PAGE_SIZE_4K) 212 * Default value provides 11:8:13 (8K), 11:9:12 (4K)
207#define BITS_FOR_PTE 9 /* 11:9:12 */ 213 */
214#define PGDIR_SHIFT 21
208#endif 215#endif
209 216
210#define BITS_FOR_PGD (32 - BITS_FOR_PTE - BITS_IN_PAGE) 217#define BITS_FOR_PTE (PGDIR_SHIFT - PAGE_SHIFT)
218#define BITS_FOR_PGD (32 - PGDIR_SHIFT)
211 219
212#define PGDIR_SHIFT (32 - BITS_FOR_PGD)
213#define PGDIR_SIZE (1UL << PGDIR_SHIFT) /* vaddr span, not PDG sz */ 220#define PGDIR_SIZE (1UL << PGDIR_SHIFT) /* vaddr span, not PDG sz */
214#define PGDIR_MASK (~(PGDIR_SIZE-1)) 221#define PGDIR_MASK (~(PGDIR_SIZE-1))
215 222