mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-08-05 16:54:27 +00: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>
41 lines
984 B
C
41 lines
984 B
C
// SPDX-License-Identifier: GPL-2.0-or-later
|
|
/*
|
|
* Device tree support
|
|
*
|
|
* Copyright (C) 2013, 2015 Altera Corporation
|
|
* Copyright (C) 2010 Thomas Chou <thomas@wytron.com.tw>
|
|
*
|
|
* Based on MIPS support for CONFIG_OF device tree support
|
|
*
|
|
* Copyright (C) 2010 Cisco Systems Inc. <dediao@cisco.com>
|
|
*/
|
|
|
|
#include <linux/init.h>
|
|
#include <linux/types.h>
|
|
#include <linux/memblock.h>
|
|
#include <linux/of.h>
|
|
#include <linux/of_fdt.h>
|
|
#include <linux/io.h>
|
|
|
|
#include <asm/sections.h>
|
|
|
|
void __init early_init_devtree(void *params)
|
|
{
|
|
__be32 __maybe_unused *dtb = (u32 *)__dtb_start;
|
|
|
|
#if defined(CONFIG_NIOS2_DTB_AT_PHYS_ADDR)
|
|
if (be32_to_cpup((__be32 *)CONFIG_NIOS2_DTB_PHYS_ADDR) ==
|
|
OF_DT_HEADER) {
|
|
params = (void *)CONFIG_NIOS2_DTB_PHYS_ADDR;
|
|
early_init_dt_scan(params, __pa(params));
|
|
return;
|
|
}
|
|
#endif
|
|
|
|
#ifdef CONFIG_NIOS2_DTB_SOURCE_BOOL
|
|
if (be32_to_cpu((__be32) *dtb) == OF_DT_HEADER)
|
|
params = (void *)__dtb_start;
|
|
#endif
|
|
|
|
early_init_dt_scan(params, __pa(params));
|
|
}
|