|
33 | 33 | #include <asm/pgtable.h>
|
34 | 34 | #include <asm/sections.h>
|
35 | 35 | #include <asm/soc.h>
|
| 36 | +#include <asm/sparsemem.h> |
36 | 37 | #include <asm/tlbflush.h>
|
37 | 38 |
|
38 | 39 | #include "../kernel/head.h"
|
@@ -62,6 +63,13 @@ EXPORT_SYMBOL(pgtable_l5_enabled);
|
62 | 63 | phys_addr_t phys_ram_base __ro_after_init;
|
63 | 64 | EXPORT_SYMBOL(phys_ram_base);
|
64 | 65 |
|
| 66 | +#ifdef CONFIG_SPARSEMEM_VMEMMAP |
| 67 | +#define VMEMMAP_ADDR_ALIGN (1ULL << SECTION_SIZE_BITS) |
| 68 | + |
| 69 | +unsigned long vmemmap_start_pfn __ro_after_init; |
| 70 | +EXPORT_SYMBOL(vmemmap_start_pfn); |
| 71 | +#endif |
| 72 | + |
65 | 73 | unsigned long empty_zero_page[PAGE_SIZE / sizeof(unsigned long)]
|
66 | 74 | __page_aligned_bss;
|
67 | 75 | EXPORT_SYMBOL(empty_zero_page);
|
@@ -240,8 +248,12 @@ static void __init setup_bootmem(void)
|
240 | 248 | * Make sure we align the start of the memory on a PMD boundary so that
|
241 | 249 | * at worst, we map the linear mapping with PMD mappings.
|
242 | 250 | */
|
243 |
| - if (!IS_ENABLED(CONFIG_XIP_KERNEL)) |
| 251 | + if (!IS_ENABLED(CONFIG_XIP_KERNEL)) { |
244 | 252 | phys_ram_base = memblock_start_of_DRAM() & PMD_MASK;
|
| 253 | +#ifdef CONFIG_SPARSEMEM_VMEMMAP |
| 254 | + vmemmap_start_pfn = round_down(phys_ram_base, VMEMMAP_ADDR_ALIGN) >> PAGE_SHIFT; |
| 255 | +#endif |
| 256 | + } |
245 | 257 |
|
246 | 258 | /*
|
247 | 259 | * In 64-bit, any use of __va/__pa before this point is wrong as we
|
@@ -1101,6 +1113,9 @@ asmlinkage void __init setup_vm(uintptr_t dtb_pa)
|
1101 | 1113 | kernel_map.xiprom_sz = (uintptr_t)(&_exiprom) - (uintptr_t)(&_xiprom);
|
1102 | 1114 |
|
1103 | 1115 | phys_ram_base = CONFIG_PHYS_RAM_BASE;
|
| 1116 | +#ifdef CONFIG_SPARSEMEM_VMEMMAP |
| 1117 | + vmemmap_start_pfn = round_down(phys_ram_base, VMEMMAP_ADDR_ALIGN) >> PAGE_SHIFT; |
| 1118 | +#endif |
1104 | 1119 | kernel_map.phys_addr = (uintptr_t)CONFIG_PHYS_RAM_BASE;
|
1105 | 1120 | kernel_map.size = (uintptr_t)(&_end) - (uintptr_t)(&_start);
|
1106 | 1121 |
|
|
0 commit comments