public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Christoffer Dall <christoffer.dall@linaro.org>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v5 7/8] ARM: extend non-secure switch to also go into HYP mode
Date: Thu, 3 Oct 2013 19:55:15 +0100	[thread overview]
Message-ID: <20131003185515.GG3029@lvm> (raw)
In-Reply-To: <20131003082457.4fcb136f@lilith>

On Thu, Oct 03, 2013 at 08:24:57AM +0200, Albert ARIBAUD wrote:
> Hi Andre,
> 
> On Thu, 19 Sep 2013 18:06:45 +0200, Andre Przywara
> <andre.przywara@linaro.org> wrote:
> 
> > For the KVM and XEN hypervisors to be usable, we need to enter the
> > kernel in HYP mode. Now that we already are in non-secure state,
> > HYP mode switching is within short reach.
> > 
> > While doing the non-secure switch, we have to enable the HVC
> > instruction and setup the HYP mode HVBAR (while still secure).
> > 
> > The actual switch is done by dropping back from a HYP mode handler
> > without actually leaving HYP mode, so we introduce a new handler
> > routine in our new secure exception vector table.
> > 
> > In the assembly switching routine we save and restore the banked LR
> > and SP registers around the hypercall to do the actual HYP mode
> > switch.
> > 
> > The C routine first checks whether we are in HYP mode already and
> > also whether the virtualization extensions are available. It also
> > checks whether the HYP mode switch was finally successful.
> > The bootm command part only calls the new function after the
> > non-secure switch.
> > 
> > Signed-off-by: Andre Przywara <andre.przywara@linaro.org>
> > ---
> >  arch/arm/cpu/armv7/Makefile      |  2 +-
> >  arch/arm/cpu/armv7/nonsec_virt.S | 43 +++++++++++++++++++++++++++++++++++-----
> >  arch/arm/cpu/armv7/virt-v7.c     | 37 ++++++++++++++++++++++++++++++++++
> >  arch/arm/include/asm/armv7.h     |  6 ++++--
> >  arch/arm/lib/bootm.c             |  7 ++++++-
> >  5 files changed, 86 insertions(+), 9 deletions(-)
> > 
> > Changes:
> > v3..v4: w/s fixes, embed error output
> > v4..v5: none
> 
> Seems like Christoffer's comment was not addressed here but IIUC, it
> was in other files (Christoffer, feel free to comment). Any reason why
> the "older asm" comments form was not replaced in here?
>   

I think these comments are a bit superflous, but not exactly harmful, so
I didn't raise the flag when they were not corrected.  My thought was
that if you're building for a board that has support for the
virtualization extensions you should be using a toolchain that knows
about them too, but Andre pointed out that his (I think Debian) still
used an old enough cross toolchain not to have this support.

In any case, I don't think this warrants holding back the patches but
can be fixed as a follow-up if the community agrees that we need to
support older toolchains by some define that encodes the hvc and eret
instructions properly.

Thanks,
-Christoffer

  reply	other threads:[~2013-10-03 18:55 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-19 16:06 [U-Boot] [PATCH v5 0/8] ARMv7: Add HYP mode switching support Andre Przywara
2013-09-19 16:06 ` [U-Boot] [PATCH v5 1/8] ARM: prepare armv7.h to be included from assembly source Andre Przywara
2013-09-19 16:06 ` [U-Boot] [PATCH v5 2/8] ARM: add secure monitor handler to switch to non-secure state Andre Przywara
2013-09-19 21:50   ` Mj Embd
2013-09-20  0:42     ` Christoffer Dall
2013-09-20  2:38       ` Mj Embd
2013-09-20  3:47         ` Christoffer Dall
2013-10-03  6:30   ` Albert ARIBAUD
2013-10-12  9:27   ` [U-Boot] [PATCH v5 2/8] ARM: add secure monitor handler to switchto " TigerLiu at viatech.com.cn
2013-10-12 19:50     ` Albert ARIBAUD
2013-10-14  2:14       ` TigerLiu at viatech.com.cn
2013-10-14  5:16         ` Albert ARIBAUD
2013-10-14  5:23           ` TigerLiu at viatech.com.cn
2013-09-19 16:06 ` [U-Boot] [PATCH v5 3/8] ARM: add assembly routine to switch to " Andre Przywara
2013-09-19 16:30   ` Mj Embd
2013-09-19 19:26     ` Christoffer Dall
2013-09-19 19:57       ` Mj Embd
2013-09-19 20:11         ` Christoffer Dall
2013-09-19 20:38           ` Mj Embd
2013-09-19 21:31             ` Andre Przywara
2013-09-19 21:39               ` Mj Embd
2013-09-19 21:55                 ` Mj Embd
2013-09-19 22:35                   ` Peter Maydell
2013-09-19 22:50                     ` Mj Embd
2013-09-19 23:21                       ` Peter Maydell
2013-09-19 21:28           ` Ian Campbell
2013-09-19 21:09         ` Andre Przywara
2013-09-19 21:27         ` Ian Campbell
2013-09-19 16:06 ` [U-Boot] [PATCH v5 4/8] ARM: add C function " Andre Przywara
2013-09-19 16:06 ` [U-Boot] [PATCH v5 5/8] ARM: trigger non-secure state switch during bootm execution Andre Przywara
2013-09-19 16:06 ` [U-Boot] [PATCH v5 6/8] ARM: add SMP support for non-secure switch Andre Przywara
2013-09-19 16:06 ` [U-Boot] [PATCH v5 7/8] ARM: extend non-secure switch to also go into HYP mode Andre Przywara
2013-10-03  6:24   ` Albert ARIBAUD
2013-10-03 18:55     ` Christoffer Dall [this message]
2013-10-03 19:14       ` Albert ARIBAUD
2013-09-19 16:06 ` [U-Boot] [PATCH v5 8/8] ARM: VExpress: enable ARMv7 virt support for VExpress A15 Andre Przywara
2013-10-03 19:31 ` [U-Boot] [PATCH v5 0/8] ARMv7: Add HYP mode switching support Albert ARIBAUD

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=20131003185515.GG3029@lvm \
    --to=christoffer.dall@linaro.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