U-Boot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Tom Rini <trini@konsulko.com>
To: Anshul Dalal <anshuld@ti.com>
Cc: u-boot@lists.denx.de, vigneshr@ti.com
Subject: Re: [PATCH v1] ti: k3: abstract common fdt api for reserved mem fixups
Date: Wed, 4 Jun 2025 11:57:41 -0600	[thread overview]
Message-ID: <20250604175741.GA1940110@bill-the-cat> (raw)
In-Reply-To: <20250522150941.563959-1-anshuld@ti.com>

[-- Attachment #1: Type: text/plain, Size: 2640 bytes --]

On Thu, May 22, 2025 at 08:39:40PM +0530, Anshul Dalal wrote:

> The usage of fdt_fixup_reserved is repeated for ATF and OP-TEE for
> multiple platforms, this patch creates a single fdt API for fixing up
> the reserved-memory node with added error handling.
> 
> All k3 platforms already share a common tispl template which ensures
> binaries are loaded as per the respective CONFIG_*_LOAD_ADDR. And the
> provided new_size for the fixup is overridden by the size from fdt node
> anyways. This allows for safe abstraction of the reserved memory fixups
> for all current platforms.
> 
> fdt_fixup_reserved now abstracts the ATF and OP-TEE fixups by calling
> the renamed static fdt_fixup_reserved_memory function with the required
> parameters.
> 
> Signed-off-by: Anshul Dalal <anshuld@ti.com>
[snip]

I think this shows the start of fixing up some problems, but that we
need to do more.

> diff --git a/arch/arm/mach-k3/am62ax/am62a7_fdt.c b/arch/arm/mach-k3/am62ax/am62a7_fdt.c
> index 7f764ab36b5..9a4599432ff 100644
> --- a/arch/arm/mach-k3/am62ax/am62a7_fdt.c
> +++ b/arch/arm/mach-k3/am62ax/am62a7_fdt.c
> @@ -10,8 +10,5 @@
>  
>  int ft_system_setup(void *blob, struct bd_info *bd)
>  {
> -	fdt_fixup_reserved(blob, "tfa", CONFIG_K3_ATF_LOAD_ADDR, 0x80000);
> -	fdt_fixup_reserved(blob, "optee", CONFIG_K3_OPTEE_LOAD_ADDR, 0x1800000);
> -
> -	return 0;
> +	return fdt_fixup_reserved(blob);
>  }

This is good.

> diff --git a/arch/arm/mach-k3/am62px/am62p5_fdt.c b/arch/arm/mach-k3/am62px/am62p5_fdt.c
> index 2c40fa5a594..9f4b1663864 100644
> --- a/arch/arm/mach-k3/am62px/am62p5_fdt.c
> +++ b/arch/arm/mach-k3/am62px/am62p5_fdt.c
> @@ -92,8 +92,5 @@ int ft_system_setup(void *blob, struct bd_info *bd)
>  	fdt_fixup_canfd_nodes_am62p(blob, k3_has_canfd());
>  	fdt_fixup_thermal_zone_nodes_am62p(blob, k3_get_max_temp());
>  	fdt_fixup_cpu_freq_nodes_am62p(blob, k3_get_a53_max_frequency());

Is it really OK for any of the above fixups to fail to happen and be
silently ignored? fdt_fixup_thermal_zone_nodes_am62p() for example looks
like it throws away error conditions from functions it calls. And other
boards are doing similar things.

[sniip]
> +int fdt_fixup_reserved(void *blob)
> +{
> +	int ret;
> +
> +	ret = fdt_fixup_reserved_memory(blob, "tfa", CONFIG_K3_ATF_LOAD_ADDR,
> +					0x80000);
> +	if (ret)
> +		return ret;

Good.

> +	ret = fdt_fixup_reserved_memory(blob, "optee",
> +					CONFIG_K3_OPTEE_LOAD_ADDR, 0x1800000);
> +	if (ret)
> +		return ret;
> +
> +	return 0;

But we can just return fdt_fixup_reserved_memory(...) here.

-- 
Tom

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]

  reply	other threads:[~2025-06-04 17:57 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-22 15:09 [PATCH v1] ti: k3: abstract common fdt api for reserved mem fixups Anshul Dalal
2025-06-04 17:57 ` Tom Rini [this message]
2025-06-05  4:05   ` Anshul Dalal

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=20250604175741.GA1940110@bill-the-cat \
    --to=trini@konsulko.com \
    --cc=anshuld@ti.com \
    --cc=u-boot@lists.denx.de \
    --cc=vigneshr@ti.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox