All of lore.kernel.org
 help / color / mirror / Atom feed
From: Rob Herring <robh@kernel.org>
To: Usama Arif <usamaarif642@gmail.com>
Cc: mark.rutland@arm.com, will@kernel.org, leitao@debian.org,
	catalin.marinas@arm.com, saravanak@google.com,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, devicetree@vger.kernel.org,
	kexec@lists.infradead.org
Subject: Re: [PATCH] of/kexec: save pa of initial_boot_params for arm64 and use it at kexec
Date: Thu, 3 Oct 2024 19:03:16 -0500	[thread overview]
Message-ID: <20241004000316.GA1910499-robh@kernel.org> (raw)
In-Reply-To: <20241003113840.2972416-1-usamaarif642@gmail.com>

On Thu, Oct 03, 2024 at 12:38:40PM +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 stash the physical address when it is known at
> boot time and use it at kexec time instead of converting the virtual
> address using __pa().
> 
> Reported-by: Breno Leitao <leitao@debian.org>
> Suggested-by: Mark Rutland <mark.rutland@arm.com>
> Signed-off-by: Usama Arif <usamaarif642@gmail.com>
> Fixes: ac10be5cdbfa ("arm64: Use common of_kexec_alloc_and_setup_fdt()")
> ---
>  arch/arm64/kernel/setup.c | 8 ++++++++
>  drivers/of/fdt.c          | 6 ++++++
>  drivers/of/kexec.c        | 8 ++++++--
>  include/linux/of_fdt.h    | 2 ++
>  4 files changed, 22 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/arm64/kernel/setup.c b/arch/arm64/kernel/setup.c
> index b22d28ec8028..a4d96f5e2e05 100644
> --- a/arch/arm64/kernel/setup.c
> +++ b/arch/arm64/kernel/setup.c
> @@ -194,6 +194,14 @@ static void __init setup_machine_fdt(phys_addr_t dt_phys)
>  	/* Early fixups are done, map the FDT as read-only now */
>  	fixmap_remap_fdt(dt_phys, &size, PAGE_KERNEL_RO);
>  
> +	/*
> +	 * Save dt_phys address so that it can be used later for kexec. This
> +	 * is done as __pa() is only intended to be used for linear map addresses
> +	 * and using it for initial_boot_params which is in fixmap will give an
> +	 * incorrect value.
> +	 */
> +	set_initial_boot_params_pa(dt_phys);

No new arch->dt functions please. If we need to save off the PA, then do 
that when we set initial_boot_params.

Rob

_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

WARNING: multiple messages have this Message-ID (diff)
From: Rob Herring <robh@kernel.org>
To: Usama Arif <usamaarif642@gmail.com>
Cc: mark.rutland@arm.com, will@kernel.org, leitao@debian.org,
	catalin.marinas@arm.com, saravanak@google.com,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, devicetree@vger.kernel.org,
	kexec@lists.infradead.org
Subject: Re: [PATCH] of/kexec: save pa of initial_boot_params for arm64 and use it at kexec
Date: Thu, 3 Oct 2024 19:03:16 -0500	[thread overview]
Message-ID: <20241004000316.GA1910499-robh@kernel.org> (raw)
In-Reply-To: <20241003113840.2972416-1-usamaarif642@gmail.com>

On Thu, Oct 03, 2024 at 12:38:40PM +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 stash the physical address when it is known at
> boot time and use it at kexec time instead of converting the virtual
> address using __pa().
> 
> Reported-by: Breno Leitao <leitao@debian.org>
> Suggested-by: Mark Rutland <mark.rutland@arm.com>
> Signed-off-by: Usama Arif <usamaarif642@gmail.com>
> Fixes: ac10be5cdbfa ("arm64: Use common of_kexec_alloc_and_setup_fdt()")
> ---
>  arch/arm64/kernel/setup.c | 8 ++++++++
>  drivers/of/fdt.c          | 6 ++++++
>  drivers/of/kexec.c        | 8 ++++++--
>  include/linux/of_fdt.h    | 2 ++
>  4 files changed, 22 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/arm64/kernel/setup.c b/arch/arm64/kernel/setup.c
> index b22d28ec8028..a4d96f5e2e05 100644
> --- a/arch/arm64/kernel/setup.c
> +++ b/arch/arm64/kernel/setup.c
> @@ -194,6 +194,14 @@ static void __init setup_machine_fdt(phys_addr_t dt_phys)
>  	/* Early fixups are done, map the FDT as read-only now */
>  	fixmap_remap_fdt(dt_phys, &size, PAGE_KERNEL_RO);
>  
> +	/*
> +	 * Save dt_phys address so that it can be used later for kexec. This
> +	 * is done as __pa() is only intended to be used for linear map addresses
> +	 * and using it for initial_boot_params which is in fixmap will give an
> +	 * incorrect value.
> +	 */
> +	set_initial_boot_params_pa(dt_phys);

No new arch->dt functions please. If we need to save off the PA, then do 
that when we set initial_boot_params.

Rob


  parent reply	other threads:[~2024-10-04  0:08 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-03 11:38 [PATCH] of/kexec: save pa of initial_boot_params for arm64 and use it at kexec Usama Arif
2024-10-03 11:38 ` Usama Arif
2024-10-03 20:20 ` Saravana Kannan
2024-10-03 20:20   ` Saravana Kannan
2024-10-07 13:54   ` Usama Arif
2024-10-07 13:54     ` Usama Arif
2024-10-04  0:03 ` Rob Herring [this message]
2024-10-04  0:03   ` Rob Herring
2024-10-07 14:06   ` Usama Arif
2024-10-07 14:06     ` Usama Arif
2024-10-07 14:39     ` Rob Herring
2024-10-07 14:39       ` Rob Herring
2024-10-07 15:30       ` Usama Arif
2024-10-07 15:30         ` Usama Arif
2024-10-23  9:38         ` Usama Arif
2024-10-23  9:38           ` Usama Arif
2024-10-23 13:40         ` Rob Herring
2024-10-23 13:40           ` Rob Herring
2024-10-23 14:43           ` Usama Arif
2024-10-23 14:43             ` Usama Arif
2024-10-23 15:17             ` Rob Herring
2024-10-23 15:17               ` Rob Herring
2024-10-23 15:24               ` Usama Arif
2024-10-23 15:24                 ` Usama Arif

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20241004000316.GA1910499-robh@kernel.org \
    --to=robh@kernel.org \
    --cc=catalin.marinas@arm.com \
    --cc=devicetree@vger.kernel.org \
    --cc=kexec@lists.infradead.org \
    --cc=leitao@debian.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=saravanak@google.com \
    --cc=usamaarif642@gmail.com \
    --cc=will@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.