mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-02-26 00:31:10 -05:00
__pa() is only intended to be used for linear map addresses and using
it for initial_boot_params which is in fixmap for arm64 will give an
incorrect value. Hence save the physical address when it is known at
boot time when calling early_init_dt_scan for arm64 and use it at kexec
time instead of converting the virtual address using __pa().
Note that arm64 doesn't need the FDT region reserved in the DT as the
kernel explicitly reserves the passed in FDT. Therefore, only a debug
warning is fixed with this change.
Reported-by: Breno Leitao <leitao@debian.org>
Suggested-by: Mark Rutland <mark.rutland@arm.com>
Signed-off-by: Usama Arif <usamaarif642@gmail.com>
Fixes: ac10be5cdb ("arm64: Use common of_kexec_alloc_and_setup_fdt()")
Link: https://lore.kernel.org/r/20241023171426.452688-1-usamaarif642@gmail.com
Signed-off-by: Rob Herring (Arm) <robh@kernel.org>
42 lines
732 B
C
42 lines
732 B
C
// SPDX-License-Identifier: GPL-2.0-only
|
|
|
|
#include <linux/init.h>
|
|
#include <linux/of_fdt.h>
|
|
#include <linux/printk.h>
|
|
#include <linux/memblock.h>
|
|
#include <init.h>
|
|
|
|
#include "um_arch.h"
|
|
|
|
static char *dtb __initdata;
|
|
|
|
void uml_dtb_init(void)
|
|
{
|
|
long long size;
|
|
void *area;
|
|
|
|
area = uml_load_file(dtb, &size);
|
|
if (area) {
|
|
if (!early_init_dt_scan(area, __pa(area))) {
|
|
pr_err("invalid DTB %s\n", dtb);
|
|
memblock_free(area, size);
|
|
return;
|
|
}
|
|
|
|
early_init_fdt_scan_reserved_mem();
|
|
}
|
|
|
|
unflatten_device_tree();
|
|
}
|
|
|
|
static int __init uml_dtb_setup(char *line, int *add)
|
|
{
|
|
dtb = line;
|
|
return 0;
|
|
}
|
|
|
|
__uml_setup("dtb=", uml_dtb_setup,
|
|
"dtb=<file>\n"
|
|
" Boot the kernel with the devicetree blob from the specified file.\n"
|
|
);
|