All of lore.kernel.org
 help / color / mirror / Atom feed
From: Christoffer Dall <christoffer.dall@linaro.org>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 3/9] ARM: HYP/non-sec: add a barrier after setting SCR.NS==1
Date: Fri, 22 Nov 2013 08:53:27 -0800	[thread overview]
Message-ID: <20131122165327.GJ9314@cbox> (raw)
In-Reply-To: <528F3845.7070004@arm.com>

On Fri, Nov 22, 2013 at 10:56:05AM +0000, Marc Zyngier wrote:
> On 22/11/13 01:51, Christoffer Dall wrote:
> > On 21 November 2013 00:59, Marc Zyngier <marc.zyngier@arm.com> wrote:
> >> A CP15 instruction execution can be reordered, requiring an
> >> isb to be sure it is executed in program order.
> >>
> >> Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
> >> ---
> >>  arch/arm/cpu/armv7/nonsec_virt.S | 1 +
> >>  1 file changed, 1 insertion(+)
> >>
> >> diff --git a/arch/arm/cpu/armv7/nonsec_virt.S b/arch/arm/cpu/armv7/nonsec_virt.S
> >> index 29987cd..648066f 100644
> >> --- a/arch/arm/cpu/armv7/nonsec_virt.S
> >> +++ b/arch/arm/cpu/armv7/nonsec_virt.S
> >> @@ -47,6 +47,7 @@ _secure_monitor:
> >>  #endif
> >>
> >>         mcr     p15, 0, r1, c1, c1, 0           @ write SCR (with NS bit set)
> >> +       isb
> >>
> >>  #ifdef CONFIG_ARMV7_VIRT
> >>         mrceq   p15, 0, r0, c12, c0, 1          @ get MVBAR value
> >> --
> >> 1.8.2.3
> >>
> > Does this matter?  Are we not still in monitor mode and therefore
> > secure and the exception return below will surely be ordered by the
> > cpu after the mcr, right? or no?
> 
> You need to look at what is between the SCR access and the exception
> return (and you cannot see that from the patch): There's a write to
> HVBAR that can only be executed if SCR.NS==1.
> 
> If the write to SCR is delayed, the whole thing will stop very quickly...
> 
Ah, I didn't realize this specific about PL2-mode system control
registers and relied on the fact that we were just in monitor mode and
that the setting of this bit essentially didn't matter; I obviously got
this wrong, and I think to be fair that Andre had this isb in his
original code and removed it after my review.

/my bad.

Thanks for the explanation.

-Christoffer

  reply	other threads:[~2013-11-22 16:53 UTC|newest]

Thread overview: 48+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-21  8:59 [U-Boot] [PATCH 0/9] ARMv7: add PSCI support to u-boot Marc Zyngier
2013-11-21  8:59 ` [U-Boot] [PATCH 1/9] ARM: HYP/non-sec: fix alignment requirements for vectors Marc Zyngier
2013-11-21 10:19   ` Masahiro Yamada
2013-11-21 10:36     ` Marc Zyngier
2013-11-21 22:24   ` Andre Przywara
2013-11-21  8:59 ` [U-Boot] [PATCH 2/9] ARM: HYP/non-sec: move switch to non-sec to the last boot phase Marc Zyngier
2013-11-26 14:36   ` Andre Przywara
2013-11-21  8:59 ` [U-Boot] [PATCH 3/9] ARM: HYP/non-sec: add a barrier after setting SCR.NS==1 Marc Zyngier
2013-11-22  1:51   ` Christoffer Dall
2013-11-22 10:56     ` Marc Zyngier
2013-11-22 16:53       ` Christoffer Dall [this message]
2013-12-30  3:10     ` [U-Boot] [PATCH 3/9] ARM: HYP/non-sec switch in bootm.c TigerLiu at viatech.com.cn
2013-12-30  4:57       ` Christoffer Dall
2013-12-30  5:15         ` TigerLiu at viatech.com.cn
2013-12-30  5:22           ` Christoffer Dall
2013-12-30  5:33             ` TigerLiu at viatech.com.cn
2013-11-26 14:39   ` [U-Boot] [PATCH 3/9] ARM: HYP/non-sec: add a barrier after setting SCR.NS==1 Andre Przywara
2013-11-21  8:59 ` [U-Boot] [PATCH 4/9] ARM: non-sec: reset CNTVOFF to zero Marc Zyngier
2013-11-26 14:41   ` Andre Przywara
2013-11-26 14:46     ` Marc Zyngier
2013-11-21  8:59 ` [U-Boot] [PATCH 5/9] ARM: HYP/non-sec: add generic ARMv7 PSCI code Marc Zyngier
2013-11-21  8:59 ` [U-Boot] [PATCH 6/9] ARM: HYP/non-sec: make pen code sections depend on !ARMV7_PSCI Marc Zyngier
2014-06-04  1:51   ` [U-Boot] [PATCH 6/9] ARM: HYP/non-sec: make pen code sectionsdepend " TigerLiu at via-alliance.com
2013-11-21  9:00 ` [U-Boot] [PATCH 7/9] ARM: HYP/non-sec: add the option for a second-stage monitor Marc Zyngier
2013-11-21  9:00 ` [U-Boot] [PATCH 8/9] sunxi: HYP/non-sec: add sun7i PSCI backend Marc Zyngier
2013-11-21  9:00 ` [U-Boot] [PATCH 9/9] sunxi: HYP/non-sec: configure CNTFRQ on all CPUs Marc Zyngier
2013-11-21 14:28 ` [U-Boot] [PATCH 0/9] ARMv7: add PSCI support to u-boot Rob Herring
2013-11-21 15:04   ` Marc Zyngier
2013-11-22  1:54     ` Christoffer Dall
2013-11-22  3:58       ` Anup Patel
2013-11-22  8:42         ` [U-Boot] [linux-sunxi] " Ian Campbell
2013-11-22  9:00           ` Anup Patel
2013-11-22 16:49             ` Christoffer Dall
2013-11-22 10:25         ` [U-Boot] " Marc Zyngier
2013-11-22 10:51       ` Marc Zyngier
2013-11-22  8:40     ` [U-Boot] [linux-sunxi] " Ian Campbell
2013-11-22  8:56       ` Anup Patel
2013-11-22 10:49         ` Ian Campbell
2013-11-22 14:51       ` Marc Zyngier
2013-12-06 11:43 ` [U-Boot] " Andre Przywara
2013-12-06 12:12   ` Marc Zyngier
2013-12-06 12:59     ` [U-Boot] [linux-sunxi] " Ian Campbell
2013-12-06 15:44       ` Ian Campbell
2013-12-06 15:48         ` Andre Przywara
2013-12-06 17:21           ` Ian Campbell
2013-12-06 17:45             ` Marc Zyngier
2013-12-06 13:03     ` [U-Boot] " Andre Przywara
2013-12-06 16:00       ` Marc Zyngier

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=20131122165327.GJ9314@cbox \
    --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 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.