Lines Matching +full:max +full:- +full:virtual +full:- +full:functions
1 // SPDX-License-Identifier: GPL-2.0-only
5 * Copyright (C) 1995-2005 Russell King
24 #include <linux/dma-direct.h>
25 #include <linux/dma-map-ops.h>
40 #include <asm/kernel-pgtable.h>
50 #include <asm/xen/swiotlb-xen.h>
58 s64 memstart_addr __ro_after_init = -1;
63 * and ZONE_DMA32. By default ZONE_DMA covers the 32-bit addressable memory
64 * unless restricted on specific platforms (e.g. 30-bit on Raspberry Pi 4).
65 * In such case, ZONE_DMA32 covers the rest of the 32-bit addressable memory,
89 * in the virtual address space.
118 return min(zone_limit, memblock_end_of_DRAM() - 1) + 1;
134 * Information we get from firmware (e.g. DT dma-ranges) describe DMA
136 * Some of them rely on DMA zone in low 32-bit memory. Keep low RAM
187 s64 linear_region_size = PAGE_END - _PAGE_OFFSET(vabits_actual);
190 * Corner case: 52-bit VA capable systems running KVM in nVHE mode may
212 if ((memblock_end_of_DRAM() - memstart_addr) > linear_region_size)
224 memstart_addr = round_up(memblock_end_of_DRAM() - linear_region_size,
230 * If we are running with a 52-bit kernel VA config on a system that
232 * memory in the 48-bit addressable part of the linear region, i.e.,
237 memstart_addr -= _PAGE_OFFSET(vabits_actual) - _PAGE_OFFSET(52);
246 memblock_add(__pa_symbol(_text), (u64)(_end - _text));
253 * Otherwise, this is a no-op
256 u64 size = PAGE_ALIGN(phys_initrd_start + phys_initrd_size) - base;
269 "initrd not fully accessible via the linear mapping -- please check your bootloader ...\n")) {
282 memblock_reserve(__pa_symbol(_stext), _end - _stext);
284 /* the generic initrd code expects virtual addresses */
294 unsigned long min, max;
297 max = PFN_DOWN(memblock_end_of_DRAM());
299 early_memtest(min << PAGE_SHIFT, max << PAGE_SHIFT);
301 max_pfn = max_low_pfn = max;
372 * scratch using the virtual address range and page size.
396 memblock_free(lm_init_begin, lm_init_end - lm_init_begin);
422 * Choose a random page-aligned base address for a window of 'size' bytes which
423 * entirely contains the interval [start, end - 1].
429 if ((end - start) >= size)
432 max_pgoff = (size - (end - start)) / PAGE_SIZE;
435 return start - pgoff * PAGE_SIZE;
440 * image and other modules. References using PREL32 relocations have a +/-2G
444 * Modules may directly branch to functions and code within the kernel text,
445 * and to functions and code within other modules. These branches will use
446 * CALL26/JUMP26 relocations with a +/-128M range. Without PLTs, we must ensure
462 u64 kernel_size = kernel_end - kernel_start;
473 module_direct_base = kernel_end - SZ_128M;
475 module_plt_base = kernel_end - SZ_2G;
478 u64 max = kernel_end;
483 module_direct_base = random_bounding_box(SZ_128M, min, max);
486 max = module_direct_base + SZ_128M;
490 module_plt_base = random_bounding_box(SZ_2G, min, max);
493 pr_info("%llu pages in range for non-PLT usage",
494 module_direct_base ? (SZ_128M - kernel_size) / PAGE_SIZE : 0);
496 module_plt_base ? (SZ_2G - kernel_size) / PAGE_SIZE : 0);