[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAL_JsqK=cbknmjKa-rtr9vPhaOoYf26KNzvQ0uGabOwy19jcCA@mail.gmail.com>
Date: Mon, 28 Oct 2024 12:33:51 -0500
From: Rob Herring <robh@...nel.org>
To: Will Deacon <will@...nel.org>
Cc: Usama Arif <usamaarif642@...il.com>, mark.rutland@....com, leitao@...ian.org,
catalin.marinas@....com, tglx@...utronix.de, chris@...kel.net,
saravanak@...gle.com, linux-arm-kernel@...ts.infradead.org,
linux-kernel@...r.kernel.org, devicetree@...r.kernel.org,
kexec@...ts.infradead.org, loongarch@...ts.linux.dev,
linux-sh@...r.kernel.org, linux-riscv@...ts.infradead.org,
linuxppc-dev@...ts.ozlabs.org, linux-openrisc@...r.kernel.org,
linux-mips@...r.kernel.org, linux-csky@...r.kernel.org
Subject: Re: [PATCH v2] of/fdt: add dt_phys arg to early_init_dt_scan and early_init_dt_verify
On Mon, Oct 28, 2024 at 10:41 AM Will Deacon <will@...nel.org> wrote:
>
> On Wed, Oct 23, 2024 at 06:14:26PM +0100, Usama Arif wrote:
> > __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().
> >
> > Reported-by: Breno Leitao <leitao@...ian.org>
> > Suggested-by: Mark Rutland <mark.rutland@....com>
> > Signed-off-by: Usama Arif <usamaarif642@...il.com>
> > Fixes: ac10be5cdbfa ("arm64: Use common of_kexec_alloc_and_setup_fdt()")
> > ---
> > v1 -> 2:
> > - pass dt_phys in early_init_dt_scan instead of creating
> > anorther arch->dt function (Rob Herring)
> > ---
> > arch/arc/kernel/devtree.c | 2 +-
> > arch/arm/kernel/devtree.c | 2 +-
> > arch/arm64/kernel/setup.c | 6 +++++-
> > arch/csky/kernel/setup.c | 4 ++--
> > arch/loongarch/kernel/setup.c | 2 +-
> > arch/microblaze/kernel/prom.c | 2 +-
> > arch/mips/kernel/prom.c | 2 +-
> > arch/mips/kernel/relocate.c | 2 +-
> > arch/nios2/kernel/prom.c | 4 ++--
> > arch/openrisc/kernel/prom.c | 2 +-
> > arch/powerpc/kernel/dt_cpu_ftrs.c | 2 +-
> > arch/powerpc/kernel/prom.c | 2 +-
> > arch/powerpc/platforms/pseries/plpks.c | 2 +-
> > arch/riscv/kernel/setup.c | 2 +-
> > arch/sh/kernel/setup.c | 2 +-
> > arch/um/kernel/dtb.c | 2 +-
> > arch/x86/kernel/devicetree.c | 2 +-
> > arch/xtensa/kernel/setup.c | 2 +-
> > drivers/of/fdt.c | 14 ++++++++------
> > drivers/of/kexec.c | 2 +-
> > include/linux/of_fdt.h | 5 +++--
> > 21 files changed, 36 insertions(+), 29 deletions(-)
> >
> > diff --git a/arch/arc/kernel/devtree.c b/arch/arc/kernel/devtree.c
> > index 4c9e61457b2f..cc6ac7d128aa 100644
> > --- a/arch/arc/kernel/devtree.c
> > +++ b/arch/arc/kernel/devtree.c
> > @@ -62,7 +62,7 @@ const struct machine_desc * __init setup_machine_fdt(void *dt)
> > const struct machine_desc *mdesc;
> > unsigned long dt_root;
> >
> > - if (!early_init_dt_scan(dt))
> > + if (!early_init_dt_scan(dt, __pa(dt)))
> > return NULL;
> >
> > mdesc = of_flat_dt_match_machine(NULL, arch_get_next_mach);
> > diff --git a/arch/arm/kernel/devtree.c b/arch/arm/kernel/devtree.c
> > index fdb74e64206a..3b78966e750a 100644
> > --- a/arch/arm/kernel/devtree.c
> > +++ b/arch/arm/kernel/devtree.c
> > @@ -200,7 +200,7 @@ const struct machine_desc * __init setup_machine_fdt(void *dt_virt)
> >
> > mdesc_best = &__mach_desc_GENERIC_DT;
> >
> > - if (!dt_virt || !early_init_dt_verify(dt_virt))
> > + if (!dt_virt || !early_init_dt_verify(dt_virt, __pa(dt_virt)))
> > return NULL;
> >
> > mdesc = of_flat_dt_match_machine(mdesc_best, arch_get_next_mach);
> > diff --git a/arch/arm64/kernel/setup.c b/arch/arm64/kernel/setup.c
> > index b22d28ec8028..177262739c49 100644
> > --- a/arch/arm64/kernel/setup.c
> > +++ b/arch/arm64/kernel/setup.c
> > @@ -175,7 +175,11 @@ static void __init setup_machine_fdt(phys_addr_t dt_phys)
> > if (dt_virt)
> > memblock_reserve(dt_phys, size);
> >
> > - if (!dt_virt || !early_init_dt_scan(dt_virt)) {
> > + /*
> > + * dt_virt is a fixmap address, hence __pa(dt_virt) can't be used.
> > + * Pass dt_phys directly.
> > + */
> > + if (!dt_virt || !early_init_dt_scan(dt_virt, dt_phys)) {
>
> nit: It looks like early_init_dt_verify() will now return false if
> !dt_virt, so we can drop the additional check here.
That was true before, but I'll fix this up when applying.
Rob
Powered by blists - more mailing lists