From: Marc Zyngier <maz@kernel.org>
To: Sam Edwards <cfsworks@gmail.com>
Cc: wens@csie.org, Andre Przywara <andre.przywara@arm.com>,
u-boot@lists.denx.de, Jagan Teki <jagan@amarulasolutions.com>
Subject: Re: [PATCH] sunxi: psci: remove redundant initialization from psci_arch_init
Date: Sat, 26 Aug 2023 11:22:01 +0100 [thread overview]
Message-ID: <86cyzaf6ie.wl-maz@kernel.org> (raw)
In-Reply-To: <69909b61-f57e-fc91-43a5-0f4bd23609c9@gmail.com>
On Fri, 25 Aug 2023 19:05:32 +0100,
Sam Edwards <cfsworks@gmail.com> wrote:
>
> On 8/25/23 00:20, Chen-Yu Tsai wrote:
>
> Hi Chen-Yu,
>
> > IIRC the GIC manual says that the secure bit is set or cleared to select
> > which bank of registers is accessed.
>
> Which secure bit are we talking about here? Do we mean the
> *configured* secure bit (SCR.NS, what the code is attempting to clear)
> or the *effective* secure bit (AWPROT[1], et al)? The distinction is
> important in monitor mode (where this function runs) since there (and
> only there) the CPU core ignores the configured setting and runs in
> the secure world unconditionally.
>
> I'm guessing it's most likely the latter since the former isn't
> exposed outside of the CPU core, unless the GIC has some special
> signal going to it...
The GIC definitely has the NS bit routed to it. Otherwise, the secure
configuration would just be an utter joke. Just try it.
>
> > And I suppose it is here to be more robust.
>
> ...but if it is the former (i.e. SCR.NS is significant in this
> function) the code should be retained, but moved *before* the GIC
> register accesses, and the old value of SCR.NS should be restored
> *after*.
>
> Either way: I don't think this line should be kept in its current
> form, because it's written in a way that strongly suggests that we
> want to run in secure mode after exiting monitor mode, which is flatly
> not the case.
Well, history is unfortunately against you on that front. Running on
the secure side definitely was a requirement when this code was
initially written, as the AW BSP *required* to run on the secure side.
If that requirement is no more, great. But I don't think you can
decide that unilaterally.
M.
--
Without deviation from the norm, progress is not possible.
next prev parent reply other threads:[~2023-08-26 10:22 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20230531201520.15479-1-CFSworks@gmail.com>
2023-08-14 20:39 ` [PATCH] sunxi: psci: remove redundant initialization from psci_arch_init Andre Przywara
2023-08-15 11:13 ` Marc Zyngier
2023-08-25 7:20 ` Chen-Yu Tsai
2023-08-25 18:05 ` Sam Edwards
2023-08-26 10:22 ` Marc Zyngier [this message]
2023-08-28 21:49 ` Sam Edwards
2023-08-29 14:30 ` Chen-Yu Tsai
2023-08-29 14:34 ` Chen-Yu Tsai
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=86cyzaf6ie.wl-maz@kernel.org \
--to=maz@kernel.org \
--cc=andre.przywara@arm.com \
--cc=cfsworks@gmail.com \
--cc=jagan@amarulasolutions.com \
--cc=u-boot@lists.denx.de \
--cc=wens@csie.org \
/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.