All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH v4 0/9] LS2080ARDB: Enable EFI boot support
@ 2016-06-20 23:07 Alexander Graf
  2016-06-20 23:07 ` [U-Boot] [PATCH v4 1/9] ls2080: Exit dpaa only right before exiting U-Boot Alexander Graf
                   ` (9 more replies)
  0 siblings, 10 replies; 32+ messages in thread
From: Alexander Graf @ 2016-06-20 23:07 UTC (permalink / raw)
  To: u-boot

We now have EFI support in U-Boot which worked out of the box on all systems
that I tried it on so far. Except for the LS2080ARDB. With this patch set
I can successfully boot grub2 and Linux from there on such a system - even
using PXE.

v3 -> v4:

  - Add CONFIG_CMD_FS_GENERIC to defconfig
  - Move code into generic quiesce weak function
  - Exit device for real when going to Linux
  - Only apply DPL if we have something to apply
  - New: armv8: ls2080a: Declare spin tables as reserved for efi loader
  - New: efi_loader: Allow boards to implement get_time and reset_system
  - New: armv8: fsl-layerscape: Add support for efi_loader RTS reset
  - New: efi_loader: Declare secure memory as reserved
  - New: efi_loader: Allow bouncing for network

Alexander Graf (9):
  ls2080: Exit dpaa only right before exiting U-Boot
  efi_loader: AArch64: Run EFI payloads in EL2 if U-Boot runs in EL3
  ls2080ardb: Reserve DP-DDR RAM
  ls2080ardb: Convert to distro boot
  armv8: ls2080a: Declare spin tables as reserved for efi loader
  efi_loader: Allow boards to implement get_time and reset_system
  armv8: fsl-layerscape: Add support for efi_loader RTS reset
  efi_loader: Declare secure memory as reserved
  efi_loader: Allow bouncing for network

 arch/arm/cpu/armv8/fsl-layerscape/cpu.c  |  33 +++++++++-
 arch/arm/cpu/armv8/fsl-layerscape/fdt.c  |   6 ++
 arch/arm/include/asm/armv8/mmu.h         |  19 +++---
 arch/arm/include/asm/u-boot-arm.h        |   1 +
 arch/arm/lib/bootm.c                     |   7 +++
 board/freescale/ls2080a/ls2080a.c        |   6 +-
 board/freescale/ls2080aqds/ls2080aqds.c  |  11 ++--
 board/freescale/ls2080ardb/ls2080ardb.c  |  20 ++++--
 cmd/bootefi.c                            |  15 +++++
 configs/ls2080a_emu_defconfig            |   1 +
 configs/ls2080a_simu_defconfig           |   1 +
 configs/ls2080aqds_SECURE_BOOT_defconfig |   1 +
 configs/ls2080aqds_defconfig             |   1 +
 configs/ls2080aqds_nand_defconfig        |   1 +
 configs/ls2080ardb_SECURE_BOOT_defconfig |   1 +
 configs/ls2080ardb_defconfig             |   1 +
 configs/ls2080ardb_nand_defconfig        |   1 +
 drivers/net/fsl-mc/mc.c                  |  24 +++++++-
 include/configs/ls2080ardb.h             |  26 +++++++-
 include/efi_loader.h                     |  18 ++++++
 lib/efi_loader/efi_boottime.c            |   2 +
 lib/efi_loader/efi_memory.c              |  15 +++++
 lib/efi_loader/efi_net.c                 |   7 +++
 lib/efi_loader/efi_runtime.c             | 101 +++++++++++++++++++++++++++----
 24 files changed, 283 insertions(+), 36 deletions(-)

-- 
1.8.5.6

^ permalink raw reply	[flat|nested] 32+ messages in thread

* [U-Boot] [PATCH v4 1/9] ls2080: Exit dpaa only right before exiting U-Boot
  2016-06-20 23:07 [U-Boot] [PATCH v4 0/9] LS2080ARDB: Enable EFI boot support Alexander Graf
@ 2016-06-20 23:07 ` Alexander Graf
  2016-06-20 23:07 ` [U-Boot] [PATCH v4 2/9] efi_loader: AArch64: Run EFI payloads in EL2 if U-Boot runs in EL3 Alexander Graf
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 32+ messages in thread
From: Alexander Graf @ 2016-06-20 23:07 UTC (permalink / raw)
  To: u-boot

On ls2080 we have a separate network fabric component which we need to
shut down before we enter Linux (or any other OS). Along with that also
comes configuration of the fabric using a description file.

Today we always stop and configure the fabric in the boot script and
(again) exit it on device tree generation. This works ok for the normal
booti case, but with bootefi the payload we're running may still want to
access the network.

So let's add a new fsl_mc command that defers configuration and stopping
the hardware to when we actually exit U-Boot, so that we can still use
the fabric from an EFI payload.

For existing boot scripts, nothing should change with this patch.

Signed-off-by: Alexander Graf <agraf@suse.de>

---

v3 -> v4:

  - Move code into generic quiesce weak function
  - Exit device for real when going to Linux
  - Only apply DPL if we have something to apply
---
 arch/arm/include/asm/u-boot-arm.h       |  1 +
 arch/arm/lib/bootm.c                    |  7 +++++++
 board/freescale/ls2080a/ls2080a.c       |  6 +++++-
 board/freescale/ls2080aqds/ls2080aqds.c | 11 +++++------
 board/freescale/ls2080ardb/ls2080ardb.c | 11 +++++------
 drivers/net/fsl-mc/mc.c                 | 24 ++++++++++++++++++++++--
 lib/efi_loader/efi_boottime.c           |  2 ++
 7 files changed, 47 insertions(+), 15 deletions(-)

diff --git a/arch/arm/include/asm/u-boot-arm.h b/arch/arm/include/asm/u-boot-arm.h
index 414042d..023daf5 100644
--- a/arch/arm/include/asm/u-boot-arm.h
+++ b/arch/arm/include/asm/u-boot-arm.h
@@ -37,6 +37,7 @@ int	arch_early_init_r(void);
 /* board/.../... */
 int	board_init(void);
 void	dram_init_banksize (void);
+void    board_quiesce_devices(void);
 
 /* cpu/.../interrupt.c */
 int	arch_interrupt_init	(void);
diff --git a/arch/arm/lib/bootm.c b/arch/arm/lib/bootm.c
index 0838d89..4904e86 100644
--- a/arch/arm/lib/bootm.c
+++ b/arch/arm/lib/bootm.c
@@ -64,6 +64,10 @@ void arch_lmb_reserve(struct lmb *lmb)
 		    gd->bd->bi_dram[0].start + gd->bd->bi_dram[0].size - sp);
 }
 
+__weak void board_quiesce_devices(void)
+{
+}
+
 /**
  * announce_and_cleanup() - Print message and prepare for kernel boot
  *
@@ -84,6 +88,9 @@ static void announce_and_cleanup(int fake)
 #ifdef CONFIG_USB_DEVICE
 	udc_disconnect();
 #endif
+
+	board_quiesce_devices();
+
 	cleanup_before_linux();
 }
 
diff --git a/board/freescale/ls2080a/ls2080a.c b/board/freescale/ls2080a/ls2080a.c
index 00337d7..d875485 100644
--- a/board/freescale/ls2080a/ls2080a.c
+++ b/board/freescale/ls2080a/ls2080a.c
@@ -107,6 +107,11 @@ void fdt_fixup_board_enet(void *fdt)
 	else
 		fdt_status_fail(fdt, offset);
 }
+
+void board_quiesce_devices(void)
+{
+	fsl_mc_ldpaa_exit(gd->bd);
+}
 #endif
 
 #ifdef CONFIG_OF_BOARD_SETUP
@@ -127,7 +132,6 @@ int ft_board_setup(void *blob, bd_t *bd)
 
 #ifdef CONFIG_FSL_MC_ENET
 	fdt_fixup_board_enet(blob);
-	fsl_mc_ldpaa_exit(bd);
 #endif
 
 	return 0;
diff --git a/board/freescale/ls2080aqds/ls2080aqds.c b/board/freescale/ls2080aqds/ls2080aqds.c
index 7d95deb..c6a8d02 100644
--- a/board/freescale/ls2080aqds/ls2080aqds.c
+++ b/board/freescale/ls2080aqds/ls2080aqds.c
@@ -296,14 +296,16 @@ void fdt_fixup_board_enet(void *fdt)
 	else
 		fdt_status_fail(fdt, offset);
 }
+
+void board_quiesce_devices(void)
+{
+	fsl_mc_ldpaa_exit(gd->bd);
+}
 #endif
 
 #ifdef CONFIG_OF_BOARD_SETUP
 int ft_board_setup(void *blob, bd_t *bd)
 {
-#ifdef CONFIG_FSL_MC_ENET
-	int err;
-#endif
 	u64 base[CONFIG_NR_DRAM_BANKS];
 	u64 size[CONFIG_NR_DRAM_BANKS];
 
@@ -321,9 +323,6 @@ int ft_board_setup(void *blob, bd_t *bd)
 
 #ifdef CONFIG_FSL_MC_ENET
 	fdt_fixup_board_enet(blob);
-	err = fsl_mc_ldpaa_exit(bd);
-	if (err)
-		return err;
 #endif
 
 	return 0;
diff --git a/board/freescale/ls2080ardb/ls2080ardb.c b/board/freescale/ls2080ardb/ls2080ardb.c
index a65cd4a..d1475a5 100644
--- a/board/freescale/ls2080ardb/ls2080ardb.c
+++ b/board/freescale/ls2080ardb/ls2080ardb.c
@@ -260,14 +260,16 @@ void fdt_fixup_board_enet(void *fdt)
 	else
 		fdt_status_fail(fdt, offset);
 }
+
+void board_quiesce_devices(void)
+{
+	fsl_mc_ldpaa_exit(gd->bd);
+}
 #endif
 
 #ifdef CONFIG_OF_BOARD_SETUP
 int ft_board_setup(void *blob, bd_t *bd)
 {
-#ifdef CONFIG_FSL_MC_ENET
-	int err;
-#endif
 	u64 base[CONFIG_NR_DRAM_BANKS];
 	u64 size[CONFIG_NR_DRAM_BANKS];
 
@@ -285,9 +287,6 @@ int ft_board_setup(void *blob, bd_t *bd)
 
 #ifdef CONFIG_FSL_MC_ENET
 	fdt_fixup_board_enet(blob);
-	err = fsl_mc_ldpaa_exit(bd);
-	if (err)
-		return err;
 #endif
 
 	return 0;
diff --git a/drivers/net/fsl-mc/mc.c b/drivers/net/fsl-mc/mc.c
index 1811b0f..46b8a6b 100644
--- a/drivers/net/fsl-mc/mc.c
+++ b/drivers/net/fsl-mc/mc.c
@@ -40,6 +40,7 @@ int child_dprc_id;
 struct fsl_dpbp_obj *dflt_dpbp = NULL;
 struct fsl_dpio_obj *dflt_dpio = NULL;
 struct fsl_dpni_obj *dflt_dpni = NULL;
+static u64 mc_lazy_dpl_addr;
 
 #ifdef DEBUG
 void dump_ram_words(const char *title, void *addr)
@@ -572,6 +573,9 @@ int mc_apply_dpl(u64 mc_dpl_addr)
 	u64 mc_ram_addr = mc_get_dram_addr();
 	size_t mc_ram_size = mc_get_dram_block_size();
 
+	if (!mc_dpl_addr)
+		return -1;
+
 	error = load_mc_dpl(mc_ram_addr, mc_ram_size, mc_dpl_addr);
 	if (error != 0)
 		return error;
@@ -1156,6 +1160,11 @@ int fsl_mc_ldpaa_exit(bd_t *bd)
 {
 	int err = 0;
 
+	if (bd && mc_lazy_dpl_addr && !fsl_mc_ldpaa_exit(NULL)) {
+		mc_apply_dpl(mc_lazy_dpl_addr);
+		mc_lazy_dpl_addr = 0;
+	}
+
 	/* MC is not loaded intentionally, So return success. */
 	if (bd && get_mc_boot_status() != 0)
 		return 0;
@@ -1259,6 +1268,7 @@ static int do_fsl_mc(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 		}
 		break;
 
+	case 'l':
 	case 'a': {
 			u64 mc_dpl_addr;
 
@@ -1279,8 +1289,17 @@ static int do_fsl_mc(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 				return -ENODEV;
 			}
 
-			if (!fsl_mc_ldpaa_exit(NULL))
-				err = mc_apply_dpl(mc_dpl_addr);
+			if (argv[1][0] == 'l') {
+				/*
+				 * We will do the actual dpaa exit and dpl apply
+				 * later from announce_and_cleanup().
+				 */
+				mc_lazy_dpl_addr = mc_dpl_addr;
+			} else {
+				/* The user wants it applied now */
+				if (!fsl_mc_ldpaa_exit(NULL))
+					err = mc_apply_dpl(mc_dpl_addr);
+			}
 			break;
 		}
 	default:
@@ -1298,5 +1317,6 @@ U_BOOT_CMD(
 	"DPAA2 command to manage Management Complex (MC)",
 	"start mc [FW_addr] [DPC_addr] - Start Management Complex\n"
 	"fsl_mc apply DPL [DPL_addr] - Apply DPL file\n"
+	"fsl_mc lazyapply DPL [DPL_addr] - Apply DPL file on exit\n"
 	"fsl_mc start aiop [FW_addr] - Start AIOP\n"
 );
diff --git a/lib/efi_loader/efi_boottime.c b/lib/efi_loader/efi_boottime.c
index be6f5e8..a226b4a 100644
--- a/lib/efi_loader/efi_boottime.c
+++ b/lib/efi_loader/efi_boottime.c
@@ -523,6 +523,8 @@ static efi_status_t EFIAPI efi_exit_boot_services(void *image_handle,
 {
 	EFI_ENTRY("%p, %ld", image_handle, map_key);
 
+	board_quiesce_devices();
+
 	/* Fix up caches for EFI payloads if necessary */
 	efi_exit_caches();
 
-- 
1.8.5.6

^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [U-Boot] [PATCH v4 2/9] efi_loader: AArch64: Run EFI payloads in EL2 if U-Boot runs in EL3
  2016-06-20 23:07 [U-Boot] [PATCH v4 0/9] LS2080ARDB: Enable EFI boot support Alexander Graf
  2016-06-20 23:07 ` [U-Boot] [PATCH v4 1/9] ls2080: Exit dpaa only right before exiting U-Boot Alexander Graf
@ 2016-06-20 23:07 ` Alexander Graf
  2016-06-21 17:12   ` york sun
  2016-06-22  2:50   ` Prabhakar Kushwaha
  2016-06-20 23:07 ` [U-Boot] [PATCH v4 3/9] ls2080ardb: Reserve DP-DDR RAM Alexander Graf
                   ` (7 subsequent siblings)
  9 siblings, 2 replies; 32+ messages in thread
From: Alexander Graf @ 2016-06-20 23:07 UTC (permalink / raw)
  To: u-boot

Some boards decided not to run ATF or other secure firmware in EL3, so
they instead run U-Boot there. The uEFI spec doesn't know what EL3 is
though - it only knows about EL2 and EL1. So if we see that we're running
in EL3, let's get into EL2 to make payloads happy.

Signed-off-by: Alexander Graf <agraf@suse.de>
---
 arch/arm/include/asm/armv8/mmu.h | 19 ++++++++++++-------
 cmd/bootefi.c                    | 11 +++++++++++
 2 files changed, 23 insertions(+), 7 deletions(-)

diff --git a/arch/arm/include/asm/armv8/mmu.h b/arch/arm/include/asm/armv8/mmu.h
index 0d08ed3..876a2b2 100644
--- a/arch/arm/include/asm/armv8/mmu.h
+++ b/arch/arm/include/asm/armv8/mmu.h
@@ -116,19 +116,24 @@
 static inline void set_ttbr_tcr_mair(int el, u64 table, u64 tcr, u64 attr)
 {
 	asm volatile("dsb sy");
-	if (el == 1) {
+	switch (el) {
+	case 1:
 		asm volatile("msr ttbr0_el1, %0" : : "r" (table) : "memory");
 		asm volatile("msr tcr_el1, %0" : : "r" (tcr) : "memory");
 		asm volatile("msr mair_el1, %0" : : "r" (attr) : "memory");
-	} else if (el == 2) {
-		asm volatile("msr ttbr0_el2, %0" : : "r" (table) : "memory");
-		asm volatile("msr tcr_el2, %0" : : "r" (tcr) : "memory");
-		asm volatile("msr mair_el2, %0" : : "r" (attr) : "memory");
-	} else if (el == 3) {
+		break;
+	case 3:
 		asm volatile("msr ttbr0_el3, %0" : : "r" (table) : "memory");
 		asm volatile("msr tcr_el3, %0" : : "r" (tcr) : "memory");
 		asm volatile("msr mair_el3, %0" : : "r" (attr) : "memory");
-	} else {
+
+		/* We may switch to EL2 later, so set those too; fall through */
+	case 2:
+		asm volatile("msr ttbr0_el2, %0" : : "r" (table) : "memory");
+		asm volatile("msr tcr_el2, %0" : : "r" (tcr) : "memory");
+		asm volatile("msr mair_el2, %0" : : "r" (attr) : "memory");
+		break;
+	default:
 		hang();
 	}
 	asm volatile("isb");
diff --git a/cmd/bootefi.c b/cmd/bootefi.c
index 2169065..edd0980 100644
--- a/cmd/bootefi.c
+++ b/cmd/bootefi.c
@@ -205,6 +205,17 @@ static unsigned long do_bootefi_exec(void *efi, void *fdt)
 		loaded_image_info.device_handle = nethandle;
 #endif
 
+#ifdef CONFIG_ARM64
+	/* On AArch64 we need to make sure we call our payload in < EL3 */
+	if (current_el() == 3) {
+		smp_kick_all_cpus();
+		dcache_disable();	/* flush cache before switch to EL2 */
+		armv8_switch_to_el2();
+		/* Enable caches again */
+		set_sctlr(get_sctlr() | (CR_C|CR_M));
+	}
+#endif
+
 	/* Call our payload! */
 	debug("%s:%d Jumping to 0x%lx\n", __func__, __LINE__, (long)entry);
 
-- 
1.8.5.6

^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [U-Boot] [PATCH v4 3/9] ls2080ardb: Reserve DP-DDR RAM
  2016-06-20 23:07 [U-Boot] [PATCH v4 0/9] LS2080ARDB: Enable EFI boot support Alexander Graf
  2016-06-20 23:07 ` [U-Boot] [PATCH v4 1/9] ls2080: Exit dpaa only right before exiting U-Boot Alexander Graf
  2016-06-20 23:07 ` [U-Boot] [PATCH v4 2/9] efi_loader: AArch64: Run EFI payloads in EL2 if U-Boot runs in EL3 Alexander Graf
@ 2016-06-20 23:07 ` Alexander Graf
  2016-06-22  2:51   ` Prabhakar Kushwaha
  2016-06-20 23:07 ` [U-Boot] [PATCH v4 4/9] ls2080ardb: Convert to distro boot Alexander Graf
                   ` (6 subsequent siblings)
  9 siblings, 1 reply; 32+ messages in thread
From: Alexander Graf @ 2016-06-20 23:07 UTC (permalink / raw)
  To: u-boot

The DP-DDR shouldn't be exposed as conventional memory to an OS, so let's
rather claim it's a reserved region in the EFI memory map

Signed-off-by: Alexander Graf <agraf@suse.de>
---
 board/freescale/ls2080ardb/ls2080ardb.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/board/freescale/ls2080ardb/ls2080ardb.c b/board/freescale/ls2080ardb/ls2080ardb.c
index d1475a5..493f66d 100644
--- a/board/freescale/ls2080ardb/ls2080ardb.c
+++ b/board/freescale/ls2080ardb/ls2080ardb.c
@@ -16,6 +16,7 @@
 #include <fsl_debug_server.h>
 #include <fsl-mc/fsl_mc.h>
 #include <environment.h>
+#include <efi_loader.h>
 #include <i2c.h>
 #include <asm/arch/soc.h>
 #include <fsl_sec.h>
@@ -202,6 +203,14 @@ int misc_init_r(void)
 	if (adjust_vdd(0))
 		printf("Warning: Adjusting core voltage failed.\n");
 
+#ifdef CONFIG_EFI_LOADER
+	if (soc_has_dp_ddr() && gd->bd->bi_dram[2].size) {
+		efi_add_memory_map(gd->bd->bi_dram[2].start,
+				   gd->bd->bi_dram[2].size >> EFI_PAGE_SHIFT,
+				   EFI_RESERVED_MEMORY_TYPE, false);
+	}
+#endif
+
 	return 0;
 }
 
-- 
1.8.5.6

^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [U-Boot] [PATCH v4 4/9] ls2080ardb: Convert to distro boot
  2016-06-20 23:07 [U-Boot] [PATCH v4 0/9] LS2080ARDB: Enable EFI boot support Alexander Graf
                   ` (2 preceding siblings ...)
  2016-06-20 23:07 ` [U-Boot] [PATCH v4 3/9] ls2080ardb: Reserve DP-DDR RAM Alexander Graf
@ 2016-06-20 23:07 ` Alexander Graf
  2016-06-21 21:49   ` york sun
  2016-06-22  2:54   ` Prabhakar Kushwaha
  2016-06-20 23:07 ` [U-Boot] [PATCH v4 5/9] armv8: ls2080a: Declare spin tables as reserved for efi loader Alexander Graf
                   ` (5 subsequent siblings)
  9 siblings, 2 replies; 32+ messages in thread
From: Alexander Graf @ 2016-06-20 23:07 UTC (permalink / raw)
  To: u-boot

Most new systems in U-Boot these days make use of the generic "distro"
framework which allows a user to have U-Boot scan for a bootable OS
on all available media types.

This patch extends the LS2080ARDB board to use that framework if the
hard coded NOR flash location does not contain a bootable image.

Signed-off-by: Alexander Graf <agraf@suse.de>

---

v1 -> v2:

  - Boot NOR flash before distro boot

v2 -> v3:

  - Actually run distro boot (s/&&/||/ after bootm)

v3 -> v4:

  - Add CONFIG_CMD_FS_GENERIC to defconfig
---
 configs/ls2080a_emu_defconfig            |  1 +
 configs/ls2080a_simu_defconfig           |  1 +
 configs/ls2080aqds_SECURE_BOOT_defconfig |  1 +
 configs/ls2080aqds_defconfig             |  1 +
 configs/ls2080aqds_nand_defconfig        |  1 +
 configs/ls2080ardb_SECURE_BOOT_defconfig |  1 +
 configs/ls2080ardb_defconfig             |  1 +
 configs/ls2080ardb_nand_defconfig        |  1 +
 include/configs/ls2080ardb.h             | 26 +++++++++++++++++++++++++-
 9 files changed, 33 insertions(+), 1 deletion(-)

diff --git a/configs/ls2080a_emu_defconfig b/configs/ls2080a_emu_defconfig
index 21a0283..c55feb5 100644
--- a/configs/ls2080a_emu_defconfig
+++ b/configs/ls2080a_emu_defconfig
@@ -27,3 +27,4 @@ CONFIG_CMD_CACHE=y
 CONFIG_SYS_NS16550=y
 CONFIG_OF_LIBFDT=y
 CONFIG_EFI_LOADER_BOUNCE_BUFFER=y
+CONFIG_CMD_FS_GENERIC=y
diff --git a/configs/ls2080a_simu_defconfig b/configs/ls2080a_simu_defconfig
index 1b670b0..edb267d 100644
--- a/configs/ls2080a_simu_defconfig
+++ b/configs/ls2080a_simu_defconfig
@@ -30,3 +30,4 @@ CONFIG_NET_RANDOM_ETHADDR=y
 CONFIG_SYS_NS16550=y
 CONFIG_OF_LIBFDT=y
 CONFIG_EFI_LOADER_BOUNCE_BUFFER=y
+CONFIG_CMD_FS_GENERIC=y
diff --git a/configs/ls2080aqds_SECURE_BOOT_defconfig b/configs/ls2080aqds_SECURE_BOOT_defconfig
index 947ac3d..23be0c2 100644
--- a/configs/ls2080aqds_SECURE_BOOT_defconfig
+++ b/configs/ls2080aqds_SECURE_BOOT_defconfig
@@ -35,3 +35,4 @@ CONFIG_USB_XHCI_HCD=y
 CONFIG_USB_XHCI_DWC3=y
 CONFIG_RSA=y
 CONFIG_EFI_LOADER_BOUNCE_BUFFER=y
+CONFIG_CMD_FS_GENERIC=y
diff --git a/configs/ls2080aqds_defconfig b/configs/ls2080aqds_defconfig
index cd8a7bd..0ed1f03 100644
--- a/configs/ls2080aqds_defconfig
+++ b/configs/ls2080aqds_defconfig
@@ -34,3 +34,4 @@ CONFIG_USB=y
 CONFIG_USB_XHCI_HCD=y
 CONFIG_USB_XHCI_DWC3=y
 CONFIG_EFI_LOADER_BOUNCE_BUFFER=y
+CONFIG_CMD_FS_GENERIC=y
diff --git a/configs/ls2080aqds_nand_defconfig b/configs/ls2080aqds_nand_defconfig
index ea3fd1e..778ce59 100644
--- a/configs/ls2080aqds_nand_defconfig
+++ b/configs/ls2080aqds_nand_defconfig
@@ -35,3 +35,4 @@ CONFIG_USB=y
 CONFIG_USB_XHCI_HCD=y
 CONFIG_USB_XHCI_DWC3=y
 CONFIG_EFI_LOADER_BOUNCE_BUFFER=y
+CONFIG_CMD_FS_GENERIC=y
diff --git a/configs/ls2080ardb_SECURE_BOOT_defconfig b/configs/ls2080ardb_SECURE_BOOT_defconfig
index 8f98720..c561dd0 100644
--- a/configs/ls2080ardb_SECURE_BOOT_defconfig
+++ b/configs/ls2080ardb_SECURE_BOOT_defconfig
@@ -35,3 +35,4 @@ CONFIG_USB_XHCI_HCD=y
 CONFIG_USB_XHCI_DWC3=y
 CONFIG_RSA=y
 CONFIG_EFI_LOADER_BOUNCE_BUFFER=y
+CONFIG_CMD_FS_GENERIC=y
diff --git a/configs/ls2080ardb_defconfig b/configs/ls2080ardb_defconfig
index c0b8a98..2295513 100644
--- a/configs/ls2080ardb_defconfig
+++ b/configs/ls2080ardb_defconfig
@@ -34,3 +34,4 @@ CONFIG_USB=y
 CONFIG_USB_XHCI_HCD=y
 CONFIG_USB_XHCI_DWC3=y
 CONFIG_EFI_LOADER_BOUNCE_BUFFER=y
+CONFIG_CMD_FS_GENERIC=y
diff --git a/configs/ls2080ardb_nand_defconfig b/configs/ls2080ardb_nand_defconfig
index 26ffe98..9cc70e8 100644
--- a/configs/ls2080ardb_nand_defconfig
+++ b/configs/ls2080ardb_nand_defconfig
@@ -28,3 +28,4 @@ CONFIG_USB_XHCI_HCD=y
 CONFIG_USB_XHCI_DWC3=y
 CONFIG_OF_LIBFDT=y
 CONFIG_EFI_LOADER_BOUNCE_BUFFER=y
+CONFIG_CMD_FS_GENERIC=y
diff --git a/include/configs/ls2080ardb.h b/include/configs/ls2080ardb.h
index 86a49a5..b0e00b6 100644
--- a/include/configs/ls2080ardb.h
+++ b/include/configs/ls2080ardb.h
@@ -321,10 +321,24 @@ unsigned long get_board_sys_clk(void);
 #define CONFIG_SYS_USB_XHCI_MAX_ROOT_PORTS      2
 #define CONFIG_USB_STORAGE
 
+#undef CONFIG_CMDLINE_EDITING
+#include <config_distro_defaults.h>
+
+#define BOOT_TARGET_DEVICES(func) \
+	func(MMC, mmc, 0) \
+	func(SCSI, scsi, 0) \
+	func(DHCP, dhcp, na)
+#include <config_distro_bootcmd.h>
+
 /* Initial environment variables */
 #undef CONFIG_EXTRA_ENV_SETTINGS
 #define CONFIG_EXTRA_ENV_SETTINGS		\
 	"hwconfig=fsl_ddr:bank_intlv=auto\0"	\
+	"scriptaddr=0x80800000\0"		\
+	"kernel_addr_r=0x81000000\0"		\
+	"pxefile_addr_r=0x81000000\0"		\
+	"fdt_addr_r=0x88000000\0"		\
+	"ramdisk_addr_r=0x89000000\0"		\
 	"loadaddr=0x80100000\0"			\
 	"kernel_addr=0x100000\0"		\
 	"ramdisk_addr=0x800000\0"		\
@@ -334,8 +348,10 @@ unsigned long get_board_sys_clk(void);
 	"kernel_start=0x581100000\0"		\
 	"kernel_load=0xa0000000\0"		\
 	"kernel_size=0x2800000\0"		\
+	"fdtfile=fsl-ls2080a-rdb.dtb\0"		\
 	"mcinitcmd=fsl_mc start mc 0x580300000"	\
-	" 0x580800000 \0"
+	" 0x580800000 \0"			\
+	BOOTENV
 
 #undef CONFIG_BOOTARGS
 #define CONFIG_BOOTARGS		"console=ttyS1,115200 root=/dev/ram0 " \
@@ -343,6 +359,14 @@ unsigned long get_board_sys_clk(void);
 				"ramdisk_size=0x2000000 default_hugepagesz=2m" \
 				" hugepagesz=2m hugepages=256"
 
+#undef CONFIG_BOOTCOMMAND
+/* Try to boot an on-NOR kernel first, then do normal distro boot */
+#define CONFIG_BOOTCOMMAND "run mcinitcmd && fsl_mc lazyapply dpl 0x580700000" \
+			   " && cp.b $kernel_start $kernel_load $kernel_size" \
+			   " && bootm $kernel_load" \
+			   " || setenv ethact DPMAC5 at xgmii" \
+			   " && run distro_bootcmd"
+
 /* MAC/PHY configuration */
 #ifdef CONFIG_FSL_MC_ENET
 #define CONFIG_PHYLIB_10G
-- 
1.8.5.6

^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [U-Boot] [PATCH v4 5/9] armv8: ls2080a: Declare spin tables as reserved for efi loader
  2016-06-20 23:07 [U-Boot] [PATCH v4 0/9] LS2080ARDB: Enable EFI boot support Alexander Graf
                   ` (3 preceding siblings ...)
  2016-06-20 23:07 ` [U-Boot] [PATCH v4 4/9] ls2080ardb: Convert to distro boot Alexander Graf
@ 2016-06-20 23:07 ` Alexander Graf
  2016-06-22  3:06   ` Prabhakar Kushwaha
  2016-06-20 23:07 ` [U-Boot] [PATCH v4 6/9] efi_loader: Allow boards to implement get_time and reset_system Alexander Graf
                   ` (4 subsequent siblings)
  9 siblings, 1 reply; 32+ messages in thread
From: Alexander Graf @ 2016-06-20 23:07 UTC (permalink / raw)
  To: u-boot

The efi loader code has its own memory map, so it needs to be aware where
the spin tables are located, to ensure that no code writes into those
regions.

Signed-off-by: Alexander Graf <agraf@suse.de>
---
 arch/arm/cpu/armv8/fsl-layerscape/fdt.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/arch/arm/cpu/armv8/fsl-layerscape/fdt.c b/arch/arm/cpu/armv8/fsl-layerscape/fdt.c
index d17227a..91d6374 100644
--- a/arch/arm/cpu/armv8/fsl-layerscape/fdt.c
+++ b/arch/arm/cpu/armv8/fsl-layerscape/fdt.c
@@ -5,6 +5,7 @@
  */
 
 #include <common.h>
+#include <efi_loader.h>
 #include <libfdt.h>
 #include <fdt_support.h>
 #include <phy.h>
@@ -72,6 +73,11 @@ void ft_fixup_cpu(void *blob)
 
 	fdt_add_mem_rsv(blob, (uintptr_t)&secondary_boot_code,
 			*boot_code_size);
+#ifdef CONFIG_EFI_LOADER
+	efi_add_memory_map((uintptr_t)&secondary_boot_code,
+			   ALIGN(*boot_code_size, EFI_PAGE_SIZE) >> EFI_PAGE_SHIFT,
+			   EFI_RESERVED_MEMORY_TYPE, false);
+#endif
 }
 #endif
 
-- 
1.8.5.6

^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [U-Boot] [PATCH v4 6/9] efi_loader: Allow boards to implement get_time and reset_system
  2016-06-20 23:07 [U-Boot] [PATCH v4 0/9] LS2080ARDB: Enable EFI boot support Alexander Graf
                   ` (4 preceding siblings ...)
  2016-06-20 23:07 ` [U-Boot] [PATCH v4 5/9] armv8: ls2080a: Declare spin tables as reserved for efi loader Alexander Graf
@ 2016-06-20 23:07 ` Alexander Graf
  2016-06-20 23:07 ` [U-Boot] [PATCH v4 7/9] armv8: fsl-layerscape: Add support for efi_loader RTS reset Alexander Graf
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 32+ messages in thread
From: Alexander Graf @ 2016-06-20 23:07 UTC (permalink / raw)
  To: u-boot

EFI allows an OS to leverage firmware drivers while the OS is running. In the
generic code we so far had to stub those implementations out, because we would
need board specific knowledge about MMIO setups for it.

However, boards can easily implement those themselves. This patch provides the
framework so that a board can implement its own versions of get_time and
reset_system which would actually do something useful.

While at it we also introduce a simple way for code to reserve MMIO pointers
as runtime available.

Signed-off-by: Alexander Graf <agraf@suse.de>
---
 cmd/bootefi.c                |   4 ++
 include/efi_loader.h         |  18 ++++++++
 lib/efi_loader/efi_runtime.c | 101 ++++++++++++++++++++++++++++++++++++++-----
 3 files changed, 112 insertions(+), 11 deletions(-)

diff --git a/cmd/bootefi.c b/cmd/bootefi.c
index edd0980..651ae1a 100644
--- a/cmd/bootefi.c
+++ b/cmd/bootefi.c
@@ -216,6 +216,10 @@ static unsigned long do_bootefi_exec(void *efi, void *fdt)
 	}
 #endif
 
+	/* Initialize EFI runtime services */
+	efi_reset_system_init();
+	efi_get_time_init();
+
 	/* Call our payload! */
 	debug("%s:%d Jumping to 0x%lx\n", __func__, __LINE__, (long)entry);
 
diff --git a/include/efi_loader.h b/include/efi_loader.h
index 9738835..91d6a84 100644
--- a/include/efi_loader.h
+++ b/include/efi_loader.h
@@ -150,11 +150,29 @@ static inline void ascii2unicode(u16 *unicode, const char *ascii)
 #define EFI_RUNTIME_DATA __attribute__ ((section ("efi_runtime_data")))
 #define EFI_RUNTIME_TEXT __attribute__ ((section ("efi_runtime_text")))
 
+/* Call this with mmio_ptr as the _pointer_ to a pointer to an MMIO region
+ * to make it available at runtime */
+void efi_add_runtime_mmio(void *mmio_ptr, u64 len);
+
+/* Boards may provide the functions below to implement RTS functionality */
+
+void EFI_RUNTIME_TEXT EFIAPI efi_reset_system(
+			enum efi_reset_type reset_type,
+			efi_status_t reset_status,
+			unsigned long data_size, void *reset_data);
+void efi_reset_system_init(void);
+
+efi_status_t EFI_RUNTIME_TEXT EFIAPI efi_get_time(
+			struct efi_time *time,
+			struct efi_time_cap *capabilities);
+void efi_get_time_init(void);
+
 #else /* defined(EFI_LOADER) && !defined(CONFIG_SPL_BUILD) */
 
 /* Without CONFIG_EFI_LOADER we don't have a runtime section, stub it out */
 #define EFI_RUNTIME_DATA
 #define EFI_RUNTIME_TEXT
+static inline void efi_add_runtime_mmio(void **mmio_ptr, u64 len) { }
 
 /* No loader configured, stub out EFI_ENTRY */
 static inline void efi_restore_gd(void) { }
diff --git a/lib/efi_loader/efi_runtime.c b/lib/efi_loader/efi_runtime.c
index 99b5ef1..5301d68 100644
--- a/lib/efi_loader/efi_runtime.c
+++ b/lib/efi_loader/efi_runtime.c
@@ -16,6 +16,16 @@
 /* For manual relocation support */
 DECLARE_GLOBAL_DATA_PTR;
 
+struct efi_runtime_mmio_list {
+	struct list_head link;
+	void **ptr;
+	u64 paddr;
+	u64 len;
+};
+
+/* This list contains all runtime available mmio regions */
+LIST_HEAD(efi_runtime_mmio);
+
 static efi_status_t EFI_RUNTIME_TEXT EFIAPI efi_unimplemented(void);
 static efi_status_t EFI_RUNTIME_TEXT EFIAPI efi_device_error(void);
 static efi_status_t EFI_RUNTIME_TEXT EFIAPI efi_invalid_parameter(void);
@@ -55,9 +65,10 @@ struct elf_rela {
  * handle a good number of runtime callbacks
  */
 
-static void EFIAPI efi_reset_system(enum efi_reset_type reset_type,
-				    efi_status_t reset_status,
-				    unsigned long data_size, void *reset_data)
+static void EFIAPI efi_reset_system_boottime(
+			enum efi_reset_type reset_type,
+			efi_status_t reset_status,
+			unsigned long data_size, void *reset_data)
 {
 	EFI_ENTRY("%d %lx %lx %p", reset_type, reset_status, data_size,
 		  reset_data);
@@ -72,11 +83,12 @@ static void EFIAPI efi_reset_system(enum efi_reset_type reset_type,
 		break;
 	}
 
-	EFI_EXIT(EFI_SUCCESS);
+	while (1) { }
 }
 
-static efi_status_t EFIAPI efi_get_time(struct efi_time *time,
-					struct efi_time_cap *capabilities)
+static efi_status_t EFIAPI efi_get_time_boottime(
+			struct efi_time *time,
+			struct efi_time_cap *capabilities)
 {
 #if defined(CONFIG_CMD_DATE) && defined(CONFIG_DM_RTC)
 	struct rtc_time tm;
@@ -107,6 +119,33 @@ static efi_status_t EFIAPI efi_get_time(struct efi_time *time,
 #endif
 }
 
+/* Boards may override the helpers below to implement RTS functionality */
+
+void __weak EFI_RUNTIME_TEXT EFIAPI efi_reset_system(
+			enum efi_reset_type reset_type,
+			efi_status_t reset_status,
+			unsigned long data_size, void *reset_data)
+{
+	/* Nothing we can do */
+	while (1) { }
+}
+
+void __weak efi_reset_system_init(void)
+{
+}
+
+efi_status_t __weak EFI_RUNTIME_TEXT EFIAPI efi_get_time(
+			struct efi_time *time,
+			struct efi_time_cap *capabilities)
+{
+	/* Nothing we can do */
+	return EFI_DEVICE_ERROR;
+}
+
+void __weak efi_get_time_init(void)
+{
+}
+
 struct efi_runtime_detach_list_struct {
 	void *ptr;
 	void *patchto;
@@ -116,7 +155,7 @@ static const struct efi_runtime_detach_list_struct efi_runtime_detach_list[] = {
 	{
 		/* do_reset is gone */
 		.ptr = &efi_runtime_services.reset_system,
-		.patchto = NULL,
+		.patchto = efi_reset_system,
 	}, {
 		/* invalidate_*cache_all are gone */
 		.ptr = &efi_runtime_services.set_virtual_address_map,
@@ -124,7 +163,7 @@ static const struct efi_runtime_detach_list_struct efi_runtime_detach_list[] = {
 	}, {
 		/* RTC accessors are gone */
 		.ptr = &efi_runtime_services.get_time,
-		.patchto = &efi_device_error,
+		.patchto = &efi_get_time,
 	}, {
 		/* Clean up system table */
 		.ptr = &systab.con_in,
@@ -233,12 +272,38 @@ static efi_status_t EFIAPI efi_set_virtual_address_map(
 	EFI_ENTRY("%lx %lx %x %p", memory_map_size, descriptor_size,
 		  descriptor_version, virtmap);
 
+	/* Rebind mmio pointers */
+	for (i = 0; i < n; i++) {
+		struct efi_mem_desc *map = (void*)virtmap +
+					   (descriptor_size * i);
+		struct list_head *lhandle;
+		efi_physical_addr_t map_start = map->physical_start;
+		efi_physical_addr_t map_len = map->num_pages << EFI_PAGE_SHIFT;
+		efi_physical_addr_t map_end = map_start + map_len;
+
+		/* Adjust all mmio pointers in this region */
+		list_for_each(lhandle, &efi_runtime_mmio) {
+			struct efi_runtime_mmio_list *lmmio;
+
+			lmmio = list_entry(lhandle,
+					   struct efi_runtime_mmio_list,
+					   link);
+			if ((map_start <= lmmio->paddr) &&
+			    (map_end >= lmmio->paddr)) {
+				u64 off = map->virtual_start - map_start;
+				*lmmio->ptr = (void*)(lmmio->paddr + off);
+			}
+		}
+	}
+
+	/* Move the actual runtime code over */
 	for (i = 0; i < n; i++) {
 		struct efi_mem_desc *map;
 
 		map = (void*)virtmap + (descriptor_size * i);
 		if (map->type == EFI_RUNTIME_SERVICES_CODE) {
-			ulong new_offset = map->virtual_start - (runtime_start - gd->relocaddr);
+			ulong new_offset = map->virtual_start -
+					   (runtime_start - gd->relocaddr);
 
 			efi_runtime_relocate(new_offset, map);
 			/* Once we're virtual, we can no longer handle
@@ -251,6 +316,20 @@ static efi_status_t EFIAPI efi_set_virtual_address_map(
 	return EFI_EXIT(EFI_INVALID_PARAMETER);
 }
 
+void efi_add_runtime_mmio(void *mmio_ptr, u64 len)
+{
+	struct efi_runtime_mmio_list *newmmio;
+
+	u64 pages = (len + EFI_PAGE_SIZE - 1) >> EFI_PAGE_SHIFT;
+	efi_add_memory_map(*(uintptr_t *)mmio_ptr, pages, EFI_MMAP_IO, false);
+
+	newmmio = calloc(1, sizeof(*newmmio));
+	newmmio->ptr = mmio_ptr;
+	newmmio->paddr = *(uintptr_t *)mmio_ptr;
+	newmmio->len = len;
+        list_add_tail(&newmmio->link, &efi_runtime_mmio);
+}
+
 /*
  * In the second stage, U-Boot has disappeared. To isolate our runtime code
  * that at this point still exists from the rest, we put it into a special
@@ -292,7 +371,7 @@ struct efi_runtime_services EFI_RUNTIME_DATA efi_runtime_services = {
 		.revision = EFI_RUNTIME_SERVICES_REVISION,
 		.headersize = sizeof(struct efi_table_hdr),
 	},
-	.get_time = &efi_get_time,
+	.get_time = &efi_get_time_boottime,
 	.set_time = (void *)&efi_device_error,
 	.get_wakeup_time = (void *)&efi_unimplemented,
 	.set_wakeup_time = (void *)&efi_unimplemented,
@@ -302,5 +381,5 @@ struct efi_runtime_services EFI_RUNTIME_DATA efi_runtime_services = {
 	.get_next_variable = (void *)&efi_device_error,
 	.set_variable = (void *)&efi_device_error,
 	.get_next_high_mono_count = (void *)&efi_device_error,
-	.reset_system = &efi_reset_system,
+	.reset_system = &efi_reset_system_boottime,
 };
-- 
1.8.5.6

^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [U-Boot] [PATCH v4 7/9] armv8: fsl-layerscape: Add support for efi_loader RTS reset
  2016-06-20 23:07 [U-Boot] [PATCH v4 0/9] LS2080ARDB: Enable EFI boot support Alexander Graf
                   ` (5 preceding siblings ...)
  2016-06-20 23:07 ` [U-Boot] [PATCH v4 6/9] efi_loader: Allow boards to implement get_time and reset_system Alexander Graf
@ 2016-06-20 23:07 ` Alexander Graf
  2016-06-20 23:07 ` [U-Boot] [PATCH v4 8/9] efi_loader: Declare secure memory as reserved Alexander Graf
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 32+ messages in thread
From: Alexander Graf @ 2016-06-20 23:07 UTC (permalink / raw)
  To: u-boot

When implementing efi loader support, we can expose runtime services
for payloads. One such service is CPU reset.

This patch implements RTS CPU reset support for layerscape systems.

Signed-off-by: Alexander Graf <agraf@suse.de>
---
 arch/arm/cpu/armv8/fsl-layerscape/cpu.c | 33 +++++++++++++++++++++++++++++++--
 1 file changed, 31 insertions(+), 2 deletions(-)

diff --git a/arch/arm/cpu/armv8/fsl-layerscape/cpu.c b/arch/arm/cpu/armv8/fsl-layerscape/cpu.c
index 8062106..53b9c01 100644
--- a/arch/arm/cpu/armv8/fsl-layerscape/cpu.c
+++ b/arch/arm/cpu/armv8/fsl-layerscape/cpu.c
@@ -17,6 +17,7 @@
 #ifdef CONFIG_MP
 #include <asm/arch/mp.h>
 #endif
+#include <efi_loader.h>
 #include <fm_eth.h>
 #include <fsl_debug_server.h>
 #include <fsl-mc/fsl_mc.h>
@@ -677,9 +678,10 @@ int timer_init(void)
 	return 0;
 }
 
-void reset_cpu(ulong addr)
+EFI_RUNTIME_DATA u32 __iomem *rstcr = (u32 *)CONFIG_SYS_FSL_RST_ADDR;
+
+void EFI_RUNTIME_TEXT reset_cpu(ulong addr)
 {
-	u32 __iomem *rstcr = (u32 *)CONFIG_SYS_FSL_RST_ADDR;
 	u32 val;
 
 	/* Raise RESET_REQ_B */
@@ -688,6 +690,33 @@ void reset_cpu(ulong addr)
 	scfg_out32(rstcr, val);
 }
 
+#ifdef CONFIG_EFI_LOADER
+
+void EFI_RUNTIME_TEXT EFIAPI efi_reset_system(
+		       enum efi_reset_type reset_type,
+		       efi_status_t reset_status,
+		       unsigned long data_size, void *reset_data)
+{
+	switch (reset_type) {
+	case EFI_RESET_COLD:
+	case EFI_RESET_WARM:
+		reset_cpu(0);
+		break;
+	case EFI_RESET_SHUTDOWN:
+		/* Nothing we can do */
+		break;
+	}
+
+	while (1) { }
+}
+
+void efi_reset_system_init(void)
+{
+       efi_add_runtime_mmio(&rstcr, sizeof(*rstcr));
+}
+
+#endif
+
 phys_size_t board_reserve_ram_top(phys_size_t ram_size)
 {
 	phys_size_t ram_top = ram_size;
-- 
1.8.5.6

^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [U-Boot] [PATCH v4 8/9] efi_loader: Declare secure memory as reserved
  2016-06-20 23:07 [U-Boot] [PATCH v4 0/9] LS2080ARDB: Enable EFI boot support Alexander Graf
                   ` (6 preceding siblings ...)
  2016-06-20 23:07 ` [U-Boot] [PATCH v4 7/9] armv8: fsl-layerscape: Add support for efi_loader RTS reset Alexander Graf
@ 2016-06-20 23:07 ` Alexander Graf
  2016-07-20 15:20   ` york sun
  2016-06-20 23:07 ` [U-Boot] [PATCH v4 9/9] efi_loader: Allow bouncing for network Alexander Graf
  2016-06-23  5:30 ` [U-Boot] [PATCH v4 0/9] LS2080ARDB: Enable EFI boot support Prabhakar Kushwaha
  9 siblings, 1 reply; 32+ messages in thread
From: Alexander Graf @ 2016-06-20 23:07 UTC (permalink / raw)
  To: u-boot

Some systems may implemente TrustZone (EL3) in U-Boot. Those systems
reserve some memory that U-Boot is aware of as secure.

For those systems, mask out that secure memory in the EFI memory map,
as it's not usable from EL2 or EL1.

Signed-off-by: Alexander Graf <agraf@suse.de>
---
 lib/efi_loader/efi_memory.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/lib/efi_loader/efi_memory.c b/lib/efi_loader/efi_memory.c
index df2381e..6e2eeeb 100644
--- a/lib/efi_loader/efi_memory.c
+++ b/lib/efi_loader/efi_memory.c
@@ -398,5 +398,20 @@ int efi_memory_init(void)
 	efi_bounce_buffer = (void*)(uintptr_t)efi_bounce_buffer_addr;
 #endif
 
+#ifdef CONFIG_SYS_MEM_RESERVE_SECURE
+	/* Declare secure ram as reserved */
+        if (gd->secure_ram & MEM_RESERVE_SECURE_SECURED) {
+		uint64_t secure_start = gd->secure_ram;
+		uint64_t secure_pages = CONFIG_SYS_MEM_RESERVE_SECURE;
+
+		secure_start &= MEM_RESERVE_SECURE_ADDR_MASK;
+		secure_start &= ~EFI_PAGE_MASK;
+		secure_pages = (secure_pages + EFI_PAGE_MASK) >> EFI_PAGE_SHIFT;
+
+		efi_add_memory_map(secure_start, secure_pages,
+				   EFI_RESERVED_MEMORY_TYPE, false);
+        }
+#endif
+
 	return 0;
 }
-- 
1.8.5.6

^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [U-Boot] [PATCH v4 9/9] efi_loader: Allow bouncing for network
  2016-06-20 23:07 [U-Boot] [PATCH v4 0/9] LS2080ARDB: Enable EFI boot support Alexander Graf
                   ` (7 preceding siblings ...)
  2016-06-20 23:07 ` [U-Boot] [PATCH v4 8/9] efi_loader: Declare secure memory as reserved Alexander Graf
@ 2016-06-20 23:07 ` Alexander Graf
  2016-06-23  5:30 ` [U-Boot] [PATCH v4 0/9] LS2080ARDB: Enable EFI boot support Prabhakar Kushwaha
  9 siblings, 0 replies; 32+ messages in thread
From: Alexander Graf @ 2016-06-20 23:07 UTC (permalink / raw)
  To: u-boot

So far bounce buffers were only used for disk I/O, but network I/O
may suffer from the same problem.

On platforms that have problems doing DMA on high addresses, let's
also bounce outgoing network packets. Incoming ones always already
get bounced.

Signed-off-by: Alexander Graf <agraf@suse.de>
---
 lib/efi_loader/efi_net.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/lib/efi_loader/efi_net.c b/lib/efi_loader/efi_net.c
index dd3b485..6a8a0d7 100644
--- a/lib/efi_loader/efi_net.c
+++ b/lib/efi_loader/efi_net.c
@@ -152,7 +152,14 @@ static efi_status_t EFIAPI efi_net_transmit(struct efi_simple_network *this,
 		return EFI_EXIT(EFI_INVALID_PARAMETER);
 	}
 
+#ifdef CONFIG_EFI_LOADER_BOUNCE_BUFFER
+	/* Ethernet packets always fit, just bounce */
+	memcpy(efi_bounce_buffer, buffer, buffer_size);
+	net_send_packet(efi_bounce_buffer, buffer_size);
+#else
 	net_send_packet(buffer, buffer_size);
+#endif
+
 	new_tx_packet = buffer;
 
 	return EFI_EXIT(EFI_SUCCESS);
-- 
1.8.5.6

^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [U-Boot] [PATCH v4 2/9] efi_loader: AArch64: Run EFI payloads in EL2 if U-Boot runs in EL3
  2016-06-20 23:07 ` [U-Boot] [PATCH v4 2/9] efi_loader: AArch64: Run EFI payloads in EL2 if U-Boot runs in EL3 Alexander Graf
@ 2016-06-21 17:12   ` york sun
  2016-06-21 17:55     ` Alexander Graf
  2016-06-22  2:50   ` Prabhakar Kushwaha
  1 sibling, 1 reply; 32+ messages in thread
From: york sun @ 2016-06-21 17:12 UTC (permalink / raw)
  To: u-boot

On 06/20/2016 04:07 PM, Alexander Graf wrote:
> Some boards decided not to run ATF or other secure firmware in EL3, so
> they instead run U-Boot there. The uEFI spec doesn't know what EL3 is
> though - it only knows about EL2 and EL1. So if we see that we're running
> in EL3, let's get into EL2 to make payloads happy.
>
> Signed-off-by: Alexander Graf <agraf@suse.de>
> ---
>   arch/arm/include/asm/armv8/mmu.h | 19 ++++++++++++-------
>   cmd/bootefi.c                    | 11 +++++++++++
>   2 files changed, 23 insertions(+), 7 deletions(-)
>
> diff --git a/arch/arm/include/asm/armv8/mmu.h b/arch/arm/include/asm/armv8/mmu.h
> index 0d08ed3..876a2b2 100644
> --- a/arch/arm/include/asm/armv8/mmu.h
> +++ b/arch/arm/include/asm/armv8/mmu.h
> @@ -116,19 +116,24 @@
>   static inline void set_ttbr_tcr_mair(int el, u64 table, u64 tcr, u64 attr)
>   {
>   	asm volatile("dsb sy");
> -	if (el == 1) {
> +	switch (el) {
> +	case 1:
>   		asm volatile("msr ttbr0_el1, %0" : : "r" (table) : "memory");
>   		asm volatile("msr tcr_el1, %0" : : "r" (tcr) : "memory");
>   		asm volatile("msr mair_el1, %0" : : "r" (attr) : "memory");
> -	} else if (el == 2) {
> -		asm volatile("msr ttbr0_el2, %0" : : "r" (table) : "memory");
> -		asm volatile("msr tcr_el2, %0" : : "r" (tcr) : "memory");
> -		asm volatile("msr mair_el2, %0" : : "r" (attr) : "memory");
> -	} else if (el == 3) {
> +		break;
> +	case 3:
>   		asm volatile("msr ttbr0_el3, %0" : : "r" (table) : "memory");
>   		asm volatile("msr tcr_el3, %0" : : "r" (tcr) : "memory");
>   		asm volatile("msr mair_el3, %0" : : "r" (attr) : "memory");
> -	} else {
> +
> +		/* We may switch to EL2 later, so set those too; fall through */
> +	case 2:
> +		asm volatile("msr ttbr0_el2, %0" : : "r" (table) : "memory");
> +		asm volatile("msr tcr_el2, %0" : : "r" (tcr) : "memory");
> +		asm volatile("msr mair_el2, %0" : : "r" (attr) : "memory");
> +		break;


This may be problematic. If we use secure memory for EL3, the MMU tables 
have to be within the secure memory. But EL2 will not be able to access 
it. I believe you have verified this patch set actually work. I am 
curious how it work.

York

^ permalink raw reply	[flat|nested] 32+ messages in thread

* [U-Boot] [PATCH v4 2/9] efi_loader: AArch64: Run EFI payloads in EL2 if U-Boot runs in EL3
  2016-06-21 17:12   ` york sun
@ 2016-06-21 17:55     ` Alexander Graf
  2016-06-21 18:02       ` york sun
  0 siblings, 1 reply; 32+ messages in thread
From: Alexander Graf @ 2016-06-21 17:55 UTC (permalink / raw)
  To: u-boot



> Am 21.06.2016 um 19:12 schrieb york sun <york.sun@nxp.com>:
> 
>> On 06/20/2016 04:07 PM, Alexander Graf wrote:
>> Some boards decided not to run ATF or other secure firmware in EL3, so
>> they instead run U-Boot there. The uEFI spec doesn't know what EL3 is
>> though - it only knows about EL2 and EL1. So if we see that we're running
>> in EL3, let's get into EL2 to make payloads happy.
>> 
>> Signed-off-by: Alexander Graf <agraf@suse.de>
>> ---
>>  arch/arm/include/asm/armv8/mmu.h | 19 ++++++++++++-------
>>  cmd/bootefi.c                    | 11 +++++++++++
>>  2 files changed, 23 insertions(+), 7 deletions(-)
>> 
>> diff --git a/arch/arm/include/asm/armv8/mmu.h b/arch/arm/include/asm/armv8/mmu.h
>> index 0d08ed3..876a2b2 100644
>> --- a/arch/arm/include/asm/armv8/mmu.h
>> +++ b/arch/arm/include/asm/armv8/mmu.h
>> @@ -116,19 +116,24 @@
>>  static inline void set_ttbr_tcr_mair(int el, u64 table, u64 tcr, u64 attr)
>>  {
>>      asm volatile("dsb sy");
>> -    if (el == 1) {
>> +    switch (el) {
>> +    case 1:
>>          asm volatile("msr ttbr0_el1, %0" : : "r" (table) : "memory");
>>          asm volatile("msr tcr_el1, %0" : : "r" (tcr) : "memory");
>>          asm volatile("msr mair_el1, %0" : : "r" (attr) : "memory");
>> -    } else if (el == 2) {
>> -        asm volatile("msr ttbr0_el2, %0" : : "r" (table) : "memory");
>> -        asm volatile("msr tcr_el2, %0" : : "r" (tcr) : "memory");
>> -        asm volatile("msr mair_el2, %0" : : "r" (attr) : "memory");
>> -    } else if (el == 3) {
>> +        break;
>> +    case 3:
>>          asm volatile("msr ttbr0_el3, %0" : : "r" (table) : "memory");
>>          asm volatile("msr tcr_el3, %0" : : "r" (tcr) : "memory");
>>          asm volatile("msr mair_el3, %0" : : "r" (attr) : "memory");
>> -    } else {
>> +
>> +        /* We may switch to EL2 later, so set those too; fall through */
>> +    case 2:
>> +        asm volatile("msr ttbr0_el2, %0" : : "r" (table) : "memory");
>> +        asm volatile("msr tcr_el2, %0" : : "r" (tcr) : "memory");
>> +        asm volatile("msr mair_el2, %0" : : "r" (attr) : "memory");
>> +        break;
> 
> 
> This may be problematic. If we use secure memory for EL3, the MMU tables 
> have to be within the secure memory. But EL2 will not be able to access 
> it. I believe you have verified this patch set actually work. I am 
> curious how it work.

That's a good question. I suppose the default config doesn't actually lock secure memory? Or doesn't go secure at all?

Alex

^ permalink raw reply	[flat|nested] 32+ messages in thread

* [U-Boot] [PATCH v4 2/9] efi_loader: AArch64: Run EFI payloads in EL2 if U-Boot runs in EL3
  2016-06-21 17:55     ` Alexander Graf
@ 2016-06-21 18:02       ` york sun
  2016-06-22  5:44         ` Alexander Graf
  0 siblings, 1 reply; 32+ messages in thread
From: york sun @ 2016-06-21 18:02 UTC (permalink / raw)
  To: u-boot

On 06/21/2016 10:55 AM, Alexander Graf wrote:
>
>
>> Am 21.06.2016 um 19:12 schrieb york sun <york.sun@nxp.com>:
>>
>>> On 06/20/2016 04:07 PM, Alexander Graf wrote:
>>> Some boards decided not to run ATF or other secure firmware in EL3, so
>>> they instead run U-Boot there. The uEFI spec doesn't know what EL3 is
>>> though - it only knows about EL2 and EL1. So if we see that we're running
>>> in EL3, let's get into EL2 to make payloads happy.
>>>
>>> Signed-off-by: Alexander Graf <agraf@suse.de>
>>> ---
>>>   arch/arm/include/asm/armv8/mmu.h | 19 ++++++++++++-------
>>>   cmd/bootefi.c                    | 11 +++++++++++
>>>   2 files changed, 23 insertions(+), 7 deletions(-)
>>>
>>> diff --git a/arch/arm/include/asm/armv8/mmu.h b/arch/arm/include/asm/armv8/mmu.h
>>> index 0d08ed3..876a2b2 100644
>>> --- a/arch/arm/include/asm/armv8/mmu.h
>>> +++ b/arch/arm/include/asm/armv8/mmu.h
>>> @@ -116,19 +116,24 @@
>>>   static inline void set_ttbr_tcr_mair(int el, u64 table, u64 tcr, u64 attr)
>>>   {
>>>       asm volatile("dsb sy");
>>> -    if (el == 1) {
>>> +    switch (el) {
>>> +    case 1:
>>>           asm volatile("msr ttbr0_el1, %0" : : "r" (table) : "memory");
>>>           asm volatile("msr tcr_el1, %0" : : "r" (tcr) : "memory");
>>>           asm volatile("msr mair_el1, %0" : : "r" (attr) : "memory");
>>> -    } else if (el == 2) {
>>> -        asm volatile("msr ttbr0_el2, %0" : : "r" (table) : "memory");
>>> -        asm volatile("msr tcr_el2, %0" : : "r" (tcr) : "memory");
>>> -        asm volatile("msr mair_el2, %0" : : "r" (attr) : "memory");
>>> -    } else if (el == 3) {
>>> +        break;
>>> +    case 3:
>>>           asm volatile("msr ttbr0_el3, %0" : : "r" (table) : "memory");
>>>           asm volatile("msr tcr_el3, %0" : : "r" (tcr) : "memory");
>>>           asm volatile("msr mair_el3, %0" : : "r" (attr) : "memory");
>>> -    } else {
>>> +
>>> +        /* We may switch to EL2 later, so set those too; fall through */
>>> +    case 2:
>>> +        asm volatile("msr ttbr0_el2, %0" : : "r" (table) : "memory");
>>> +        asm volatile("msr tcr_el2, %0" : : "r" (tcr) : "memory");
>>> +        asm volatile("msr mair_el2, %0" : : "r" (attr) : "memory");
>>> +        break;
>>
>>
>> This may be problematic. If we use secure memory for EL3, the MMU tables
>> have to be within the secure memory. But EL2 will not be able to access
>> it. I believe you have verified this patch set actually work. I am
>> curious how it work.
>
> That's a good question. I suppose the default config doesn't actually lock secure memory? Or doesn't go secure at all?
>

The patch set using this secure memory is still pending. Our internal 
team has been working on it. So the secure memory has been working. I am 
sure I have put MMU tables in secure memory. You can verify by running 
"bdi" command. It will show you the secure memory location. If you don't 
see it, then you don't have secure memory setup. By default, it is enabled.

I remember I have done a test to access to the secure memory from 
non-secure master and got an exception.

Could your test run at EL2 without a proper MMU table? I don't remember 
if the core would hang, or continue to run if fetching MMU table fails.

York

^ permalink raw reply	[flat|nested] 32+ messages in thread

* [U-Boot] [PATCH v4 4/9] ls2080ardb: Convert to distro boot
  2016-06-20 23:07 ` [U-Boot] [PATCH v4 4/9] ls2080ardb: Convert to distro boot Alexander Graf
@ 2016-06-21 21:49   ` york sun
  2016-06-22  4:53     ` Alexander Graf
  2016-06-22  2:54   ` Prabhakar Kushwaha
  1 sibling, 1 reply; 32+ messages in thread
From: york sun @ 2016-06-21 21:49 UTC (permalink / raw)
  To: u-boot

On 06/20/2016 04:07 PM, Alexander Graf wrote:
> Most new systems in U-Boot these days make use of the generic "distro"
> framework which allows a user to have U-Boot scan for a bootable OS
> on all available media types.
>
> This patch extends the LS2080ARDB board to use that framework if the
> hard coded NOR flash location does not contain a bootable image.
>
> Signed-off-by: Alexander Graf <agraf@suse.de>
>
> ---
>
> v1 -> v2:
>
>    - Boot NOR flash before distro boot
>
> v2 -> v3:
>
>    - Actually run distro boot (s/&&/||/ after bootm)
>
> v3 -> v4:
>
>    - Add CONFIG_CMD_FS_GENERIC to defconfig
> ---
>   configs/ls2080a_emu_defconfig            |  1 +
>   configs/ls2080a_simu_defconfig           |  1 +
>   configs/ls2080aqds_SECURE_BOOT_defconfig |  1 +
>   configs/ls2080aqds_defconfig             |  1 +
>   configs/ls2080aqds_nand_defconfig        |  1 +
>   configs/ls2080ardb_SECURE_BOOT_defconfig |  1 +
>   configs/ls2080ardb_defconfig             |  1 +
>   configs/ls2080ardb_nand_defconfig        |  1 +
>   include/configs/ls2080ardb.h             | 26 +++++++++++++++++++++++++-
>   9 files changed, 33 insertions(+), 1 deletion(-)
>
> diff --git a/configs/ls2080a_emu_defconfig b/configs/ls2080a_emu_defconfig
> index 21a0283..c55feb5 100644
> --- a/configs/ls2080a_emu_defconfig
> +++ b/configs/ls2080a_emu_defconfig
> @@ -27,3 +27,4 @@ CONFIG_CMD_CACHE=y
>   CONFIG_SYS_NS16550=y
>   CONFIG_OF_LIBFDT=y
>   CONFIG_EFI_LOADER_BOUNCE_BUFFER=y
> +CONFIG_CMD_FS_GENERIC=y
> diff --git a/configs/ls2080a_simu_defconfig b/configs/ls2080a_simu_defconfig
> index 1b670b0..edb267d 100644
> --- a/configs/ls2080a_simu_defconfig
> +++ b/configs/ls2080a_simu_defconfig
> @@ -30,3 +30,4 @@ CONFIG_NET_RANDOM_ETHADDR=y
>   CONFIG_SYS_NS16550=y
>   CONFIG_OF_LIBFDT=y
>   CONFIG_EFI_LOADER_BOUNCE_BUFFER=y
> +CONFIG_CMD_FS_GENERIC=y

For simulator and emulator targets, probably the filesystem commands 
don't get used, due to the physical limitation.

York

^ permalink raw reply	[flat|nested] 32+ messages in thread

* [U-Boot] [PATCH v4 2/9] efi_loader: AArch64: Run EFI payloads in EL2 if U-Boot runs in EL3
  2016-06-20 23:07 ` [U-Boot] [PATCH v4 2/9] efi_loader: AArch64: Run EFI payloads in EL2 if U-Boot runs in EL3 Alexander Graf
  2016-06-21 17:12   ` york sun
@ 2016-06-22  2:50   ` Prabhakar Kushwaha
  2016-06-22  5:46     ` Alexander Graf
  1 sibling, 1 reply; 32+ messages in thread
From: Prabhakar Kushwaha @ 2016-06-22  2:50 UTC (permalink / raw)
  To: u-boot

Hi Alex

> -----Original Message-----
> From: Alexander Graf [mailto:agraf at suse.de]
> Sent: Tuesday, June 21, 2016 4:37 AM
> To: u-boot at lists.denx.de
> Cc: york sun <york.sun@nxp.com>; Prabhakar Kushwaha
> <prabhakar.kushwaha@nxp.com>
> Subject: [PATCH v4 2/9] efi_loader: AArch64: Run EFI payloads in EL2 if U-
> Boot runs in EL3
> 
> Some boards decided not to run ATF or other secure firmware in EL3, so they
> instead run U-Boot there. The uEFI spec doesn't know what EL3 is though - it
> only knows about EL2 and EL1. So if we see that we're running in EL3, let's get
> into EL2 to make payloads happy.
> 
> Signed-off-by: Alexander Graf <agraf@suse.de>
> ---

<snip>

>  	asm volatile("isb");
> diff --git a/cmd/bootefi.c b/cmd/bootefi.c index 2169065..edd0980 100644
> --- a/cmd/bootefi.c
> +++ b/cmd/bootefi.c
> @@ -205,6 +205,17 @@ static unsigned long do_bootefi_exec(void *efi, void
> *fdt)
>  		loaded_image_info.device_handle = nethandle;  #endif
> 
> +#ifdef CONFIG_ARM64
> +	/* On AArch64 we need to make sure we call our payload in < EL3 */
> +	if (current_el() == 3) {
> +		smp_kick_all_cpus();
> +		dcache_disable();	/* flush cache before switch to EL2 */
> +		armv8_switch_to_el2();
> +		/* Enable caches again */
> +		set_sctlr(get_sctlr() | (CR_C|CR_M));
> +	}

As exception level switch to EL2. Who is creating MMU table for EL2.

--prabhakar

^ permalink raw reply	[flat|nested] 32+ messages in thread

* [U-Boot] [PATCH v4 3/9] ls2080ardb: Reserve DP-DDR RAM
  2016-06-20 23:07 ` [U-Boot] [PATCH v4 3/9] ls2080ardb: Reserve DP-DDR RAM Alexander Graf
@ 2016-06-22  2:51   ` Prabhakar Kushwaha
  2016-06-22  4:54     ` Alexander Graf
  0 siblings, 1 reply; 32+ messages in thread
From: Prabhakar Kushwaha @ 2016-06-22  2:51 UTC (permalink / raw)
  To: u-boot

Hi Alex,


> -----Original Message-----
> From: Alexander Graf [mailto:agraf at suse.de]
> Sent: Tuesday, June 21, 2016 4:37 AM
> To: u-boot at lists.denx.de
> Cc: york sun <york.sun@nxp.com>; Prabhakar Kushwaha
> <prabhakar.kushwaha@nxp.com>
> Subject: [PATCH v4 3/9] ls2080ardb: Reserve DP-DDR RAM
> 
> The DP-DDR shouldn't be exposed as conventional memory to an OS, so let's
> rather claim it's a reserved region in the EFI memory map
> 
> Signed-off-by: Alexander Graf <agraf@suse.de>
> ---
>  board/freescale/ls2080ardb/ls2080ardb.c | 9 +++++++++
>  1 file changed, 9 insertions(+)
> 
> diff --git a/board/freescale/ls2080ardb/ls2080ardb.c
> b/board/freescale/ls2080ardb/ls2080ardb.c
> index d1475a5..493f66d 100644
> --- a/board/freescale/ls2080ardb/ls2080ardb.c
> +++ b/board/freescale/ls2080ardb/ls2080ardb.c
> @@ -16,6 +16,7 @@
>  #include <fsl_debug_server.h>
>  #include <fsl-mc/fsl_mc.h>
>  #include <environment.h>
> +#include <efi_loader.h>
>  #include <i2c.h>
>  #include <asm/arch/soc.h>
>  #include <fsl_sec.h>
> @@ -202,6 +203,14 @@ int misc_init_r(void)
>  	if (adjust_vdd(0))
>  		printf("Warning: Adjusting core voltage failed.\n");
> 
> +#ifdef CONFIG_EFI_LOADER
> +	if (soc_has_dp_ddr() && gd->bd->bi_dram[2].size) {
> +		efi_add_memory_map(gd->bd->bi_dram[2].start,
> +				   gd->bd->bi_dram[2].size >>
> EFI_PAGE_SHIFT,
> +				   EFI_RESERVED_MEMORY_TYPE, false);
> +	}
> +#endif

DP-DDR is not for ARM cores.  It is for other accelerators present in LS2080A.
I will suggest not to use DP-DDR for EFI memory.

--prabhakar

^ permalink raw reply	[flat|nested] 32+ messages in thread

* [U-Boot] [PATCH v4 4/9] ls2080ardb: Convert to distro boot
  2016-06-20 23:07 ` [U-Boot] [PATCH v4 4/9] ls2080ardb: Convert to distro boot Alexander Graf
  2016-06-21 21:49   ` york sun
@ 2016-06-22  2:54   ` Prabhakar Kushwaha
  1 sibling, 0 replies; 32+ messages in thread
From: Prabhakar Kushwaha @ 2016-06-22  2:54 UTC (permalink / raw)
  To: u-boot

Hi Alex

> -----Original Message-----
> From: Alexander Graf [mailto:agraf at suse.de]
> Sent: Tuesday, June 21, 2016 4:37 AM
> To: u-boot at lists.denx.de
> Cc: york sun <york.sun@nxp.com>; Prabhakar Kushwaha
> <prabhakar.kushwaha@nxp.com>
> Subject: [PATCH v4 4/9] ls2080ardb: Convert to distro boot
> 
> Most new systems in U-Boot these days make use of the generic "distro"
> framework which allows a user to have U-Boot scan for a bootable OS on all
> available media types.
> 
> This patch extends the LS2080ARDB board to use that framework if the hard
> coded NOR flash location does not contain a bootable image.
> 
> Signed-off-by: Alexander Graf <agraf@suse.de>
> 
> ---
> 
> v1 -> v2:
> 
>   - Boot NOR flash before distro boot
> 
> v2 -> v3:
> 
>   - Actually run distro boot (s/&&/||/ after bootm)
> 
> v3 -> v4:
> 
>   - Add CONFIG_CMD_FS_GENERIC to defconfig
> ---
>  configs/ls2080a_emu_defconfig            |  1 +
>  configs/ls2080a_simu_defconfig           |  1 +
>  configs/ls2080aqds_SECURE_BOOT_defconfig |  1 +
>  configs/ls2080aqds_defconfig             |  1 +
>  configs/ls2080aqds_nand_defconfig        |  1 +
>  configs/ls2080ardb_SECURE_BOOT_defconfig |  1 +
>  configs/ls2080ardb_defconfig             |  1 +
>  configs/ls2080ardb_nand_defconfig        |  1 +
>  include/configs/ls2080ardb.h             | 26 +++++++++++++++++++++++++-
>  9 files changed, 33 insertions(+), 1 deletion(-)
> 

<snip>

> index 86a49a5..b0e00b6 100644
> --- a/include/configs/ls2080ardb.h
> +++ b/include/configs/ls2080ardb.h
> @@ -321,10 +321,24 @@ unsigned long get_board_sys_clk(void);
>  #define CONFIG_SYS_USB_XHCI_MAX_ROOT_PORTS      2
>  #define CONFIG_USB_STORAGE
> 
> +#undef CONFIG_CMDLINE_EDITING
> +#include <config_distro_defaults.h>
> +
> +#define BOOT_TARGET_DEVICES(func) \
> +	func(MMC, mmc, 0) \
> +	func(SCSI, scsi, 0) \
> +	func(DHCP, dhcp, na)
> +#include <config_distro_bootcmd.h>
> +
>  /* Initial environment variables */
>  #undef CONFIG_EXTRA_ENV_SETTINGS
>  #define CONFIG_EXTRA_ENV_SETTINGS		\
>  	"hwconfig=fsl_ddr:bank_intlv=auto\0"	\
> +	"scriptaddr=0x80800000\0"		\
> +	"kernel_addr_r=0x81000000\0"		\
> +	"pxefile_addr_r=0x81000000\0"		\
> +	"fdt_addr_r=0x88000000\0"		\
> +	"ramdisk_addr_r=0x89000000\0"		\
>  	"loadaddr=0x80100000\0"			\
>  	"kernel_addr=0x100000\0"		\
>  	"ramdisk_addr=0x800000\0"		\
> @@ -334,8 +348,10 @@ unsigned long get_board_sys_clk(void);
>  	"kernel_start=0x581100000\0"		\
>  	"kernel_load=0xa0000000\0"		\
>  	"kernel_size=0x2800000\0"		\
> +	"fdtfile=fsl-ls2080a-rdb.dtb\0"		\
>  	"mcinitcmd=fsl_mc start mc 0x580300000"	\
> -	" 0x580800000 \0"
> +	" 0x580800000 \0"			\
> +	BOOTENV
> 
>  #undef CONFIG_BOOTARGS
>  #define CONFIG_BOOTARGS		"console=ttyS1,115200
> root=/dev/ram0 " \
> @@ -343,6 +359,14 @@ unsigned long get_board_sys_clk(void);
>  				"ramdisk_size=0x2000000
> default_hugepagesz=2m" \
>  				" hugepagesz=2m hugepages=256"
> 
> +#undef CONFIG_BOOTCOMMAND
> +/* Try to boot an on-NOR kernel first, then do normal distro boot */
> +#define CONFIG_BOOTCOMMAND "run mcinitcmd && fsl_mc lazyapply dpl
> 0x580700000" \
> +			   " && cp.b $kernel_start $kernel_load $kernel_size"
> \
> +			   " && bootm $kernel_load" \
> +			   " || setenv ethact DPMAC5 at xgmii" \
> +			   " && run distro_bootcmd"
> +

One suggestion,  Can we avoid hard-coding here " DPMAC5 at xgmii ". 
It will be really good if ethrpime being used.

--prabhakar

^ permalink raw reply	[flat|nested] 32+ messages in thread

* [U-Boot] [PATCH v4 5/9] armv8: ls2080a: Declare spin tables as reserved for efi loader
  2016-06-20 23:07 ` [U-Boot] [PATCH v4 5/9] armv8: ls2080a: Declare spin tables as reserved for efi loader Alexander Graf
@ 2016-06-22  3:06   ` Prabhakar Kushwaha
  2016-06-22  4:55     ` Alexander Graf
  0 siblings, 1 reply; 32+ messages in thread
From: Prabhakar Kushwaha @ 2016-06-22  3:06 UTC (permalink / raw)
  To: u-boot

Hi Alex,


> -----Original Message-----
> From: Alexander Graf [mailto:agraf at suse.de]
> Sent: Tuesday, June 21, 2016 4:37 AM
> To: u-boot at lists.denx.de
> Cc: york sun <york.sun@nxp.com>; Prabhakar Kushwaha
> <prabhakar.kushwaha@nxp.com>
> Subject: [PATCH v4 5/9] armv8: ls2080a: Declare spin tables as reserved for
> efi loader
> 
> The efi loader code has its own memory map, so it needs to be aware where
> the spin tables are located, to ensure that no code writes into those regions.
> 
> Signed-off-by: Alexander Graf <agraf@suse.de>
> ---
>  arch/arm/cpu/armv8/fsl-layerscape/fdt.c | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/arch/arm/cpu/armv8/fsl-layerscape/fdt.c
> b/arch/arm/cpu/armv8/fsl-layerscape/fdt.c
> index d17227a..91d6374 100644
> --- a/arch/arm/cpu/armv8/fsl-layerscape/fdt.c
> +++ b/arch/arm/cpu/armv8/fsl-layerscape/fdt.c
> @@ -5,6 +5,7 @@
>   */
> 
>  #include <common.h>
> +#include <efi_loader.h>
>  #include <libfdt.h>
>  #include <fdt_support.h>
>  #include <phy.h>
> @@ -72,6 +73,11 @@ void ft_fixup_cpu(void *blob)
> 
>  	fdt_add_mem_rsv(blob, (uintptr_t)&secondary_boot_code,
>  			*boot_code_size);
> +#ifdef CONFIG_EFI_LOADER
> +	efi_add_memory_map((uintptr_t)&secondary_boot_code,
> +			   ALIGN(*boot_code_size, EFI_PAGE_SIZE) >>
> EFI_PAGE_SHIFT,
> +			   EFI_RESERVED_MEMORY_TYPE, false); #endif
>  }
>  #endif

I believe this place(during DTS fix-up) is too late for  adding this memory in EFI memory map. 
Not sure, grub2 user may write this memory before launching Linux.

--prabhakar

^ permalink raw reply	[flat|nested] 32+ messages in thread

* [U-Boot] [PATCH v4 4/9] ls2080ardb: Convert to distro boot
  2016-06-21 21:49   ` york sun
@ 2016-06-22  4:53     ` Alexander Graf
  2016-06-22 15:15       ` york sun
  0 siblings, 1 reply; 32+ messages in thread
From: Alexander Graf @ 2016-06-22  4:53 UTC (permalink / raw)
  To: u-boot



> Am 21.06.2016 um 23:49 schrieb york sun <york.sun@nxp.com>:
> 
>> On 06/20/2016 04:07 PM, Alexander Graf wrote:
>> Most new systems in U-Boot these days make use of the generic "distro"
>> framework which allows a user to have U-Boot scan for a bootable OS
>> on all available media types.
>> 
>> This patch extends the LS2080ARDB board to use that framework if the
>> hard coded NOR flash location does not contain a bootable image.
>> 
>> Signed-off-by: Alexander Graf <agraf@suse.de>
>> 
>> ---
>> 
>> v1 -> v2:
>> 
>>   - Boot NOR flash before distro boot
>> 
>> v2 -> v3:
>> 
>>   - Actually run distro boot (s/&&/||/ after bootm)
>> 
>> v3 -> v4:
>> 
>>   - Add CONFIG_CMD_FS_GENERIC to defconfig
>> ---
>>  configs/ls2080a_emu_defconfig            |  1 +
>>  configs/ls2080a_simu_defconfig           |  1 +
>>  configs/ls2080aqds_SECURE_BOOT_defconfig |  1 +
>>  configs/ls2080aqds_defconfig             |  1 +
>>  configs/ls2080aqds_nand_defconfig        |  1 +
>>  configs/ls2080ardb_SECURE_BOOT_defconfig |  1 +
>>  configs/ls2080ardb_defconfig             |  1 +
>>  configs/ls2080ardb_nand_defconfig        |  1 +
>>  include/configs/ls2080ardb.h             | 26 +++++++++++++++++++++++++-
>>  9 files changed, 33 insertions(+), 1 deletion(-)
>> 
>> diff --git a/configs/ls2080a_emu_defconfig b/configs/ls2080a_emu_defconfig
>> index 21a0283..c55feb5 100644
>> --- a/configs/ls2080a_emu_defconfig
>> +++ b/configs/ls2080a_emu_defconfig
>> @@ -27,3 +27,4 @@ CONFIG_CMD_CACHE=y
>>  CONFIG_SYS_NS16550=y
>>  CONFIG_OF_LIBFDT=y
>>  CONFIG_EFI_LOADER_BOUNCE_BUFFER=y
>> +CONFIG_CMD_FS_GENERIC=y
>> diff --git a/configs/ls2080a_simu_defconfig b/configs/ls2080a_simu_defconfig
>> index 1b670b0..edb267d 100644
>> --- a/configs/ls2080a_simu_defconfig
>> +++ b/configs/ls2080a_simu_defconfig
>> @@ -30,3 +30,4 @@ CONFIG_NET_RANDOM_ETHADDR=y
>>  CONFIG_SYS_NS16550=y
>>  CONFIG_OF_LIBFDT=y
>>  CONFIG_EFI_LOADER_BOUNCE_BUFFER=y
>> +CONFIG_CMD_FS_GENERIC=y
> 
> For simulator and emulator targets, probably the filesystem commands 
> don't get used, due to the physical limitation.

Why not? You can still attach some storage to the simulator, no?

Alex

^ permalink raw reply	[flat|nested] 32+ messages in thread

* [U-Boot] [PATCH v4 3/9] ls2080ardb: Reserve DP-DDR RAM
  2016-06-22  2:51   ` Prabhakar Kushwaha
@ 2016-06-22  4:54     ` Alexander Graf
  0 siblings, 0 replies; 32+ messages in thread
From: Alexander Graf @ 2016-06-22  4:54 UTC (permalink / raw)
  To: u-boot



> Am 22.06.2016 um 04:51 schrieb Prabhakar Kushwaha <prabhakar.kushwaha@nxp.com>:
> 
> Hi Alex,
> 
> 
>> -----Original Message-----
>> From: Alexander Graf [mailto:agraf at suse.de]
>> Sent: Tuesday, June 21, 2016 4:37 AM
>> To: u-boot at lists.denx.de
>> Cc: york sun <york.sun@nxp.com>; Prabhakar Kushwaha
>> <prabhakar.kushwaha@nxp.com>
>> Subject: [PATCH v4 3/9] ls2080ardb: Reserve DP-DDR RAM
>> 
>> The DP-DDR shouldn't be exposed as conventional memory to an OS, so let's
>> rather claim it's a reserved region in the EFI memory map
>> 
>> Signed-off-by: Alexander Graf <agraf@suse.de>
>> ---
>> board/freescale/ls2080ardb/ls2080ardb.c | 9 +++++++++
>> 1 file changed, 9 insertions(+)
>> 
>> diff --git a/board/freescale/ls2080ardb/ls2080ardb.c
>> b/board/freescale/ls2080ardb/ls2080ardb.c
>> index d1475a5..493f66d 100644
>> --- a/board/freescale/ls2080ardb/ls2080ardb.c
>> +++ b/board/freescale/ls2080ardb/ls2080ardb.c
>> @@ -16,6 +16,7 @@
>> #include <fsl_debug_server.h>
>> #include <fsl-mc/fsl_mc.h>
>> #include <environment.h>
>> +#include <efi_loader.h>
>> #include <i2c.h>
>> #include <asm/arch/soc.h>
>> #include <fsl_sec.h>
>> @@ -202,6 +203,14 @@ int misc_init_r(void)
>>    if (adjust_vdd(0))
>>        printf("Warning: Adjusting core voltage failed.\n");
>> 
>> +#ifdef CONFIG_EFI_LOADER
>> +    if (soc_has_dp_ddr() && gd->bd->bi_dram[2].size) {
>> +        efi_add_memory_map(gd->bd->bi_dram[2].start,
>> +                   gd->bd->bi_dram[2].size >>
>> EFI_PAGE_SHIFT,
>> +                   EFI_RESERVED_MEMORY_TYPE, false);
>> +    }
>> +#endif
> 
> DP-DDR is not for ARM cores.  It is for other accelerators present in LS2080A.
> I will suggest not to use DP-DDR for EFI memory.

That's exactly what this patch does :). It tells marks the DP-DDR as reserved in the memory map.

Alex

^ permalink raw reply	[flat|nested] 32+ messages in thread

* [U-Boot] [PATCH v4 5/9] armv8: ls2080a: Declare spin tables as reserved for efi loader
  2016-06-22  3:06   ` Prabhakar Kushwaha
@ 2016-06-22  4:55     ` Alexander Graf
  0 siblings, 0 replies; 32+ messages in thread
From: Alexander Graf @ 2016-06-22  4:55 UTC (permalink / raw)
  To: u-boot



> Am 22.06.2016 um 05:06 schrieb Prabhakar Kushwaha <prabhakar.kushwaha@nxp.com>:
> 
> Hi Alex,
> 
> 
>> -----Original Message-----
>> From: Alexander Graf [mailto:agraf at suse.de]
>> Sent: Tuesday, June 21, 2016 4:37 AM
>> To: u-boot at lists.denx.de
>> Cc: york sun <york.sun@nxp.com>; Prabhakar Kushwaha
>> <prabhakar.kushwaha@nxp.com>
>> Subject: [PATCH v4 5/9] armv8: ls2080a: Declare spin tables as reserved for
>> efi loader
>> 
>> The efi loader code has its own memory map, so it needs to be aware where
>> the spin tables are located, to ensure that no code writes into those regions.
>> 
>> Signed-off-by: Alexander Graf <agraf@suse.de>
>> ---
>> arch/arm/cpu/armv8/fsl-layerscape/fdt.c | 6 ++++++
>> 1 file changed, 6 insertions(+)
>> 
>> diff --git a/arch/arm/cpu/armv8/fsl-layerscape/fdt.c
>> b/arch/arm/cpu/armv8/fsl-layerscape/fdt.c
>> index d17227a..91d6374 100644
>> --- a/arch/arm/cpu/armv8/fsl-layerscape/fdt.c
>> +++ b/arch/arm/cpu/armv8/fsl-layerscape/fdt.c
>> @@ -5,6 +5,7 @@
>>  */
>> 
>> #include <common.h>
>> +#include <efi_loader.h>
>> #include <libfdt.h>
>> #include <fdt_support.h>
>> #include <phy.h>
>> @@ -72,6 +73,11 @@ void ft_fixup_cpu(void *blob)
>> 
>>    fdt_add_mem_rsv(blob, (uintptr_t)&secondary_boot_code,
>>            *boot_code_size);
>> +#ifdef CONFIG_EFI_LOADER
>> +    efi_add_memory_map((uintptr_t)&secondary_boot_code,
>> +               ALIGN(*boot_code_size, EFI_PAGE_SIZE) >>
>> EFI_PAGE_SHIFT,
>> +               EFI_RESERVED_MEMORY_TYPE, false); #endif
>> }
>> #endif
> 
> I believe this place(during DTS fix-up) is too late for  adding this memory in EFI memory map. 
> Not sure, grub2 user may write this memory before launching Linux.

The dt fixups get called in bootefi, so before grub2 starts :)


Alex

^ permalink raw reply	[flat|nested] 32+ messages in thread

* [U-Boot] [PATCH v4 2/9] efi_loader: AArch64: Run EFI payloads in EL2 if U-Boot runs in EL3
  2016-06-21 18:02       ` york sun
@ 2016-06-22  5:44         ` Alexander Graf
  2016-07-15 15:40           ` york sun
  2016-07-20 15:18           ` york sun
  0 siblings, 2 replies; 32+ messages in thread
From: Alexander Graf @ 2016-06-22  5:44 UTC (permalink / raw)
  To: u-boot



On 21.06.16 20:02, york sun wrote:
> On 06/21/2016 10:55 AM, Alexander Graf wrote:
>>
>>
>>> Am 21.06.2016 um 19:12 schrieb york sun <york.sun@nxp.com>:
>>>
>>>> On 06/20/2016 04:07 PM, Alexander Graf wrote:
>>>> Some boards decided not to run ATF or other secure firmware in EL3, so
>>>> they instead run U-Boot there. The uEFI spec doesn't know what EL3 is
>>>> though - it only knows about EL2 and EL1. So if we see that we're running
>>>> in EL3, let's get into EL2 to make payloads happy.
>>>>
>>>> Signed-off-by: Alexander Graf <agraf@suse.de>
>>>> ---
>>>>   arch/arm/include/asm/armv8/mmu.h | 19 ++++++++++++-------
>>>>   cmd/bootefi.c                    | 11 +++++++++++
>>>>   2 files changed, 23 insertions(+), 7 deletions(-)
>>>>
>>>> diff --git a/arch/arm/include/asm/armv8/mmu.h b/arch/arm/include/asm/armv8/mmu.h
>>>> index 0d08ed3..876a2b2 100644
>>>> --- a/arch/arm/include/asm/armv8/mmu.h
>>>> +++ b/arch/arm/include/asm/armv8/mmu.h
>>>> @@ -116,19 +116,24 @@
>>>>   static inline void set_ttbr_tcr_mair(int el, u64 table, u64 tcr, u64 attr)
>>>>   {
>>>>       asm volatile("dsb sy");
>>>> -    if (el == 1) {
>>>> +    switch (el) {
>>>> +    case 1:
>>>>           asm volatile("msr ttbr0_el1, %0" : : "r" (table) : "memory");
>>>>           asm volatile("msr tcr_el1, %0" : : "r" (tcr) : "memory");
>>>>           asm volatile("msr mair_el1, %0" : : "r" (attr) : "memory");
>>>> -    } else if (el == 2) {
>>>> -        asm volatile("msr ttbr0_el2, %0" : : "r" (table) : "memory");
>>>> -        asm volatile("msr tcr_el2, %0" : : "r" (tcr) : "memory");
>>>> -        asm volatile("msr mair_el2, %0" : : "r" (attr) : "memory");
>>>> -    } else if (el == 3) {
>>>> +        break;
>>>> +    case 3:
>>>>           asm volatile("msr ttbr0_el3, %0" : : "r" (table) : "memory");
>>>>           asm volatile("msr tcr_el3, %0" : : "r" (tcr) : "memory");
>>>>           asm volatile("msr mair_el3, %0" : : "r" (attr) : "memory");
>>>> -    } else {
>>>> +
>>>> +        /* We may switch to EL2 later, so set those too; fall through */
>>>> +    case 2:
>>>> +        asm volatile("msr ttbr0_el2, %0" : : "r" (table) : "memory");
>>>> +        asm volatile("msr tcr_el2, %0" : : "r" (tcr) : "memory");
>>>> +        asm volatile("msr mair_el2, %0" : : "r" (attr) : "memory");
>>>> +        break;
>>>
>>>
>>> This may be problematic. If we use secure memory for EL3, the MMU tables
>>> have to be within the secure memory. But EL2 will not be able to access
>>> it. I believe you have verified this patch set actually work. I am
>>> curious how it work.
>>
>> That's a good question. I suppose the default config doesn't actually lock secure memory? Or doesn't go secure at all?
>>
> 
> The patch set using this secure memory is still pending. Our internal 
> team has been working on it. So the secure memory has been working. I am 
> sure I have put MMU tables in secure memory. You can verify by running 
> "bdi" command. It will show you the secure memory location. If you don't 
> see it, then you don't have secure memory setup. By default, it is enabled.

Ok, yes, I do see secure memory there.

> I remember I have done a test to access to the secure memory from 
> non-secure master and got an exception.
> 
> Could your test run at EL2 without a proper MMU table? I don't remember 
> if the core would hang, or continue to run if fetching MMU table fails.

So without this patch, U-Boot would just hang (or probably loop in
delivering page faults) in the switch to EL2, before we even reach any
EFI payload. I'm not sure why it does succeed in accessing the page
tables though if they are indeed in secure memory.

Maybe we should just turn the whole logic upside down. Switch from EL3
to EL2 in very early init code and get people to just run ATF or some
other self-contained trusted firmware (maybe even built as part of
U-Boot) in EL3. Putting all of U-Boot into EL3 doesn't seem to much of a
good idea either way, as there is a lot of code that has no business at EL3.

Would that approach work for you as well?


Alex

^ permalink raw reply	[flat|nested] 32+ messages in thread

* [U-Boot] [PATCH v4 2/9] efi_loader: AArch64: Run EFI payloads in EL2 if U-Boot runs in EL3
  2016-06-22  2:50   ` Prabhakar Kushwaha
@ 2016-06-22  5:46     ` Alexander Graf
  0 siblings, 0 replies; 32+ messages in thread
From: Alexander Graf @ 2016-06-22  5:46 UTC (permalink / raw)
  To: u-boot



On 22.06.16 04:50, Prabhakar Kushwaha wrote:
> Hi Alex
> 
>> -----Original Message-----
>> From: Alexander Graf [mailto:agraf at suse.de]
>> Sent: Tuesday, June 21, 2016 4:37 AM
>> To: u-boot at lists.denx.de
>> Cc: york sun <york.sun@nxp.com>; Prabhakar Kushwaha
>> <prabhakar.kushwaha@nxp.com>
>> Subject: [PATCH v4 2/9] efi_loader: AArch64: Run EFI payloads in EL2 if U-
>> Boot runs in EL3
>>
>> Some boards decided not to run ATF or other secure firmware in EL3, so they
>> instead run U-Boot there. The uEFI spec doesn't know what EL3 is though - it
>> only knows about EL2 and EL1. So if we see that we're running in EL3, let's get
>> into EL2 to make payloads happy.
>>
>> Signed-off-by: Alexander Graf <agraf@suse.de>
>> ---
> 
> <snip>
> 
>>  	asm volatile("isb");
>> diff --git a/cmd/bootefi.c b/cmd/bootefi.c index 2169065..edd0980 100644
>> --- a/cmd/bootefi.c
>> +++ b/cmd/bootefi.c
>> @@ -205,6 +205,17 @@ static unsigned long do_bootefi_exec(void *efi, void
>> *fdt)
>>  		loaded_image_info.device_handle = nethandle;  #endif
>>
>> +#ifdef CONFIG_ARM64
>> +	/* On AArch64 we need to make sure we call our payload in < EL3 */
>> +	if (current_el() == 3) {
>> +		smp_kick_all_cpus();
>> +		dcache_disable();	/* flush cache before switch to EL2 */
>> +		armv8_switch_to_el2();
>> +		/* Enable caches again */
>> +		set_sctlr(get_sctlr() | (CR_C|CR_M));
>> +	}
> 
> As exception level switch to EL2. Who is creating MMU table for EL2.

It just reuses the same page tables that EL3 was using. As York already
mentioned, that shouldn't have worked, but does :).


Alex

^ permalink raw reply	[flat|nested] 32+ messages in thread

* [U-Boot] [PATCH v4 4/9] ls2080ardb: Convert to distro boot
  2016-06-22  4:53     ` Alexander Graf
@ 2016-06-22 15:15       ` york sun
  0 siblings, 0 replies; 32+ messages in thread
From: york sun @ 2016-06-22 15:15 UTC (permalink / raw)
  To: u-boot

On 06/21/2016 09:53 PM, Alexander Graf wrote:
>
>
>> Am 21.06.2016 um 23:49 schrieb york sun <york.sun@nxp.com>:
>>
>>> On 06/20/2016 04:07 PM, Alexander Graf wrote:
>>> Most new systems in U-Boot these days make use of the generic "distro"
>>> framework which allows a user to have U-Boot scan for a bootable OS
>>> on all available media types.
>>>
>>> This patch extends the LS2080ARDB board to use that framework if the
>>> hard coded NOR flash location does not contain a bootable image.
>>>
>>> Signed-off-by: Alexander Graf <agraf@suse.de>
>>>
>>> ---
>>>
>>> v1 -> v2:
>>>
>>>    - Boot NOR flash before distro boot
>>>
>>> v2 -> v3:
>>>
>>>    - Actually run distro boot (s/&&/||/ after bootm)
>>>
>>> v3 -> v4:
>>>
>>>    - Add CONFIG_CMD_FS_GENERIC to defconfig
>>> ---
>>>   configs/ls2080a_emu_defconfig            |  1 +
>>>   configs/ls2080a_simu_defconfig           |  1 +
>>>   configs/ls2080aqds_SECURE_BOOT_defconfig |  1 +
>>>   configs/ls2080aqds_defconfig             |  1 +
>>>   configs/ls2080aqds_nand_defconfig        |  1 +
>>>   configs/ls2080ardb_SECURE_BOOT_defconfig |  1 +
>>>   configs/ls2080ardb_defconfig             |  1 +
>>>   configs/ls2080ardb_nand_defconfig        |  1 +
>>>   include/configs/ls2080ardb.h             | 26 +++++++++++++++++++++++++-
>>>   9 files changed, 33 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/configs/ls2080a_emu_defconfig b/configs/ls2080a_emu_defconfig
>>> index 21a0283..c55feb5 100644
>>> --- a/configs/ls2080a_emu_defconfig
>>> +++ b/configs/ls2080a_emu_defconfig
>>> @@ -27,3 +27,4 @@ CONFIG_CMD_CACHE=y
>>>   CONFIG_SYS_NS16550=y
>>>   CONFIG_OF_LIBFDT=y
>>>   CONFIG_EFI_LOADER_BOUNCE_BUFFER=y
>>> +CONFIG_CMD_FS_GENERIC=y
>>> diff --git a/configs/ls2080a_simu_defconfig b/configs/ls2080a_simu_defconfig
>>> index 1b670b0..edb267d 100644
>>> --- a/configs/ls2080a_simu_defconfig
>>> +++ b/configs/ls2080a_simu_defconfig
>>> @@ -30,3 +30,4 @@ CONFIG_NET_RANDOM_ETHADDR=y
>>>   CONFIG_SYS_NS16550=y
>>>   CONFIG_OF_LIBFDT=y
>>>   CONFIG_EFI_LOADER_BOUNCE_BUFFER=y
>>> +CONFIG_CMD_FS_GENERIC=y
>>
>> For simulator and emulator targets, probably the filesystem commands
>> don't get used, due to the physical limitation.
>
> Why not? You can still attach some storage to the simulator, no?

Well, it doesn't hurt to include FS command. But there is no storage 
device for our simulator/emulator.

York

^ permalink raw reply	[flat|nested] 32+ messages in thread

* [U-Boot] [PATCH v4 0/9] LS2080ARDB: Enable EFI boot support
  2016-06-20 23:07 [U-Boot] [PATCH v4 0/9] LS2080ARDB: Enable EFI boot support Alexander Graf
                   ` (8 preceding siblings ...)
  2016-06-20 23:07 ` [U-Boot] [PATCH v4 9/9] efi_loader: Allow bouncing for network Alexander Graf
@ 2016-06-23  5:30 ` Prabhakar Kushwaha
  2016-06-23  7:34   ` Alexander Graf
  9 siblings, 1 reply; 32+ messages in thread
From: Prabhakar Kushwaha @ 2016-06-23  5:30 UTC (permalink / raw)
  To: u-boot

Hi Alex,

> -----Original Message-----
> From: Alexander Graf [mailto:agraf at suse.de]
> Sent: Tuesday, June 21, 2016 4:37 AM
> To: u-boot at lists.denx.de
> Cc: york sun <york.sun@nxp.com>; Prabhakar Kushwaha
> <prabhakar.kushwaha@nxp.com>
> Subject: [PATCH v4 0/9] LS2080ARDB: Enable EFI boot support
> 
> We now have EFI support in U-Boot which worked out of the box on all
> systems that I tried it on so far. Except for the LS2080ARDB. With this patch
> set I can successfully boot grub2 and Linux from there on such a system -
> even using PXE.
> 
> v3 -> v4:
> 
>   - Add CONFIG_CMD_FS_GENERIC to defconfig
>   - Move code into generic quiesce weak function
>   - Exit device for real when going to Linux
>   - Only apply DPL if we have something to apply
>   - New: armv8: ls2080a: Declare spin tables as reserved for efi loader
>   - New: efi_loader: Allow boards to implement get_time and reset_system
>   - New: armv8: fsl-layerscape: Add support for efi_loader RTS reset
>   - New: efi_loader: Declare secure memory as reserved
>   - New: efi_loader: Allow bouncing for network
> 
> Alexander Graf (9):
>   ls2080: Exit dpaa only right before exiting U-Boot
>   efi_loader: AArch64: Run EFI payloads in EL2 if U-Boot runs in EL3
>   ls2080ardb: Reserve DP-DDR RAM
>   ls2080ardb: Convert to distro boot
>   armv8: ls2080a: Declare spin tables as reserved for efi loader
>   efi_loader: Allow boards to implement get_time and reset_system
>   armv8: fsl-layerscape: Add support for efi_loader RTS reset
>   efi_loader: Declare secure memory as reserved
>   efi_loader: Allow bouncing for network
> 
>  arch/arm/cpu/armv8/fsl-layerscape/cpu.c  |  33 +++++++++-
>  arch/arm/cpu/armv8/fsl-layerscape/fdt.c  |   6 ++
>  arch/arm/include/asm/armv8/mmu.h         |  19 +++---
>  arch/arm/include/asm/u-boot-arm.h        |   1 +
>  arch/arm/lib/bootm.c                     |   7 +++
>  board/freescale/ls2080a/ls2080a.c        |   6 +-
>  board/freescale/ls2080aqds/ls2080aqds.c  |  11 ++--
> board/freescale/ls2080ardb/ls2080ardb.c  |  20 ++++--
>  cmd/bootefi.c                            |  15 +++++
>  configs/ls2080a_emu_defconfig            |   1 +
>  configs/ls2080a_simu_defconfig           |   1 +
>  configs/ls2080aqds_SECURE_BOOT_defconfig |   1 +
>  configs/ls2080aqds_defconfig             |   1 +
>  configs/ls2080aqds_nand_defconfig        |   1 +
>  configs/ls2080ardb_SECURE_BOOT_defconfig |   1 +
>  configs/ls2080ardb_defconfig             |   1 +
>  configs/ls2080ardb_nand_defconfig        |   1 +
>  drivers/net/fsl-mc/mc.c                  |  24 +++++++-
>  include/configs/ls2080ardb.h             |  26 +++++++-
>  include/efi_loader.h                     |  18 ++++++
>  lib/efi_loader/efi_boottime.c            |   2 +
>  lib/efi_loader/efi_memory.c              |  15 +++++
>  lib/efi_loader/efi_net.c                 |   7 +++
>  lib/efi_loader/efi_runtime.c             | 101 +++++++++++++++++++++++++++-
> ---

I am testing your patch set on ls2080ardb. 
Observation:-
1. Linux boot no more crashing with e1000#0, DPMAC5 at XSGMII. Even tried with default bootcmd. 
2. Grub2 crash while booting :(

I have applied your patch on top of commit " 9f823615af919c6b89f0b80197f009f78299dcde"

Please find log below.


=> usb start
starting USB...
USB0:   Register 200017f NbrPorts 2
Starting the controller
USB XHCI 1.00
scanning bus 0 for devices... 2 USB Device(s) found
USB1:   Register 200017f NbrPorts 2
Starting the controller
USB XHCI 1.00
scanning bus 1 for devices... 1 USB Device(s) found
       scanning usb for storage devices... 1 Storage Device(s) found
=> edit ethact
edit: DPMAC5 at xgmii
=> tftp 0x80000000 fsl-ls2080a-rdb.dtb; fdt addr 0x80000000; fdt boardsetup;tftp 0xa0000000 grubaa64.efi; bootefi a0000000 0x80000000
Using DPMAC5 at xgmii device
TFTP from server 192.168.1.1; our IP address is 192.168.1.34
Filename 'fsl-ls2080a-rdb.dtb'.
Load address: 0x80000000
Loading: ###
         2 KiB/s
done
Bytes transferred = 10549 (2935 hex)
WARNING: could not set reg FDT_ERR_NOSPACE.
ERROR: could not set fsl,usb-erratum-a008751 for snps,dwc3: FDT_ERR_NOSPACE.
ERROR: could not set fsl,usb-erratum-a008751 for snps,dwc3: FDT_ERR_NOSPACE.
Using DPMAC5 at xgmii device
TFTP from server 192.168.1.1; our IP address is 192.168.1.34
Filename 'grubaa64.efi'.
Load address: 0xa0000000
Loading: #################################################################
         #################################################################
         ###########################################
         85.9 KiB/s
done
Bytes transferred = 884224 (d7e00 hex)
## Starting EFI application at 0xa0000000 ...
Scanning disks on scsi...
Scanning disks on usb...
Scanning disks on mmc...
MMC: no card present
MMC Device 1 not found
MMC Device 2 not found
MMC Device 3 not found
Found 4 disks
"Synchronous Abort" handler, esr 0x8a000000
ELR:     97ffeee9d5033fdf
LR:      fff03d0c
x0 : 00000000fff87250 x1 : 00000000fff90720
x2 : 97ffeee9d5033fdf x3 : 00000000fff897a0
x4 : 0000000000000000 x5 : 00000000fff897b0
x6 : 0000000000000008 x7 : 0000000000000001
x8 : 0000000000000003 x9 : 000000000000000c
x10: 000000000a200023 x11: 0000000000000002
x12: 0000000000000002 x13: 00000000fff7ccd1
x14: 00000000fff7cccb x15: 00000000ffefeb50
x16: 00000000fff7ccc0 x17: 00000000fff7ccba
x18: 00000000ffcf7d78 x19: 00000000fff87250
x20: 0000000080000000 x21: 0000000000000003
x22: 00000000ffd1bf50 x23: 0000000000000003
x24: 00000000fff9e4a4 x25: 0000000000000000
x26: 0000000000000000 x27: 00000000fff87250
x28: 00000000fff87000 x29: 00000000fff03c40

Resetting CPU ...

### ERROR ### Please RESET the board ###

--prabhakar

^ permalink raw reply	[flat|nested] 32+ messages in thread

* [U-Boot] [PATCH v4 0/9] LS2080ARDB: Enable EFI boot support
  2016-06-23  5:30 ` [U-Boot] [PATCH v4 0/9] LS2080ARDB: Enable EFI boot support Prabhakar Kushwaha
@ 2016-06-23  7:34   ` Alexander Graf
  2016-06-23 10:34     ` Prabhakar Kushwaha
  0 siblings, 1 reply; 32+ messages in thread
From: Alexander Graf @ 2016-06-23  7:34 UTC (permalink / raw)
  To: u-boot



> Am 23.06.2016 um 07:30 schrieb Prabhakar Kushwaha <prabhakar.kushwaha@nxp.com>:
> 
> Hi Alex,
> 
>> -----Original Message-----
>> From: Alexander Graf [mailto:agraf at suse.de]
>> Sent: Tuesday, June 21, 2016 4:37 AM
>> To: u-boot at lists.denx.de
>> Cc: york sun <york.sun@nxp.com>; Prabhakar Kushwaha
>> <prabhakar.kushwaha@nxp.com>
>> Subject: [PATCH v4 0/9] LS2080ARDB: Enable EFI boot support
>> 
>> We now have EFI support in U-Boot which worked out of the box on all
>> systems that I tried it on so far. Except for the LS2080ARDB. With this patch
>> set I can successfully boot grub2 and Linux from there on such a system -
>> even using PXE.
>> 
>> v3 -> v4:
>> 
>>  - Add CONFIG_CMD_FS_GENERIC to defconfig
>>  - Move code into generic quiesce weak function
>>  - Exit device for real when going to Linux
>>  - Only apply DPL if we have something to apply
>>  - New: armv8: ls2080a: Declare spin tables as reserved for efi loader
>>  - New: efi_loader: Allow boards to implement get_time and reset_system
>>  - New: armv8: fsl-layerscape: Add support for efi_loader RTS reset
>>  - New: efi_loader: Declare secure memory as reserved
>>  - New: efi_loader: Allow bouncing for network
>> 
>> Alexander Graf (9):
>>  ls2080: Exit dpaa only right before exiting U-Boot
>>  efi_loader: AArch64: Run EFI payloads in EL2 if U-Boot runs in EL3
>>  ls2080ardb: Reserve DP-DDR RAM
>>  ls2080ardb: Convert to distro boot
>>  armv8: ls2080a: Declare spin tables as reserved for efi loader
>>  efi_loader: Allow boards to implement get_time and reset_system
>>  armv8: fsl-layerscape: Add support for efi_loader RTS reset
>>  efi_loader: Declare secure memory as reserved
>>  efi_loader: Allow bouncing for network
>> 
>> arch/arm/cpu/armv8/fsl-layerscape/cpu.c  |  33 +++++++++-
>> arch/arm/cpu/armv8/fsl-layerscape/fdt.c  |   6 ++
>> arch/arm/include/asm/armv8/mmu.h         |  19 +++---
>> arch/arm/include/asm/u-boot-arm.h        |   1 +
>> arch/arm/lib/bootm.c                     |   7 +++
>> board/freescale/ls2080a/ls2080a.c        |   6 +-
>> board/freescale/ls2080aqds/ls2080aqds.c  |  11 ++--
>> board/freescale/ls2080ardb/ls2080ardb.c  |  20 ++++--
>> cmd/bootefi.c                            |  15 +++++
>> configs/ls2080a_emu_defconfig            |   1 +
>> configs/ls2080a_simu_defconfig           |   1 +
>> configs/ls2080aqds_SECURE_BOOT_defconfig |   1 +
>> configs/ls2080aqds_defconfig             |   1 +
>> configs/ls2080aqds_nand_defconfig        |   1 +
>> configs/ls2080ardb_SECURE_BOOT_defconfig |   1 +
>> configs/ls2080ardb_defconfig             |   1 +
>> configs/ls2080ardb_nand_defconfig        |   1 +
>> drivers/net/fsl-mc/mc.c                  |  24 +++++++-
>> include/configs/ls2080ardb.h             |  26 +++++++-
>> include/efi_loader.h                     |  18 ++++++
>> lib/efi_loader/efi_boottime.c            |   2 +
>> lib/efi_loader/efi_memory.c              |  15 +++++
>> lib/efi_loader/efi_net.c                 |   7 +++
>> lib/efi_loader/efi_runtime.c             | 101 +++++++++++++++++++++++++++-
>> ---
> 
> I am testing your patch set on ls2080ardb. 
> Observation:-
> 1. Linux boot no more crashing with e1000#0, DPMAC5 at XSGMII. Even tried with default bootcmd. 
> 2. Grub2 crash while booting :(
> 
> I have applied your patch on top of commit " 9f823615af919c6b89f0b80197f009f78299dcde"
> 
> Please find log below.
> 
> 
> => usb start
> starting USB...
> USB0:   Register 200017f NbrPorts 2
> Starting the controller
> USB XHCI 1.00
> scanning bus 0 for devices... 2 USB Device(s) found
> USB1:   Register 200017f NbrPorts 2
> Starting the controller
> USB XHCI 1.00
> scanning bus 1 for devices... 1 USB Device(s) found
>       scanning usb for storage devices... 1 Storage Device(s) found
> => edit ethact
> edit: DPMAC5 at xgmii
> => tftp 0x80000000 fsl-ls2080a-rdb.dtb; fdt addr 0x80000000; fdt boardsetup;tftp 0xa0000000 grubaa64.efi; bootefi a0000000 0x80000000
> Using DPMAC5 at xgmii device
> TFTP from server 192.168.1.1; our IP address is 192.168.1.34
> Filename 'fsl-ls2080a-rdb.dtb'.
> Load address: 0x80000000
> Loading: ###
>         2 KiB/s
> done
> Bytes transferred = 10549 (2935 hex)
> WARNING: could not set reg FDT_ERR_NOSPACE.
> ERROR: could not set fsl,usb-erratum-a008751 for snps,dwc3: FDT_ERR_NOSPACE.
> ERROR: could not set fsl,usb-erratum-a008751 for snps,dwc3: FDT_ERR_NOSPACE.
> Using DPMAC5 at xgmii device
> TFTP from server 192.168.1.1; our IP address is 192.168.1.34
> Filename 'grubaa64.efi'.
> Load address: 0xa0000000
> Loading: #################################################################
>         #################################################################
>         ###########################################
>         85.9 KiB/s
> done
> Bytes transferred = 884224 (d7e00 hex)
> ## Starting EFI application at 0xa0000000 ...
> Scanning disks on scsi...
> Scanning disks on usb...
> Scanning disks on mmc...
> MMC: no card present
> MMC Device 1 not found
> MMC Device 2 not found
> MMC Device 3 not found
> Found 4 disks

So it crashes in U-Boot disk enumeration code ...

> "Synchronous Abort" handler, esr 0x8a000000
> ELR:     97ffeee9d5033fdf

... trying to access an instruction that is completely bogus.

Can you please add #define DEBUG at the beginning of efi_disk.c and try to isolate where it crashes from there?

Alex

^ permalink raw reply	[flat|nested] 32+ messages in thread

* [U-Boot] [PATCH v4 0/9] LS2080ARDB: Enable EFI boot support
  2016-06-23  7:34   ` Alexander Graf
@ 2016-06-23 10:34     ` Prabhakar Kushwaha
  2016-06-23 12:39       ` Alexander Graf
  0 siblings, 1 reply; 32+ messages in thread
From: Prabhakar Kushwaha @ 2016-06-23 10:34 UTC (permalink / raw)
  To: u-boot

Hi Alex,

Please find logs attached.

Regards,
Prabhakar


> -----Original Message-----
> From: Alexander Graf [mailto:agraf at suse.de]
> Sent: Thursday, June 23, 2016 1:04 PM
> To: Prabhakar Kushwaha <prabhakar.kushwaha@nxp.com>
> Cc: u-boot at lists.denx.de; york sun <york.sun@nxp.com>
> Subject: Re: [PATCH v4 0/9] LS2080ARDB: Enable EFI boot support
> 
> 
> 
> > Am 23.06.2016 um 07:30 schrieb Prabhakar Kushwaha
> <prabhakar.kushwaha@nxp.com>:
> >
> > Hi Alex,
> >
> >> -----Original Message-----
> >> From: Alexander Graf [mailto:agraf at suse.de]
> >> Sent: Tuesday, June 21, 2016 4:37 AM
> >> To: u-boot at lists.denx.de
> >> Cc: york sun <york.sun@nxp.com>; Prabhakar Kushwaha
> >> <prabhakar.kushwaha@nxp.com>
> >> Subject: [PATCH v4 0/9] LS2080ARDB: Enable EFI boot support
> >>
> >> We now have EFI support in U-Boot which worked out of the box on all
> >> systems that I tried it on so far. Except for the LS2080ARDB. With
> >> this patch set I can successfully boot grub2 and Linux from there on
> >> such a system - even using PXE.
> >>
> >> v3 -> v4:
> >>
> >>  - Add CONFIG_CMD_FS_GENERIC to defconfig
> >>  - Move code into generic quiesce weak function
> >>  - Exit device for real when going to Linux
> >>  - Only apply DPL if we have something to apply
> >>  - New: armv8: ls2080a: Declare spin tables as reserved for efi
> >> loader
> >>  - New: efi_loader: Allow boards to implement get_time and
> >> reset_system
> >>  - New: armv8: fsl-layerscape: Add support for efi_loader RTS reset
> >>  - New: efi_loader: Declare secure memory as reserved
> >>  - New: efi_loader: Allow bouncing for network
> >>
> >> Alexander Graf (9):
> >>  ls2080: Exit dpaa only right before exiting U-Boot
> >>  efi_loader: AArch64: Run EFI payloads in EL2 if U-Boot runs in EL3
> >>  ls2080ardb: Reserve DP-DDR RAM
> >>  ls2080ardb: Convert to distro boot
> >>  armv8: ls2080a: Declare spin tables as reserved for efi loader
> >>  efi_loader: Allow boards to implement get_time and reset_system
> >>  armv8: fsl-layerscape: Add support for efi_loader RTS reset
> >>  efi_loader: Declare secure memory as reserved
> >>  efi_loader: Allow bouncing for network
> >>
> >> arch/arm/cpu/armv8/fsl-layerscape/cpu.c  |  33 +++++++++-
> >> arch/arm/cpu/armv8/fsl-layerscape/fdt.c  |   6 ++
> >> arch/arm/include/asm/armv8/mmu.h         |  19 +++---
> >> arch/arm/include/asm/u-boot-arm.h        |   1 +
> >> arch/arm/lib/bootm.c                     |   7 +++
> >> board/freescale/ls2080a/ls2080a.c        |   6 +-
> >> board/freescale/ls2080aqds/ls2080aqds.c  |  11 ++--
> >> board/freescale/ls2080ardb/ls2080ardb.c  |  20 ++++--
> >> cmd/bootefi.c                            |  15 +++++
> >> configs/ls2080a_emu_defconfig            |   1 +
> >> configs/ls2080a_simu_defconfig           |   1 +
> >> configs/ls2080aqds_SECURE_BOOT_defconfig |   1 +
> >> configs/ls2080aqds_defconfig             |   1 +
> >> configs/ls2080aqds_nand_defconfig        |   1 +
> >> configs/ls2080ardb_SECURE_BOOT_defconfig |   1 +
> >> configs/ls2080ardb_defconfig             |   1 +
> >> configs/ls2080ardb_nand_defconfig        |   1 +
> >> drivers/net/fsl-mc/mc.c                  |  24 +++++++-
> >> include/configs/ls2080ardb.h             |  26 +++++++-
> >> include/efi_loader.h                     |  18 ++++++
> >> lib/efi_loader/efi_boottime.c            |   2 +
> >> lib/efi_loader/efi_memory.c              |  15 +++++
> >> lib/efi_loader/efi_net.c                 |   7 +++
> >> lib/efi_loader/efi_runtime.c             | 101
> +++++++++++++++++++++++++++-
> >> ---
> >
> > I am testing your patch set on ls2080ardb.
> > Observation:-
> > 1. Linux boot no more crashing with e1000#0, DPMAC5 at XSGMII. Even tried
> with default bootcmd.
> > 2. Grub2 crash while booting :(
> >
> > I have applied your patch on top of commit "
> 9f823615af919c6b89f0b80197f009f78299dcde"
> >
> > Please find log below.
> >
> >
> > => usb start
> > starting USB...
> > USB0:   Register 200017f NbrPorts 2
> > Starting the controller
> > USB XHCI 1.00
> > scanning bus 0 for devices... 2 USB Device(s) found
> > USB1:   Register 200017f NbrPorts 2
> > Starting the controller
> > USB XHCI 1.00
> > scanning bus 1 for devices... 1 USB Device(s) found
> >       scanning usb for storage devices... 1 Storage Device(s) found =>
> > edit ethact
> > edit: DPMAC5 at xgmii
> > => tftp 0x80000000 fsl-ls2080a-rdb.dtb; fdt addr 0x80000000; fdt
> > boardsetup;tftp 0xa0000000 grubaa64.efi; bootefi a0000000 0x80000000
> > Using DPMAC5 at xgmii device TFTP from server 192.168.1.1; our IP address
> > is 192.168.1.34 Filename 'fsl-ls2080a-rdb.dtb'.
> > Load address: 0x80000000
> > Loading: ###
> >         2 KiB/s
> > done
> > Bytes transferred = 10549 (2935 hex)
> > WARNING: could not set reg FDT_ERR_NOSPACE.
> > ERROR: could not set fsl,usb-erratum-a008751 for snps,dwc3:
> FDT_ERR_NOSPACE.
> > ERROR: could not set fsl,usb-erratum-a008751 for snps,dwc3:
> FDT_ERR_NOSPACE.
> > Using DPMAC5 at xgmii device
> > TFTP from server 192.168.1.1; our IP address is 192.168.1.34 Filename
> > 'grubaa64.efi'.
> > Load address: 0xa0000000
> > Loading:
> ##########################################################
> #######
> >
> ##########################################################
> #######
> >         ###########################################
> >         85.9 KiB/s
> > done
> > Bytes transferred = 884224 (d7e00 hex) ## Starting EFI application at
> > 0xa0000000 ...
> > Scanning disks on scsi...
> > Scanning disks on usb...
> > Scanning disks on mmc...
> > MMC: no card present
> > MMC Device 1 not found
> > MMC Device 2 not found
> > MMC Device 3 not found
> > Found 4 disks
> 
> So it crashes in U-Boot disk enumeration code ...
> 
> > "Synchronous Abort" handler, esr 0x8a000000
> > ELR:     97ffeee9d5033fdf
> 
> ... trying to access an instruction that is completely bogus.
> 
> Can you please add #define DEBUG at the beginning of efi_disk.c and try to
> isolate where it crashes from there?
> 
> Alex
> 

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: log.txt
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160623/93b632d1/attachment.txt>

^ permalink raw reply	[flat|nested] 32+ messages in thread

* [U-Boot] [PATCH v4 0/9] LS2080ARDB: Enable EFI boot support
  2016-06-23 10:34     ` Prabhakar Kushwaha
@ 2016-06-23 12:39       ` Alexander Graf
  2016-06-23 13:06         ` Prabhakar Kushwaha
  0 siblings, 1 reply; 32+ messages in thread
From: Alexander Graf @ 2016-06-23 12:39 UTC (permalink / raw)
  To: u-boot



On 23.06.16 12:34, Prabhakar Kushwaha wrote:
> Hi Alex,
> 
> Please find logs attached.
> 
> Regards,
> Prabhakar
> 
> 
>> > -----Original Message-----
>> > From: Alexander Graf [mailto:agraf at suse.de]
>> > Sent: Thursday, June 23, 2016 1:04 PM
>> > To: Prabhakar Kushwaha <prabhakar.kushwaha@nxp.com>
>> > Cc: u-boot at lists.denx.de; york sun <york.sun@nxp.com>
>> > Subject: Re: [PATCH v4 0/9] LS2080ARDB: Enable EFI boot support
>> > 
>> > 
>> > 
>>> > > Am 23.06.2016 um 07:30 schrieb Prabhakar Kushwaha
>> > <prabhakar.kushwaha@nxp.com>:
>>> > >
>>> > > Hi Alex,
>>> > >
>>>> > >> -----Original Message-----
>>>> > >> From: Alexander Graf [mailto:agraf at suse.de]
>>>> > >> Sent: Tuesday, June 21, 2016 4:37 AM
>>>> > >> To: u-boot at lists.denx.de
>>>> > >> Cc: york sun <york.sun@nxp.com>; Prabhakar Kushwaha
>>>> > >> <prabhakar.kushwaha@nxp.com>
>>>> > >> Subject: [PATCH v4 0/9] LS2080ARDB: Enable EFI boot support
>>>> > >>
>>>> > >> We now have EFI support in U-Boot which worked out of the box on all
>>>> > >> systems that I tried it on so far. Except for the LS2080ARDB. With
>>>> > >> this patch set I can successfully boot grub2 and Linux from there on
>>>> > >> such a system - even using PXE.
>>>> > >>
>>>> > >> v3 -> v4:
>>>> > >>
>>>> > >>  - Add CONFIG_CMD_FS_GENERIC to defconfig
>>>> > >>  - Move code into generic quiesce weak function
>>>> > >>  - Exit device for real when going to Linux
>>>> > >>  - Only apply DPL if we have something to apply
>>>> > >>  - New: armv8: ls2080a: Declare spin tables as reserved for efi
>>>> > >> loader
>>>> > >>  - New: efi_loader: Allow boards to implement get_time and
>>>> > >> reset_system
>>>> > >>  - New: armv8: fsl-layerscape: Add support for efi_loader RTS reset
>>>> > >>  - New: efi_loader: Declare secure memory as reserved
>>>> > >>  - New: efi_loader: Allow bouncing for network
>>>> > >>
>>>> > >> Alexander Graf (9):
>>>> > >>  ls2080: Exit dpaa only right before exiting U-Boot
>>>> > >>  efi_loader: AArch64: Run EFI payloads in EL2 if U-Boot runs in EL3
>>>> > >>  ls2080ardb: Reserve DP-DDR RAM
>>>> > >>  ls2080ardb: Convert to distro boot
>>>> > >>  armv8: ls2080a: Declare spin tables as reserved for efi loader
>>>> > >>  efi_loader: Allow boards to implement get_time and reset_system
>>>> > >>  armv8: fsl-layerscape: Add support for efi_loader RTS reset
>>>> > >>  efi_loader: Declare secure memory as reserved
>>>> > >>  efi_loader: Allow bouncing for network
>>>> > >>
>>>> > >> arch/arm/cpu/armv8/fsl-layerscape/cpu.c  |  33 +++++++++-
>>>> > >> arch/arm/cpu/armv8/fsl-layerscape/fdt.c  |   6 ++
>>>> > >> arch/arm/include/asm/armv8/mmu.h         |  19 +++---
>>>> > >> arch/arm/include/asm/u-boot-arm.h        |   1 +
>>>> > >> arch/arm/lib/bootm.c                     |   7 +++
>>>> > >> board/freescale/ls2080a/ls2080a.c        |   6 +-
>>>> > >> board/freescale/ls2080aqds/ls2080aqds.c  |  11 ++--
>>>> > >> board/freescale/ls2080ardb/ls2080ardb.c  |  20 ++++--
>>>> > >> cmd/bootefi.c                            |  15 +++++
>>>> > >> configs/ls2080a_emu_defconfig            |   1 +
>>>> > >> configs/ls2080a_simu_defconfig           |   1 +
>>>> > >> configs/ls2080aqds_SECURE_BOOT_defconfig |   1 +
>>>> > >> configs/ls2080aqds_defconfig             |   1 +
>>>> > >> configs/ls2080aqds_nand_defconfig        |   1 +
>>>> > >> configs/ls2080ardb_SECURE_BOOT_defconfig |   1 +
>>>> > >> configs/ls2080ardb_defconfig             |   1 +
>>>> > >> configs/ls2080ardb_nand_defconfig        |   1 +
>>>> > >> drivers/net/fsl-mc/mc.c                  |  24 +++++++-
>>>> > >> include/configs/ls2080ardb.h             |  26 +++++++-
>>>> > >> include/efi_loader.h                     |  18 ++++++
>>>> > >> lib/efi_loader/efi_boottime.c            |   2 +
>>>> > >> lib/efi_loader/efi_memory.c              |  15 +++++
>>>> > >> lib/efi_loader/efi_net.c                 |   7 +++
>>>> > >> lib/efi_loader/efi_runtime.c             | 101
>> > +++++++++++++++++++++++++++-
>>>> > >> ---
>>> > >
>>> > > I am testing your patch set on ls2080ardb.
>>> > > Observation:-
>>> > > 1. Linux boot no more crashing with e1000#0, DPMAC5 at XSGMII. Even tried
>> > with default bootcmd.
>>> > > 2. Grub2 crash while booting :(
>>> > >
>>> > > I have applied your patch on top of commit "
>> > 9f823615af919c6b89f0b80197f009f78299dcde"
>>> > >
>>> > > Please find log below.
>>> > >
>>> > >
>>> > > => usb start
>>> > > starting USB...
>>> > > USB0:   Register 200017f NbrPorts 2
>>> > > Starting the controller
>>> > > USB XHCI 1.00
>>> > > scanning bus 0 for devices... 2 USB Device(s) found
>>> > > USB1:   Register 200017f NbrPorts 2
>>> > > Starting the controller
>>> > > USB XHCI 1.00
>>> > > scanning bus 1 for devices... 1 USB Device(s) found
>>> > >       scanning usb for storage devices... 1 Storage Device(s) found =>
>>> > > edit ethact
>>> > > edit: DPMAC5 at xgmii
>>> > > => tftp 0x80000000 fsl-ls2080a-rdb.dtb; fdt addr 0x80000000; fdt
>>> > > boardsetup;tftp 0xa0000000 grubaa64.efi; bootefi a0000000 0x80000000
>>> > > Using DPMAC5 at xgmii device TFTP from server 192.168.1.1; our IP address
>>> > > is 192.168.1.34 Filename 'fsl-ls2080a-rdb.dtb'.
>>> > > Load address: 0x80000000
>>> > > Loading: ###
>>> > >         2 KiB/s
>>> > > done
>>> > > Bytes transferred = 10549 (2935 hex)
>>> > > WARNING: could not set reg FDT_ERR_NOSPACE.
>>> > > ERROR: could not set fsl,usb-erratum-a008751 for snps,dwc3:
>> > FDT_ERR_NOSPACE.
>>> > > ERROR: could not set fsl,usb-erratum-a008751 for snps,dwc3:
>> > FDT_ERR_NOSPACE.
>>> > > Using DPMAC5 at xgmii device
>>> > > TFTP from server 192.168.1.1; our IP address is 192.168.1.34 Filename
>>> > > 'grubaa64.efi'.
>>> > > Load address: 0xa0000000
>>> > > Loading:
>> > ##########################################################
>> > #######
>>> > >
>> > ##########################################################
>> > #######
>>> > >         ###########################################
>>> > >         85.9 KiB/s
>>> > > done
>>> > > Bytes transferred = 884224 (d7e00 hex) ## Starting EFI application at
>>> > > 0xa0000000 ...
>>> > > Scanning disks on scsi...
>>> > > Scanning disks on usb...
>>> > > Scanning disks on mmc...
>>> > > MMC: no card present
>>> > > MMC Device 1 not found
>>> > > MMC Device 2 not found
>>> > > MMC Device 3 not found
>>> > > Found 4 disks
>> > 
>> > So it crashes in U-Boot disk enumeration code ...
>> > 
>>> > > "Synchronous Abort" handler, esr 0x8a000000
>>> > > ELR:     97ffeee9d5033fdf
>> > 
>> > ... trying to access an instruction that is completely bogus.
>> > 
>> > Can you please add #define DEBUG at the beginning of efi_disk.c and try to
>> > isolate where it crashes from there?
>> > 
>> > Alex
>> > 
> 
> 
> log.txt
> 
> 
> U-Boot 2016.07-rc2-00026-gd11e29d-dirty (Jun 23 2016 - 15:58:26 +0530)
> 
> SoC:  LS2085E (0x87010010)
> Clock Configuration:
>        CPU0(A57):1800 MHz  CPU1(A57):1800 MHz  CPU2(A57):1800 MHz
>        CPU3(A57):1800 MHz  CPU4(A57):1800 MHz  CPU5(A57):1800 MHz
>        CPU6(A57):1800 MHz  CPU7(A57):1800 MHz
>        Bus:      500  MHz  DDR:      1866.667 MT/s     DP-DDR:   1600 MT/s
> Reset Configuration Word (RCW):
>        00000000: 48303828 48480048 00000000 00000000
>        00000010: 00000000 00200000 00200000 00000000
>        00000020: 01012980 00002580 00000000 00000000
>        00000030: 00000e0b 00000000 00000000 00000000
>        00000040: 00000000 00000000 00000000 00000000
>        00000050: 00000000 00000000 00000000 00000000
>        00000060: 00000000 00000000 00027000 00000000
>        00000070: 412a0000 00000000 00000000 00000000
> Model: Freescale Layerscape 2080a RDB Board
> Board: LS2085E-RDB, Board Arch: V1, Board version: D, boot from vBank: 4
> FPGA: v1.20
> SERDES1 Reference : Clock1 = 156.25MHz Clock2 = 156.25MHz
> SERDES2 Reference : Clock1 = 100MHz Clock2 = 100MHz
> I2C:   ready
> DRAM:  Initializing DDR....using SPD
> Detected UDIMM 18ASF1G72AZ-2G1A1
> Detected UDIMM 18ASF1G72AZ-2G1A1
> DP-DDR:  Detected UDIMM 18ASF1G72AZ-2G1A1
> 19 GiB
> DDR    15 GiB (DDR4, 64-bit, CL=13, ECC on)
>        DDR Controller Interleaving Mode: 256B
>        DDR Chip-Select Interleaving Mode: CS0+CS1
> DP-DDR 4 GiB (DDR4, 32-bit, CL=11, ECC on)
>        DDR Chip-Select Interleaving Mode: CS0+CS1
> Waking secondary cores to start from ffefb000
> All (8) cores are up.
> Using SERDES1 Protocol: 42 (0x2a)
> Using SERDES2 Protocol: 65 (0x41)
> Flash: 128 MiB
> NAND:  2048 MiB
> MMC:   FSL_SDHC: 0
> *** Warning - bad CRC, using default environment
> 
> EEPROM: NXID v1
> PCIe1: disabled
> PCIe2: disabled
> PCIe3: Root Complex x1 gen1, regs @ 0x3600000
> PCI:
>      01:00.0    - 8086:10d3 - Network controller
> PCIe3: Bus 00 - 01
> PCIe4: Root Complex no link, regs @ 0x3700000
> In:    serial
> Out:   serial
> Err:   serial
> Debug Server FW: Not a FIT image
> SEC0: RNG instantiated
> SATA link 0 timeout.
> AHCI 0001.0301 32 slots 1 ports 6 Gbps 0x1 impl SATA mode
> flags: 64bit ncq pm clo only pmp fbss pio slum part ccc apst
> Found 0 device(s).
> SCSI:  Net:   crc32+
> fsl-mc: Booting Management Complex ... SUCCESS
> fsl-mc: Management Complex booted (version: 9.0.6, boot status: 0x1)
> e1000: 68:05:ca:36:94:8c
>        DPMAC1 at xgmii [PRIME]
> Warning: DPMAC1 at xgmii (eth0) using random MAC address - ca:0a:bf:68:4c:60
> , DPMAC2 at xgmii
> Warning: DPMAC2 at xgmii (eth1) using random MAC address - de:23:02:2f:dd:94
> , DPMAC3 at xgmii
> Warning: DPMAC3 at xgmii (eth2) using random MAC address - d6:2b:2b:55:51:98
> , DPMAC4 at xgmii
> Warning: DPMAC4 at xgmii (eth3) using random MAC address - ee:70:d6:f5:b8:90
> , DPMAC5 at xgmii
> Warning: DPMAC5 at xgmii (eth4) using random MAC address - e6:78:ff:8f:34:9c
> , DPMAC6 at xgmii
> Warning: DPMAC6 at xgmii (eth5) using random MAC address - be:85:aa:93:8f:0d
> , DPMAC7 at xgmii
> Warning: DPMAC7 at xgmii (eth6) using random MAC address - b6:8d:83:e9:03:01
> , DPMAC8 at xgmii
> Warning: DPMAC8 at xgmii (eth7) using random MAC address - 8e:d6:7e:49:ea:09
> , e1000#0
> Hit any key to stop autoboot:  0
> =>
> =>
> =>
> =>
> => edit ethact
> edit: e1000#0
> => edit ethprime
> edit: e1000#0
> => sav
> Unknown command 'sav' - try 'help'
> => saveenv
> Saving Environment to Flash...
> Un-Protected 1 sectors
> Erasing Flash...
> . done
> Erased 1 sectors
> Writing to Flash... 9....8....7....6....5....4....3....2....1....9....8....7....6....5....4....3....2....1....done
> Protected 1 sectors
> => usb start
> starting USB...
> USB0:   Register 200017f NbrPorts 2
> Starting the controller
> USB XHCI 1.00
> scanning bus 0 for devices... 2 USB Device(s) found
> USB1:   Register 200017f NbrPorts 2
> Starting the controller
> USB XHCI 1.00
> scanning bus 1 for devices... 1 USB Device(s) found
>        scanning usb for storage devices... 1 Storage Device(s) found
> =>
> => All (8) cores are up.<INTERRUPT>
> => tftp 0x80000000 fsl-ls2080a-rdb.dtb; fdt addr 0x80000000; fdt boardsetup;tftp 0xa0000000 grubaa64.efi; bootefi a0000000 0x80000000
> *** ERROR: `serverip' not set
> libfdt fdt_check_header(): FDT_ERR_BADMAGIC
> No FDT memory address configured. Please configure
> the FDT address via "fdt addr <address>" command.
> Aborting!
> *** ERROR: `serverip' not set
> ## Starting EFI application at 0xa0000000 ...
> WARNING: Invalid device tree, expect boot to fail
> efi_load_pe: Invalid DOS Signature
> ## Application terminated, r = -2
> => edit serverip
> edit: 192.168.1.1
> => edit ipaddr
> edit: 192.168.1.34
> => sav
> Unknown command 'sav' - try 'help'
> => save
>   save saveenv
> => save
> save - save file to a filesystem
> 
> Usage:
> save <interface> <dev[:part]> <addr> <filename> bytes [pos]
>     - Save binary file 'filename' to partition 'part' on device
>       type 'interface' instance 'dev' from addr 'addr' in memory.
>       'bytes' gives the size to save in bytes and is mandatory.
>       'pos' gives the file byte position to start writing to.
>       If 'pos' is 0 or omitted, the file is written from the start.
> => saven
> Unknown command 'saven' - try 'help'
> => saveenv
> Saving Environment to Flash...
> Un-Protected 1 sectors
> Erasing Flash...
> . done
> Erased 1 sectors
> Writing to Flash... 9....8....7....6....5....4....3....2....1....9....8....7....6....5....4....3....2....1....done
> Protected 1 sectors
> => tftp 0x80000000 fsl-ls2080a-rdb.dtb; fdt addr 0x80000000; fdt boardsetup;tftp 0xa0000000 grubaa64.efi; bootefi a0000000 0x80000000
> Using e1000#0 device
> TFTP from server 192.168.1.1; our IP address is 192.168.1.34
> Filename 'fsl-ls2080a-rdb.dtb'.
> Load address: 0x80000000
> Loading: ###
>          735.4 KiB/s
> done
> Bytes transferred = 10549 (2935 hex)
> WARNING: could not set reg FDT_ERR_NOSPACE.
> ERROR: could not set fsl,usb-erratum-a008751 for snps,dwc3: FDT_ERR_NOSPACE.
> ERROR: could not set fsl,usb-erratum-a008751 for snps,dwc3: FDT_ERR_NOSPACE.
> Using e1000#0 device
> TFTP from server 192.168.1.1; our IP address is 192.168.1.34
> Filename 'grubaa64.efi'.
> Load address: 0xa0000000
> Loading: #################################################################
>          #################################################################
>          ###########################################
>          1.5 MiB/s
> done
> Bytes transferred = 884224 (d7e00 hex)
> ## Starting EFI application at 0xa0000000 ...
> Scanning disks on scsi...
> Scanning disks on usb...
> Scanning disks on mmc...
> MMC: no card present
> MMC Device 1 not found
> MMC Device 2 not found
> MMC Device 3 not found
> Found 4 disks
> do_bootefi_exec:225 Jumping to 0xfac1d400
> 00000000fff87380, 00000000fac28c10, 00000000ffcf4d18, 00000000fff87380, 0000000000000000, 0x2EFI: Entry efi_cin_get_mode(00000000fff6b1a0, 00000000ffcf4d3c, 0000000000000000, 0000000000000000)
> EFI: Entry efi_cin_get_mode(00000000fff6b1a0, 00000000ffcf4d1c, 0000000000000000, 0000000000000000)
> EFI: Entry efi_cout_enable_cursor(00000000fff6b150, 1)
> EFI: Entry efi_net_initialize(00000000ffd1b958, 0, 0)
> EFI: Entry efi_cout_set_attribute(00000000fff6b150, 7)
> EFI: Entry efi_cout_set_attribute(00000000fff6b150, 7)
> EFI: Entry efi_net_initialize(00000000ffd1b958, 0, 0)
> EFI: Entry efi_cout_set_attribute(00000000fff6b150, 0)
> EFI: Entry efi_cout_clear_screen(00000000fff6b150)
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> EFI: Entry efi_cout_set_attribute(00000000fff6b150, 0)
> EFI: Entry efi_cout_enable_cursor(00000000fff6b150, 1)
> EFI: Entry efi_cout_query_mode(00000000fff6b150, 0, 00000000ffcf4d00, 00000000ffcf4d08)
> EFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4ab0)
>  EFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4ab0)
>  EFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4ab0)
>  EFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4ab0)
>  EFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4ab0)
>  EFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4ab0)
>  EFI: Entry efi_cout_query_mode(00000000fff6b150, 0, 00000000ffcf4b50, 00000000ffcf4b58)
> EFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> MEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> iEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> nEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> iEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> mEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> aEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> lEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
>  EFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> BEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> AEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> SEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> HEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> -EFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> lEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> iEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> kEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> eEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
>  EFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> lEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> iEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> nEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> eEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
>  EFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> eEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> dEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> iEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> tEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> iEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> nEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> gEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
>  EFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> iEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> sEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
>  EFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> sEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> uEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> pEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> pEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> oEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> rEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> tEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> eEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> dEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> .EFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
>  EFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> FEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> oEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> rEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
>  EFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> tEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> hEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> eEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
>  EFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> fEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> iEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> rEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> sEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> tEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
>  EFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> wEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> oEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> rEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> dEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> ,EFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
>  EFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> TEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> AEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> BEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
>  EFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> lEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> iEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> sEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> tEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> sEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
>  EFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> pEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> oEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> sEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> sEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> iEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> bEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> lEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> eEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
>  EFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> cEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> oEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> mEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> mEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> aEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> nEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> dEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
>  EFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> cEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> oEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> mEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> pEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> lEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> eEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> tEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> iEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> oEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> nEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> sEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> .EFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
>  EFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> AEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> nEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> yEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> wEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> hEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> eEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> rEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> eEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
>  EFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> eEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> lEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> sEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> eEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
>  EFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> TEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> AEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> BEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
>  EFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> lEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> iEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> sEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> tEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> sEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
>  EFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> pEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> oEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> sEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> sEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> iEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> bEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> lEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> eEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
>  EFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> dEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> eEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> vEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> iEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> cEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> eEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
>  EFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> oEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> rEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
>  EFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> fEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> iEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> lEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> eEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
>  EFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> cEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> oEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> mEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> pEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> lEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> eEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> tEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> iEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> oEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> nEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> sEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> .EFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
>  EFI: Entry efi_cout_query_mode(00000000fff6b150, 0, 00000000ffcf4b10, 00000000ffcf4b18)
> EFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a40)
>  EFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a40)
>  EFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a40)
>  EFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a40)
>  EFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a40)
>  EFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a40)
>  EFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a40)
>  EFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a40)
>  EFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a40)
>  EFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a40)
>  EFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a40)
>  EFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a40)
>  EFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a40)
>  EFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a40)
>  EFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a40)
>  EFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a40)
>  EFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a40)
>  EFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a40)
>  EFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a40)
>  EFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a40)
>  EFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a40)
>  EFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a40)
>  EFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a40)
>  EFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a40)
>  EFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a40)
>  EFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a40)
>  EFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a40)
>  EFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a40)
>  EFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a40)
>  EFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a40)
>  EFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a40)
>  EFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a40)
>  EFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a40)
>  EFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a40)
>  EFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a40)
>  EFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a40)
>  EFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a40)
>  EFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a40)
>  EFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a40)
>  EFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a40)
>  EFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a40)
>  EFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a40)
>  EFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a40)
>  EFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a40)
>  EFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a40)
>  EFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a40)
>  EFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a40)
>  EFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a40)
>  EFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a40)
>  EFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a40)
>  EFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a40)
>  EFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a40)
>  EFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a40)
>  EFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a40)
>  EFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a40)
>  EFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a40)
>  EFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a40)
>  EFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a40)
>  EFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a40)
>  EFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4c20)
> 
> EFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4c20)
> EFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4c20)
> 
> EFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4c20)
> EFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4c20)
> 
> EFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4c20)
> EFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4b50)
> 
> EFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4b50)
> EFI: Entry efi_cout_query_mode(00000000fff6b150, 0, 00000000ffcf4a50, 00000000ffcf4a58)
> EFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4990)
> gEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4990)
> rEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4990)
> uEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4990)
> bEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4990)
>> >EFI: Entry efi_cout_query_mode(00000000fff6b150, 0, 00000000ffcf4a50, 00000000ffcf4a58)
> EFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4990)
>  EFI: Entry efi_cout_query_mode(00000000fff6b150, 0, 00000000ffcf4c10, 00000000ffcf4c18)
> EFI: Entry efi_cout_query_mode(00000000fff6b150, 0, 00000000ffcf4c10, 00000000ffcf4c18)
> "Synchronous Abort" handler, esr 0x96000005
> ELR:     fff1cafc
> LR:      fff63410

Ok, this one is different. Here grub2 reaches its shell and then crashes
inside of grub2 code.

Sounds like memory corruption somewhere maybe? Can you please try to see
if increasing the malloc area helps?


Alex

^ permalink raw reply	[flat|nested] 32+ messages in thread

* [U-Boot] [PATCH v4 0/9] LS2080ARDB: Enable EFI boot support
  2016-06-23 12:39       ` Alexander Graf
@ 2016-06-23 13:06         ` Prabhakar Kushwaha
  0 siblings, 0 replies; 32+ messages in thread
From: Prabhakar Kushwaha @ 2016-06-23 13:06 UTC (permalink / raw)
  To: u-boot


> -----Original Message-----
> From: Alexander Graf [mailto:agraf at suse.de]
> Sent: Thursday, June 23, 2016 6:10 PM
> To: Prabhakar Kushwaha <prabhakar.kushwaha@nxp.com>
> Cc: u-boot at lists.denx.de; york sun <york.sun@nxp.com>
> Subject: Re: [PATCH v4 0/9] LS2080ARDB: Enable EFI boot support
> 
> 
> 
> On 23.06.16 12:34, Prabhakar Kushwaha wrote:
> > Hi Alex,
> >
> > Please find logs attached.
> >
> > Regards,
> > Prabhakar
> >
> >
> >> > -----Original Message-----
> >> > From: Alexander Graf [mailto:agraf at suse.de]
> >> > Sent: Thursday, June 23, 2016 1:04 PM
> >> > To: Prabhakar Kushwaha <prabhakar.kushwaha@nxp.com>
> >> > Cc: u-boot at lists.denx.de; york sun <york.sun@nxp.com>
> >> > Subject: Re: [PATCH v4 0/9] LS2080ARDB: Enable EFI boot support
> >> >
> >> >
> >> >
> >>> > > Am 23.06.2016 um 07:30 schrieb Prabhakar Kushwaha
> >> > <prabhakar.kushwaha@nxp.com>:
> >>> > >
> >>> > > Hi Alex,
> >>> > >
> >>>> > >> -----Original Message-----
> >>>> > >> From: Alexander Graf [mailto:agraf at suse.de]
> >>>> > >> Sent: Tuesday, June 21, 2016 4:37 AM
> >>>> > >> To: u-boot at lists.denx.de
> >>>> > >> Cc: york sun <york.sun@nxp.com>; Prabhakar Kushwaha
> >>>> > >> <prabhakar.kushwaha@nxp.com>
> >>>> > >> Subject: [PATCH v4 0/9] LS2080ARDB: Enable EFI boot support
> >>>> > >>
> >>>> > >> We now have EFI support in U-Boot which worked out of the box
> >>>> > >> on all systems that I tried it on so far. Except for the
> >>>> > >> LS2080ARDB. With this patch set I can successfully boot grub2
> >>>> > >> and Linux from there on such a system - even using PXE.
> >>>> > >>
> >>>> > >> v3 -> v4:
> >>>> > >>
> >>>> > >>  - Add CONFIG_CMD_FS_GENERIC to defconfig
> >>>> > >>  - Move code into generic quiesce weak function
> >>>> > >>  - Exit device for real when going to Linux
> >>>> > >>  - Only apply DPL if we have something to apply
> >>>> > >>  - New: armv8: ls2080a: Declare spin tables as reserved for
> >>>> > >> efi loader
> >>>> > >>  - New: efi_loader: Allow boards to implement get_time and
> >>>> > >> reset_system
> >>>> > >>  - New: armv8: fsl-layerscape: Add support for efi_loader RTS
> >>>> > >> reset
> >>>> > >>  - New: efi_loader: Declare secure memory as reserved
> >>>> > >>  - New: efi_loader: Allow bouncing for network
> >>>> > >>
> >>>> > >> Alexander Graf (9):
> >>>> > >>  ls2080: Exit dpaa only right before exiting U-Boot
> >>>> > >>  efi_loader: AArch64: Run EFI payloads in EL2 if U-Boot runs
> >>>> > >> in EL3
> >>>> > >>  ls2080ardb: Reserve DP-DDR RAM
> >>>> > >>  ls2080ardb: Convert to distro boot
> >>>> > >>  armv8: ls2080a: Declare spin tables as reserved for efi
> >>>> > >> loader
> >>>> > >>  efi_loader: Allow boards to implement get_time and
> >>>> > >> reset_system
> >>>> > >>  armv8: fsl-layerscape: Add support for efi_loader RTS reset
> >>>> > >>  efi_loader: Declare secure memory as reserved
> >>>> > >>  efi_loader: Allow bouncing for network
> >>>> > >>
> >>>> > >> arch/arm/cpu/armv8/fsl-layerscape/cpu.c  |  33 +++++++++-
> >>>> > >> arch/arm/cpu/armv8/fsl-layerscape/fdt.c  |   6 ++
> >>>> > >> arch/arm/include/asm/armv8/mmu.h         |  19 +++---
> >>>> > >> arch/arm/include/asm/u-boot-arm.h        |   1 +
> >>>> > >> arch/arm/lib/bootm.c                     |   7 +++
> >>>> > >> board/freescale/ls2080a/ls2080a.c        |   6 +-
> >>>> > >> board/freescale/ls2080aqds/ls2080aqds.c  |  11 ++--
> >>>> > >> board/freescale/ls2080ardb/ls2080ardb.c  |  20 ++++--
> >>>> > >> cmd/bootefi.c                            |  15 +++++
> >>>> > >> configs/ls2080a_emu_defconfig            |   1 +
> >>>> > >> configs/ls2080a_simu_defconfig           |   1 +
> >>>> > >> configs/ls2080aqds_SECURE_BOOT_defconfig |   1 +
> >>>> > >> configs/ls2080aqds_defconfig             |   1 +
> >>>> > >> configs/ls2080aqds_nand_defconfig        |   1 +
> >>>> > >> configs/ls2080ardb_SECURE_BOOT_defconfig |   1 +
> >>>> > >> configs/ls2080ardb_defconfig             |   1 +
> >>>> > >> configs/ls2080ardb_nand_defconfig        |   1 +
> >>>> > >> drivers/net/fsl-mc/mc.c                  |  24 +++++++-
> >>>> > >> include/configs/ls2080ardb.h             |  26 +++++++-
> >>>> > >> include/efi_loader.h                     |  18 ++++++
> >>>> > >> lib/efi_loader/efi_boottime.c            |   2 +
> >>>> > >> lib/efi_loader/efi_memory.c              |  15 +++++
> >>>> > >> lib/efi_loader/efi_net.c                 |   7 +++
> >>>> > >> lib/efi_loader/efi_runtime.c             | 101
> >> > +++++++++++++++++++++++++++-
> >>>> > >> ---
> >>> > >
> >>> > > I am testing your patch set on ls2080ardb.
> >>> > > Observation:-
> >>> > > 1. Linux boot no more crashing with e1000#0, DPMAC5 at XSGMII.
> Even
> >>> > > tried
> >> > with default bootcmd.
> >>> > > 2. Grub2 crash while booting :(
> >>> > >
> >>> > > I have applied your patch on top of commit "
> >> > 9f823615af919c6b89f0b80197f009f78299dcde"
> >>> > >
> >>> > > Please find log below.
> >>> > >
> >>> > >
> >>> > > => usb start
> >>> > > starting USB...
> >>> > > USB0:   Register 200017f NbrPorts 2
> >>> > > Starting the controller
> >>> > > USB XHCI 1.00
> >>> > > scanning bus 0 for devices... 2 USB Device(s) found
> >>> > > USB1:   Register 200017f NbrPorts 2
> >>> > > Starting the controller
> >>> > > USB XHCI 1.00
> >>> > > scanning bus 1 for devices... 1 USB Device(s) found
> >>> > >       scanning usb for storage devices... 1 Storage Device(s)
> >>> > > found => edit ethact
> >>> > > edit: DPMAC5 at xgmii
> >>> > > => tftp 0x80000000 fsl-ls2080a-rdb.dtb; fdt addr 0x80000000; fdt
> >>> > > boardsetup;tftp 0xa0000000 grubaa64.efi; bootefi a0000000
> >>> > > 0x80000000 Using DPMAC5 at xgmii device TFTP from server
> >>> > > 192.168.1.1; our IP address is 192.168.1.34 Filename 'fsl-ls2080a-
> rdb.dtb'.
> >>> > > Load address: 0x80000000
> >>> > > Loading: ###
> >>> > >         2 KiB/s
> >>> > > done
> >>> > > Bytes transferred = 10549 (2935 hex)
> >>> > > WARNING: could not set reg FDT_ERR_NOSPACE.
> >>> > > ERROR: could not set fsl,usb-erratum-a008751 for snps,dwc3:
> >> > FDT_ERR_NOSPACE.
> >>> > > ERROR: could not set fsl,usb-erratum-a008751 for snps,dwc3:
> >> > FDT_ERR_NOSPACE.
> >>> > > Using DPMAC5 at xgmii device
> >>> > > TFTP from server 192.168.1.1; our IP address is 192.168.1.34
> >>> > > Filename 'grubaa64.efi'.
> >>> > > Load address: 0xa0000000
> >>> > > Loading:
> >> >
> ##########################################################
> >> > #######
> >>> > >
> >> >
> ##########################################################
> >> > #######
> >>> > >         ###########################################
> >>> > >         85.9 KiB/s
> >>> > > done
> >>> > > Bytes transferred = 884224 (d7e00 hex) ## Starting EFI
> >>> > > application at
> >>> > > 0xa0000000 ...
> >>> > > Scanning disks on scsi...
> >>> > > Scanning disks on usb...
> >>> > > Scanning disks on mmc...
> >>> > > MMC: no card present
> >>> > > MMC Device 1 not found
> >>> > > MMC Device 2 not found
> >>> > > MMC Device 3 not found
> >>> > > Found 4 disks
> >> >
> >> > So it crashes in U-Boot disk enumeration code ...
> >> >
> >>> > > "Synchronous Abort" handler, esr 0x8a000000
> >>> > > ELR:     97ffeee9d5033fdf
> >> >
> >> > ... trying to access an instruction that is completely bogus.
> >> >
> >> > Can you please add #define DEBUG at the beginning of efi_disk.c and
> >> > try to isolate where it crashes from there?
> >> >
> >> > Alex
> >> >
> >
> >
> > log.txt
> >
> >
> > U-Boot 2016.07-rc2-00026-gd11e29d-dirty (Jun 23 2016 - 15:58:26 +0530)
> >
> > SoC:  LS2085E (0x87010010)
> > Clock Configuration:
> >        CPU0(A57):1800 MHz  CPU1(A57):1800 MHz  CPU2(A57):1800 MHz
> >        CPU3(A57):1800 MHz  CPU4(A57):1800 MHz  CPU5(A57):1800 MHz
> >        CPU6(A57):1800 MHz  CPU7(A57):1800 MHz
> >        Bus:      500  MHz  DDR:      1866.667 MT/s     DP-DDR:   1600 MT/s
> > Reset Configuration Word (RCW):
> >        00000000: 48303828 48480048 00000000 00000000
> >        00000010: 00000000 00200000 00200000 00000000
> >        00000020: 01012980 00002580 00000000 00000000
> >        00000030: 00000e0b 00000000 00000000 00000000
> >        00000040: 00000000 00000000 00000000 00000000
> >        00000050: 00000000 00000000 00000000 00000000
> >        00000060: 00000000 00000000 00027000 00000000
> >        00000070: 412a0000 00000000 00000000 00000000
> > Model: Freescale Layerscape 2080a RDB Board
> > Board: LS2085E-RDB, Board Arch: V1, Board version: D, boot from vBank:
> > 4
> > FPGA: v1.20
> > SERDES1 Reference : Clock1 = 156.25MHz Clock2 = 156.25MHz
> > SERDES2 Reference : Clock1 = 100MHz Clock2 = 100MHz
> > I2C:   ready
> > DRAM:  Initializing DDR....using SPD
> > Detected UDIMM 18ASF1G72AZ-2G1A1
> > Detected UDIMM 18ASF1G72AZ-2G1A1
> > DP-DDR:  Detected UDIMM 18ASF1G72AZ-2G1A1
> > 19 GiB
> > DDR    15 GiB (DDR4, 64-bit, CL=13, ECC on)
> >        DDR Controller Interleaving Mode: 256B
> >        DDR Chip-Select Interleaving Mode: CS0+CS1 DP-DDR 4 GiB (DDR4,
> > 32-bit, CL=11, ECC on)
> >        DDR Chip-Select Interleaving Mode: CS0+CS1 Waking secondary
> > cores to start from ffefb000 All (8) cores are up.
> > Using SERDES1 Protocol: 42 (0x2a)
> > Using SERDES2 Protocol: 65 (0x41)
> > Flash: 128 MiB
> > NAND:  2048 MiB
> > MMC:   FSL_SDHC: 0
> > *** Warning - bad CRC, using default environment
> >
> > EEPROM: NXID v1
> > PCIe1: disabled
> > PCIe2: disabled
> > PCIe3: Root Complex x1 gen1, regs @ 0x3600000
> > PCI:
> >      01:00.0    - 8086:10d3 - Network controller
> > PCIe3: Bus 00 - 01
> > PCIe4: Root Complex no link, regs @ 0x3700000
> > In:    serial
> > Out:   serial
> > Err:   serial
> > Debug Server FW: Not a FIT image
> > SEC0: RNG instantiated
> > SATA link 0 timeout.
> > AHCI 0001.0301 32 slots 1 ports 6 Gbps 0x1 impl SATA mode
> > flags: 64bit ncq pm clo only pmp fbss pio slum part ccc apst Found 0
> > device(s).
> > SCSI:  Net:   crc32+
> > fsl-mc: Booting Management Complex ... SUCCESS
> > fsl-mc: Management Complex booted (version: 9.0.6, boot status: 0x1)
> > e1000: 68:05:ca:36:94:8c
> >        DPMAC1 at xgmii [PRIME]
> > Warning: DPMAC1 at xgmii (eth0) using random MAC address -
> > ca:0a:bf:68:4c:60 , DPMAC2 at xgmii
> > Warning: DPMAC2 at xgmii (eth1) using random MAC address -
> > de:23:02:2f:dd:94 , DPMAC3 at xgmii
> > Warning: DPMAC3 at xgmii (eth2) using random MAC address -
> > d6:2b:2b:55:51:98 , DPMAC4 at xgmii
> > Warning: DPMAC4 at xgmii (eth3) using random MAC address -
> > ee:70:d6:f5:b8:90 , DPMAC5 at xgmii
> > Warning: DPMAC5 at xgmii (eth4) using random MAC address -
> > e6:78:ff:8f:34:9c , DPMAC6 at xgmii
> > Warning: DPMAC6 at xgmii (eth5) using random MAC address -
> > be:85:aa:93:8f:0d , DPMAC7 at xgmii
> > Warning: DPMAC7 at xgmii (eth6) using random MAC address -
> > b6:8d:83:e9:03:01 , DPMAC8 at xgmii
> > Warning: DPMAC8 at xgmii (eth7) using random MAC address -
> > 8e:d6:7e:49:ea:09 , e1000#0 Hit any key to stop autoboot:  0 => => =>
> > => => edit ethact
> > edit: e1000#0
> > => edit ethprime
> > edit: e1000#0
> > => sav
> > Unknown command 'sav' - try 'help'
> > => saveenv
> > Saving Environment to Flash...
> > Un-Protected 1 sectors
> > Erasing Flash...
> > . done
> > Erased 1 sectors
> > Writing to Flash...
> > 9....8....7....6....5....4....3....2....1....9....8....7....6....5....
> > 4....3....2....1....done
> > Protected 1 sectors
> > => usb start
> > starting USB...
> > USB0:   Register 200017f NbrPorts 2
> > Starting the controller
> > USB XHCI 1.00
> > scanning bus 0 for devices... 2 USB Device(s) found
> > USB1:   Register 200017f NbrPorts 2
> > Starting the controller
> > USB XHCI 1.00
> > scanning bus 1 for devices... 1 USB Device(s) found
> >        scanning usb for storage devices... 1 Storage Device(s) found
> > => => All (8) cores are up.<INTERRUPT> => tftp 0x80000000
> > fsl-ls2080a-rdb.dtb; fdt addr 0x80000000; fdt boardsetup;tftp
> > 0xa0000000 grubaa64.efi; bootefi a0000000 0x80000000
> > *** ERROR: `serverip' not set
> > libfdt fdt_check_header(): FDT_ERR_BADMAGIC No FDT memory address
> > configured. Please configure the FDT address via "fdt addr <address>"
> > command.
> > Aborting!
> > *** ERROR: `serverip' not set
> > ## Starting EFI application at 0xa0000000 ...
> > WARNING: Invalid device tree, expect boot to fail
> > efi_load_pe: Invalid DOS Signature
> > ## Application terminated, r = -2
> > => edit serverip
> > edit: 192.168.1.1
> > => edit ipaddr
> > edit: 192.168.1.34
> > => sav
> > Unknown command 'sav' - try 'help'
> > => save
> >   save saveenv
> > => save
> > save - save file to a filesystem
> >
> > Usage:
> > save <interface> <dev[:part]> <addr> <filename> bytes [pos]
> >     - Save binary file 'filename' to partition 'part' on device
> >       type 'interface' instance 'dev' from addr 'addr' in memory.
> >       'bytes' gives the size to save in bytes and is mandatory.
> >       'pos' gives the file byte position to start writing to.
> >       If 'pos' is 0 or omitted, the file is written from the start.
> > => saven
> > Unknown command 'saven' - try 'help'
> > => saveenv
> > Saving Environment to Flash...
> > Un-Protected 1 sectors
> > Erasing Flash...
> > . done
> > Erased 1 sectors
> > Writing to Flash...
> > 9....8....7....6....5....4....3....2....1....9....8....7....6....5....
> > 4....3....2....1....done
> > Protected 1 sectors
> > => tftp 0x80000000 fsl-ls2080a-rdb.dtb; fdt addr 0x80000000; fdt
> > boardsetup;tftp 0xa0000000 grubaa64.efi; bootefi a0000000 0x80000000
> > Using e1000#0 device TFTP from server 192.168.1.1; our IP address is
> > 192.168.1.34 Filename 'fsl-ls2080a-rdb.dtb'.
> > Load address: 0x80000000
> > Loading: ###
> >          735.4 KiB/s
> > done
> > Bytes transferred = 10549 (2935 hex)
> > WARNING: could not set reg FDT_ERR_NOSPACE.
> > ERROR: could not set fsl,usb-erratum-a008751 for snps,dwc3:
> FDT_ERR_NOSPACE.
> > ERROR: could not set fsl,usb-erratum-a008751 for snps,dwc3:
> FDT_ERR_NOSPACE.
> > Using e1000#0 device
> > TFTP from server 192.168.1.1; our IP address is 192.168.1.34 Filename
> > 'grubaa64.efi'.
> > Load address: 0xa0000000
> > Loading:
> ##########################################################
> #######
> >
> ##########################################################
> #######
> >          ###########################################
> >          1.5 MiB/s
> > done
> > Bytes transferred = 884224 (d7e00 hex) ## Starting EFI application at
> > 0xa0000000 ...
> > Scanning disks on scsi...
> > Scanning disks on usb...
> > Scanning disks on mmc...
> > MMC: no card present
> > MMC Device 1 not found
> > MMC Device 2 not found
> > MMC Device 3 not found
> > Found 4 disks
> > do_bootefi_exec:225 Jumping to 0xfac1d400 00000000fff87380,
> > 00000000fac28c10, 00000000ffcf4d18, 00000000fff87380,
> > 0000000000000000, 0x2EFI: Entry efi_cin_get_mode(00000000fff6b1a0,
> > 00000000ffcf4d3c, 0000000000000000, 0000000000000000)
> > EFI: Entry efi_cin_get_mode(00000000fff6b1a0, 00000000ffcf4d1c,
> > 0000000000000000, 0000000000000000)
> > EFI: Entry efi_cout_enable_cursor(00000000fff6b150, 1)
> > EFI: Entry efi_net_initialize(00000000ffd1b958, 0, 0)
> > EFI: Entry efi_cout_set_attribute(00000000fff6b150, 7)
> > EFI: Entry efi_cout_set_attribute(00000000fff6b150, 7)
> > EFI: Entry efi_net_initialize(00000000ffd1b958, 0, 0)
> > EFI: Entry efi_cout_set_attribute(00000000fff6b150, 0)
> > EFI: Entry efi_cout_clear_screen(00000000fff6b150)
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> > EFI: Entry efi_cout_set_attribute(00000000fff6b150, 0)
> > EFI: Entry efi_cout_enable_cursor(00000000fff6b150, 1)
> > EFI: Entry efi_cout_query_mode(00000000fff6b150, 0, 00000000ffcf4d00,
> > 00000000ffcf4d08)
> > EFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4ab0)
> >  EFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4ab0)
> >  EFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4ab0)
> >  EFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4ab0)
> >  EFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4ab0)
> >  EFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4ab0)
> >  EFI: Entry efi_cout_query_mode(00000000fff6b150, 0, 00000000ffcf4b50,
> > 00000000ffcf4b58)
> > EFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> > MEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> > iEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> > nEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> > iEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> > mEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> > aEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> > lEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> >  EFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> > BEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> > AEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> > SEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> > HEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> > -EFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> > lEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> > iEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> > kEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> > eEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> >  EFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> > lEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> > iEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> > nEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> > eEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> >  EFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> > eEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> > dEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> > iEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> > tEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> > iEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> > nEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> > gEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> >  EFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> > iEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> > sEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> >  EFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> > sEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> > uEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> > pEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> > pEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> > oEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> > rEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> > tEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> > eEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> > dEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> > .EFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> >  EFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> > FEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> > oEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> > rEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> >  EFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> > tEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> > hEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> > eEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> >  EFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> > fEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> > iEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> > rEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> > sEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> > tEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> >  EFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> > wEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> > oEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> > rEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> > dEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> > ,EFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> >  EFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> > TEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> > AEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> > BEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> >  EFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> > lEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> > iEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> > sEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> > tEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> > sEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> >  EFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> > pEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> > oEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> > sEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> > sEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> > iEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> > bEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> > lEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> > eEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> >  EFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> > cEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> > oEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> > mEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> > mEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> > aEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> > nEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> > dEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> >  EFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> > cEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> > oEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> > mEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> > pEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> > lEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> > eEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> > tEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> > iEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> > oEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> > nEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> > sEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> > .EFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> >  EFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> > AEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> > nEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> > yEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> > wEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> > hEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> > eEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> > rEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> > eEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> >  EFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> > eEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> > lEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> > sEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> > eEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> >  EFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> > TEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> > AEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> > BEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> >  EFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> > lEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> > iEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> > sEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> > tEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> > sEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> >  EFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> > pEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> > oEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> > sEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> > sEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> > iEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> > bEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> > lEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> > eEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> >  EFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> > dEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> > eEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> > vEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> > iEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> > cEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> > eEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> >  EFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> > oEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> > rEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> >  EFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> > fEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> > iEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> > lEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> > eEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> >  EFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> > cEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> > oEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> > mEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> > pEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> > lEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> > eEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> > tEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> > iEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> > oEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> > nEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> > sEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> > .EFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a90)
> >  EFI: Entry efi_cout_query_mode(00000000fff6b150, 0, 00000000ffcf4b10,
> > 00000000ffcf4b18)
> > EFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a40)
> >  EFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a40)
> >  EFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a40)
> >  EFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a40)
> >  EFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a40)
> >  EFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a40)
> >  EFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a40)
> >  EFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a40)
> >  EFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a40)
> >  EFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a40)
> >  EFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a40)
> >  EFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a40)
> >  EFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a40)
> >  EFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a40)
> >  EFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a40)
> >  EFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a40)
> >  EFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a40)
> >  EFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a40)
> >  EFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a40)
> >  EFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a40)
> >  EFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a40)
> >  EFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a40)
> >  EFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a40)
> >  EFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a40)
> >  EFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a40)
> >  EFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a40)
> >  EFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a40)
> >  EFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a40)
> >  EFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a40)
> >  EFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a40)
> >  EFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a40)
> >  EFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a40)
> >  EFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a40)
> >  EFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a40)
> >  EFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a40)
> >  EFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a40)
> >  EFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a40)
> >  EFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a40)
> >  EFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a40)
> >  EFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a40)
> >  EFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a40)
> >  EFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a40)
> >  EFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a40)
> >  EFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a40)
> >  EFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a40)
> >  EFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a40)
> >  EFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a40)
> >  EFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a40)
> >  EFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a40)
> >  EFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a40)
> >  EFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a40)
> >  EFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a40)
> >  EFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a40)
> >  EFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a40)
> >  EFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a40)
> >  EFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a40)
> >  EFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a40)
> >  EFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a40)
> >  EFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4a40)
> >  EFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4c20)
> >
> > EFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4c20)
> > EFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4c20)
> >
> > EFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4c20)
> > EFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4c20)
> >
> > EFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4c20)
> > EFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4b50)
> >
> > EFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4b50)
> > EFI: Entry efi_cout_query_mode(00000000fff6b150, 0, 00000000ffcf4a50,
> > 00000000ffcf4a58)
> > EFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4990)
> > gEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4990)
> > rEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4990)
> > uEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4990)
> > bEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4990)
> >> >EFI: Entry efi_cout_query_mode(00000000fff6b150, 0,
> >> >00000000ffcf4a50, 00000000ffcf4a58)
> > EFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffcf4990)
> >  EFI: Entry efi_cout_query_mode(00000000fff6b150, 0, 00000000ffcf4c10,
> > 00000000ffcf4c18)
> > EFI: Entry efi_cout_query_mode(00000000fff6b150, 0, 00000000ffcf4c10,
> > 00000000ffcf4c18) "Synchronous Abort" handler, esr 0x96000005
> > ELR:     fff1cafc
> > LR:      fff63410
> 
> Ok, this one is different. Here grub2 reaches its shell and then crashes inside
> of grub2 code.
> 
> Sounds like memory corruption somewhere maybe? Can you please try to
> see if increasing the malloc area helps?
> 

No success :(


EFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffaf4c20)
EFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffaf4c20)

EFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffaf4c20)
EFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffaf4c20)

EFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffaf4c20)
EFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffaf4b50)

EFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffaf4b50)
EFI: Entry efi_cout_query_mode(00000000fff6b150, 0, 00000000ffaf4a50, 00000000ffaf4a58)
EFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffaf4990)
gEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffaf4990)
rEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffaf4990)
uEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffaf4990)
bEFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffaf4990)
>EFI: Entry efi_cout_query_mode(00000000fff6b150, 0, 00000000ffaf4a50, 00000000ffaf4a58)
EFI: Entry efi_cout_output_string(00000000fff6b150, 00000000ffaf4990)
 EFI: Entry efi_cout_query_mode(00000000fff6b150, 0, 00000000ffaf4c10, 00000000ffaf4c18)
EFI: Entry efi_cout_query_mode(00000000fff6b150, 0, 00000000ffaf4c10, 00000000ffaf4c18)
"Synchronous Abort" handler, esr 0x96000005
ELR:     fff1cafc
LR:      fff63410
x0 : 00000000ffaf4808 x1 : 0000000000000214
x2 : 00000000fffffffa x3 : 0000000000000020
x4 : 0000000000000000 x5 : 0000000000000001
x6 : 0000000000000000 x7 : 0000000000000020
x8 : 0000000000000032 x9 : 000000000000001b
x10: 000000000000000f x11: 00000000ffaf4618
x12: 00000000fff6ab90 x13: 0000000000000000
x14: 000000000000200d x15: 000000000000200c
x16: 00000000faa1ee18 x17: 00000000fff7ca0e
x18: 00000000fffffffe x19: 000000000000005e
x20: 00000083bffb4100 x21: 00000000ffb1b908
x22: 00000083bffb4f98 x23: 00000083bfeeb120
x24: 00000000ffaf4b68 x25: 00000000fff87380
x26: 0000000000000000 x27: 0000000000000020
x28: 00000083bff975a0 x29: 00000000ffaf4790

Resetting CPU ...

### ERROR ### Please RESET the board ###

Following changes is done 


diff --git a/include/configs/ls2080a_common.h b/include/configs/ls2080a_common.h
index ebe1415..c0c7ebc 100644
--- a/include/configs/ls2080a_common.h
+++ b/include/configs/ls2080a_common.h
@@ -88,7 +88,7 @@
 #define COUNTER_FREQUENCY              25000000        /* 25MHz */
 
 /* Size of malloc() pool */
-#define CONFIG_SYS_MALLOC_LEN          (CONFIG_ENV_SIZE + 2048 * 1024)
+#define CONFIG_SYS_MALLOC_LEN          (CONFIG_ENV_SIZE + 2 * 2048 * 1024)
 
 /* I2C */
 #define CONFIG_SYS_I2C

--prabhakar

^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [U-Boot] [PATCH v4 2/9] efi_loader: AArch64: Run EFI payloads in EL2 if U-Boot runs in EL3
  2016-06-22  5:44         ` Alexander Graf
@ 2016-07-15 15:40           ` york sun
  2016-07-20 15:18           ` york sun
  1 sibling, 0 replies; 32+ messages in thread
From: york sun @ 2016-07-15 15:40 UTC (permalink / raw)
  To: u-boot

On 06/21/2016 10:44 PM, Alexander Graf wrote:
>
>
> On 21.06.16 20:02, york sun wrote:
>> On 06/21/2016 10:55 AM, Alexander Graf wrote:
>>>
>>>
>>>> Am 21.06.2016 um 19:12 schrieb york sun <york.sun@nxp.com>:
>>>>
>>>>> On 06/20/2016 04:07 PM, Alexander Graf wrote:
>>>>> Some boards decided not to run ATF or other secure firmware in EL3, so
>>>>> they instead run U-Boot there. The uEFI spec doesn't know what EL3 is
>>>>> though - it only knows about EL2 and EL1. So if we see that we're running
>>>>> in EL3, let's get into EL2 to make payloads happy.
>>>>>
>>>>> Signed-off-by: Alexander Graf <agraf@suse.de>
>>>>> ---
>>>>>    arch/arm/include/asm/armv8/mmu.h | 19 ++++++++++++-------
>>>>>    cmd/bootefi.c                    | 11 +++++++++++
>>>>>    2 files changed, 23 insertions(+), 7 deletions(-)
>>>>>
>>>>> diff --git a/arch/arm/include/asm/armv8/mmu.h b/arch/arm/include/asm/armv8/mmu.h
>>>>> index 0d08ed3..876a2b2 100644
>>>>> --- a/arch/arm/include/asm/armv8/mmu.h
>>>>> +++ b/arch/arm/include/asm/armv8/mmu.h
>>>>> @@ -116,19 +116,24 @@
>>>>>    static inline void set_ttbr_tcr_mair(int el, u64 table, u64 tcr, u64 attr)
>>>>>    {
>>>>>        asm volatile("dsb sy");
>>>>> -    if (el == 1) {
>>>>> +    switch (el) {
>>>>> +    case 1:
>>>>>            asm volatile("msr ttbr0_el1, %0" : : "r" (table) : "memory");
>>>>>            asm volatile("msr tcr_el1, %0" : : "r" (tcr) : "memory");
>>>>>            asm volatile("msr mair_el1, %0" : : "r" (attr) : "memory");
>>>>> -    } else if (el == 2) {
>>>>> -        asm volatile("msr ttbr0_el2, %0" : : "r" (table) : "memory");
>>>>> -        asm volatile("msr tcr_el2, %0" : : "r" (tcr) : "memory");
>>>>> -        asm volatile("msr mair_el2, %0" : : "r" (attr) : "memory");
>>>>> -    } else if (el == 3) {
>>>>> +        break;
>>>>> +    case 3:
>>>>>            asm volatile("msr ttbr0_el3, %0" : : "r" (table) : "memory");
>>>>>            asm volatile("msr tcr_el3, %0" : : "r" (tcr) : "memory");
>>>>>            asm volatile("msr mair_el3, %0" : : "r" (attr) : "memory");
>>>>> -    } else {
>>>>> +
>>>>> +        /* We may switch to EL2 later, so set those too; fall through */
>>>>> +    case 2:
>>>>> +        asm volatile("msr ttbr0_el2, %0" : : "r" (table) : "memory");
>>>>> +        asm volatile("msr tcr_el2, %0" : : "r" (tcr) : "memory");
>>>>> +        asm volatile("msr mair_el2, %0" : : "r" (attr) : "memory");
>>>>> +        break;
>>>>
>>>>
>>>> This may be problematic. If we use secure memory for EL3, the MMU tables
>>>> have to be within the secure memory. But EL2 will not be able to access
>>>> it. I believe you have verified this patch set actually work. I am
>>>> curious how it work.
>>>
>>> That's a good question. I suppose the default config doesn't actually lock secure memory? Or doesn't go secure at all?
>>>
>>
>> The patch set using this secure memory is still pending. Our internal
>> team has been working on it. So the secure memory has been working. I am
>> sure I have put MMU tables in secure memory. You can verify by running
>> "bdi" command. It will show you the secure memory location. If you don't
>> see it, then you don't have secure memory setup. By default, it is enabled.
>
> Ok, yes, I do see secure memory there.
>
>> I remember I have done a test to access to the secure memory from
>> non-secure master and got an exception.
>>
>> Could your test run at EL2 without a proper MMU table? I don't remember
>> if the core would hang, or continue to run if fetching MMU table fails.
>
> So without this patch, U-Boot would just hang (or probably loop in
> delivering page faults) in the switch to EL2, before we even reach any
> EFI payload. I'm not sure why it does succeed in accessing the page
> tables though if they are indeed in secure memory.
>
> Maybe we should just turn the whole logic upside down. Switch from EL3
> to EL2 in very early init code and get people to just run ATF or some
> other self-contained trusted firmware (maybe even built as part of
> U-Boot) in EL3. Putting all of U-Boot into EL3 doesn't seem to much of a
> good idea either way, as there is a lot of code that has no business at EL3.
>
> Would that approach work for you as well?
>

Alex,

I think we can make this work. I have two patch pending. One is my 
rewriting MMU setup for FSL Layerscape SoCs. Another one is Zhiqiang's 
PPA patch. Once they are both merged, you can drop the change in 
set_ttbr_tcr_mair() and let dcache_disable() do the job. The latter one 
will call mmu_setup() to setup new tables for EL2.

York

^ permalink raw reply	[flat|nested] 32+ messages in thread

* [U-Boot] [PATCH v4 2/9] efi_loader: AArch64: Run EFI payloads in EL2 if U-Boot runs in EL3
  2016-06-22  5:44         ` Alexander Graf
  2016-07-15 15:40           ` york sun
@ 2016-07-20 15:18           ` york sun
  1 sibling, 0 replies; 32+ messages in thread
From: york sun @ 2016-07-20 15:18 UTC (permalink / raw)
  To: u-boot

On 06/21/2016 10:44 PM, Alexander Graf wrote:
>
>
> On 21.06.16 20:02, york sun wrote:
>> On 06/21/2016 10:55 AM, Alexander Graf wrote:
>>>
>>>
>>>> Am 21.06.2016 um 19:12 schrieb york sun <york.sun@nxp.com>:
>>>>
>>>>> On 06/20/2016 04:07 PM, Alexander Graf wrote:
>>>>> Some boards decided not to run ATF or other secure firmware in EL3, so
>>>>> they instead run U-Boot there. The uEFI spec doesn't know what EL3 is
>>>>> though - it only knows about EL2 and EL1. So if we see that we're running
>>>>> in EL3, let's get into EL2 to make payloads happy.
>>>>>
>>>>> Signed-off-by: Alexander Graf <agraf@suse.de>
>>>>> ---
>>>>>   arch/arm/include/asm/armv8/mmu.h | 19 ++++++++++++-------
>>>>>   cmd/bootefi.c                    | 11 +++++++++++
>>>>>   2 files changed, 23 insertions(+), 7 deletions(-)
>>>>>
>>>>> diff --git a/arch/arm/include/asm/armv8/mmu.h b/arch/arm/include/asm/armv8/mmu.h
>>>>> index 0d08ed3..876a2b2 100644
>>>>> --- a/arch/arm/include/asm/armv8/mmu.h
>>>>> +++ b/arch/arm/include/asm/armv8/mmu.h
>>>>> @@ -116,19 +116,24 @@
>>>>>   static inline void set_ttbr_tcr_mair(int el, u64 table, u64 tcr, u64 attr)
>>>>>   {
>>>>>       asm volatile("dsb sy");
>>>>> -    if (el == 1) {
>>>>> +    switch (el) {
>>>>> +    case 1:
>>>>>           asm volatile("msr ttbr0_el1, %0" : : "r" (table) : "memory");
>>>>>           asm volatile("msr tcr_el1, %0" : : "r" (tcr) : "memory");
>>>>>           asm volatile("msr mair_el1, %0" : : "r" (attr) : "memory");
>>>>> -    } else if (el == 2) {
>>>>> -        asm volatile("msr ttbr0_el2, %0" : : "r" (table) : "memory");
>>>>> -        asm volatile("msr tcr_el2, %0" : : "r" (tcr) : "memory");
>>>>> -        asm volatile("msr mair_el2, %0" : : "r" (attr) : "memory");
>>>>> -    } else if (el == 3) {
>>>>> +        break;
>>>>> +    case 3:
>>>>>           asm volatile("msr ttbr0_el3, %0" : : "r" (table) : "memory");
>>>>>           asm volatile("msr tcr_el3, %0" : : "r" (tcr) : "memory");
>>>>>           asm volatile("msr mair_el3, %0" : : "r" (attr) : "memory");
>>>>> -    } else {
>>>>> +
>>>>> +        /* We may switch to EL2 later, so set those too; fall through */
>>>>> +    case 2:
>>>>> +        asm volatile("msr ttbr0_el2, %0" : : "r" (table) : "memory");
>>>>> +        asm volatile("msr tcr_el2, %0" : : "r" (tcr) : "memory");
>>>>> +        asm volatile("msr mair_el2, %0" : : "r" (attr) : "memory");
>>>>> +        break;
>>>>
>>>>
>>>> This may be problematic. If we use secure memory for EL3, the MMU tables
>>>> have to be within the secure memory. But EL2 will not be able to access
>>>> it. I believe you have verified this patch set actually work. I am
>>>> curious how it work.
>>>
>>> That's a good question. I suppose the default config doesn't actually lock secure memory? Or doesn't go secure at all?
>>>
>>
>> The patch set using this secure memory is still pending. Our internal
>> team has been working on it. So the secure memory has been working. I am
>> sure I have put MMU tables in secure memory. You can verify by running
>> "bdi" command. It will show you the secure memory location. If you don't
>> see it, then you don't have secure memory setup. By default, it is enabled.
>
> Ok, yes, I do see secure memory there.
>
>> I remember I have done a test to access to the secure memory from
>> non-secure master and got an exception.
>>
>> Could your test run at EL2 without a proper MMU table? I don't remember
>> if the core would hang, or continue to run if fetching MMU table fails.
>
> So without this patch, U-Boot would just hang (or probably loop in
> delivering page faults) in the switch to EL2, before we even reach any
> EFI payload. I'm not sure why it does succeed in accessing the page
> tables though if they are indeed in secure memory.
>
> Maybe we should just turn the whole logic upside down. Switch from EL3
> to EL2 in very early init code and get people to just run ATF or some
> other self-contained trusted firmware (maybe even built as part of
> U-Boot) in EL3. Putting all of U-Boot into EL3 doesn't seem to much of a
> good idea either way, as there is a lot of code that has no business at EL3.
>
> Would that approach work for you as well?
>

Alex,

With recent patches merged, I think we have a solution here. You can 
call dcache_enable() after switching to el2 in cmd/bootefi.c. Since MMU 
is not on by default, mmu_setup() will be called. In the weak function, 
you check if (!gd->arch.tlb_fillptr), so no new tables are created. The 
code following will enable MMU for EL2. For platforms with mmu_setup 
(including ls2080a), mmu_setup() will take care of creating new tables 
in non-secure memory. I have verified on LS1043A with new PPA framework.

I can test this for you, if you educate me how to run distro boot. Do I 
need hard drive/image to continue?

York

^ permalink raw reply	[flat|nested] 32+ messages in thread

* [U-Boot] [PATCH v4 8/9] efi_loader: Declare secure memory as reserved
  2016-06-20 23:07 ` [U-Boot] [PATCH v4 8/9] efi_loader: Declare secure memory as reserved Alexander Graf
@ 2016-07-20 15:20   ` york sun
  0 siblings, 0 replies; 32+ messages in thread
From: york sun @ 2016-07-20 15:20 UTC (permalink / raw)
  To: u-boot

On 06/20/2016 04:07 PM, Alexander Graf wrote:
> Some systems may implemente TrustZone (EL3) in U-Boot. Those systems
> reserve some memory that U-Boot is aware of as secure.
>
> For those systems, mask out that secure memory in the EFI memory map,
> as it's not usable from EL2 or EL1.
>
> Signed-off-by: Alexander Graf <agraf@suse.de>
> ---
>  lib/efi_loader/efi_memory.c | 15 +++++++++++++++
>  1 file changed, 15 insertions(+)
>
> diff --git a/lib/efi_loader/efi_memory.c b/lib/efi_loader/efi_memory.c
> index df2381e..6e2eeeb 100644
> --- a/lib/efi_loader/efi_memory.c
> +++ b/lib/efi_loader/efi_memory.c
> @@ -398,5 +398,20 @@ int efi_memory_init(void)
>  	efi_bounce_buffer = (void*)(uintptr_t)efi_bounce_buffer_addr;
>  #endif
>
> +#ifdef CONFIG_SYS_MEM_RESERVE_SECURE
> +	/* Declare secure ram as reserved */
> +        if (gd->secure_ram & MEM_RESERVE_SECURE_SECURED) {

This variable has been moved to gd->arch.secure_ram in recent commit.

York

^ permalink raw reply	[flat|nested] 32+ messages in thread

end of thread, other threads:[~2016-07-20 15:20 UTC | newest]

Thread overview: 32+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-06-20 23:07 [U-Boot] [PATCH v4 0/9] LS2080ARDB: Enable EFI boot support Alexander Graf
2016-06-20 23:07 ` [U-Boot] [PATCH v4 1/9] ls2080: Exit dpaa only right before exiting U-Boot Alexander Graf
2016-06-20 23:07 ` [U-Boot] [PATCH v4 2/9] efi_loader: AArch64: Run EFI payloads in EL2 if U-Boot runs in EL3 Alexander Graf
2016-06-21 17:12   ` york sun
2016-06-21 17:55     ` Alexander Graf
2016-06-21 18:02       ` york sun
2016-06-22  5:44         ` Alexander Graf
2016-07-15 15:40           ` york sun
2016-07-20 15:18           ` york sun
2016-06-22  2:50   ` Prabhakar Kushwaha
2016-06-22  5:46     ` Alexander Graf
2016-06-20 23:07 ` [U-Boot] [PATCH v4 3/9] ls2080ardb: Reserve DP-DDR RAM Alexander Graf
2016-06-22  2:51   ` Prabhakar Kushwaha
2016-06-22  4:54     ` Alexander Graf
2016-06-20 23:07 ` [U-Boot] [PATCH v4 4/9] ls2080ardb: Convert to distro boot Alexander Graf
2016-06-21 21:49   ` york sun
2016-06-22  4:53     ` Alexander Graf
2016-06-22 15:15       ` york sun
2016-06-22  2:54   ` Prabhakar Kushwaha
2016-06-20 23:07 ` [U-Boot] [PATCH v4 5/9] armv8: ls2080a: Declare spin tables as reserved for efi loader Alexander Graf
2016-06-22  3:06   ` Prabhakar Kushwaha
2016-06-22  4:55     ` Alexander Graf
2016-06-20 23:07 ` [U-Boot] [PATCH v4 6/9] efi_loader: Allow boards to implement get_time and reset_system Alexander Graf
2016-06-20 23:07 ` [U-Boot] [PATCH v4 7/9] armv8: fsl-layerscape: Add support for efi_loader RTS reset Alexander Graf
2016-06-20 23:07 ` [U-Boot] [PATCH v4 8/9] efi_loader: Declare secure memory as reserved Alexander Graf
2016-07-20 15:20   ` york sun
2016-06-20 23:07 ` [U-Boot] [PATCH v4 9/9] efi_loader: Allow bouncing for network Alexander Graf
2016-06-23  5:30 ` [U-Boot] [PATCH v4 0/9] LS2080ARDB: Enable EFI boot support Prabhakar Kushwaha
2016-06-23  7:34   ` Alexander Graf
2016-06-23 10:34     ` Prabhakar Kushwaha
2016-06-23 12:39       ` Alexander Graf
2016-06-23 13:06         ` Prabhakar Kushwaha

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.