mirror of https://github.com/OpenIPC/firmware.git
64 lines
2.3 KiB
Diff
64 lines
2.3 KiB
Diff
diff -drupN a/arch/arm64/mm/init.c b/arch/arm64/mm/init.c
|
|
--- a/arch/arm64/mm/init.c 2018-08-06 17:23:04.000000000 +0300
|
|
+++ b/arch/arm64/mm/init.c 2022-06-12 05:28:14.000000000 +0300
|
|
@@ -36,6 +36,7 @@
|
|
#include <linux/efi.h>
|
|
#include <linux/swiotlb.h>
|
|
#include <linux/vmalloc.h>
|
|
+#include <linux/mm.h>
|
|
|
|
#include <asm/boot.h>
|
|
#include <asm/fixmap.h>
|
|
@@ -145,9 +146,11 @@ static void __init zone_sizes_init(unsig
|
|
#endif /* CONFIG_NUMA */
|
|
|
|
#ifdef CONFIG_HAVE_ARCH_PFN_VALID
|
|
+#define PFN_MASK ((1UL << (64 - PAGE_SHIFT)) - 1)
|
|
+
|
|
int pfn_valid(unsigned long pfn)
|
|
{
|
|
- return memblock_is_map_memory(pfn << PAGE_SHIFT);
|
|
+ return (pfn & PFN_MASK) == pfn && memblock_is_map_memory(pfn << PAGE_SHIFT);
|
|
}
|
|
EXPORT_SYMBOL(pfn_valid);
|
|
#endif
|
|
@@ -209,8 +212,8 @@ void __init arm64_memblock_init(void)
|
|
* linear mapping. Take care not to clip the kernel which may be
|
|
* high in memory.
|
|
*/
|
|
- memblock_remove(max_t(u64, memstart_addr + linear_region_size, __pa(_end)),
|
|
- ULLONG_MAX);
|
|
+ memblock_remove(max_t(u64, memstart_addr + linear_region_size,
|
|
+ __pa_symbol(_end)), ULLONG_MAX);
|
|
if (memstart_addr + linear_region_size < memblock_end_of_DRAM()) {
|
|
/* ensure that memstart_addr remains sufficiently aligned */
|
|
memstart_addr = round_up(memblock_end_of_DRAM() - linear_region_size,
|
|
@@ -225,7 +228,7 @@ void __init arm64_memblock_init(void)
|
|
*/
|
|
if (memory_limit != (phys_addr_t)ULLONG_MAX) {
|
|
memblock_mem_limit_remove_map(memory_limit);
|
|
- memblock_add(__pa(_text), (u64)(_end - _text));
|
|
+ memblock_add(__pa_symbol(_text), (u64)(_end - _text));
|
|
}
|
|
|
|
if (IS_ENABLED(CONFIG_BLK_DEV_INITRD) && initrd_start) {
|
|
@@ -278,7 +281,7 @@ void __init arm64_memblock_init(void)
|
|
* Register the kernel text, kernel data, initrd, and initial
|
|
* pagetables with memblock.
|
|
*/
|
|
- memblock_reserve(__pa(_text), _end - _text);
|
|
+ memblock_reserve(__pa_symbol(_text), _end - _text);
|
|
#ifdef CONFIG_BLK_DEV_INITRD
|
|
if (initrd_start) {
|
|
memblock_reserve(initrd_start, initrd_end - initrd_start);
|
|
@@ -488,7 +491,8 @@ void __init mem_init(void)
|
|
|
|
void free_initmem(void)
|
|
{
|
|
- free_reserved_area(__va(__pa(__init_begin)), __va(__pa(__init_end)),
|
|
+ free_reserved_area(lm_alias(__init_begin),
|
|
+ lm_alias(__init_end),
|
|
0, "unused kernel");
|
|
/*
|
|
* Unmap the __init region but leave the VM area in place. This
|