public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Peng Fan <peng.fan@oss.nxp.com>
To: Daniel Baluta <daniel.baluta@oss.nxp.com>
Cc: Bjorn Andersson <andersson@kernel.org>,
	Mathieu Poirier <mathieu.poirier@linaro.org>,
	Rob Herring <robh@kernel.org>,
	Krzysztof Kozlowski <krzk+dt@kernel.org>,
	Conor Dooley <conor+dt@kernel.org>, Frank Li <Frank.Li@nxp.com>,
	Sascha Hauer <s.hauer@pengutronix.de>,
	Pengutronix Kernel Team <kernel@pengutronix.de>,
	Fabio Estevam <festevam@gmail.com>,
	linux-remoteproc@vger.kernel.org, devicetree@vger.kernel.org,
	imx@lists.linux.dev, linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, Peng Fan <peng.fan@nxp.com>
Subject: Re: [PATCH 1/4] dt-bindings: remoteproc: imx-rproc: Introduce fsl,reset-vector-mask
Date: Fri, 20 Mar 2026 21:02:19 +0800	[thread overview]
Message-ID: <ab1D2qIUh+KPnS7p@shlinux89> (raw)
In-Reply-To: <3e1a3f07-8c0c-4757-afd2-b9e6574a6274@oss.nxp.com>


Hi Daniel,

On Fri, Mar 20, 2026 at 11:46:53AM +0200, Daniel Baluta wrote:
>On 3/12/26 14:36, Peng Fan (OSS) wrote:
>> From: Peng Fan <peng.fan@nxp.com>
>>
>> Cortex-M[7,33] processors use a fixed reset vector table format:
>>
>>   0x00  Initial SP value
>>   0x04  Reset vector
>>   0x08  NMI
>>   0x0C  ...
>>   ...
>>   IRQ[n]
>>
>> In ELF images, the corresponding layout is:
>>
>> reset_vectors:  --> hardware reset address
>>         .word __stack_end__
>>         .word Reset_Handler
>>         .word NMI_Handler
>>         .word HardFault_Handler
>>         ...
>>         .word UART_IRQHandler
>>         .word SPI_IRQHandler
>>         ...
>>
>> Reset_Handler:  --> ELF entry point address
>>         ...
>>
>> The hardware fetches the first two words from reset_vectors and populates
>> SP with __stack_end__ and PC with Reset_Handler. Execution proceeds from
>> Reset_Handler.
>>
>> However, the ELF entry point does not always match the hardware reset
>> address. For example, on i.MX94 CM33S:
>>
>>   ELF entry point:           0x0ffc211d
>>   CM33S hardware reset base: 0x0ffc0000
>>
>> To derive the correct hardware reset address, the unused lower bits must
>> be masked off. The boot code should apply a SoC‑specific mask before
>> programming the reset address registers, e.g.:
>>
>>   reset_address = entry & reset-vector-mask
>
>
>What do you think about this idea:
>
>Use fsl,reset-vector-base instead of a mask. It could happen that for example
>
>a CM7 instance has explicit requirements to boot from TCM but the entry point is in DRAM.
>Then masking won't help.
>
>fsl,reset-vector-base is always fixed hardware integration dependent and you can always
>
>specify it in DT.
>

Thanks for sharing ideas. But this not work:
1. User start an elf which is built to run in TCM. the reset vector is in TCM.
2. User stop remote processor
3. User start an elf which is built to run in DDR. the reset vector is in DDR.

So a fixed fsl,reset-vector-base not work. We need a per elf reset vector base.

For the case you list about boot from TCM, entry is DRAM. this is i.MX8M DDR
elf demo. The hardware always fetches PC/STACK from 0, but elf entry is in
DDR. We always use 0 as boot address for i.MX8M, no matter what elf entry is.

For i.MX95/943, there is an register to configure M7 or M33S start address,
If the image is designed to run in DDR, user should set reset vector and elf
entry both in DDR. If the image is designed to run TCM, but space is not enough,
DDR is also used, the reset vector and elf entry should be both in TCM.

Per my talk with NXP SDK team, It is less that 16KB from reset vector to
elf entry address.

But in case people really want the case you list, we may use a flag
BIT0: 0 means base
BIT0: 1 means mask

fsl,reset-vector = <0x[x] | BIT(0)>;  --> mask
fsl,reset-vector = <0x[x] & ~BIT(0)>; --> base

Thanks
Peng
>

  reply	other threads:[~2026-03-20 13:00 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-12 12:36 [PATCH 0/4] Add i.MX94 remoteproc support and reset vector handling improvements Peng Fan (OSS)
2026-03-12 12:36 ` [PATCH 1/4] dt-bindings: remoteproc: imx-rproc: Introduce fsl,reset-vector-mask Peng Fan (OSS)
2026-03-20  9:46   ` Daniel Baluta
2026-03-20 13:02     ` Peng Fan [this message]
2026-03-23 15:15       ` Daniel Baluta
2026-03-23 19:15   ` Rob Herring
2026-03-23 20:20     ` Daniel Baluta
2026-03-12 12:36 ` [PATCH 2/4] dt-bindings: remoteproc: imx-rproc: Support i.MX94 Peng Fan (OSS)
2026-03-12 14:48   ` Frank Li
2026-03-23 15:16   ` Daniel Baluta
2026-03-23 19:16   ` Rob Herring (Arm)
2026-03-12 12:36 ` [PATCH 3/4] remoteproc: imx_rproc: Pass bootaddr to SM CPU/LMM reset vector Peng Fan (OSS)
2026-03-12 12:36 ` [PATCH 4/4] remoteproc: imx_rproc: Add support for i.MX94 Peng Fan (OSS)
2026-03-12 19:24   ` Frank Li
2026-03-23 15:24   ` Daniel Baluta
2026-03-20  9:19 ` [PATCH 0/4] Add i.MX94 remoteproc support and reset vector handling improvements Daniel Baluta
2026-03-23 14:32   ` Mathieu Poirier
2026-03-25  8:41     ` Daniel Baluta
2026-03-26 12:20       ` Peng Fan

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=ab1D2qIUh+KPnS7p@shlinux89 \
    --to=peng.fan@oss.nxp.com \
    --cc=Frank.Li@nxp.com \
    --cc=andersson@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=daniel.baluta@oss.nxp.com \
    --cc=devicetree@vger.kernel.org \
    --cc=festevam@gmail.com \
    --cc=imx@lists.linux.dev \
    --cc=kernel@pengutronix.de \
    --cc=krzk+dt@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-remoteproc@vger.kernel.org \
    --cc=mathieu.poirier@linaro.org \
    --cc=peng.fan@nxp.com \
    --cc=robh@kernel.org \
    --cc=s.hauer@pengutronix.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox