|
22 | 22 | #include <linux/hugetlb.h>
|
23 | 23 |
|
24 | 24 | #include <asm/fixmap.h>
|
| 25 | +#include <asm/sparsemem.h> |
25 | 26 | #include <asm/tlbflush.h>
|
26 | 27 | #include <asm/sections.h>
|
27 | 28 | #include <asm/soc.h>
|
@@ -52,6 +53,13 @@ EXPORT_SYMBOL(pgtable_l5_enabled);
|
52 | 53 | phys_addr_t phys_ram_base __ro_after_init;
|
53 | 54 | EXPORT_SYMBOL(phys_ram_base);
|
54 | 55 |
|
| 56 | +#ifdef CONFIG_SPARSEMEM_VMEMMAP |
| 57 | +#define VMEMMAP_ADDR_ALIGN (1ULL << SECTION_SIZE_BITS) |
| 58 | + |
| 59 | +unsigned long vmemmap_start_pfn __ro_after_init; |
| 60 | +EXPORT_SYMBOL(vmemmap_start_pfn); |
| 61 | +#endif |
| 62 | + |
55 | 63 | unsigned long empty_zero_page[PAGE_SIZE / sizeof(unsigned long)]
|
56 | 64 | __page_aligned_bss;
|
57 | 65 | EXPORT_SYMBOL(empty_zero_page);
|
@@ -210,8 +218,12 @@ static void __init setup_bootmem(void)
|
210 | 218 | memblock_reserve(vmlinux_start, vmlinux_end - vmlinux_start);
|
211 | 219 |
|
212 | 220 | phys_ram_end = memblock_end_of_DRAM();
|
213 |
| - if (!IS_ENABLED(CONFIG_XIP_KERNEL)) |
| 221 | + if (!IS_ENABLED(CONFIG_XIP_KERNEL)) { |
214 | 222 | phys_ram_base = memblock_start_of_DRAM();
|
| 223 | +#ifdef CONFIG_SPARSEMEM_VMEMMAP |
| 224 | + vmemmap_start_pfn = round_down(phys_ram_base, VMEMMAP_ADDR_ALIGN) >> PAGE_SHIFT; |
| 225 | +#endif |
| 226 | +} |
215 | 227 | /*
|
216 | 228 | * Reserve physical address space that would be mapped to virtual
|
217 | 229 | * addresses greater than (void *)(-PAGE_SIZE) because:
|
@@ -946,6 +958,9 @@ asmlinkage void __init setup_vm(uintptr_t dtb_pa)
|
946 | 958 | kernel_map.xiprom_sz = (uintptr_t)(&_exiprom) - (uintptr_t)(&_xiprom);
|
947 | 959 |
|
948 | 960 | phys_ram_base = CONFIG_PHYS_RAM_BASE;
|
| 961 | +#ifdef CONFIG_SPARSEMEM_VMEMMAP |
| 962 | + vmemmap_start_pfn = round_down(phys_ram_base, VMEMMAP_ADDR_ALIGN) >> PAGE_SHIFT; |
| 963 | +#endif |
949 | 964 | kernel_map.phys_addr = (uintptr_t)CONFIG_PHYS_RAM_BASE;
|
950 | 965 | kernel_map.size = (uintptr_t)(&_end) - (uintptr_t)(&_start);
|
951 | 966 |
|
|
0 commit comments