mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: "Sascha Hauer" <s.hauer@pengutronix.de>
To: "Ahmad Fatoum" <a.fatoum@pengutronix.de>
Cc: barebox@lists.infradead.org, str@pengutronix.de
Subject: Re: [PATCH] ARM: i.MX: prevent use of imx_cpu_type in PBL
Date: Tue, 26 May 2026 06:56:21 +0000	[thread overview]
Message-ID: <E1wRliA-0000000GFNm-02hm@pty.whiteo.stw.pengutronix.de> (raw)
In-Reply-To: <8ca9c8ba-374c-4ded-80ef-1d3f151a72be@pengutronix.de>

On 2026-05-26 08:41, Ahmad Fatoum wrote:
> Hello Sascha,
> 
> On 5/26/26 08:35, Sascha Hauer wrote:
> > On 2026-05-22 15:48, Ahmad Fatoum wrote:
> >> Functions like cpu_is_mx6q internally call cpu_is_mx6() first,
> >> which can be evaluated at compile-time if only i.MX6 boards are enabled.
> >>
> >> This allowed calling cpu_is_mx6q in PBL entry points as long as barebox was
> >> compiled for only a single SoC.
> >>
> >> Since the multi-arch/multi-platform support was added however,
> >> cpu_is_mx6 became a runtime check that's never true in PBL, leading all
> >> cpu_is_mx* in 32-boards to silently fail at runtime.
> >>
> >> We have no in-tree boards that are affected by this, so until some
> >> out-of-tree user is bothered enough to fix is, acknowledge that this no
> >> longer works and turn the silent breakage into a loud compile-time error
> >> whenever anything ends up referencing __imx_cpu_type.
> > 
> > imx_set_cpu_type() has users in PBL:
> > 
> > arch/arm/mach-imx/atf.c:280:    imx_set_cpu_type(IMX_CPU_IMX8MM);
> > arch/arm/mach-imx/atf.c:343:    imx_set_cpu_type(IMX_CPU_IMX8MP);
> > arch/arm/mach-imx/atf.c:406:    imx_set_cpu_type(IMX_CPU_IMX8MN);
> > arch/arm/mach-imx/atf.c:463:    imx_set_cpu_type(IMX_CPU_IMX8MQ);
> > arch/arm/mach-imx/atf.c:492:    imx_set_cpu_type(IMX_CPU_IMX93);
> > 
> > Also several consumers rely on it in PBL:
> > 
> > arch/arm/mach-imx/tzasc.c:358:  if (cpu_is_mx8mm() || cpu_is_mx8mn() || cpu_is_mx8mp())
> > arch/arm/mach-imx/tzasc.c:365:  if (cpu_is_mx8mn() || cpu_is_mx8mp())
> > arch/arm/mach-imx/atf.c:90:     if (cpu_is_mx8mn())
> > arch/arm/mach-imx/atf.c:143:    if (cpu_is_mx8mn())
> > arch/arm/mach-imx/atf.c:198:    if (!IS_ENABLED(CONFIG_ARCH_IMX_ATF_PASS_BL_PARAMS) || cpu_is_mx8mq()) {
> 
> Yes and the definition is still emitted for CONFIG_ARCH_IMX_ATF=y.
> The change here onl affects 32-bit i.MX.

Alright, I have overlooked the || defined(CONFIG_ARCH_IMX_ATF).

Sascha

--
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



  reply	other threads:[~2026-05-26  7:36 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-22 13:48 Ahmad Fatoum
2026-05-26  6:35 ` Sascha Hauer
2026-05-26  6:41   ` Ahmad Fatoum
2026-05-26  6:56     ` Sascha Hauer [this message]
2026-05-26  6:56 ` Sascha Hauer

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=E1wRliA-0000000GFNm-02hm@pty.whiteo.stw.pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=a.fatoum@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=str@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