All of lore.kernel.org
 help / color / mirror / Atom feed
From: Anshul Dalal <anshuld@ti.com>
To: Bryan Brattlof <bb@ti.com>
Cc: <u-boot@lists.denx.de>, <d-gole@ti.com>, <b-padhi@ti.com>,
	<vigneshr@ti.com>, <trini@konsulko.com>, <nm@ti.com>,
	<robertcnelson@gmail.com>, <w.egorov@phytec.de>,
	<francesco.dolcini@toradex.com>, <ggiordano@phytec.com>,
	<m-chawdhry@ti.com>, <a-nandan@ti.com>, <afd@ti.com>,
	<u-kumar1@ti.com>, <devarsht@ti.com>,
	<ilias.apalodimas@linaro.org>
Subject: Re: [PATCH -next v6 10/10] mach-k3: add carveouts for TFA and optee
Date: Wed, 10 Sep 2025 17:35:07 +0530	[thread overview]
Message-ID: <DCP3UJR6WC44.CKQ79WHIG19X@ti.com> (raw)
In-Reply-To: <20250910111434.xz57ywvmx6kc7ku5@bryanbrattlof.com>

On Wed Sep 10, 2025 at 4:44 PM IST, Bryan Brattlof wrote:
> On September  5, 2025 thus sayeth Anshul Dalal:
>> K3 platforms have reserved memory regions for TFA and OPTEE which should
>> be unmapped for U-Boot.
>> 
>> Therefore this patch adds the necessary fdt fixups to properly set the
>> load address for TFA/OPTEE and unmaps both by mmu_unmap_reserved_mem.
>> 
>> Signed-off-by: Anshul Dalal <anshuld@ti.com>
>> ---
>>  arch/arm/mach-k3/common.c | 26 ++++++++++++++++++++++++++
>>  1 file changed, 26 insertions(+)
>> 
>> diff --git a/arch/arm/mach-k3/common.c b/arch/arm/mach-k3/common.c
>> index 9c2fe92cf25..71fc7d31abe 100644
>> --- a/arch/arm/mach-k3/common.c
>> +++ b/arch/arm/mach-k3/common.c
>> @@ -31,6 +31,7 @@
>>  #include <dm/uclass-internal.h>
>>  #include <dm/device-internal.h>
>>  #include <asm/armv8/mmu.h>
>> +#include <mach/k3-common-fdt.h>
>>  #include <mach/k3-ddr.h>
>>  
>>  #define PROC_BOOT_CTRL_FLAG_R5_CORE_HALT	0x00000001
>> @@ -263,6 +264,7 @@ void board_prep_linux(struct bootm_headers *images)
>>  
>>  void enable_caches(void)
>>  {
>> +	void *fdt = (void *)gd->fdt_blob;
>>  	int ret;
>>  
>>  	ret = mem_map_fix_dram_banks(K3_MEM_MAP_FIRST_BANK_IDX, K3_MEM_MAP_LEN,
>> @@ -273,6 +275,30 @@ void enable_caches(void)
>>  
>>  	mmu_setup();
>>  
>> +	if (CONFIG_K3_ATF_LOAD_ADDR >= CFG_SYS_SDRAM_BASE) {
>> +		ret = fdt_fixup_reserved(fdt, "tfa", CONFIG_K3_ATF_LOAD_ADDR,
>> +					 0x80000);
>> +		if (ret)
>> +			debug("%s: Failed to perform tfa fixups (%s)\n",
>> +			      __func__, fdt_strerror(ret));
>> +		ret = mmu_unmap_reserved_mem("tfa");
>> +		if (ret)
>> +			debug("%s: Failed to unmap tfa rsvd mem (%s)\n",
>> +			      __func__, fdt_strerror(ret));
>> +	}
>> +
>> +	if (CONFIG_K3_OPTEE_LOAD_ADDR >= CFG_SYS_SDRAM_BASE) {
>> +		ret = fdt_fixup_reserved(fdt, "optee",
>> +					 CONFIG_K3_OPTEE_LOAD_ADDR, 0x1800000);
>
> We will most likely need to move these sizes into Kconfig. The fact they 
> have remained the same is purely an artifact from us not changing
> anything nor developing much on OP-TEE for most of K3's lifetime.
>
> For future chips BL1 and OP-TEE will likely need to grow.

Yeah, we would probably need to update the fdt_fixup_reserved API as
well which currently just ignores the size we provide if one already
exists in the reserved-memory node.

Regards,
Anshul

  reply	other threads:[~2025-09-10 12:05 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-05  8:18 [PATCH -next v6 0/9] Add support for dynamic MMU configuration Anshul Dalal
2025-09-05  8:18 ` [PATCH -next v6 01/10] mach-k3: use minimal memory map for all K3 Anshul Dalal
2025-09-10  9:42   ` Dhruva Gole
2025-09-05  8:18 ` [PATCH -next v6 02/10] mach-k3: use custom enable_cache Anshul Dalal
2025-09-10  9:44   ` Dhruva Gole
2025-09-05  8:18 ` [PATCH -next v6 03/10] arm: armv8: mmu: export mmu_setup Anshul Dalal
2025-09-10  9:47   ` Dhruva Gole
2025-09-12  5:59   ` Ilias Apalodimas
2025-09-12  6:02     ` Ilias Apalodimas
2025-09-05  8:18 ` [PATCH -next v6 04/10] arm: armv8: invalidate dcache entries on dcache_enable Anshul Dalal
2025-09-10  9:50   ` Dhruva Gole
2025-09-12  6:03   ` Ilias Apalodimas
2025-09-05  8:18 ` [PATCH -next v6 05/10] arm: armv8: mmu: add mem_map_fix_dram_banks Anshul Dalal
2025-09-12  6:33   ` Ilias Apalodimas
2025-09-12  6:38     ` Anshul Dalal
2025-09-12  7:26       ` Ilias Apalodimas
2025-09-12  7:41         ` Anshul Dalal
2025-09-05  8:18 ` [PATCH -next v6 06/10] mach-k3: map all banks using mem_map_fix_dram_banks Anshul Dalal
2025-09-05  8:18 ` [PATCH -next v6 07/10] arm: armv8: mmu: add mmu_unmap_reserved_mem Anshul Dalal
2025-09-12  6:35   ` Ilias Apalodimas
2025-09-05  8:18 ` [PATCH -next v6 08/10] spl: split spl_board_fixups to arch/board specific Anshul Dalal
2025-09-05  8:19 ` [PATCH -next v6 09/10] mach-k3: add reserved memory fixups for next boot stage Anshul Dalal
2025-09-05  8:19 ` [PATCH -next v6 10/10] mach-k3: add carveouts for TFA and optee Anshul Dalal
2025-09-10 11:14   ` Bryan Brattlof
2025-09-10 12:05     ` Anshul Dalal [this message]
2025-09-08 14:20 ` [PATCH -next v6 0/9] Add support for dynamic MMU configuration Wadim Egorov

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=DCP3UJR6WC44.CKQ79WHIG19X@ti.com \
    --to=anshuld@ti.com \
    --cc=a-nandan@ti.com \
    --cc=afd@ti.com \
    --cc=b-padhi@ti.com \
    --cc=bb@ti.com \
    --cc=d-gole@ti.com \
    --cc=devarsht@ti.com \
    --cc=francesco.dolcini@toradex.com \
    --cc=ggiordano@phytec.com \
    --cc=ilias.apalodimas@linaro.org \
    --cc=m-chawdhry@ti.com \
    --cc=nm@ti.com \
    --cc=robertcnelson@gmail.com \
    --cc=trini@konsulko.com \
    --cc=u-boot@lists.denx.de \
    --cc=u-kumar1@ti.com \
    --cc=vigneshr@ti.com \
    --cc=w.egorov@phytec.de \
    /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.