| .. | .. |
|---|
| 2 | 2 | #ifndef _ASM_POWERPC_BOOK3S_64_HASH_64K_H |
|---|
| 3 | 3 | #define _ASM_POWERPC_BOOK3S_64_HASH_64K_H |
|---|
| 4 | 4 | |
|---|
| 5 | | -#define H_PTE_INDEX_SIZE 8 |
|---|
| 6 | | -#define H_PMD_INDEX_SIZE 10 |
|---|
| 7 | | -#define H_PUD_INDEX_SIZE 10 |
|---|
| 8 | | -#define H_PGD_INDEX_SIZE 8 |
|---|
| 5 | +#define H_PTE_INDEX_SIZE 8 // size: 8B << 8 = 2KB, maps 2^8 x 64KB = 16MB |
|---|
| 6 | +#define H_PMD_INDEX_SIZE 10 // size: 8B << 10 = 8KB, maps 2^10 x 16MB = 16GB |
|---|
| 7 | +#define H_PUD_INDEX_SIZE 10 // size: 8B << 10 = 8KB, maps 2^10 x 16GB = 16TB |
|---|
| 8 | +#define H_PGD_INDEX_SIZE 8 // size: 8B << 8 = 2KB, maps 2^8 x 16TB = 4PB |
|---|
| 9 | + |
|---|
| 10 | +/* |
|---|
| 11 | + * If we store section details in page->flags we can't increase the MAX_PHYSMEM_BITS |
|---|
| 12 | + * if we increase SECTIONS_WIDTH we will not store node details in page->flags and |
|---|
| 13 | + * page_to_nid does a page->section->node lookup |
|---|
| 14 | + * Hence only increase for VMEMMAP. Further depending on SPARSEMEM_EXTREME reduce |
|---|
| 15 | + * memory requirements with large number of sections. |
|---|
| 16 | + * 51 bits is the max physical real address on POWER9 |
|---|
| 17 | + */ |
|---|
| 18 | +#if defined(CONFIG_SPARSEMEM_VMEMMAP) && defined(CONFIG_SPARSEMEM_EXTREME) |
|---|
| 19 | +#define H_MAX_PHYSMEM_BITS 51 |
|---|
| 20 | +#else |
|---|
| 21 | +#define H_MAX_PHYSMEM_BITS 46 |
|---|
| 22 | +#endif |
|---|
| 9 | 23 | |
|---|
| 10 | 24 | /* |
|---|
| 11 | 25 | * Each context is 512TB size. SLB miss for first context/default context |
|---|
| 12 | 26 | * is handled in the hotpath. |
|---|
| 13 | 27 | */ |
|---|
| 14 | 28 | #define MAX_EA_BITS_PER_CONTEXT 49 |
|---|
| 29 | +#define REGION_SHIFT MAX_EA_BITS_PER_CONTEXT |
|---|
| 30 | + |
|---|
| 31 | +/* |
|---|
| 32 | + * We use one context for each MAP area. |
|---|
| 33 | + */ |
|---|
| 34 | +#define H_KERN_MAP_SIZE (1UL << MAX_EA_BITS_PER_CONTEXT) |
|---|
| 35 | + |
|---|
| 36 | +/* |
|---|
| 37 | + * Define the address range of the kernel non-linear virtual area |
|---|
| 38 | + * 2PB |
|---|
| 39 | + */ |
|---|
| 40 | +#define H_KERN_VIRT_START ASM_CONST(0xc008000000000000) |
|---|
| 15 | 41 | |
|---|
| 16 | 42 | /* |
|---|
| 17 | 43 | * 64k aligned address free up few of the lower bits of RPN for us |
|---|
| .. | .. |
|---|
| 19 | 45 | */ |
|---|
| 20 | 46 | #define H_PAGE_COMBO _RPAGE_RPN0 /* this is a combo 4k page */ |
|---|
| 21 | 47 | #define H_PAGE_4K_PFN _RPAGE_RPN1 /* PFN is for a single 4k page */ |
|---|
| 22 | | -#define H_PAGE_BUSY _RPAGE_RPN44 /* software: PTE & hash are busy */ |
|---|
| 48 | +#define H_PAGE_BUSY _RPAGE_RSV1 /* software: PTE & hash are busy */ |
|---|
| 23 | 49 | #define H_PAGE_HASHPTE _RPAGE_RPN43 /* PTE has associated HPTE */ |
|---|
| 24 | 50 | |
|---|
| 25 | 51 | /* memory key bits. */ |
|---|
| 26 | | -#define H_PTE_PKEY_BIT0 _RPAGE_RSV1 |
|---|
| 27 | | -#define H_PTE_PKEY_BIT1 _RPAGE_RSV2 |
|---|
| 28 | | -#define H_PTE_PKEY_BIT2 _RPAGE_RSV3 |
|---|
| 29 | | -#define H_PTE_PKEY_BIT3 _RPAGE_RSV4 |
|---|
| 30 | | -#define H_PTE_PKEY_BIT4 _RPAGE_RSV5 |
|---|
| 52 | +#define H_PTE_PKEY_BIT4 _RPAGE_PKEY_BIT4 |
|---|
| 53 | +#define H_PTE_PKEY_BIT3 _RPAGE_PKEY_BIT3 |
|---|
| 54 | +#define H_PTE_PKEY_BIT2 _RPAGE_PKEY_BIT2 |
|---|
| 55 | +#define H_PTE_PKEY_BIT1 _RPAGE_PKEY_BIT1 |
|---|
| 56 | +#define H_PTE_PKEY_BIT0 _RPAGE_PKEY_BIT0 |
|---|
| 31 | 57 | |
|---|
| 32 | 58 | /* |
|---|
| 33 | 59 | * We need to differentiate between explicit huge page and THP huge |
|---|