hc
2024-05-11 297b60346df8beafee954a0fd7c2d64f33f3b9bc
kernel/arch/powerpc/include/asm/book3s/64/hash-64k.h
....@@ -2,16 +2,42 @@
22 #ifndef _ASM_POWERPC_BOOK3S_64_HASH_64K_H
33 #define _ASM_POWERPC_BOOK3S_64_HASH_64K_H
44
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
923
1024 /*
1125 * Each context is 512TB size. SLB miss for first context/default context
1226 * is handled in the hotpath.
1327 */
1428 #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)
1541
1642 /*
1743 * 64k aligned address free up few of the lower bits of RPN for us
....@@ -19,15 +45,15 @@
1945 */
2046 #define H_PAGE_COMBO _RPAGE_RPN0 /* this is a combo 4k page */
2147 #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 */
2349 #define H_PAGE_HASHPTE _RPAGE_RPN43 /* PTE has associated HPTE */
2450
2551 /* 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
3157
3258 /*
3359 * We need to differentiate between explicit huge page and THP huge