1 // SPDX-License-Identifier: GPL-2.0-only
2 /*
3 * Based on arch/arm/mm/init.c
4 *
5 * Copyright (C) 1995-2005 Russell King
6 * Copyright (C) 2012 ARM Ltd.
7 */
8
9 #include <linux/kernel.h>
10 #include <linux/export.h>
11 #include <linux/errno.h>
12 #include <linux/swap.h>
13 #include <linux/init.h>
14 #include <linux/cache.h>
15 #include <linux/mman.h>
16 #include <linux/nodemask.h>
17 #include <linux/initrd.h>
18 #include <linux/gfp.h>
19 #include <linux/memblock.h>
20 #include <linux/sort.h>
21 #include <linux/of.h>
22 #include <linux/of_fdt.h>
23 #include <linux/dma-direct.h>
24 #include <linux/dma-map-ops.h>
25 #include <linux/efi.h>
26 #include <linux/swiotlb.h>
27 #include <linux/vmalloc.h>
28 #include <linux/mm.h>
29 #include <linux/kexec.h>
30 #include <linux/crash_dump.h>
31 #include <linux/hugetlb.h>
32 #include <linux/acpi_iort.h>
33 #include <linux/rk-dma-heap.h>
34
35 #include <asm/boot.h>
36 #include <asm/fixmap.h>
37 #include <asm/kasan.h>
38 #include <asm/kernel-pgtable.h>
39 #include <asm/kvm_host.h>
40 #include <asm/memory.h>
41 #include <asm/numa.h>
42 #include <asm/sections.h>
43 #include <asm/setup.h>
44 #include <linux/sizes.h>
45 #include <asm/tlb.h>
46 #include <asm/alternative.h>
47
48 /*
49 * We need to be able to catch inadvertent references to memstart_addr
50 * that occur (potentially in generic code) before arm64_memblock_init()
51 * executes, which assigns it its actual value. So use a default value
52 * that cannot be mistaken for a real physical address.
53 */
54 s64 memstart_addr __ro_after_init = -1;
55 EXPORT_SYMBOL(memstart_addr);
56
57 /*
58 * If the corresponding config options are enabled, we create both ZONE_DMA
59 * and ZONE_DMA32. By default ZONE_DMA covers the 32-bit addressable memory
60 * unless restricted on specific platforms (e.g. 30-bit on Raspberry Pi 4).
61 * In such case, ZONE_DMA32 covers the rest of the 32-bit addressable memory,
62 * otherwise it is empty.
63 *
64 * Memory reservation for crash kernel either done early or deferred
65 * depending on DMA memory zones configs (ZONE_DMA) --
66 *
67 * In absence of ZONE_DMA configs arm64_dma_phys_limit initialized
68 * here instead of max_zone_phys(). This lets early reservation of
69 * crash kernel memory which has a dependency on arm64_dma_phys_limit.
70 * Reserving memory early for crash kernel allows linear creation of block
71 * mappings (greater than page-granularity) for all the memory bank rangs.
72 * In this scheme a comparatively quicker boot is observed.
73 *
74 * If ZONE_DMA configs are defined, crash kernel memory reservation
75 * is delayed until DMA zone memory range size initilazation performed in
76 * zone_sizes_init(). The defer is necessary to steer clear of DMA zone
77 * memory range to avoid overlap allocation. So crash kernel memory boundaries
78 * are not known when mapping all bank memory ranges, which otherwise means
79 * not possible to exclude crash kernel range from creating block mappings
80 * so page-granularity mappings are created for the entire memory range.
81 * Hence a slightly slower boot is observed.
82 *
83 * Note: Page-granularity mapppings are necessary for crash kernel memory
84 * range for shrinking its size via /sys/kernel/kexec_crash_size interface.
85 */
86 #if IS_ENABLED(CONFIG_ZONE_DMA) || IS_ENABLED(CONFIG_ZONE_DMA32)
87 phys_addr_t __ro_after_init arm64_dma_phys_limit;
88 #else
89 phys_addr_t __ro_after_init arm64_dma_phys_limit = PHYS_MASK + 1;
90 #endif
91
92 /*
93 * Provide a run-time mean of disabling ZONE_DMA32 if it is enabled via
94 * CONFIG_ZONE_DMA32.
95 */
96 static bool disable_dma32 __ro_after_init;
97
98 #ifdef CONFIG_KEXEC_CORE
99 /*
100 * reserve_crashkernel() - reserves memory for crash kernel
101 *
102 * This function reserves memory area given in "crashkernel=" kernel command
103 * line parameter. The memory reserved is used by dump capture kernel when
104 * primary kernel is crashing.
105 */
reserve_crashkernel(void)106 static void __init reserve_crashkernel(void)
107 {
108 unsigned long long crash_base, crash_size;
109 int ret;
110
111 ret = parse_crashkernel(boot_command_line, memblock_phys_mem_size(),
112 &crash_size, &crash_base);
113 /* no crashkernel= or invalid value specified */
114 if (ret || !crash_size)
115 return;
116
117 crash_size = PAGE_ALIGN(crash_size);
118
119 if (crash_base == 0) {
120 /* Current arm64 boot protocol requires 2MB alignment */
121 crash_base = memblock_find_in_range(0, arm64_dma_phys_limit,
122 crash_size, SZ_2M);
123 if (crash_base == 0) {
124 pr_warn("cannot allocate crashkernel (size:0x%llx)\n",
125 crash_size);
126 return;
127 }
128 } else {
129 /* User specifies base address explicitly. */
130 if (!memblock_is_region_memory(crash_base, crash_size)) {
131 pr_warn("cannot reserve crashkernel: region is not memory\n");
132 return;
133 }
134
135 if (memblock_is_region_reserved(crash_base, crash_size)) {
136 pr_warn("cannot reserve crashkernel: region overlaps reserved memory\n");
137 return;
138 }
139
140 if (!IS_ALIGNED(crash_base, SZ_2M)) {
141 pr_warn("cannot reserve crashkernel: base address is not 2MB aligned\n");
142 return;
143 }
144 }
145 memblock_reserve(crash_base, crash_size);
146
147 pr_info("crashkernel reserved: 0x%016llx - 0x%016llx (%lld MB)\n",
148 crash_base, crash_base + crash_size, crash_size >> 20);
149
150 crashk_res.start = crash_base;
151 crashk_res.end = crash_base + crash_size - 1;
152 }
153 #else
reserve_crashkernel(void)154 static void __init reserve_crashkernel(void)
155 {
156 }
157 #endif /* CONFIG_KEXEC_CORE */
158
159 #ifdef CONFIG_CRASH_DUMP
early_init_dt_scan_elfcorehdr(unsigned long node,const char * uname,int depth,void * data)160 static int __init early_init_dt_scan_elfcorehdr(unsigned long node,
161 const char *uname, int depth, void *data)
162 {
163 const __be32 *reg;
164 int len;
165
166 if (depth != 1 || strcmp(uname, "chosen") != 0)
167 return 0;
168
169 reg = of_get_flat_dt_prop(node, "linux,elfcorehdr", &len);
170 if (!reg || (len < (dt_root_addr_cells + dt_root_size_cells)))
171 return 1;
172
173 elfcorehdr_addr = dt_mem_next_cell(dt_root_addr_cells, ®);
174 elfcorehdr_size = dt_mem_next_cell(dt_root_size_cells, ®);
175
176 return 1;
177 }
178
179 /*
180 * reserve_elfcorehdr() - reserves memory for elf core header
181 *
182 * This function reserves the memory occupied by an elf core header
183 * described in the device tree. This region contains all the
184 * information about primary kernel's core image and is used by a dump
185 * capture kernel to access the system memory on primary kernel.
186 */
reserve_elfcorehdr(void)187 static void __init reserve_elfcorehdr(void)
188 {
189 of_scan_flat_dt(early_init_dt_scan_elfcorehdr, NULL);
190
191 if (!elfcorehdr_size)
192 return;
193
194 if (memblock_is_region_reserved(elfcorehdr_addr, elfcorehdr_size)) {
195 pr_warn("elfcorehdr is overlapped\n");
196 return;
197 }
198
199 memblock_reserve(elfcorehdr_addr, elfcorehdr_size);
200
201 pr_info("Reserving %lldKB of memory at 0x%llx for elfcorehdr\n",
202 elfcorehdr_size >> 10, elfcorehdr_addr);
203 }
204 #else
reserve_elfcorehdr(void)205 static void __init reserve_elfcorehdr(void)
206 {
207 }
208 #endif /* CONFIG_CRASH_DUMP */
209
210 /*
211 * Return the maximum physical address for a zone accessible by the given bits
212 * limit. If DRAM starts above 32-bit, expand the zone to the maximum
213 * available memory, otherwise cap it at 32-bit.
214 */
max_zone_phys(unsigned int zone_bits)215 static phys_addr_t __init max_zone_phys(unsigned int zone_bits)
216 {
217 phys_addr_t zone_mask = DMA_BIT_MASK(zone_bits);
218 phys_addr_t phys_start = memblock_start_of_DRAM();
219
220 if (phys_start > U32_MAX)
221 zone_mask = PHYS_ADDR_MAX;
222 else if (phys_start > zone_mask)
223 zone_mask = U32_MAX;
224
225 return min(zone_mask, memblock_end_of_DRAM() - 1) + 1;
226 }
227
zone_sizes_init(unsigned long min,unsigned long max)228 static void __init zone_sizes_init(unsigned long min, unsigned long max)
229 {
230 unsigned long max_zone_pfns[MAX_NR_ZONES] = {0};
231 unsigned int __maybe_unused acpi_zone_dma_bits;
232 unsigned int __maybe_unused dt_zone_dma_bits;
233 phys_addr_t __maybe_unused dma32_phys_limit = max_zone_phys(32);
234
235 #ifdef CONFIG_ZONE_DMA
236 acpi_zone_dma_bits = fls64(acpi_iort_dma_get_max_cpu_address());
237 dt_zone_dma_bits = fls64(of_dma_get_max_cpu_address(NULL));
238 zone_dma_bits = min3(32U, dt_zone_dma_bits, acpi_zone_dma_bits);
239 arm64_dma_phys_limit = max_zone_phys(zone_dma_bits);
240 max_zone_pfns[ZONE_DMA] = PFN_DOWN(arm64_dma_phys_limit);
241 #endif
242 #ifdef CONFIG_ZONE_DMA32
243 max_zone_pfns[ZONE_DMA32] = disable_dma32 ? 0 : PFN_DOWN(dma32_phys_limit);
244 if (!arm64_dma_phys_limit)
245 arm64_dma_phys_limit = dma32_phys_limit;
246 #endif
247 max_zone_pfns[ZONE_NORMAL] = max;
248
249 free_area_init(max_zone_pfns);
250 }
251
early_disable_dma32(char * buf)252 static int __init early_disable_dma32(char *buf)
253 {
254 if (!buf)
255 return -EINVAL;
256
257 if (!strcmp(buf, "on"))
258 disable_dma32 = true;
259
260 return 0;
261 }
262 early_param("disable_dma32", early_disable_dma32);
263
pfn_valid(unsigned long pfn)264 int pfn_valid(unsigned long pfn)
265 {
266 phys_addr_t addr = pfn << PAGE_SHIFT;
267
268 if ((addr >> PAGE_SHIFT) != pfn)
269 return 0;
270
271 #ifdef CONFIG_SPARSEMEM
272 if (pfn_to_section_nr(pfn) >= NR_MEM_SECTIONS)
273 return 0;
274
275 if (!valid_section(__pfn_to_section(pfn)))
276 return 0;
277
278 /*
279 * ZONE_DEVICE memory does not have the memblock entries.
280 * memblock_is_map_memory() check for ZONE_DEVICE based
281 * addresses will always fail. Even the normal hotplugged
282 * memory will never have MEMBLOCK_NOMAP flag set in their
283 * memblock entries. Skip memblock search for all non early
284 * memory sections covering all of hotplug memory including
285 * both normal and ZONE_DEVICE based.
286 */
287 if (!early_section(__pfn_to_section(pfn)))
288 return pfn_section_valid(__pfn_to_section(pfn), pfn);
289 #endif
290 return memblock_is_map_memory(addr);
291 }
292 EXPORT_SYMBOL(pfn_valid);
293
294 static phys_addr_t memory_limit = PHYS_ADDR_MAX;
295
296 /*
297 * Limit the memory size that was specified via FDT.
298 */
early_mem(char * p)299 static int __init early_mem(char *p)
300 {
301 if (!p)
302 return 1;
303
304 memory_limit = memparse(p, &p) & PAGE_MASK;
305 pr_notice("Memory limited to %lldMB\n", memory_limit >> 20);
306
307 return 0;
308 }
309 early_param("mem", early_mem);
310
early_init_dt_scan_usablemem(unsigned long node,const char * uname,int depth,void * data)311 static int __init early_init_dt_scan_usablemem(unsigned long node,
312 const char *uname, int depth, void *data)
313 {
314 struct memblock_region *usablemem = data;
315 const __be32 *reg;
316 int len;
317
318 if (depth != 1 || strcmp(uname, "chosen") != 0)
319 return 0;
320
321 reg = of_get_flat_dt_prop(node, "linux,usable-memory-range", &len);
322 if (!reg || (len < (dt_root_addr_cells + dt_root_size_cells)))
323 return 1;
324
325 usablemem->base = dt_mem_next_cell(dt_root_addr_cells, ®);
326 usablemem->size = dt_mem_next_cell(dt_root_size_cells, ®);
327
328 return 1;
329 }
330
fdt_enforce_memory_region(void)331 static void __init fdt_enforce_memory_region(void)
332 {
333 struct memblock_region reg = {
334 .size = 0,
335 };
336
337 of_scan_flat_dt(early_init_dt_scan_usablemem, ®);
338
339 if (reg.size)
340 memblock_cap_memory_range(reg.base, reg.size);
341 }
342
arm64_memblock_init(void)343 void __init arm64_memblock_init(void)
344 {
345 const s64 linear_region_size = BIT(vabits_actual - 1);
346
347 /* Handle linux,usable-memory-range property */
348 fdt_enforce_memory_region();
349
350 /* Remove memory above our supported physical address size */
351 memblock_remove(1ULL << PHYS_MASK_SHIFT, ULLONG_MAX);
352
353 /*
354 * Select a suitable value for the base of physical memory.
355 */
356 memstart_addr = round_down(memblock_start_of_DRAM(),
357 ARM64_MEMSTART_ALIGN);
358
359 /*
360 * Remove the memory that we will not be able to cover with the
361 * linear mapping. Take care not to clip the kernel which may be
362 * high in memory.
363 */
364 memblock_remove(max_t(u64, memstart_addr + linear_region_size,
365 __pa_symbol(_end)), ULLONG_MAX);
366 if (memstart_addr + linear_region_size < memblock_end_of_DRAM()) {
367 /* ensure that memstart_addr remains sufficiently aligned */
368 memstart_addr = round_up(memblock_end_of_DRAM() - linear_region_size,
369 ARM64_MEMSTART_ALIGN);
370 memblock_remove(0, memstart_addr);
371 }
372
373 /*
374 * If we are running with a 52-bit kernel VA config on a system that
375 * does not support it, we have to place the available physical
376 * memory in the 48-bit addressable part of the linear region, i.e.,
377 * we have to move it upward. Since memstart_addr represents the
378 * physical address of PAGE_OFFSET, we have to *subtract* from it.
379 */
380 if (IS_ENABLED(CONFIG_ARM64_VA_BITS_52) && (vabits_actual != 52))
381 memstart_addr -= _PAGE_OFFSET(48) - _PAGE_OFFSET(52);
382
383 /*
384 * Apply the memory limit if it was set. Since the kernel may be loaded
385 * high up in memory, add back the kernel region that must be accessible
386 * via the linear mapping.
387 */
388 if (memory_limit != PHYS_ADDR_MAX) {
389 memblock_mem_limit_remove_map(memory_limit);
390 memblock_add(__pa_symbol(_text), (u64)(_end - _text));
391 }
392
393 if (IS_ENABLED(CONFIG_BLK_DEV_INITRD) && phys_initrd_size) {
394 /*
395 * Add back the memory we just removed if it results in the
396 * initrd to become inaccessible via the linear mapping.
397 * Otherwise, this is a no-op
398 */
399 u64 base = phys_initrd_start & PAGE_MASK;
400 u64 size = PAGE_ALIGN(phys_initrd_start + phys_initrd_size) - base;
401
402 /*
403 * We can only add back the initrd memory if we don't end up
404 * with more memory than we can address via the linear mapping.
405 * It is up to the bootloader to position the kernel and the
406 * initrd reasonably close to each other (i.e., within 32 GB of
407 * each other) so that all granule/#levels combinations can
408 * always access both.
409 */
410 if (WARN(base < memblock_start_of_DRAM() ||
411 base + size > memblock_start_of_DRAM() +
412 linear_region_size,
413 "initrd not fully accessible via the linear mapping -- please check your bootloader ...\n")) {
414 phys_initrd_size = 0;
415 } else {
416 memblock_remove(base, size); /* clear MEMBLOCK_ flags */
417 memblock_add(base, size);
418 memblock_reserve(base, size);
419 }
420 }
421
422 if (IS_ENABLED(CONFIG_RANDOMIZE_BASE)) {
423 extern u16 memstart_offset_seed;
424 u64 mmfr0 = read_cpuid(ID_AA64MMFR0_EL1);
425 int parange = cpuid_feature_extract_unsigned_field(
426 mmfr0, ID_AA64MMFR0_PARANGE_SHIFT);
427 s64 range = linear_region_size -
428 BIT(id_aa64mmfr0_parange_to_phys_shift(parange));
429
430 /*
431 * If the size of the linear region exceeds, by a sufficient
432 * margin, the size of the region that the physical memory can
433 * span, randomize the linear region as well.
434 */
435 if (memstart_offset_seed > 0 && range >= (s64)ARM64_MEMSTART_ALIGN) {
436 range /= ARM64_MEMSTART_ALIGN;
437 memstart_addr -= ARM64_MEMSTART_ALIGN *
438 ((range * memstart_offset_seed) >> 16);
439 }
440 }
441
442 /*
443 * Register the kernel text, kernel data, initrd, and initial
444 * pagetables with memblock.
445 */
446 memblock_reserve(__pa_symbol(_text), _end - _text);
447 if (IS_ENABLED(CONFIG_BLK_DEV_INITRD) && phys_initrd_size) {
448 /* the generic initrd code expects virtual addresses */
449 initrd_start = __phys_to_virt(phys_initrd_start);
450 initrd_end = initrd_start + phys_initrd_size;
451 }
452
453 early_init_fdt_scan_reserved_mem();
454
455 reserve_elfcorehdr();
456
457 if (!IS_ENABLED(CONFIG_ZONE_DMA) && !IS_ENABLED(CONFIG_ZONE_DMA32))
458 reserve_crashkernel();
459
460 high_memory = __va(memblock_end_of_DRAM() - 1) + 1;
461 }
462
bootmem_init(void)463 void __init bootmem_init(void)
464 {
465 unsigned long min, max;
466
467 min = PFN_UP(memblock_start_of_DRAM());
468 max = PFN_DOWN(memblock_end_of_DRAM());
469
470 early_memtest(min << PAGE_SHIFT, max << PAGE_SHIFT);
471
472 max_pfn = max_low_pfn = max;
473 min_low_pfn = min;
474
475 arm64_numa_init();
476
477 /*
478 * must be done after arm64_numa_init() which calls numa_init() to
479 * initialize node_online_map that gets used in hugetlb_cma_reserve()
480 * while allocating required CMA size across online nodes.
481 */
482 #if defined(CONFIG_HUGETLB_PAGE) && defined(CONFIG_CMA)
483 arm64_hugetlb_cma_reserve();
484 #endif
485
486 dma_pernuma_cma_reserve();
487
488 kvm_hyp_reserve();
489
490 /*
491 * sparse_init() tries to allocate memory from memblock, so must be
492 * done after the fixed reservations
493 */
494 sparse_init();
495 zone_sizes_init(min, max);
496
497 /*
498 * Reserve the CMA area after arm64_dma_phys_limit was initialised.
499 */
500 dma_contiguous_reserve(arm64_dma_phys_limit);
501 rk_dma_heap_cma_setup();
502
503 /*
504 * request_standard_resources() depends on crashkernel's memory being
505 * reserved, so do it here.
506 */
507 if (IS_ENABLED(CONFIG_ZONE_DMA) || IS_ENABLED(CONFIG_ZONE_DMA32))
508 reserve_crashkernel();
509
510 memblock_dump_all();
511 }
512
513 #ifndef CONFIG_SPARSEMEM_VMEMMAP
free_memmap(unsigned long start_pfn,unsigned long end_pfn)514 static inline void free_memmap(unsigned long start_pfn, unsigned long end_pfn)
515 {
516 struct page *start_pg, *end_pg;
517 unsigned long pg, pgend;
518
519 /*
520 * Convert start_pfn/end_pfn to a struct page pointer.
521 */
522 start_pg = pfn_to_page(start_pfn - 1) + 1;
523 end_pg = pfn_to_page(end_pfn - 1) + 1;
524
525 /*
526 * Convert to physical addresses, and round start upwards and end
527 * downwards.
528 */
529 pg = (unsigned long)PAGE_ALIGN(__pa(start_pg));
530 pgend = (unsigned long)__pa(end_pg) & PAGE_MASK;
531
532 /*
533 * If there are free pages between these, free the section of the
534 * memmap array.
535 */
536 if (pg < pgend)
537 memblock_free(pg, pgend - pg);
538 }
539
540 /*
541 * The mem_map array can get very big. Free the unused area of the memory map.
542 */
free_unused_memmap(void)543 static void __init free_unused_memmap(void)
544 {
545 unsigned long start, end, prev_end = 0;
546 int i;
547
548 for_each_mem_pfn_range(i, MAX_NUMNODES, &start, &end, NULL) {
549 #ifdef CONFIG_SPARSEMEM
550 /*
551 * Take care not to free memmap entries that don't exist due
552 * to SPARSEMEM sections which aren't present.
553 */
554 start = min(start, ALIGN(prev_end, PAGES_PER_SECTION));
555 #endif
556 /*
557 * If we had a previous bank, and there is a space between the
558 * current bank and the previous, free it.
559 */
560 if (prev_end && prev_end < start)
561 free_memmap(prev_end, start);
562
563 /*
564 * Align up here since the VM subsystem insists that the
565 * memmap entries are valid from the bank end aligned to
566 * MAX_ORDER_NR_PAGES.
567 */
568 prev_end = ALIGN(end, MAX_ORDER_NR_PAGES);
569 }
570
571 #ifdef CONFIG_SPARSEMEM
572 if (!IS_ALIGNED(prev_end, PAGES_PER_SECTION))
573 free_memmap(prev_end, ALIGN(prev_end, PAGES_PER_SECTION));
574 #endif
575 }
576 #endif /* !CONFIG_SPARSEMEM_VMEMMAP */
577
578 /*
579 * mem_init() marks the free areas in the mem_map and tells us how much memory
580 * is free. This is done after various parts of the system have claimed their
581 * memory after the kernel image.
582 */
mem_init(void)583 void __init mem_init(void)
584 {
585 if (swiotlb_force == SWIOTLB_FORCE ||
586 max_pfn > PFN_DOWN(arm64_dma_phys_limit))
587 swiotlb_init(1);
588 else
589 swiotlb_force = SWIOTLB_NO_FORCE;
590
591 set_max_mapnr(max_pfn - PHYS_PFN_OFFSET);
592
593 #ifndef CONFIG_SPARSEMEM_VMEMMAP
594 free_unused_memmap();
595 #endif
596 /* this will put all unused low memory onto the freelists */
597 memblock_free_all();
598
599 mem_init_print_info(NULL);
600
601 /*
602 * Check boundaries twice: Some fundamental inconsistencies can be
603 * detected at build time already.
604 */
605 #ifdef CONFIG_COMPAT
606 BUILD_BUG_ON(TASK_SIZE_32 > DEFAULT_MAP_WINDOW_64);
607 #endif
608
609 if (PAGE_SIZE >= 16384 && get_num_physpages() <= 128) {
610 extern int sysctl_overcommit_memory;
611 /*
612 * On a machine this small we won't get anywhere without
613 * overcommit, so turn it on by default.
614 */
615 sysctl_overcommit_memory = OVERCOMMIT_ALWAYS;
616 }
617 }
618
free_initmem(void)619 void free_initmem(void)
620 {
621 free_reserved_area(lm_alias(__init_begin),
622 lm_alias(__init_end),
623 POISON_FREE_INITMEM, "unused kernel");
624 /*
625 * Unmap the __init region but leave the VM area in place. This
626 * prevents the region from being reused for kernel modules, which
627 * is not supported by kallsyms.
628 */
629 unmap_kernel_range((u64)__init_begin, (u64)(__init_end - __init_begin));
630 }
631
dump_mem_limit(void)632 void dump_mem_limit(void)
633 {
634 if (memory_limit != PHYS_ADDR_MAX) {
635 pr_emerg("Memory Limit: %llu MB\n", memory_limit >> 20);
636 } else {
637 pr_emerg("Memory Limit: none\n");
638 }
639 }
640