From: Anshul Dalal <anshuld@ti.com>
To: Tom Rini <trini@konsulko.com>
Cc: <u-boot@lists.denx.de>, <vigneshr@ti.com>, <afd@ti.com>,
<m-chawdhry@ti.com>, <n-francis@ti.com>, <b-liu@ti.com>,
<nm@ti.com>, <bb@ti.com>
Subject: Re: [PATCH v7 08/10] mach-k3: common: enable falcon mode for 62 platform
Date: Mon, 9 Jun 2025 17:32:10 +0530 [thread overview]
Message-ID: <DAHZJMLNMEZ2.230MX338MEONB@ti.com> (raw)
In-Reply-To: <20250606191502.GB1382132@bill-the-cat>
On Sat Jun 7, 2025 at 12:45 AM IST, Tom Rini wrote:
> On Tue, Jun 03, 2025 at 07:54:48PM +0530, Anshul Dalal wrote:
>> We use the spl_board_prepare_for_boot hook to call k3_falcon_prep which
>> is ran after tispl is loaded but before jump_to_image.
>>
>> In here, we find the boot media and load the image just as std falcon
>> flow (since spl_start_uboot returns 0 now). Once the kernel and args are
>> loaded, we perform fdt fixups on the fdt accompanying the kernel (if
>> loaded as FIT) or the loaded up args and return.
>>
>> Now when the flow goes to jump_to_image, we do the regular pre-jump
>> procedure and jump to ATF which jumps to the kernel directly since we
>> have already loaded the kernel and dtb at their respective addresses
>> (PRELOADED_BL33_BASE and K3_HW_CONFIG_BASE).
>>
>> Signed-off-by: Anshul Dalal <anshuld@ti.com>
>> ---
>> arch/arm/mach-k3/common.c | 107 ++++++++++++++++++++++++++++++++++++++
>> 1 file changed, 107 insertions(+)
>>
>> diff --git a/arch/arm/mach-k3/common.c b/arch/arm/mach-k3/common.c
>> index fc230f180d0..70317fec19c 100644
>> --- a/arch/arm/mach-k3/common.c
>> +++ b/arch/arm/mach-k3/common.c
>> @@ -259,8 +259,115 @@ static __maybe_unused void k3_dma_remove(void)
>> pr_warn("DMA Device not found (err=%d)\n", rc);
>> }
>>
>> +#if IS_ENABLED(CONFIG_SPL_OS_BOOT) && !IS_ENABLED(CONFIG_ARM64)
>> +static bool tispl_loaded;
>> +
>> +int spl_start_uboot(void)
>> +{
>> + if (!tispl_loaded)
>> + return 1;
>> + return 0;
>> +}
>> +
>> +static int k3_falcon_fdt_fixup(void *fdt)
>> +{
>> + struct disk_partition info;
>> + struct blk_desc *dev_desc;
>> + char bootmedia[32];
>> + char bootpart[32];
>> + char str[256];
>> + int ret;
>> +
>> + strcpy(bootmedia, env_get("boot"));
>> + strcpy(bootpart, env_get("bootpart"));
>
> Since we're talking secure parts, strncpy is even more important, and
> being aware of:
> * Note that unlike userspace strncpy, this does not %NUL-pad the buffer.
> * However, the result is not %NUL-terminated if the source exceeds
> * @count bytes.
> from lib/string.c
>
Got it, I'll update the call to strncpy(bootmedia, env_get("boot"), 32)
in the next revision.
>> + ret = blk_get_device_part_str(bootmedia, bootpart, &dev_desc, &info, 0);
>> + if (ret < 0)
>> + printf("Failed to get part details for %s %s [%d]\n", bootmedia,
>> + bootpart, ret);
>
> ... and bail out?
>
That makes sense, in secure world we should not be proceeding in such a
case regardless. I'll propogate the error to the top and hang at
spl_prepare_for_boot if anything fails.
> I feel like all the changes here need a read with "and on failure in secure
> mode what can someone abuse this to do" in mind.
next prev parent reply other threads:[~2025-06-09 12:02 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-03 14:24 [PATCH v7 00/10] Add falcon support for am62a, 62p and 62x Anshul Dalal
2025-06-03 14:24 ` [PATCH v7 01/10] spl: Kconfig: allow K3 devices to use falcon mode Anshul Dalal
2025-06-06 19:06 ` Tom Rini
2025-06-09 12:08 ` Anshul Dalal
2025-06-09 14:59 ` Tom Rini
2025-06-10 8:31 ` Anshul Dalal
2025-06-10 14:44 ` Tom Rini
2025-06-12 4:35 ` Anshul Dalal
2025-06-12 15:05 ` Tom Rini
2025-06-12 15:31 ` Anshul Dalal
2025-06-12 17:47 ` Tom Rini
2025-06-03 14:24 ` [PATCH v7 02/10] spl: make CMD_BOOTZ exclusive with TI_SECURE_DEVICE Anshul Dalal
2025-06-06 19:00 ` Tom Rini
2025-06-03 14:24 ` [PATCH v7 03/10] mach-k3: fix reading size and addr from fdt on R5 Anshul Dalal
2025-06-03 14:24 ` [PATCH v7 04/10] arch: arm: k3-binman: add fit for falcon boot Anshul Dalal
2025-06-06 11:57 ` Bryan Brattlof
2025-06-09 7:28 ` Anshul Dalal
2025-06-09 15:23 ` Andrew Davis
2025-06-10 12:48 ` Anshul Dalal
2025-06-03 14:24 ` [PATCH v7 05/10] mach-k3: sysfw-loader: update img_hdr for falcon Anshul Dalal
2025-06-03 14:24 ` [PATCH v7 06/10] config: add falcon boot config fragment for am62x Anshul Dalal
2025-06-03 14:24 ` [PATCH v7 07/10] board: ti: add default dtb for am62 in falcon mode Anshul Dalal
2025-06-06 19:09 ` Tom Rini
2025-06-09 7:35 ` Anshul Dalal
2025-06-09 14:57 ` Tom Rini
2025-06-10 10:11 ` Anshul Dalal
2025-06-10 14:46 ` Tom Rini
2025-06-10 16:07 ` Anshul Dalal
2025-06-10 22:46 ` Tom Rini
2025-06-03 14:24 ` [PATCH v7 08/10] mach-k3: common: enable falcon mode for 62 platform Anshul Dalal
2025-06-06 19:15 ` Tom Rini
2025-06-09 12:02 ` Anshul Dalal [this message]
2025-06-03 14:24 ` [PATCH v7 09/10] Makefile: update tispl regex to also clean falcon spl Anshul Dalal
2025-06-03 14:24 ` [PATCH v7 10/10] doc: ti: am62: add falcon mode documentation Anshul Dalal
2025-06-30 14:05 ` [PATCH v7 00/10] Add falcon support for am62a, 62p and 62x Francesco Valla
2025-07-01 9:14 ` Raghavendra, Vignesh
2025-07-01 10:23 ` Francesco Valla
2025-07-02 10:01 ` Raghavendra, Vignesh
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=DAHZJMLNMEZ2.230MX338MEONB@ti.com \
--to=anshuld@ti.com \
--cc=afd@ti.com \
--cc=b-liu@ti.com \
--cc=bb@ti.com \
--cc=m-chawdhry@ti.com \
--cc=n-francis@ti.com \
--cc=nm@ti.com \
--cc=trini@konsulko.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 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.