All of lore.kernel.org
 help / color / mirror / Atom feed
From: Christoffer Dall <christoffer.dall@linaro.org>
To: Raz <raziebe@gmail.com>
Cc: kvmarm@lists.cs.columbia.edu
Subject: Re: Booting a kernel to EL1 in Armv8.1
Date: Wed, 25 Jan 2017 09:22:52 +0100	[thread overview]
Message-ID: <20170125082252.GS15850@cbox> (raw)
In-Reply-To: <CAPB=Z-pGjZ398fZuUeR2EsOnVf-0Qp3m4ckdeCBniKZmjs25Nw@mail.gmail.com>

On Tue, Jan 24, 2017 at 09:50:04PM +0000, Raz wrote:
> Hello
> 
> I am trying to boot EL1 kernel in a platform based on Armv8.1.
> I am using fvp as a hardware.
> What I am trying to achieve is to execute some kernel code in
> EL2 exception level..

When you boot a reasonably recent kernel on VHE, it will execute in EL2,
so all the code you're executing will be at EL2, so I think you've
already achieved what you're trying to do.

> 
> The current VHE patch is booting the kernel into EL2. So I took an older
> kernel
> and I tried to set  TTBR1_EL2 to access kernel memory as if it is TTBR1_EL1
> .

That won't work unless you set the E2H bit, see the ARMv8.1
documentation.

If you boot a kernel that doesn't have the necessary bits to enable VHE,
then you'll just run as on a non-VHE system with the main kernel running
at EL1 and a stub installed at EL2 which eventually gets replaced by the
KVM hyp lowvisor code in EL2.

> 
> It is theoretically possible ?

I'm not sure what you're asking?

> Setting TTBR1_EL2 to TTBR1_EL1
> and enabling mmu  thtough sctlr_el2 does not work.
> 

Again, not sure what you're trying to do.  If you're running in EL1
(because you're old kernel drops you to EL1) then trying to access EL2
registers obviously won't work.

If you run a VHE kernel, it will have already set the _EL2 registers to
the values you want (but it will use _EL1 register access intructions to
do so, and they are transparently rewritten by hardware to program the
corresponding _EL2 registers).

Hope this helps,
-Christoffer

  reply	other threads:[~2017-01-25  8:22 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-24 21:50 Booting a kernel to EL1 in Armv8.1 Raz
2017-01-25  8:22 ` Christoffer Dall [this message]
2017-02-14 22:08   ` Raz

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=20170125082252.GS15850@cbox \
    --to=christoffer.dall@linaro.org \
    --cc=kvmarm@lists.cs.columbia.edu \
    --cc=raziebe@gmail.com \
    /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.