public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Marc Zyngier <marc.zyngier@arm.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 0/9] ARMv7: add PSCI support to u-boot
Date: Fri, 22 Nov 2013 10:51:44 +0000	[thread overview]
Message-ID: <528F3740.4070006@arm.com> (raw)
In-Reply-To: <CAMJs5B--HUr=gux-AOPu+MxQkkjuGDMuttTAcLY2BaiDPccRVg@mail.gmail.com>

On 22/11/13 01:54, Christoffer Dall wrote:
> On 21 November 2013 07:04, Marc Zyngier <marc.zyngier@arm.com> wrote:
>> Hi Rob,
>>
>> On 21/11/13 14:28, Rob Herring wrote:
>>> On Thu, Nov 21, 2013 at 2:59 AM, Marc Zyngier <marc.zyngier@arm.com> wrote:
>>>> PSCI is an ARM standard that provides a generic interface that
>>>> supervisory software can use to manage power in the following
>>>> situations:
>>>> - Core idle management
>>>> - CPU hotplug
>>>> - big.LITTLE migration models
>>>> - System shutdown and reset
>>>>
>>>> It basically allows the kernel to offload these tasks to the firmware,
>>>> and rely on common kernel side code.
>>>>
>>>> More importantly, it gives a way to ensure that CPUs enter the kernel
>>>> at the appropriate exception level (ie HYP mode, to allow the use of
>>>> the virtualization extensions), even across events like CPUs being
>>>> powered off/on or suspended.
>>>>
>>>> The main idea here is to reuse some of the existing u-boot code to
>>>> create a separate blob that can live in SRAM (or a reserved page of
>>>> memory), containing a secure monitor that will implement the PSCI
>>>> operations. This code will still be alive when u-boot is long gone,
>>>> hence the need for a piece of memory that will not be touched by the
>>>> OS.
>>>
>>> Interesting. As a separate binary, I'm not sure this belongs or
>>> benefits from being in u-boot. I would like to see this as a more
>>> generic secure firmware loader or PSCI code be a part of u-boot code
>>> directly. With the latter, you could extend it beyond PSCI to things
>>> like env variable access (basically equivalent to UEFI runtime
>>> services). I'm not saying we should do that though.
>>
>> So I started this by having something that was actually part of u-boot,
>> and copying itself into SRAM, patching stuff as it went. The net result
>> was that I was reinventing a runtime linker. Needless to say, I gave up
>> quickly... ;-)
>>
> 
> I'm curious; why did you need to reinvent a linker?  This was all just
> assembly right? Could you not write it as position independent code
> and just copy a blob of code and be done with it?

There is more than just that. Some of the code is actually shared
between u-boot and PSCI, so in the process of copying to SRAM, you have
to patch some things there.

Some of it could be rewritten as being PIC, but there is more
fundamental issues about the current approach: the way the code is
structured, it expects to be able to switch directly from secure to
non-secure in the same memory space. With secure memory, that's a killer
(you're pulling the rug (and entire floor) from under your own feet).

So I'm now heading towards changing the "non-secure-switching" part of
u-boot to be able to return directly into the payload, instead of
carrying on within the same memory-space. This will then allow moving
that code to secure memory, and then we'll be able to share it between
u-boot and PSCI. Well, I think... ;-)

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

  parent reply	other threads:[~2013-11-22 10:51 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
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 [this message]
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=528F3740.4070006@arm.com \
    --to=marc.zyngier@arm.com \
    --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