All of lore.kernel.org
 help / color / mirror / Atom feed
From: Heinrich Schuchardt <xypron.glpk@gmx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [RFC] efi_loader: support for CONFIG_ARMV7_NONSEC
Date: Fri,  6 Apr 2018 07:43:22 +0200	[thread overview]
Message-ID: <20180406054322.11541-1-xypron.glpk@gmx.de> (raw)

Booting with SMP fails on the Allwinner A20 CPU.
https://gist.github.com/xypron/2524ba898d6905d959c744c2b05da196

When executing bootefi we need to
* copy the Power State Coordination Interface (PSCI) code to its
  destination address
* switch between our hypervisor mode (HYP) and the supervisor mode (SVC)
  of the payload (http://linux-sunxi.org/PSCI)

This patch is incomplete. It is just meant to indicate where we could
change the entry point.

With the patch iPXE cannot get a network address.

Possibly a better moment for switching to SVC is ExitBootServices.

We also have to consider switching modes at EFI_ENTRY and EFI_EXIT.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
---
 cmd/bootefi.c | 18 ++++++++++++++++--
 1 file changed, 16 insertions(+), 2 deletions(-)

diff --git a/cmd/bootefi.c b/cmd/bootefi.c
index 85f7b42e76..af5adf8b29 100644
--- a/cmd/bootefi.c
+++ b/cmd/bootefi.c
@@ -17,8 +17,10 @@
 #include <linux/libfdt_env.h>
 #include <memalign.h>
 #include <asm/global_data.h>
+#include <asm/armv7.h>
 #include <asm-generic/sections.h>
 #include <asm-generic/unaligned.h>
+#include <asm/secure.h>
 #include <linux/linkage.h>
 
 DECLARE_GLOBAL_DATA_PTR;
@@ -176,8 +178,19 @@ static efi_status_t efi_do_enter(
 {
 	efi_status_t ret = EFI_LOAD_ERROR;
 
-	if (entry)
-		ret = entry(image_handle, st);
+	if (entry) {
+#ifdef CONFIG_ARMV7_NONSEC
+		if (armv7_boot_nonsec()) {
+			armv7_init_nonsec();
+			secure_ram_addr(_do_nonsec_entry)(entry,
+					(uintptr_t)image_handle,
+					(uintptr_t)st, 0);
+		} else
+#endif
+		{
+			ret = entry(image_handle, st);
+		}
+	}
 	st->boottime->exit(image_handle, ret, 0, NULL);
 	return ret;
 }
-- 
2.14.2

             reply	other threads:[~2018-04-06  5:43 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-06  5:43 Heinrich Schuchardt [this message]
2018-04-06  7:48 ` [U-Boot] [RFC] efi_loader: support for CONFIG_ARMV7_NONSEC Alexander Graf
2018-06-12 17:42   ` Mark Kettenis

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=20180406054322.11541-1-xypron.glpk@gmx.de \
    --to=xypron.glpk@gmx.de \
    --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.