public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Marc Zyngier <maz@kernel.org>
To: u-boot@lists.denx.de
Subject: [PATCH v4] armv8: Handle EL2 Host mode
Date: Thu, 11 Feb 2021 10:44:44 +0000	[thread overview]
Message-ID: <2c2d820746f259ceca6da69510ee078e@kernel.org> (raw)
In-Reply-To: <c1bc3645e1607e99@bloch.sibelius.xs4all.nl>

Hi Mark,

On 2021-02-11 10:22, Mark Kettenis wrote:
>> Date: Thu, 11 Feb 2021 09:58:49 +0000
>> From: Marc Zyngier <maz@kernel.org>
>> 
>> On 2021-02-10 19:14, Mark Kettenis wrote:
>> > On implementations that support VHE, the layout of the CPTR_EL2
>> > register depends on whether HCR_EL2.E2H is set.  If the bit is
>> > set, CPTR_EL2 uses the same layout as CPACR_EL1 and can in fact
>> > be accessed through that register.  In that case, jump to the
>> > EL1 code to enable access to the FP/SIMD registers.  This allows
>> > U-Boot to run on systems that pass control to U-Boot in EL2 with
>> > EL2 Host mode enabled such as machines using Apple's M1 SoC.
>> >
>> > Signed-off-by: Mark Kettenis <kettenis@openbsd.org>
>> > ---
>> >
>> > v4: use EL1 codepath when HCR_EL2.E2H is set
>> >     suggested by Marc Zyngier <maz@kernel.org>
>> >
>> > v2: rename label
>> >
>> >  arch/arm/cpu/armv8/start.S | 6 ++++--
>> >  1 file changed, 4 insertions(+), 2 deletions(-)
>> >
>> > diff --git a/arch/arm/cpu/armv8/start.S b/arch/arm/cpu/armv8/start.S
>> > index 662449156b..9e9c6140cd 100644
>> > --- a/arch/arm/cpu/armv8/start.S
>> > +++ b/arch/arm/cpu/armv8/start.S
>> > @@ -132,11 +132,13 @@ pie_fixup_done:
>> >  	msr	cntfrq_el0, x0			/* Initialize CNTFRQ */
>> >  #endif
>> 
>> This seems to skip the CNTFRQ_EL0 setup. However, this should
>> probably also be done on CPUs that do not have EL3, such as M1.
>> Unless the lower level FW already deals with it? Doesn't have to
>> be part of this patch though.
> 
> Hi Marc,
> 
> I think the basic assumption that U-Boot makes is that if you enter in
> EL2 or EL1 there is firmware (e.g. TF-A) that does the CNTFRQ_EL0
> setup.
> 
> On the M1 there is defenitely lower level FW that deals with this, so
> this assumption is still fine.

Right. As long as CNTFRQ_EL0 gets set to the correct value on all CPUs,
I'm happy!

Thanks,

         M.
-- 
Jazz is not dead. It just smells funny...

  reply	other threads:[~2021-02-11 10:44 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-10 19:14 [PATCH v4] armv8: Handle EL2 Host mode Mark Kettenis
2021-02-11  9:58 ` Marc Zyngier
2021-02-11 10:22   ` Mark Kettenis
2021-02-11 10:44     ` Marc Zyngier [this message]
2021-07-10  1:08 ` Tom Rini

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=2c2d820746f259ceca6da69510ee078e@kernel.org \
    --to=maz@kernel.org \
    --cc=u-boot@lists.denx.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