mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: Stefan Kerkmann <s.kerkmann@pengutronix.de>,
	Sascha Hauer <s.hauer@pengutronix.de>
Cc: BAREBOX <barebox@lists.infradead.org>
Subject: Re: [PATCH 3/3] arm: mach-imx: tzasc: convert to cpu_is_mx8xyz macros
Date: Wed, 28 Feb 2024 10:06:35 +0100	[thread overview]
Message-ID: <9edcf72b-5d07-486d-bbd9-2afc8e7af167@pengutronix.de> (raw)
In-Reply-To: <893fb843-8c6d-411e-b67f-c0df0b28efab@pengutronix.de>

Hello Stefan,
Hello Sascha,

On 28.02.24 09:46, Stefan Kerkmann wrote:
>> Another thing is that the usage of cpu_is() has the tendency to lead to
>> cascades of if (cpu_is_x() || cpu_is_y() || cpu_is_z()) which is not
>> paticularly nice to read.
>>
> 
> That is arguably subjective :-).
> 
> For me as a developer that is new to barebox, it was confusing to find two different styles of arch dependent code. I prefer the `cpu_is_xyz` style approach which is used in barebox proper much more.
> 
> In the case of the TZC380 driver the pseudo (as they are probably optimized away) runtime arguments to the init functions seem unnecessarily complicated,

I would suspect they aren't even optimized away, because it's only known
at link-time that the function is only called once, so a late inlining
would require LTO. This means your approach may have a lower overhead
than what we are doing right now... :-)

> as does the approach to define aliases to the same function for all arches. The if style is clearer in intend as it keeps the distinction between the arches local to the parts that are actually different. Which is straight forward to read IMHO.

I also think it's a good idea that in future we should extend to more places
in the i.MX8M init code. The code duplication in ./arch/arm/mach-imx/atf.c
is not a pretty sight.

Cheers,
Ahmad

> 
>> Both are not really strong points, but on the other hand there's not
>> much improvement in this patch, so I tend to not take it.
>>
>>> -bool tzc380_is_enabled(void)
>>> +bool imx8m_tzc380_is_enabled(void)
>>
>> This change is good though as the function is clearly i.MX8 specific.
>>
>> Sascha
>>
> 
> Cheers,
> Stefan
> 

-- 
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:[~2024-02-28  9:07 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-26 14:40 [PATCH 0/3] arm: mach-imx: tzasc: port lock id_swap_bypass bit Stefan Kerkmann
2024-02-26 14:40 ` [PATCH 1/3] arm: mach-imx: tzasc: " Stefan Kerkmann
2024-02-26 16:02   ` Ahmad Fatoum
2024-02-26 16:38   ` ZHIZHIKIN Andrey
2024-02-26 14:40 ` [PATCH 2/3] arm: mach-imx: set cpu type in pbl Stefan Kerkmann
2024-02-26 16:15   ` Ahmad Fatoum
2024-02-26 14:40 ` [PATCH 3/3] arm: mach-imx: tzasc: convert to cpu_is_mx8xyz macros Stefan Kerkmann
2024-02-26 16:10   ` Ahmad Fatoum
2024-02-27  8:44   ` Sascha Hauer
2024-02-28  8:46     ` Stefan Kerkmann
2024-02-28  9:06       ` Ahmad Fatoum [this message]
2024-02-28 11:05       ` Sascha Hauer
2024-02-28 13:17         ` Stefan Kerkmann

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=9edcf72b-5d07-486d-bbd9-2afc8e7af167@pengutronix.de \
    --to=a.fatoum@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=s.hauer@pengutronix.de \
    --cc=s.kerkmann@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