linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: will.deacon@arm.com (Will Deacon)
To: linux-arm-kernel@lists.infradead.org
Subject: ARM processor mode, kernel startup, Hyp / secure state
Date: Tue, 23 Aug 2011 23:18:00 +0100	[thread overview]
Message-ID: <20110823221800.GA21084@e102144-lin.cambridge.arm.com> (raw)
In-Reply-To: <CA+wbFdcv_BsHaVwoqgF5yx6scXOodHkKjdVtarqJwjy_GFrAJQ@mail.gmail.com>

Dave,

On Tue, Aug 23, 2011 at 05:50:19PM +0100, Dave Martin wrote:
> On Tue, Aug 23, 2011 at 3:52 PM, Ian Jackson <Ian.Jackson@eu.citrix.com> wrote:
> > At first I thought that the best thing to do would be to boot the
> > kernel in any suitable mode, and have the kernel automatically detect
> > the starting mode. ?I started writing code in linux's head.S to do
> > this. ?However, detecting whether we are in secure state is very
> > difficult: it involves deliberately risking an undefined instruction
> > trap. ?The code for this was getting rather long and involved.
> 
> There may be a safe way to do this check -- for example, on ARM1176
> and Cortex-A8 there is a CP14 debug status/control register that you can
> read which includes a flag indicating which world you're in.  This isn't part
> of the architecture though and may be different/not possible on some
> CPUs.

Please don't do this! Accessing the debug registers via the CP14 registers
is like playing russian roulette with a machine gun, especially when you
have various hypervisor registers and hardware lock registers to contend
with. For 3.2, I will be guarding all of the hw_breakpoint init debug
probing with an undef_hook because I'm sick of blowing my head off when
systems are configured to keep debug out.

> All in all, it's better to engineer things so that the check doesn't need to
> be done at all

Agreed. I think it's better to assume that you can't detect whether you're
running in secure state or not.

Will

  parent reply	other threads:[~2011-08-23 22:18 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-23 14:52 ARM processor mode, kernel startup, Hyp / secure state Ian Jackson
2011-08-23 15:14 ` Russell King - ARM Linux
2011-08-23 16:50   ` Ian Jackson
2011-08-23 17:36     ` Russell King - ARM Linux
2011-08-23 17:51       ` Ian Jackson
2011-08-23 19:59         ` Nicolas Pitre
     [not found] ` <CANM98qLC2mLvXZwqurZvn-8VBR_KyQdK3Q=icU3k=95KKvJoSg@mail.gmail.com>
2011-08-23 16:38   ` [Android-virt] " Ian Jackson
2011-08-23 16:50 ` Dave Martin
2011-08-23 16:59   ` Ian Jackson
2011-08-23 17:15     ` Ian Jackson
2011-08-23 19:06     ` Dave Martin
2011-08-23 17:18   ` Ian Jackson
2011-08-23 17:45     ` Russell King - ARM Linux
2011-08-23 17:57       ` Ian Jackson
2011-08-23 20:24         ` Nicolas Pitre
2011-08-23 22:18   ` Will Deacon [this message]
2011-08-24  9:24     ` Dave Martin
2011-08-23 17:17 ` Catalin Marinas
2011-08-23 17:23   ` Ian Jackson
2011-08-23 21:12     ` Catalin Marinas
2011-08-24 13:51     ` Will Deacon
2011-08-24 15:45       ` Ian Jackson
2011-08-24 16:00         ` Will Deacon
2011-08-24 16:09           ` Ian Jackson
2011-08-24 16:13             ` Will Deacon
2011-08-25 10:13               ` Ian Jackson
2011-08-25 11:42                 ` Will Deacon
2011-08-24 17:09       ` Russell King - ARM Linux
2011-08-24 17:38         ` Will Deacon
2011-08-25  9:57         ` Dave Martin
2011-08-23 17:42   ` Russell King - ARM Linux
2011-08-24 11:43     ` Linus Walleij
2011-08-24 12:37       ` Martin HOVANG

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=20110823221800.GA21084@e102144-lin.cambridge.arm.com \
    --to=will.deacon@arm.com \
    --cc=linux-arm-kernel@lists.infradead.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).