u-boot.lists.denx.de archive mirror
 help / color / mirror / Atom feed
* [PATCH 01/12] lmb: Always compile arch_lmb_reserve() into U-Boot on arm
@ 2021-09-10 20:47 Marek Vasut
  2021-09-10 20:47 ` [PATCH 02/12] lmb: Always compile arch_lmb_reserve() into U-Boot on arc Marek Vasut
                   ` (11 more replies)
  0 siblings, 12 replies; 28+ messages in thread
From: Marek Vasut @ 2021-09-10 20:47 UTC (permalink / raw)
  To: u-boot; +Cc: Marek Vasut, Tom Rini, Simon Glass, Simon Goldschmidt

The arch_lmb_reserve() is called by lib/lmb.c lmb_reserve_common() even
if CMD_BOOT{I,M,Z} is not enabled. However, the arm32/arm64 variant of
arch_lmb_reserve() is only compiled in if CMD_BOOT{I,M,Z} is enabled.

This currently does not trigger build error, because there is an empty
weak implementation of arch_lmb_reserve(), however that is not the
function that should be used on arm32/arm64.

Fix this by moving the arch_lmb_reserve() implementation into common
code and always compile it in.

Reviewed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
Cc: Tom Rini <trini@konsulko.com>
---
V2: Add RB
---
 arch/arm/lib/bootm.c | 45 --------------------------------------------
 arch/arm/lib/stack.c | 45 ++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 45 insertions(+), 45 deletions(-)

diff --git a/arch/arm/lib/bootm.c b/arch/arm/lib/bootm.c
index f60ee3a7e6..dd6a69315a 100644
--- a/arch/arm/lib/bootm.c
+++ b/arch/arm/lib/bootm.c
@@ -16,7 +16,6 @@
 #include <command.h>
 #include <cpu_func.h>
 #include <dm.h>
-#include <lmb.h>
 #include <log.h>
 #include <asm/global_data.h>
 #include <dm/root.h>
@@ -43,50 +42,6 @@ DECLARE_GLOBAL_DATA_PTR;
 
 static struct tag *params;
 
-static ulong get_sp(void)
-{
-	ulong ret;
-
-	asm("mov %0, sp" : "=r"(ret) : );
-	return ret;
-}
-
-void arch_lmb_reserve(struct lmb *lmb)
-{
-	ulong sp, bank_end;
-	int bank;
-
-	/*
-	 * Booting a (Linux) kernel image
-	 *
-	 * Allocate space for command line and board info - the
-	 * address should be as high as possible within the reach of
-	 * the kernel (see CONFIG_SYS_BOOTMAPSZ settings), but in unused
-	 * memory, which means far enough below the current stack
-	 * pointer.
-	 */
-	sp = get_sp();
-	debug("## Current stack ends at 0x%08lx ", sp);
-
-	/* adjust sp by 4K to be safe */
-	sp -= 4096;
-	for (bank = 0; bank < CONFIG_NR_DRAM_BANKS; bank++) {
-		if (!gd->bd->bi_dram[bank].size ||
-		    sp < gd->bd->bi_dram[bank].start)
-			continue;
-		/* Watch out for RAM at end of address space! */
-		bank_end = gd->bd->bi_dram[bank].start +
-			gd->bd->bi_dram[bank].size - 1;
-		if (sp > bank_end)
-			continue;
-		if (bank_end > gd->ram_top)
-			bank_end = gd->ram_top - 1;
-
-		lmb_reserve(lmb, sp, bank_end - sp + 1);
-		break;
-	}
-}
-
 __weak void board_quiesce_devices(void)
 {
 }
diff --git a/arch/arm/lib/stack.c b/arch/arm/lib/stack.c
index b03e1cfc80..3f961f4454 100644
--- a/arch/arm/lib/stack.c
+++ b/arch/arm/lib/stack.c
@@ -12,6 +12,7 @@
  */
 #include <common.h>
 #include <init.h>
+#include <lmb.h>
 #include <asm/global_data.h>
 
 DECLARE_GLOBAL_DATA_PTR;
@@ -33,3 +34,47 @@ int arch_reserve_stacks(void)
 
 	return 0;
 }
+
+static ulong get_sp(void)
+{
+	ulong ret;
+
+	asm("mov %0, sp" : "=r"(ret) : );
+	return ret;
+}
+
+void arch_lmb_reserve(struct lmb *lmb)
+{
+	ulong sp, bank_end;
+	int bank;
+
+	/*
+	 * Booting a (Linux) kernel image
+	 *
+	 * Allocate space for command line and board info - the
+	 * address should be as high as possible within the reach of
+	 * the kernel (see CONFIG_SYS_BOOTMAPSZ settings), but in unused
+	 * memory, which means far enough below the current stack
+	 * pointer.
+	 */
+	sp = get_sp();
+	debug("## Current stack ends at 0x%08lx ", sp);
+
+	/* adjust sp by 4K to be safe */
+	sp -= 4096;
+	for (bank = 0; bank < CONFIG_NR_DRAM_BANKS; bank++) {
+		if (!gd->bd->bi_dram[bank].size ||
+		    sp < gd->bd->bi_dram[bank].start)
+			continue;
+		/* Watch out for RAM at end of address space! */
+		bank_end = gd->bd->bi_dram[bank].start +
+			gd->bd->bi_dram[bank].size - 1;
+		if (sp > bank_end)
+			continue;
+		if (bank_end > gd->ram_top)
+			bank_end = gd->ram_top - 1;
+
+		lmb_reserve(lmb, sp, bank_end - sp + 1);
+		break;
+	}
+}
-- 
2.33.0


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

* [PATCH 02/12] lmb: Always compile arch_lmb_reserve() into U-Boot on arc
  2021-09-10 20:47 [PATCH 01/12] lmb: Always compile arch_lmb_reserve() into U-Boot on arm Marek Vasut
@ 2021-09-10 20:47 ` Marek Vasut
  2021-09-24  2:41   ` Tom Rini
  2021-09-10 20:47 ` [PATCH 03/12] lmb: Add generic arch_lmb_reserve_generic() Marek Vasut
                   ` (10 subsequent siblings)
  11 siblings, 1 reply; 28+ messages in thread
From: Marek Vasut @ 2021-09-10 20:47 UTC (permalink / raw)
  To: u-boot; +Cc: Marek Vasut, Simon Glass, Simon Goldschmidt, Tom Rini

The arch_lmb_reserve() is called by lib/lmb.c lmb_reserve_common() even
if CMD_BOOTM is not enabled. However, the arc variant of arch_lmb_reserve()
is only compiled in if CMD_BOOTM is enabled.

This currently does not trigger build error, because there is an empty
weak implementation of arch_lmb_reserve(), however that is not the
function that should be used on arc.

Fix this by moving the arch_lmb_reserve() implementation into common
code and always compile it in.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
Cc: Tom Rini <trini@konsulko.com>
---
V2: No change
---
 arch/arc/lib/bootm.c | 30 ------------------------------
 arch/arc/lib/cache.c | 30 ++++++++++++++++++++++++++++++
 2 files changed, 30 insertions(+), 30 deletions(-)

diff --git a/arch/arc/lib/bootm.c b/arch/arc/lib/bootm.c
index 8a8d394a5f..41408c2b46 100644
--- a/arch/arc/lib/bootm.c
+++ b/arch/arc/lib/bootm.c
@@ -8,42 +8,12 @@
 #include <env.h>
 #include <image.h>
 #include <irq_func.h>
-#include <lmb.h>
 #include <log.h>
 #include <asm/cache.h>
 #include <asm/global_data.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
-static ulong get_sp(void)
-{
-	ulong ret;
-
-	asm("mov %0, sp" : "=r"(ret) : );
-	return ret;
-}
-
-void arch_lmb_reserve(struct lmb *lmb)
-{
-	ulong sp;
-
-	/*
-	 * Booting a (Linux) kernel image
-	 *
-	 * Allocate space for command line and board info - the
-	 * address should be as high as possible within the reach of
-	 * the kernel (see CONFIG_SYS_BOOTMAPSZ settings), but in unused
-	 * memory, which means far enough below the current stack
-	 * pointer.
-	 */
-	sp = get_sp();
-	debug("## Current stack ends at 0x%08lx ", sp);
-
-	/* adjust sp by 4K to be safe */
-	sp -= 4096;
-	lmb_reserve(lmb, sp, (CONFIG_SYS_SDRAM_BASE + gd->ram_size - sp));
-}
-
 static int cleanup_before_linux(void)
 {
 	disable_interrupts();
diff --git a/arch/arc/lib/cache.c b/arch/arc/lib/cache.c
index f807cd83d6..4ba180482c 100644
--- a/arch/arc/lib/cache.c
+++ b/arch/arc/lib/cache.c
@@ -11,6 +11,7 @@
 #include <linux/compiler.h>
 #include <linux/kernel.h>
 #include <linux/log2.h>
+#include <lmb.h>
 #include <asm/arcregs.h>
 #include <asm/arc-bcr.h>
 #include <asm/cache.h>
@@ -820,3 +821,32 @@ void sync_n_cleanup_cache_all(void)
 
 	__ic_entire_invalidate();
 }
+
+static ulong get_sp(void)
+{
+	ulong ret;
+
+	asm("mov %0, sp" : "=r"(ret) : );
+	return ret;
+}
+
+void arch_lmb_reserve(struct lmb *lmb)
+{
+	ulong sp;
+
+	/*
+	 * Booting a (Linux) kernel image
+	 *
+	 * Allocate space for command line and board info - the
+	 * address should be as high as possible within the reach of
+	 * the kernel (see CONFIG_SYS_BOOTMAPSZ settings), but in unused
+	 * memory, which means far enough below the current stack
+	 * pointer.
+	 */
+	sp = get_sp();
+	debug("## Current stack ends at 0x%08lx ", sp);
+
+	/* adjust sp by 4K to be safe */
+	sp -= 4096;
+	lmb_reserve(lmb, sp, (CONFIG_SYS_SDRAM_BASE + gd->ram_size - sp));
+}
-- 
2.33.0


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

* [PATCH 03/12] lmb: Add generic arch_lmb_reserve_generic()
  2021-09-10 20:47 [PATCH 01/12] lmb: Always compile arch_lmb_reserve() into U-Boot on arm Marek Vasut
  2021-09-10 20:47 ` [PATCH 02/12] lmb: Always compile arch_lmb_reserve() into U-Boot on arc Marek Vasut
@ 2021-09-10 20:47 ` Marek Vasut
  2021-09-10 21:10   ` Tom Rini
                     ` (2 more replies)
  2021-09-10 20:47 ` [PATCH 04/12] lmb: Switch to " Marek Vasut
                   ` (9 subsequent siblings)
  11 siblings, 3 replies; 28+ messages in thread
From: Marek Vasut @ 2021-09-10 20:47 UTC (permalink / raw)
  To: u-boot
  Cc: Marek Vasut, Alexey Brodkin, Angelo Dureghello,
	Daniel Schwierzeck, Eugeniy Paltsev, Hai Pham, Michal Simek,
	Simon Goldschmidt, Tom Rini, Wolfgang Denk

The arc/arm/m68k/microblaze/mips/ppc arch_lmb_reserve() implementations
are all mostly the same, except for a couple of details. Implement a
generic arch_lmb_reserve_generic() function which can be parametrized
enough to cater for those differences between architectures. This can
also be parametrized enough so it can handle cases where U-Boot is not
relocated to the end of DRAM e.g. because there is some other reserved
memory past U-Boot (e.g. unmovable firmware for coprocessor), it is not
relocated at all, and other such use cases.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Alexey Brodkin <alexey.brodkin@synopsys.com>
Cc: Angelo Dureghello <angelo@sysam.it>
Cc: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Cc: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
Cc: Hai Pham <hai.pham.ud@renesas.com>
Cc: Michal Simek <monstr@monstr.eu>
Cc: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
Cc: Tom Rini <trini@konsulko.com>
Cc: Wolfgang Denk <wd@denx.de>
---
V2: Reword code comment
---
 include/lmb.h |  1 +
 lib/lmb.c     | 35 +++++++++++++++++++++++++++++++++++
 2 files changed, 36 insertions(+)

diff --git a/include/lmb.h b/include/lmb.h
index 3c4afdf9f0..1984291132 100644
--- a/include/lmb.h
+++ b/include/lmb.h
@@ -122,6 +122,7 @@ lmb_size_bytes(struct lmb_region *type, unsigned long region_nr)
 
 void board_lmb_reserve(struct lmb *lmb);
 void arch_lmb_reserve(struct lmb *lmb);
+void arch_lmb_reserve_generic(struct lmb *lmb, ulong sp, ulong end, ulong align);
 
 /* Low level functions */
 
diff --git a/lib/lmb.c b/lib/lmb.c
index 7bd1255f7a..793647724c 100644
--- a/lib/lmb.c
+++ b/lib/lmb.c
@@ -12,6 +12,10 @@
 #include <log.h>
 #include <malloc.h>
 
+#include <asm/global_data.h>
+
+DECLARE_GLOBAL_DATA_PTR;
+
 #define LMB_ALLOC_ANYWHERE	0
 
 static void lmb_dump_region(struct lmb_region *rgn, char *name)
@@ -113,6 +117,37 @@ void lmb_init(struct lmb *lmb)
 	lmb->reserved.cnt = 0;
 }
 
+void arch_lmb_reserve_generic(struct lmb *lmb, ulong sp, ulong end, ulong align)
+{
+	ulong bank_end;
+	int bank;
+
+	/*
+	 * Reserve memory from aligned address below the bottom of U-Boot stack
+	 * until end of U-Boot area using LMB to prevent U-Boot from overwriting
+	 * that memory.
+	 */
+	debug("## Current stack ends at 0x%08lx ", sp);
+
+	/* adjust sp by 4K to be safe */
+	sp -= align;
+	for (bank = 0; bank < CONFIG_NR_DRAM_BANKS; bank++) {
+		if (!gd->bd->bi_dram[bank].size ||
+		    sp < gd->bd->bi_dram[bank].start)
+			continue;
+		/* Watch out for RAM at end of address space! */
+		bank_end = gd->bd->bi_dram[bank].start +
+			gd->bd->bi_dram[bank].size - 1;
+		if (sp > bank_end)
+			continue;
+		if (bank_end > end)
+			bank_end = end - 1;
+
+		lmb_reserve(lmb, sp, bank_end - sp + 1);
+		break;
+	}
+}
+
 static void lmb_reserve_common(struct lmb *lmb, void *fdt_blob)
 {
 	arch_lmb_reserve(lmb);
-- 
2.33.0


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

* [PATCH 04/12] lmb: Switch to generic arch_lmb_reserve_generic()
  2021-09-10 20:47 [PATCH 01/12] lmb: Always compile arch_lmb_reserve() into U-Boot on arm Marek Vasut
  2021-09-10 20:47 ` [PATCH 02/12] lmb: Always compile arch_lmb_reserve() into U-Boot on arc Marek Vasut
  2021-09-10 20:47 ` [PATCH 03/12] lmb: Add generic arch_lmb_reserve_generic() Marek Vasut
@ 2021-09-10 20:47 ` Marek Vasut
  2021-09-24  2:41   ` Tom Rini
  2021-09-10 20:47 ` [PATCH 05/12] lmb: arm: Increase LMB alignment to 16k in arch_lmb_reserve_generic() Marek Vasut
                   ` (8 subsequent siblings)
  11 siblings, 1 reply; 28+ messages in thread
From: Marek Vasut @ 2021-09-10 20:47 UTC (permalink / raw)
  To: u-boot
  Cc: Marek Vasut, Tom Rini, Alexey Brodkin, Angelo Dureghello,
	Daniel Schwierzeck, Eugeniy Paltsev, Hai Pham, Michal Simek,
	Simon Goldschmidt, Wolfgang Denk

Switch arc/arm/m68k/microblaze/mips/ppc arch_lmb_reserve() to
arch_lmb_reserve_generic().

Reviewed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Alexey Brodkin <alexey.brodkin@synopsys.com>
Cc: Angelo Dureghello <angelo@sysam.it>
Cc: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Cc: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
Cc: Hai Pham <hai.pham.ud@renesas.com>
Cc: Michal Simek <monstr@monstr.eu>
Cc: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
Cc: Tom Rini <trini@konsulko.com>
Cc: Wolfgang Denk <wd@denx.de>
---
V2: Add RB
---
 arch/arc/lib/cache.c        | 18 +-----------------
 arch/arm/lib/stack.c        | 33 +--------------------------------
 arch/m68k/lib/bootm.c       | 18 +-----------------
 arch/microblaze/lib/bootm.c | 28 +---------------------------
 arch/mips/lib/bootm.c       |  9 +--------
 arch/powerpc/lib/bootm.c    | 18 ++----------------
 6 files changed, 7 insertions(+), 117 deletions(-)

diff --git a/arch/arc/lib/cache.c b/arch/arc/lib/cache.c
index 4ba180482c..4c696cb53a 100644
--- a/arch/arc/lib/cache.c
+++ b/arch/arc/lib/cache.c
@@ -832,21 +832,5 @@ static ulong get_sp(void)
 
 void arch_lmb_reserve(struct lmb *lmb)
 {
-	ulong sp;
-
-	/*
-	 * Booting a (Linux) kernel image
-	 *
-	 * Allocate space for command line and board info - the
-	 * address should be as high as possible within the reach of
-	 * the kernel (see CONFIG_SYS_BOOTMAPSZ settings), but in unused
-	 * memory, which means far enough below the current stack
-	 * pointer.
-	 */
-	sp = get_sp();
-	debug("## Current stack ends at 0x%08lx ", sp);
-
-	/* adjust sp by 4K to be safe */
-	sp -= 4096;
-	lmb_reserve(lmb, sp, (CONFIG_SYS_SDRAM_BASE + gd->ram_size - sp));
+	arch_lmb_reserve_generic(lmb, get_sp(), gd->ram_top, 4096);
 }
diff --git a/arch/arm/lib/stack.c b/arch/arm/lib/stack.c
index 3f961f4454..52d9f15298 100644
--- a/arch/arm/lib/stack.c
+++ b/arch/arm/lib/stack.c
@@ -45,36 +45,5 @@ static ulong get_sp(void)
 
 void arch_lmb_reserve(struct lmb *lmb)
 {
-	ulong sp, bank_end;
-	int bank;
-
-	/*
-	 * Booting a (Linux) kernel image
-	 *
-	 * Allocate space for command line and board info - the
-	 * address should be as high as possible within the reach of
-	 * the kernel (see CONFIG_SYS_BOOTMAPSZ settings), but in unused
-	 * memory, which means far enough below the current stack
-	 * pointer.
-	 */
-	sp = get_sp();
-	debug("## Current stack ends at 0x%08lx ", sp);
-
-	/* adjust sp by 4K to be safe */
-	sp -= 4096;
-	for (bank = 0; bank < CONFIG_NR_DRAM_BANKS; bank++) {
-		if (!gd->bd->bi_dram[bank].size ||
-		    sp < gd->bd->bi_dram[bank].start)
-			continue;
-		/* Watch out for RAM at end of address space! */
-		bank_end = gd->bd->bi_dram[bank].start +
-			gd->bd->bi_dram[bank].size - 1;
-		if (sp > bank_end)
-			continue;
-		if (bank_end > gd->ram_top)
-			bank_end = gd->ram_top - 1;
-
-		lmb_reserve(lmb, sp, bank_end - sp + 1);
-		break;
-	}
+	arch_lmb_reserve_generic(lmb, get_sp(), gd->ram_top, 4096);
 }
diff --git a/arch/m68k/lib/bootm.c b/arch/m68k/lib/bootm.c
index 51a6f93858..27729db67e 100644
--- a/arch/m68k/lib/bootm.c
+++ b/arch/m68k/lib/bootm.c
@@ -32,23 +32,7 @@ static void set_clocks_in_mhz (struct bd_info *kbd);
 
 void arch_lmb_reserve(struct lmb *lmb)
 {
-	ulong sp;
-
-	/*
-	 * Booting a (Linux) kernel image
-	 *
-	 * Allocate space for command line and board info - the
-	 * address should be as high as possible within the reach of
-	 * the kernel (see CONFIG_SYS_BOOTMAPSZ settings), but in unused
-	 * memory, which means far enough below the current stack
-	 * pointer.
-	 */
-	sp = get_sp();
-	debug ("## Current stack ends at 0x%08lx ", sp);
-
-	/* adjust sp by 1K to be safe */
-	sp -= 1024;
-	lmb_reserve(lmb, sp, (CONFIG_SYS_SDRAM_BASE + gd->ram_size - sp));
+	arch_lmb_reserve_generic(lmb, get_sp(), gd->ram_top, 1024);
 }
 
 int do_bootm_linux(int flag, int argc, char *const argv[],
diff --git a/arch/microblaze/lib/bootm.c b/arch/microblaze/lib/bootm.c
index 6695ac63c7..3a6da6e29f 100644
--- a/arch/microblaze/lib/bootm.c
+++ b/arch/microblaze/lib/bootm.c
@@ -34,33 +34,7 @@ static ulong get_sp(void)
 
 void arch_lmb_reserve(struct lmb *lmb)
 {
-	ulong sp, bank_end;
-	int bank;
-
-	/*
-	 * Booting a (Linux) kernel image
-	 *
-	 * Allocate space for command line and board info - the
-	 * address should be as high as possible within the reach of
-	 * the kernel (see CONFIG_SYS_BOOTMAPSZ settings), but in unused
-	 * memory, which means far enough below the current stack
-	 * pointer.
-	 */
-	sp = get_sp();
-	debug("## Current stack ends at 0x%08lx ", sp);
-
-	/* adjust sp by 4K to be safe */
-	sp -= 4096;
-	for (bank = 0; bank < CONFIG_NR_DRAM_BANKS; bank++) {
-		if (sp < gd->bd->bi_dram[bank].start)
-			continue;
-		bank_end = gd->bd->bi_dram[bank].start +
-			gd->bd->bi_dram[bank].size;
-		if (sp >= bank_end)
-			continue;
-		lmb_reserve(lmb, sp, bank_end - sp);
-		break;
-	}
+	arch_lmb_reserve_generic(lmb, get_sp(), gd->ram_top, 4096);
 }
 
 static void boot_jump_linux(bootm_headers_t *images, int flag)
diff --git a/arch/mips/lib/bootm.c b/arch/mips/lib/bootm.c
index fde90fced4..cab8da4860 100644
--- a/arch/mips/lib/bootm.c
+++ b/arch/mips/lib/bootm.c
@@ -39,14 +39,7 @@ static ulong arch_get_sp(void)
 
 void arch_lmb_reserve(struct lmb *lmb)
 {
-	ulong sp;
-
-	sp = arch_get_sp();
-	debug("## Current stack ends at 0x%08lx\n", sp);
-
-	/* adjust sp by 4K to be safe */
-	sp -= 4096;
-	lmb_reserve(lmb, sp, gd->ram_top - sp);
+	arch_lmb_reserve_generic(lmb, arch_get_sp(), gd->ram_top, 4096);
 }
 
 static void linux_cmdline_init(void)
diff --git a/arch/powerpc/lib/bootm.c b/arch/powerpc/lib/bootm.c
index 31c17b5bb3..8d65047aa4 100644
--- a/arch/powerpc/lib/bootm.c
+++ b/arch/powerpc/lib/bootm.c
@@ -119,7 +119,7 @@ static void boot_jump_linux(bootm_headers_t *images)
 void arch_lmb_reserve(struct lmb *lmb)
 {
 	phys_size_t bootm_size;
-	ulong size, sp, bootmap_base;
+	ulong size, bootmap_base;
 
 	bootmap_base = env_get_bootm_low();
 	bootm_size = env_get_bootm_size();
@@ -141,21 +141,7 @@ void arch_lmb_reserve(struct lmb *lmb)
 		lmb_reserve(lmb, base, bootm_size - size);
 	}
 
-	/*
-	 * Booting a (Linux) kernel image
-	 *
-	 * Allocate space for command line and board info - the
-	 * address should be as high as possible within the reach of
-	 * the kernel (see CONFIG_SYS_BOOTMAPSZ settings), but in unused
-	 * memory, which means far enough below the current stack
-	 * pointer.
-	 */
-	sp = get_sp();
-	debug("## Current stack ends at 0x%08lx\n", sp);
-
-	/* adjust sp by 4K to be safe */
-	sp -= 4096;
-	lmb_reserve(lmb, sp, (CONFIG_SYS_SDRAM_BASE + get_effective_memsize() - sp));
+	arch_lmb_reserve_generic(lmb, get_sp(), gd->ram_top, 4096);
 
 #ifdef CONFIG_MP
 	cpu_mp_lmb_reserve(lmb);
-- 
2.33.0


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

* [PATCH 05/12] lmb: arm: Increase LMB alignment to 16k in arch_lmb_reserve_generic()
  2021-09-10 20:47 [PATCH 01/12] lmb: Always compile arch_lmb_reserve() into U-Boot on arm Marek Vasut
                   ` (2 preceding siblings ...)
  2021-09-10 20:47 ` [PATCH 04/12] lmb: Switch to " Marek Vasut
@ 2021-09-10 20:47 ` Marek Vasut
  2021-09-10 21:10   ` Tom Rini
  2021-09-24  2:42   ` Tom Rini
  2021-09-10 20:47 ` [PATCH 06/12] lmb: Remove imx board_lmb_reserve() Marek Vasut
                   ` (7 subsequent siblings)
  11 siblings, 2 replies; 28+ messages in thread
From: Marek Vasut @ 2021-09-10 20:47 UTC (permalink / raw)
  To: u-boot
  Cc: Marek Vasut, Alexey Brodkin, Angelo Dureghello,
	Daniel Schwierzeck, Eugeniy Paltsev, Hai Pham, Michal Simek,
	Simon Goldschmidt, Tom Rini, Wolfgang Denk, Ye Li

According to input NXP, the 4k alignment is not always sufficient.
Currently iMX works around this problem by implementing board specific
LMB reservation, however it is likely this could also occur on other
systems. Increase the LMB reservation alignment to 16k by default.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Alexey Brodkin <alexey.brodkin@synopsys.com>
Cc: Angelo Dureghello <angelo@sysam.it>
Cc: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Cc: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
Cc: Hai Pham <hai.pham.ud@renesas.com>
Cc: Michal Simek <monstr@monstr.eu>
Cc: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
Cc: Tom Rini <trini@konsulko.com>
Cc: Wolfgang Denk <wd@denx.de>
Cc: Ye Li <ye.li@nxp.com>
---
V2: New patch
---
 arch/arm/lib/stack.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/lib/stack.c b/arch/arm/lib/stack.c
index 52d9f15298..656084c7e5 100644
--- a/arch/arm/lib/stack.c
+++ b/arch/arm/lib/stack.c
@@ -45,5 +45,5 @@ static ulong get_sp(void)
 
 void arch_lmb_reserve(struct lmb *lmb)
 {
-	arch_lmb_reserve_generic(lmb, get_sp(), gd->ram_top, 4096);
+	arch_lmb_reserve_generic(lmb, get_sp(), gd->ram_top, 16384);
 }
-- 
2.33.0


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

* [PATCH 06/12] lmb: Remove imx board_lmb_reserve()
  2021-09-10 20:47 [PATCH 01/12] lmb: Always compile arch_lmb_reserve() into U-Boot on arm Marek Vasut
                   ` (3 preceding siblings ...)
  2021-09-10 20:47 ` [PATCH 05/12] lmb: arm: Increase LMB alignment to 16k in arch_lmb_reserve_generic() Marek Vasut
@ 2021-09-10 20:47 ` Marek Vasut
  2021-09-24  2:42   ` Tom Rini
  2021-09-10 20:47 ` [PATCH 07/12] lmb: nios2: Add arch_lmb_reserve() Marek Vasut
                   ` (6 subsequent siblings)
  11 siblings, 1 reply; 28+ messages in thread
From: Marek Vasut @ 2021-09-10 20:47 UTC (permalink / raw)
  To: u-boot
  Cc: Marek Vasut, Alexey Brodkin, Angelo Dureghello,
	Daniel Schwierzeck, Eugeniy Paltsev, Hai Pham, Michal Simek,
	Simon Goldschmidt, Tom Rini, Wolfgang Denk, Ye Li

This function is clearly architecture specific code, not board specific
code. The only difference from the previous arm arch_lmb_reserve() is the
extra reservation of 16k of memory below the stack bottom, rather than
the 4k. The common code now also uses 16k alignment. Remove this custom
implementation, as it now behaves exactly as the common code.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Alexey Brodkin <alexey.brodkin@synopsys.com>
Cc: Angelo Dureghello <angelo@sysam.it>
Cc: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Cc: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
Cc: Hai Pham <hai.pham.ud@renesas.com>
Cc: Michal Simek <monstr@monstr.eu>
Cc: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
Cc: Tom Rini <trini@konsulko.com>
Cc: Wolfgang Denk <wd@denx.de>
Cc: Ye Li <ye.li@nxp.com>
---
V2: Drop the custom implementation altogether
---
 arch/arm/mach-imx/misc.c | 30 ------------------------------
 1 file changed, 30 deletions(-)

diff --git a/arch/arm/mach-imx/misc.c b/arch/arm/mach-imx/misc.c
index d82efa7f8f..09a758ff6e 100644
--- a/arch/arm/mach-imx/misc.c
+++ b/arch/arm/mach-imx/misc.c
@@ -77,33 +77,3 @@ int mxs_reset_block(struct mxs_register_32 *reg)
 
 	return 0;
 }
-
-static ulong get_sp(void)
-{
-	ulong ret;
-
-	asm("mov %0, sp" : "=r"(ret) : );
-	return ret;
-}
-
-void board_lmb_reserve(struct lmb *lmb)
-{
-	ulong sp, bank_end;
-	int bank;
-
-	sp = get_sp();
-	debug("## Current stack ends at 0x%08lx ", sp);
-
-	/* adjust sp by 16K to be safe */
-	sp -= 4096 << 2;
-	for (bank = 0; bank < CONFIG_NR_DRAM_BANKS; bank++) {
-		if (sp < gd->bd->bi_dram[bank].start)
-			continue;
-		bank_end = gd->bd->bi_dram[bank].start +
-			gd->bd->bi_dram[bank].size;
-		if (sp >= bank_end)
-			continue;
-		lmb_reserve(lmb, sp, bank_end - sp);
-		break;
-	}
-}
-- 
2.33.0


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

* [PATCH 07/12] lmb: nios2: Add arch_lmb_reserve()
  2021-09-10 20:47 [PATCH 01/12] lmb: Always compile arch_lmb_reserve() into U-Boot on arm Marek Vasut
                   ` (4 preceding siblings ...)
  2021-09-10 20:47 ` [PATCH 06/12] lmb: Remove imx board_lmb_reserve() Marek Vasut
@ 2021-09-10 20:47 ` Marek Vasut
  2021-09-24  2:42   ` Tom Rini
  2021-09-10 20:47 ` [PATCH 08/12] lmb: nds32: " Marek Vasut
                   ` (5 subsequent siblings)
  11 siblings, 1 reply; 28+ messages in thread
From: Marek Vasut @ 2021-09-10 20:47 UTC (permalink / raw)
  To: u-boot; +Cc: Marek Vasut, Simon Goldschmidt, Thomas Chou, Tom Rini

Add arch_lmb_reserve() implemented using arch_lmb_reserve_generic().
It is rather likely this architecture also needs to cover U-Boot with
LMB before booting Linux.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
Cc: Thomas Chou <thomas@wytron.com.tw>
Cc: Tom Rini <trini@konsulko.com>
---
V2: No change
---
 arch/nios2/lib/bootm.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/arch/nios2/lib/bootm.c b/arch/nios2/lib/bootm.c
index 5037467151..3cb59bd977 100644
--- a/arch/nios2/lib/bootm.c
+++ b/arch/nios2/lib/bootm.c
@@ -10,6 +10,9 @@
 #include <image.h>
 #include <irq_func.h>
 #include <log.h>
+#include <asm/global_data.h>
+
+DECLARE_GLOBAL_DATA_PTR;
 
 #define NIOS_MAGIC 0x534f494e /* enable command line and initrd passing */
 
@@ -60,3 +63,16 @@ int do_bootm_linux(int flag, int argc, char *const argv[],
 
 	return 1;
 }
+
+static ulong get_sp(void)
+{
+	ulong ret;
+
+	asm("mov %0, sp" : "=r"(ret) : );
+	return ret;
+}
+
+void arch_lmb_reserve(struct lmb *lmb)
+{
+	arch_lmb_reserve_generic(lmb, get_sp(), gd->ram_top, 4096);
+}
-- 
2.33.0


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

* [PATCH 08/12] lmb: nds32: Add arch_lmb_reserve()
  2021-09-10 20:47 [PATCH 01/12] lmb: Always compile arch_lmb_reserve() into U-Boot on arm Marek Vasut
                   ` (5 preceding siblings ...)
  2021-09-10 20:47 ` [PATCH 07/12] lmb: nios2: Add arch_lmb_reserve() Marek Vasut
@ 2021-09-10 20:47 ` Marek Vasut
  2021-09-24  2:42   ` Tom Rini
  2021-09-10 20:47 ` [PATCH 09/12] lmb: riscv: " Marek Vasut
                   ` (4 subsequent siblings)
  11 siblings, 1 reply; 28+ messages in thread
From: Marek Vasut @ 2021-09-10 20:47 UTC (permalink / raw)
  To: u-boot; +Cc: Marek Vasut, Rick Chen, Simon Goldschmidt, Tom Rini

Add arch_lmb_reserve() implemented using arch_lmb_reserve_generic().
It is rather likely this architecture also needs to cover U-Boot with
LMB before booting Linux.

Reviewed-by: Rick Chen <rick@andestech.com>
Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Rick Chen <rick@andestech.com>
Cc: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
Cc: Tom Rini <trini@konsulko.com>
---
V2: Add RB from Rick
---
 arch/nds32/lib/bootm.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/arch/nds32/lib/bootm.c b/arch/nds32/lib/bootm.c
index 4cb0f530ae..a7c8978f23 100644
--- a/arch/nds32/lib/bootm.c
+++ b/arch/nds32/lib/bootm.c
@@ -245,3 +245,16 @@ static void setup_end_tag(struct bd_info *bd)
 }
 
 #endif /* CONFIG_SETUP_MEMORY_TAGS || CONFIG_CMDLINE_TAG || CONFIG_INITRD_TAG */
+
+static ulong get_sp(void)
+{
+	ulong ret;
+
+	asm("move %0, $sp" : "=r"(ret) : );
+	return ret;
+}
+
+void arch_lmb_reserve(struct lmb *lmb)
+{
+	arch_lmb_reserve_generic(lmb, get_sp(), gd->ram_top, 4096);
+}
-- 
2.33.0


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

* [PATCH 09/12] lmb: riscv: Add arch_lmb_reserve()
  2021-09-10 20:47 [PATCH 01/12] lmb: Always compile arch_lmb_reserve() into U-Boot on arm Marek Vasut
                   ` (6 preceding siblings ...)
  2021-09-10 20:47 ` [PATCH 08/12] lmb: nds32: " Marek Vasut
@ 2021-09-10 20:47 ` Marek Vasut
  2021-09-24  2:42   ` Tom Rini
  2021-09-10 20:47 ` [PATCH 10/12] lmb: sh: " Marek Vasut
                   ` (3 subsequent siblings)
  11 siblings, 1 reply; 28+ messages in thread
From: Marek Vasut @ 2021-09-10 20:47 UTC (permalink / raw)
  To: u-boot
  Cc: Marek Vasut, Rick Chen, Atish Patra, Leo, Simon Goldschmidt, Tom Rini

Add arch_lmb_reserve() implemented using arch_lmb_reserve_generic().
It is rather likely this architecture also needs to cover U-Boot with
LMB before booting Linux.

Reviewed-by: Rick Chen <rick@andestech.com>
Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Atish Patra <atish.patra@wdc.com>
Cc: Leo <ycliang@andestech.com>
Cc: Rick Chen <rick@andestech.com>
Cc: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
Cc: Tom Rini <trini@konsulko.com>
---
V2: Add RB from Rick
---
 arch/riscv/lib/bootm.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/arch/riscv/lib/bootm.c b/arch/riscv/lib/bootm.c
index 8dd1820540..ff1bdf7131 100644
--- a/arch/riscv/lib/bootm.c
+++ b/arch/riscv/lib/bootm.c
@@ -135,3 +135,16 @@ int do_bootm_vxworks(int flag, int argc, char *const argv[],
 {
 	return do_bootm_linux(flag, argc, argv, images);
 }
+
+static ulong get_sp(void)
+{
+	ulong ret;
+
+	asm("mv %0, sp" : "=r"(ret) : );
+	return ret;
+}
+
+void arch_lmb_reserve(struct lmb *lmb)
+{
+	arch_lmb_reserve_generic(lmb, get_sp(), gd->ram_top, 4096);
+}
-- 
2.33.0


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

* [PATCH 10/12] lmb: sh: Add arch_lmb_reserve()
  2021-09-10 20:47 [PATCH 01/12] lmb: Always compile arch_lmb_reserve() into U-Boot on arm Marek Vasut
                   ` (7 preceding siblings ...)
  2021-09-10 20:47 ` [PATCH 09/12] lmb: riscv: " Marek Vasut
@ 2021-09-10 20:47 ` Marek Vasut
  2021-09-24  2:42   ` Tom Rini
  2021-09-10 20:47 ` [PATCH 11/12] lmb: xtensa: " Marek Vasut
                   ` (2 subsequent siblings)
  11 siblings, 1 reply; 28+ messages in thread
From: Marek Vasut @ 2021-09-10 20:47 UTC (permalink / raw)
  To: u-boot; +Cc: Marek Vasut, Simon Goldschmidt, Tom Rini

Add arch_lmb_reserve() implemented using arch_lmb_reserve_generic().
This architecture also needs to cover U-Boot with LMB before booting
Linux.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
Cc: Tom Rini <trini@konsulko.com>
---
V2: No change
---
 arch/sh/lib/bootm.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/arch/sh/lib/bootm.c b/arch/sh/lib/bootm.c
index dc94f83785..9b71424dfe 100644
--- a/arch/sh/lib/bootm.c
+++ b/arch/sh/lib/bootm.c
@@ -12,8 +12,11 @@
 #include <env.h>
 #include <image.h>
 #include <asm/byteorder.h>
+#include <asm/global_data.h>
 #include <asm/zimage.h>
 
+DECLARE_GLOBAL_DATA_PTR;
+
 #ifdef CONFIG_SYS_DEBUG
 static void hexdump(unsigned char *buf, int len)
 {
@@ -111,3 +114,16 @@ int do_bootm_linux(int flag, int argc, char *const argv[],
 	/* does not return */
 	return 1;
 }
+
+static ulong get_sp(void)
+{
+	ulong ret;
+
+	asm("mov r15, %0" : "=r"(ret) : );
+	return ret;
+}
+
+void arch_lmb_reserve(struct lmb *lmb)
+{
+	arch_lmb_reserve_generic(lmb, get_sp(), gd->ram_top, 4096);
+}
-- 
2.33.0


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

* [PATCH 11/12] lmb: xtensa: Add arch_lmb_reserve()
  2021-09-10 20:47 [PATCH 01/12] lmb: Always compile arch_lmb_reserve() into U-Boot on arm Marek Vasut
                   ` (8 preceding siblings ...)
  2021-09-10 20:47 ` [PATCH 10/12] lmb: sh: " Marek Vasut
@ 2021-09-10 20:47 ` Marek Vasut
  2021-09-24  2:42   ` Tom Rini
  2021-09-10 20:47 ` [PATCH 12/12] lmb: x86: " Marek Vasut
  2021-09-24  2:41 ` [PATCH 01/12] lmb: Always compile arch_lmb_reserve() into U-Boot on arm Tom Rini
  11 siblings, 1 reply; 28+ messages in thread
From: Marek Vasut @ 2021-09-10 20:47 UTC (permalink / raw)
  To: u-boot; +Cc: Marek Vasut, Chris Zankel, Simon Goldschmidt, Tom Rini

Add arch_lmb_reserve() implemented using arch_lmb_reserve_generic().
It is rather likely this architecture also needs to cover U-Boot with
LMB before booting Linux.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Chris Zankel <chris@zankel.net>
Cc: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
Cc: Tom Rini <trini@konsulko.com>
---
V2: No change
---
 arch/xtensa/lib/bootm.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/arch/xtensa/lib/bootm.c b/arch/xtensa/lib/bootm.c
index bb1e2886ab..277af18168 100644
--- a/arch/xtensa/lib/bootm.c
+++ b/arch/xtensa/lib/bootm.c
@@ -197,3 +197,15 @@ int do_bootm_linux(int flag, int argc, char *argv[], bootm_headers_t *images)
 	return 1;
 }
 
+static ulong get_sp(void)
+{
+	ulong ret;
+
+	asm("mov %0, a1" : "=r"(ret) : );
+	return ret;
+}
+
+void arch_lmb_reserve(struct lmb *lmb)
+{
+	arch_lmb_reserve_generic(lmb, get_sp(), gd->ram_top, 4096);
+}
-- 
2.33.0


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

* [PATCH 12/12] lmb: x86: Add arch_lmb_reserve()
  2021-09-10 20:47 [PATCH 01/12] lmb: Always compile arch_lmb_reserve() into U-Boot on arm Marek Vasut
                   ` (9 preceding siblings ...)
  2021-09-10 20:47 ` [PATCH 11/12] lmb: xtensa: " Marek Vasut
@ 2021-09-10 20:47 ` Marek Vasut
  2021-09-24  2:42   ` Tom Rini
  2021-09-24  2:41 ` [PATCH 01/12] lmb: Always compile arch_lmb_reserve() into U-Boot on arm Tom Rini
  11 siblings, 1 reply; 28+ messages in thread
From: Marek Vasut @ 2021-09-10 20:47 UTC (permalink / raw)
  To: u-boot; +Cc: Marek Vasut, Simon Glass, Simon Goldschmidt, Tom Rini

Add arch_lmb_reserve() implemented using arch_lmb_reserve_generic().
It is rather likely this architecture also needs to cover U-Boot with
LMB before booting Linux.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
Cc: Tom Rini <trini@konsulko.com>
---
V2: No change
---
 arch/x86/lib/bootm.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/arch/x86/lib/bootm.c b/arch/x86/lib/bootm.c
index 733dd71257..667e5e689e 100644
--- a/arch/x86/lib/bootm.c
+++ b/arch/x86/lib/bootm.c
@@ -223,3 +223,21 @@ int do_bootm_linux(int flag, int argc, char *const argv[],
 
 	return boot_jump_linux(images);
 }
+
+static ulong get_sp(void)
+{
+	ulong ret;
+
+#if CONFIG_IS_ENABLED(X86_64)
+	ret = gd->start_addr_sp;
+#else
+	asm("mov %%esp, %0" : "=r"(ret) : );
+#endif
+
+	return ret;
+}
+
+void arch_lmb_reserve(struct lmb *lmb)
+{
+	arch_lmb_reserve_generic(lmb, get_sp(), gd->ram_top, 4096);
+}
-- 
2.33.0


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

* Re: [PATCH 03/12] lmb: Add generic arch_lmb_reserve_generic()
  2021-09-10 20:47 ` [PATCH 03/12] lmb: Add generic arch_lmb_reserve_generic() Marek Vasut
@ 2021-09-10 21:10   ` Tom Rini
  2021-09-12 19:27   ` Daniel Schwierzeck
  2021-09-24  2:41   ` Tom Rini
  2 siblings, 0 replies; 28+ messages in thread
From: Tom Rini @ 2021-09-10 21:10 UTC (permalink / raw)
  To: Marek Vasut
  Cc: u-boot, Marek Vasut, Alexey Brodkin, Angelo Dureghello,
	Daniel Schwierzeck, Eugeniy Paltsev, Hai Pham, Michal Simek,
	Simon Goldschmidt, Wolfgang Denk

[-- Attachment #1: Type: text/plain, Size: 1168 bytes --]

On Fri, Sep 10, 2021 at 10:47:09PM +0200, Marek Vasut wrote:

> The arc/arm/m68k/microblaze/mips/ppc arch_lmb_reserve() implementations
> are all mostly the same, except for a couple of details. Implement a
> generic arch_lmb_reserve_generic() function which can be parametrized
> enough to cater for those differences between architectures. This can
> also be parametrized enough so it can handle cases where U-Boot is not
> relocated to the end of DRAM e.g. because there is some other reserved
> memory past U-Boot (e.g. unmovable firmware for coprocessor), it is not
> relocated at all, and other such use cases.
> 
> Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
> Cc: Alexey Brodkin <alexey.brodkin@synopsys.com>
> Cc: Angelo Dureghello <angelo@sysam.it>
> Cc: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
> Cc: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
> Cc: Hai Pham <hai.pham.ud@renesas.com>
> Cc: Michal Simek <monstr@monstr.eu>
> Cc: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
> Cc: Tom Rini <trini@konsulko.com>
> Cc: Wolfgang Denk <wd@denx.de>

Reviewed-by: Tom Rini <trini@konsulko.com>

-- 
Tom

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]

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

* Re: [PATCH 05/12] lmb: arm: Increase LMB alignment to 16k in arch_lmb_reserve_generic()
  2021-09-10 20:47 ` [PATCH 05/12] lmb: arm: Increase LMB alignment to 16k in arch_lmb_reserve_generic() Marek Vasut
@ 2021-09-10 21:10   ` Tom Rini
  2021-09-24  2:42   ` Tom Rini
  1 sibling, 0 replies; 28+ messages in thread
From: Tom Rini @ 2021-09-10 21:10 UTC (permalink / raw)
  To: Marek Vasut
  Cc: u-boot, Marek Vasut, Alexey Brodkin, Angelo Dureghello,
	Daniel Schwierzeck, Eugeniy Paltsev, Hai Pham, Michal Simek,
	Simon Goldschmidt, Wolfgang Denk, Ye Li

[-- Attachment #1: Type: text/plain, Size: 920 bytes --]

On Fri, Sep 10, 2021 at 10:47:11PM +0200, Marek Vasut wrote:

> According to input NXP, the 4k alignment is not always sufficient.
> Currently iMX works around this problem by implementing board specific
> LMB reservation, however it is likely this could also occur on other
> systems. Increase the LMB reservation alignment to 16k by default.
> 
> Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
> Cc: Alexey Brodkin <alexey.brodkin@synopsys.com>
> Cc: Angelo Dureghello <angelo@sysam.it>
> Cc: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
> Cc: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
> Cc: Hai Pham <hai.pham.ud@renesas.com>
> Cc: Michal Simek <monstr@monstr.eu>
> Cc: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
> Cc: Tom Rini <trini@konsulko.com>
> Cc: Wolfgang Denk <wd@denx.de>
> Cc: Ye Li <ye.li@nxp.com>

Reviewed-by: Tom Rini <trini@konsulko.com>

-- 
Tom

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]

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

* Re: [PATCH 03/12] lmb: Add generic arch_lmb_reserve_generic()
  2021-09-10 20:47 ` [PATCH 03/12] lmb: Add generic arch_lmb_reserve_generic() Marek Vasut
  2021-09-10 21:10   ` Tom Rini
@ 2021-09-12 19:27   ` Daniel Schwierzeck
  2021-09-13  2:08     ` Marek Vasut
  2021-09-24  2:41   ` Tom Rini
  2 siblings, 1 reply; 28+ messages in thread
From: Daniel Schwierzeck @ 2021-09-12 19:27 UTC (permalink / raw)
  To: Marek Vasut, u-boot
  Cc: Marek Vasut, Alexey Brodkin, Angelo Dureghello, Eugeniy Paltsev,
	Hai Pham, Michal Simek, Simon Goldschmidt, Tom Rini,
	Wolfgang Denk

Am Freitag, dem 10.09.2021 um 22:47 +0200 schrieb Marek Vasut:
> The arc/arm/m68k/microblaze/mips/ppc arch_lmb_reserve()
> implementations
> are all mostly the same, except for a couple of details. Implement a
> generic arch_lmb_reserve_generic() function which can be parametrized
> enough to cater for those differences between architectures. This can
> also be parametrized enough so it can handle cases where U-Boot is
> not
> relocated to the end of DRAM e.g. because there is some other
> reserved
> memory past U-Boot (e.g. unmovable firmware for coprocessor), it is
> not
> relocated at all, and other such use cases.
> 
> Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
> Cc: Alexey Brodkin <alexey.brodkin@synopsys.com>
> Cc: Angelo Dureghello <angelo@sysam.it>
> Cc: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
> Cc: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
> Cc: Hai Pham <hai.pham.ud@renesas.com>
> Cc: Michal Simek <monstr@monstr.eu>
> Cc: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
> Cc: Tom Rini <trini@konsulko.com>
> Cc: Wolfgang Denk <wd@denx.de>
> ---
> V2: Reword code comment
> ---
>  include/lmb.h |  1 +
>  lib/lmb.c     | 35 +++++++++++++++++++++++++++++++++++
>  2 files changed, 36 insertions(+)
> 
> diff --git a/include/lmb.h b/include/lmb.h
> index 3c4afdf9f0..1984291132 100644
> --- a/include/lmb.h
> +++ b/include/lmb.h
> @@ -122,6 +122,7 @@ lmb_size_bytes(struct lmb_region *type, unsigned
> long region_nr)
>  
>  void board_lmb_reserve(struct lmb *lmb);
>  void arch_lmb_reserve(struct lmb *lmb);
> +void arch_lmb_reserve_generic(struct lmb *lmb, ulong sp, ulong end,
> ulong align);
>  
>  /* Low level functions */
>  
> diff --git a/lib/lmb.c b/lib/lmb.c
> index 7bd1255f7a..793647724c 100644
> --- a/lib/lmb.c
> +++ b/lib/lmb.c
> @@ -12,6 +12,10 @@
>  #include <log.h>
>  #include <malloc.h>
>  
> +#include <asm/global_data.h>
> +
> +DECLARE_GLOBAL_DATA_PTR;
> +
>  #define LMB_ALLOC_ANYWHERE	0
>  
>  static void lmb_dump_region(struct lmb_region *rgn, char *name)
> @@ -113,6 +117,37 @@ void lmb_init(struct lmb *lmb)
>  	lmb->reserved.cnt = 0;
>  }
>  
> +void arch_lmb_reserve_generic(struct lmb *lmb, ulong sp, ulong end,
> ulong align)
> +{
> +	ulong bank_end;
> +	int bank;
> +
> +	/*
> +	 * Reserve memory from aligned address below the bottom of U-
> Boot stack
> +	 * until end of U-Boot area using LMB to prevent U-Boot from
> overwriting
> +	 * that memory.
> +	 */
> +	debug("## Current stack ends at 0x%08lx ", sp);
> +
> +	/* adjust sp by 4K to be safe */

nit: comment doesn't fit anymore

> +	sp -= align;
> +	for (bank = 0; bank < CONFIG_NR_DRAM_BANKS; bank++) {
> +		if (!gd->bd->bi_dram[bank].size ||
> +		    sp < gd->bd->bi_dram[bank].start)
> +			continue;
> +		/* Watch out for RAM at end of address space! */
> +		bank_end = gd->bd->bi_dram[bank].start +
> +			gd->bd->bi_dram[bank].size - 1;
> +		if (sp > bank_end)
> +			continue;
> +		if (bank_end > end)
> +			bank_end = end - 1;

isn't that all already taken care of when initializing gd->ram_top as
well as gd->relocaddr and gd->start_addr_sp (based on gd->ram_top)? So
gd->ram_top is already guaranteed to be less or equal some DRAM bank
end address. AFAIK arch_lmb_reserve() should just protect the U-Boot
area from gd->start_addr_sp up to gd->ram_top as well as the stack area
from the current stack pointer up to the initial stack pointer in gd-
>start_addr_sp. Also you changed all callers to always pass gd->ram_top 
in "ulong end". Thus I think arch_lmb_reserve_generic() could omit
those redundant checks and could be simplified to:

    sp -= align;
    lmb_reserve(lmb, sp, gd->ram_top - sp);

Or am I overlooking something? Is that a valid use case to have U-Boot
area and stack area in different memory banks? If yes, shouldn't then
lmb_reserve() be called twice by arch_lmb_reserve() to protect stack
area AND U-Boot area?

> +
> +		lmb_reserve(lmb, sp, bank_end - sp + 1);
> +		break;
> +	}
> +}
> +
>  static void lmb_reserve_common(struct lmb *lmb, void *fdt_blob)
>  {
>  	arch_lmb_reserve(lmb);
-- 
- Daniel


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

* Re: [PATCH 03/12] lmb: Add generic arch_lmb_reserve_generic()
  2021-09-12 19:27   ` Daniel Schwierzeck
@ 2021-09-13  2:08     ` Marek Vasut
  0 siblings, 0 replies; 28+ messages in thread
From: Marek Vasut @ 2021-09-13  2:08 UTC (permalink / raw)
  To: Daniel Schwierzeck, u-boot
  Cc: Alexey Brodkin, Angelo Dureghello, Eugeniy Paltsev, Hai Pham,
	Michal Simek, Simon Goldschmidt, Tom Rini, Wolfgang Denk

On 9/12/21 9:27 PM, Daniel Schwierzeck wrote:

[...]

>> diff --git a/lib/lmb.c b/lib/lmb.c
>> index 7bd1255f7a..793647724c 100644
>> --- a/lib/lmb.c
>> +++ b/lib/lmb.c
>> @@ -12,6 +12,10 @@
>>   #include <log.h>
>>   #include <malloc.h>
>>   
>> +#include <asm/global_data.h>
>> +
>> +DECLARE_GLOBAL_DATA_PTR;
>> +
>>   #define LMB_ALLOC_ANYWHERE	0
>>   
>>   static void lmb_dump_region(struct lmb_region *rgn, char *name)
>> @@ -113,6 +117,37 @@ void lmb_init(struct lmb *lmb)
>>   	lmb->reserved.cnt = 0;
>>   }
>>   
>> +void arch_lmb_reserve_generic(struct lmb *lmb, ulong sp, ulong end,
>> ulong align)
>> +{
>> +	ulong bank_end;
>> +	int bank;
>> +
>> +	/*
>> +	 * Reserve memory from aligned address below the bottom of U-
>> Boot stack
>> +	 * until end of U-Boot area using LMB to prevent U-Boot from
>> overwriting
>> +	 * that memory.
>> +	 */
>> +	debug("## Current stack ends at 0x%08lx ", sp);
>> +
>> +	/* adjust sp by 4K to be safe */
> 
> nit: comment doesn't fit anymore
> 
>> +	sp -= align;
>> +	for (bank = 0; bank < CONFIG_NR_DRAM_BANKS; bank++) {
>> +		if (!gd->bd->bi_dram[bank].size ||
>> +		    sp < gd->bd->bi_dram[bank].start)
>> +			continue;
>> +		/* Watch out for RAM at end of address space! */
>> +		bank_end = gd->bd->bi_dram[bank].start +
>> +			gd->bd->bi_dram[bank].size - 1;
>> +		if (sp > bank_end)
>> +			continue;
>> +		if (bank_end > end)
>> +			bank_end = end - 1;
> 
> isn't that all already taken care of when initializing gd->ram_top as
> well as gd->relocaddr and gd->start_addr_sp (based on gd->ram_top)? So
> gd->ram_top is already guaranteed to be less or equal some DRAM bank
> end address. AFAIK arch_lmb_reserve() should just protect the U-Boot
> area from gd->start_addr_sp up to gd->ram_top as well as the stack area
> from the current stack pointer up to the initial stack pointer in gd-
>> start_addr_sp. Also you changed all callers to always pass gd->ram_top
> in "ulong end". Thus I think arch_lmb_reserve_generic() could omit
> those redundant checks and could be simplified to:
> 
>      sp -= align;
>      lmb_reserve(lmb, sp, gd->ram_top - sp);
> Or am I overlooking something? Is that a valid use case to have U-Boot
This would not allow reserving space at the end of DRAM bank for e.g. 
DSP firmware which just has to be at the end of DRAM bank. That's why 
there is this passing of gd->ram_top into this function and it's not 
part of the function, to prepare for this use case.

> area and stack area in different memory banks? If yes, shouldn't then
> lmb_reserve() be called twice by arch_lmb_reserve() to protect stack
> area AND U-Boot area?

The U-Boot stack is below relocated U-Boot, and there is other stuff 
between those two, so that's why this isn't called twice for stack and 
U-Boot.

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

* Re: [PATCH 01/12] lmb: Always compile arch_lmb_reserve() into U-Boot on arm
  2021-09-10 20:47 [PATCH 01/12] lmb: Always compile arch_lmb_reserve() into U-Boot on arm Marek Vasut
                   ` (10 preceding siblings ...)
  2021-09-10 20:47 ` [PATCH 12/12] lmb: x86: " Marek Vasut
@ 2021-09-24  2:41 ` Tom Rini
  11 siblings, 0 replies; 28+ messages in thread
From: Tom Rini @ 2021-09-24  2:41 UTC (permalink / raw)
  To: Marek Vasut; +Cc: u-boot, Marek Vasut, Simon Glass, Simon Goldschmidt

[-- Attachment #1: Type: text/plain, Size: 885 bytes --]

On Fri, Sep 10, 2021 at 10:47:07PM +0200, Marek Vasut wrote:

> The arch_lmb_reserve() is called by lib/lmb.c lmb_reserve_common() even
> if CMD_BOOT{I,M,Z} is not enabled. However, the arm32/arm64 variant of
> arch_lmb_reserve() is only compiled in if CMD_BOOT{I,M,Z} is enabled.
> 
> This currently does not trigger build error, because there is an empty
> weak implementation of arch_lmb_reserve(), however that is not the
> function that should be used on arm32/arm64.
> 
> Fix this by moving the arch_lmb_reserve() implementation into common
> code and always compile it in.
> 
> Reviewed-by: Tom Rini <trini@konsulko.com>
> Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
> Cc: Simon Glass <sjg@chromium.org>
> Cc: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
> Cc: Tom Rini <trini@konsulko.com>

Applied to u-boot/next, thanks!

-- 
Tom

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]

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

* Re: [PATCH 02/12] lmb: Always compile arch_lmb_reserve() into U-Boot on arc
  2021-09-10 20:47 ` [PATCH 02/12] lmb: Always compile arch_lmb_reserve() into U-Boot on arc Marek Vasut
@ 2021-09-24  2:41   ` Tom Rini
  0 siblings, 0 replies; 28+ messages in thread
From: Tom Rini @ 2021-09-24  2:41 UTC (permalink / raw)
  To: Marek Vasut; +Cc: u-boot, Marek Vasut, Simon Glass, Simon Goldschmidt

[-- Attachment #1: Type: text/plain, Size: 811 bytes --]

On Fri, Sep 10, 2021 at 10:47:08PM +0200, Marek Vasut wrote:

> The arch_lmb_reserve() is called by lib/lmb.c lmb_reserve_common() even
> if CMD_BOOTM is not enabled. However, the arc variant of arch_lmb_reserve()
> is only compiled in if CMD_BOOTM is enabled.
> 
> This currently does not trigger build error, because there is an empty
> weak implementation of arch_lmb_reserve(), however that is not the
> function that should be used on arc.
> 
> Fix this by moving the arch_lmb_reserve() implementation into common
> code and always compile it in.
> 
> Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
> Cc: Simon Glass <sjg@chromium.org>
> Cc: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
> Cc: Tom Rini <trini@konsulko.com>

Applied to u-boot/next, thanks!

-- 
Tom

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]

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

* Re: [PATCH 03/12] lmb: Add generic arch_lmb_reserve_generic()
  2021-09-10 20:47 ` [PATCH 03/12] lmb: Add generic arch_lmb_reserve_generic() Marek Vasut
  2021-09-10 21:10   ` Tom Rini
  2021-09-12 19:27   ` Daniel Schwierzeck
@ 2021-09-24  2:41   ` Tom Rini
  2 siblings, 0 replies; 28+ messages in thread
From: Tom Rini @ 2021-09-24  2:41 UTC (permalink / raw)
  To: Marek Vasut
  Cc: u-boot, Marek Vasut, Alexey Brodkin, Angelo Dureghello,
	Daniel Schwierzeck, Eugeniy Paltsev, Hai Pham, Michal Simek,
	Simon Goldschmidt, Wolfgang Denk

[-- Attachment #1: Type: text/plain, Size: 1203 bytes --]

On Fri, Sep 10, 2021 at 10:47:09PM +0200, Marek Vasut wrote:

> The arc/arm/m68k/microblaze/mips/ppc arch_lmb_reserve() implementations
> are all mostly the same, except for a couple of details. Implement a
> generic arch_lmb_reserve_generic() function which can be parametrized
> enough to cater for those differences between architectures. This can
> also be parametrized enough so it can handle cases where U-Boot is not
> relocated to the end of DRAM e.g. because there is some other reserved
> memory past U-Boot (e.g. unmovable firmware for coprocessor), it is not
> relocated at all, and other such use cases.
> 
> Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
> Cc: Alexey Brodkin <alexey.brodkin@synopsys.com>
> Cc: Angelo Dureghello <angelo@sysam.it>
> Cc: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
> Cc: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
> Cc: Hai Pham <hai.pham.ud@renesas.com>
> Cc: Michal Simek <monstr@monstr.eu>
> Cc: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
> Cc: Tom Rini <trini@konsulko.com>
> Cc: Wolfgang Denk <wd@denx.de>
> Reviewed-by: Tom Rini <trini@konsulko.com>

Applied to u-boot/next, thanks!

-- 
Tom

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]

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

* Re: [PATCH 04/12] lmb: Switch to generic arch_lmb_reserve_generic()
  2021-09-10 20:47 ` [PATCH 04/12] lmb: Switch to " Marek Vasut
@ 2021-09-24  2:41   ` Tom Rini
  0 siblings, 0 replies; 28+ messages in thread
From: Tom Rini @ 2021-09-24  2:41 UTC (permalink / raw)
  To: Marek Vasut
  Cc: u-boot, Marek Vasut, Alexey Brodkin, Angelo Dureghello,
	Daniel Schwierzeck, Eugeniy Paltsev, Hai Pham, Michal Simek,
	Simon Goldschmidt, Wolfgang Denk

[-- Attachment #1: Type: text/plain, Size: 736 bytes --]

On Fri, Sep 10, 2021 at 10:47:10PM +0200, Marek Vasut wrote:

> Switch arc/arm/m68k/microblaze/mips/ppc arch_lmb_reserve() to
> arch_lmb_reserve_generic().
> 
> Reviewed-by: Tom Rini <trini@konsulko.com>
> Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
> Cc: Alexey Brodkin <alexey.brodkin@synopsys.com>
> Cc: Angelo Dureghello <angelo@sysam.it>
> Cc: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
> Cc: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
> Cc: Hai Pham <hai.pham.ud@renesas.com>
> Cc: Michal Simek <monstr@monstr.eu>
> Cc: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
> Cc: Tom Rini <trini@konsulko.com>
> Cc: Wolfgang Denk <wd@denx.de>

Applied to u-boot/next, thanks!

-- 
Tom

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]

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

* Re: [PATCH 05/12] lmb: arm: Increase LMB alignment to 16k in arch_lmb_reserve_generic()
  2021-09-10 20:47 ` [PATCH 05/12] lmb: arm: Increase LMB alignment to 16k in arch_lmb_reserve_generic() Marek Vasut
  2021-09-10 21:10   ` Tom Rini
@ 2021-09-24  2:42   ` Tom Rini
  1 sibling, 0 replies; 28+ messages in thread
From: Tom Rini @ 2021-09-24  2:42 UTC (permalink / raw)
  To: Marek Vasut
  Cc: u-boot, Marek Vasut, Alexey Brodkin, Angelo Dureghello,
	Daniel Schwierzeck, Eugeniy Paltsev, Hai Pham, Michal Simek,
	Simon Goldschmidt, Wolfgang Denk, Ye Li

[-- Attachment #1: Type: text/plain, Size: 955 bytes --]

On Fri, Sep 10, 2021 at 10:47:11PM +0200, Marek Vasut wrote:

> According to input NXP, the 4k alignment is not always sufficient.
> Currently iMX works around this problem by implementing board specific
> LMB reservation, however it is likely this could also occur on other
> systems. Increase the LMB reservation alignment to 16k by default.
> 
> Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
> Cc: Alexey Brodkin <alexey.brodkin@synopsys.com>
> Cc: Angelo Dureghello <angelo@sysam.it>
> Cc: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
> Cc: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
> Cc: Hai Pham <hai.pham.ud@renesas.com>
> Cc: Michal Simek <monstr@monstr.eu>
> Cc: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
> Cc: Tom Rini <trini@konsulko.com>
> Cc: Wolfgang Denk <wd@denx.de>
> Cc: Ye Li <ye.li@nxp.com>
> Reviewed-by: Tom Rini <trini@konsulko.com>

Applied to u-boot/next, thanks!

-- 
Tom

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]

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

* Re: [PATCH 06/12] lmb: Remove imx board_lmb_reserve()
  2021-09-10 20:47 ` [PATCH 06/12] lmb: Remove imx board_lmb_reserve() Marek Vasut
@ 2021-09-24  2:42   ` Tom Rini
  0 siblings, 0 replies; 28+ messages in thread
From: Tom Rini @ 2021-09-24  2:42 UTC (permalink / raw)
  To: Marek Vasut
  Cc: u-boot, Marek Vasut, Alexey Brodkin, Angelo Dureghello,
	Daniel Schwierzeck, Eugeniy Paltsev, Hai Pham, Michal Simek,
	Simon Goldschmidt, Wolfgang Denk, Ye Li

[-- Attachment #1: Type: text/plain, Size: 989 bytes --]

On Fri, Sep 10, 2021 at 10:47:12PM +0200, Marek Vasut wrote:

> This function is clearly architecture specific code, not board specific
> code. The only difference from the previous arm arch_lmb_reserve() is the
> extra reservation of 16k of memory below the stack bottom, rather than
> the 4k. The common code now also uses 16k alignment. Remove this custom
> implementation, as it now behaves exactly as the common code.
> 
> Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
> Cc: Alexey Brodkin <alexey.brodkin@synopsys.com>
> Cc: Angelo Dureghello <angelo@sysam.it>
> Cc: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
> Cc: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
> Cc: Hai Pham <hai.pham.ud@renesas.com>
> Cc: Michal Simek <monstr@monstr.eu>
> Cc: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
> Cc: Tom Rini <trini@konsulko.com>
> Cc: Wolfgang Denk <wd@denx.de>
> Cc: Ye Li <ye.li@nxp.com>

Applied to u-boot/next, thanks!

-- 
Tom

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]

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

* Re: [PATCH 07/12] lmb: nios2: Add arch_lmb_reserve()
  2021-09-10 20:47 ` [PATCH 07/12] lmb: nios2: Add arch_lmb_reserve() Marek Vasut
@ 2021-09-24  2:42   ` Tom Rini
  0 siblings, 0 replies; 28+ messages in thread
From: Tom Rini @ 2021-09-24  2:42 UTC (permalink / raw)
  To: Marek Vasut; +Cc: u-boot, Marek Vasut, Simon Goldschmidt, Thomas Chou

[-- Attachment #1: Type: text/plain, Size: 489 bytes --]

On Fri, Sep 10, 2021 at 10:47:13PM +0200, Marek Vasut wrote:

> Add arch_lmb_reserve() implemented using arch_lmb_reserve_generic().
> It is rather likely this architecture also needs to cover U-Boot with
> LMB before booting Linux.
> 
> Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
> Cc: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
> Cc: Thomas Chou <thomas@wytron.com.tw>
> Cc: Tom Rini <trini@konsulko.com>

Applied to u-boot/next, thanks!

-- 
Tom

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]

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

* Re: [PATCH 08/12] lmb: nds32: Add arch_lmb_reserve()
  2021-09-10 20:47 ` [PATCH 08/12] lmb: nds32: " Marek Vasut
@ 2021-09-24  2:42   ` Tom Rini
  0 siblings, 0 replies; 28+ messages in thread
From: Tom Rini @ 2021-09-24  2:42 UTC (permalink / raw)
  To: Marek Vasut; +Cc: u-boot, Marek Vasut, Rick Chen, Simon Goldschmidt

[-- Attachment #1: Type: text/plain, Size: 532 bytes --]

On Fri, Sep 10, 2021 at 10:47:14PM +0200, Marek Vasut wrote:

> Add arch_lmb_reserve() implemented using arch_lmb_reserve_generic().
> It is rather likely this architecture also needs to cover U-Boot with
> LMB before booting Linux.
> 
> Reviewed-by: Rick Chen <rick@andestech.com>
> Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
> Cc: Rick Chen <rick@andestech.com>
> Cc: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
> Cc: Tom Rini <trini@konsulko.com>

Applied to u-boot/next, thanks!

-- 
Tom

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]

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

* Re: [PATCH 09/12] lmb: riscv: Add arch_lmb_reserve()
  2021-09-10 20:47 ` [PATCH 09/12] lmb: riscv: " Marek Vasut
@ 2021-09-24  2:42   ` Tom Rini
  0 siblings, 0 replies; 28+ messages in thread
From: Tom Rini @ 2021-09-24  2:42 UTC (permalink / raw)
  To: Marek Vasut
  Cc: u-boot, Marek Vasut, Rick Chen, Atish Patra, Leo, Simon Goldschmidt

[-- Attachment #1: Type: text/plain, Size: 608 bytes --]

On Fri, Sep 10, 2021 at 10:47:15PM +0200, Marek Vasut wrote:

> Add arch_lmb_reserve() implemented using arch_lmb_reserve_generic().
> It is rather likely this architecture also needs to cover U-Boot with
> LMB before booting Linux.
> 
> Reviewed-by: Rick Chen <rick@andestech.com>
> Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
> Cc: Atish Patra <atish.patra@wdc.com>
> Cc: Leo <ycliang@andestech.com>
> Cc: Rick Chen <rick@andestech.com>
> Cc: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
> Cc: Tom Rini <trini@konsulko.com>

Applied to u-boot/next, thanks!

-- 
Tom

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]

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

* Re: [PATCH 10/12] lmb: sh: Add arch_lmb_reserve()
  2021-09-10 20:47 ` [PATCH 10/12] lmb: sh: " Marek Vasut
@ 2021-09-24  2:42   ` Tom Rini
  0 siblings, 0 replies; 28+ messages in thread
From: Tom Rini @ 2021-09-24  2:42 UTC (permalink / raw)
  To: Marek Vasut; +Cc: u-boot, Marek Vasut, Simon Goldschmidt

[-- Attachment #1: Type: text/plain, Size: 427 bytes --]

On Fri, Sep 10, 2021 at 10:47:16PM +0200, Marek Vasut wrote:

> Add arch_lmb_reserve() implemented using arch_lmb_reserve_generic().
> This architecture also needs to cover U-Boot with LMB before booting
> Linux.
> 
> Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
> Cc: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
> Cc: Tom Rini <trini@konsulko.com>

Applied to u-boot/next, thanks!

-- 
Tom

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]

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

* Re: [PATCH 11/12] lmb: xtensa: Add arch_lmb_reserve()
  2021-09-10 20:47 ` [PATCH 11/12] lmb: xtensa: " Marek Vasut
@ 2021-09-24  2:42   ` Tom Rini
  0 siblings, 0 replies; 28+ messages in thread
From: Tom Rini @ 2021-09-24  2:42 UTC (permalink / raw)
  To: Marek Vasut; +Cc: u-boot, Marek Vasut, Chris Zankel, Simon Goldschmidt

[-- Attachment #1: Type: text/plain, Size: 486 bytes --]

On Fri, Sep 10, 2021 at 10:47:17PM +0200, Marek Vasut wrote:

> Add arch_lmb_reserve() implemented using arch_lmb_reserve_generic().
> It is rather likely this architecture also needs to cover U-Boot with
> LMB before booting Linux.
> 
> Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
> Cc: Chris Zankel <chris@zankel.net>
> Cc: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
> Cc: Tom Rini <trini@konsulko.com>

Applied to u-boot/next, thanks!

-- 
Tom

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]

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

* Re: [PATCH 12/12] lmb: x86: Add arch_lmb_reserve()
  2021-09-10 20:47 ` [PATCH 12/12] lmb: x86: " Marek Vasut
@ 2021-09-24  2:42   ` Tom Rini
  0 siblings, 0 replies; 28+ messages in thread
From: Tom Rini @ 2021-09-24  2:42 UTC (permalink / raw)
  To: Marek Vasut; +Cc: u-boot, Marek Vasut, Simon Glass, Simon Goldschmidt

[-- Attachment #1: Type: text/plain, Size: 485 bytes --]

On Fri, Sep 10, 2021 at 10:47:18PM +0200, Marek Vasut wrote:

> Add arch_lmb_reserve() implemented using arch_lmb_reserve_generic().
> It is rather likely this architecture also needs to cover U-Boot with
> LMB before booting Linux.
> 
> Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
> Cc: Simon Glass <sjg@chromium.org>
> Cc: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
> Cc: Tom Rini <trini@konsulko.com>

Applied to u-boot/next, thanks!

-- 
Tom

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]

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

end of thread, other threads:[~2021-09-24  2:45 UTC | newest]

Thread overview: 28+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-10 20:47 [PATCH 01/12] lmb: Always compile arch_lmb_reserve() into U-Boot on arm Marek Vasut
2021-09-10 20:47 ` [PATCH 02/12] lmb: Always compile arch_lmb_reserve() into U-Boot on arc Marek Vasut
2021-09-24  2:41   ` Tom Rini
2021-09-10 20:47 ` [PATCH 03/12] lmb: Add generic arch_lmb_reserve_generic() Marek Vasut
2021-09-10 21:10   ` Tom Rini
2021-09-12 19:27   ` Daniel Schwierzeck
2021-09-13  2:08     ` Marek Vasut
2021-09-24  2:41   ` Tom Rini
2021-09-10 20:47 ` [PATCH 04/12] lmb: Switch to " Marek Vasut
2021-09-24  2:41   ` Tom Rini
2021-09-10 20:47 ` [PATCH 05/12] lmb: arm: Increase LMB alignment to 16k in arch_lmb_reserve_generic() Marek Vasut
2021-09-10 21:10   ` Tom Rini
2021-09-24  2:42   ` Tom Rini
2021-09-10 20:47 ` [PATCH 06/12] lmb: Remove imx board_lmb_reserve() Marek Vasut
2021-09-24  2:42   ` Tom Rini
2021-09-10 20:47 ` [PATCH 07/12] lmb: nios2: Add arch_lmb_reserve() Marek Vasut
2021-09-24  2:42   ` Tom Rini
2021-09-10 20:47 ` [PATCH 08/12] lmb: nds32: " Marek Vasut
2021-09-24  2:42   ` Tom Rini
2021-09-10 20:47 ` [PATCH 09/12] lmb: riscv: " Marek Vasut
2021-09-24  2:42   ` Tom Rini
2021-09-10 20:47 ` [PATCH 10/12] lmb: sh: " Marek Vasut
2021-09-24  2:42   ` Tom Rini
2021-09-10 20:47 ` [PATCH 11/12] lmb: xtensa: " Marek Vasut
2021-09-24  2:42   ` Tom Rini
2021-09-10 20:47 ` [PATCH 12/12] lmb: x86: " Marek Vasut
2021-09-24  2:42   ` Tom Rini
2021-09-24  2:41 ` [PATCH 01/12] lmb: Always compile arch_lmb_reserve() into U-Boot on arm Tom Rini

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).