mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH 0/2] mvebu: make more RAM available from malloc
@ 2017-02-10 15:50 Uwe Kleine-König
  2017-02-10 15:50 ` [PATCH 1/2] mvebu: make boards pass initial memory size Uwe Kleine-König
  2017-02-10 15:51 ` [PATCH 2/2] netgear-rn2120: use complete memory from the start Uwe Kleine-König
  0 siblings, 2 replies; 4+ messages in thread
From: Uwe Kleine-König @ 2017-02-10 15:50 UTC (permalink / raw)
  To: barebox

Hello,

I have a board here that needs more than the currently available malloc
space.  The size of the malloc space depends on memory size. On mvebu
there is an initial assumption of 64 MiB RAM that is later corrected.
When the malloc memory is set aside (half of the available RAM) the
number isn't corrected yet.

So this patch set makes it necessary to let the board define the
available amount of RAM. As before just saying 64 MiB works fine. And if
a board wants more malloc space, it can specify the actual size.

The first patch the initial memory size is just pushed to the board
files with no change in functionality. The second patch changes a board
to the really available RAM.

Uwe Kleine-König (2):
  mvebu: make boards pass initial memory size
  netgear-rn2120: use complete memory from the start

 arch/arm/boards/globalscale-guruplug/lowlevel.c    |  2 +-
 arch/arm/boards/globalscale-mirabox/lowlevel.c     |  2 +-
 arch/arm/boards/lenovo-ix4-300d/lowlevel.c         |  2 +-
 arch/arm/boards/marvell-armada-xp-gp/lowlevel.c    |  2 +-
 arch/arm/boards/netgear-rn104/lowlevel.c           |  2 +-
 arch/arm/boards/netgear-rn2120/lowlevel.c          |  2 +-
 arch/arm/boards/plathome-openblocks-a6/lowlevel.c  |  2 +-
 arch/arm/boards/plathome-openblocks-ax3/lowlevel.c |  2 +-
 arch/arm/boards/solidrun-cubox/lowlevel.c          |  2 +-
 arch/arm/boards/usi-topkick/lowlevel.c             |  2 +-
 arch/arm/mach-mvebu/include/mach/lowlevel.h        |  2 +-
 arch/arm/mach-mvebu/lowlevel.c                     | 15 +++++++--------
 12 files changed, 18 insertions(+), 19 deletions(-)

-- 
2.11.0


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* [PATCH 1/2] mvebu: make boards pass initial memory size
  2017-02-10 15:50 [PATCH 0/2] mvebu: make more RAM available from malloc Uwe Kleine-König
@ 2017-02-10 15:50 ` Uwe Kleine-König
  2017-02-13  8:06   ` Sascha Hauer
  2017-02-10 15:51 ` [PATCH 2/2] netgear-rn2120: use complete memory from the start Uwe Kleine-König
  1 sibling, 1 reply; 4+ messages in thread
From: Uwe Kleine-König @ 2017-02-10 15:50 UTC (permalink / raw)
  To: barebox

While assuming SZ_64M initially is save and fixed up later, the size of the
malloc area is determined from this value. So it might make sense for some
boards to pass the correct version from the start to have more RAM available
for example to write big images into an FPGA.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 arch/arm/boards/globalscale-guruplug/lowlevel.c    |  2 +-
 arch/arm/boards/globalscale-mirabox/lowlevel.c     |  2 +-
 arch/arm/boards/lenovo-ix4-300d/lowlevel.c         |  2 +-
 arch/arm/boards/marvell-armada-xp-gp/lowlevel.c    |  2 +-
 arch/arm/boards/netgear-rn104/lowlevel.c           |  2 +-
 arch/arm/boards/netgear-rn2120/lowlevel.c          |  2 +-
 arch/arm/boards/plathome-openblocks-a6/lowlevel.c  |  2 +-
 arch/arm/boards/plathome-openblocks-ax3/lowlevel.c |  2 +-
 arch/arm/boards/solidrun-cubox/lowlevel.c          |  2 +-
 arch/arm/boards/usi-topkick/lowlevel.c             |  2 +-
 arch/arm/mach-mvebu/include/mach/lowlevel.h        |  2 +-
 arch/arm/mach-mvebu/lowlevel.c                     | 15 +++++++--------
 12 files changed, 18 insertions(+), 19 deletions(-)

diff --git a/arch/arm/boards/globalscale-guruplug/lowlevel.c b/arch/arm/boards/globalscale-guruplug/lowlevel.c
index 91bc1cf5655e..8ec381710025 100644
--- a/arch/arm/boards/globalscale-guruplug/lowlevel.c
+++ b/arch/arm/boards/globalscale-guruplug/lowlevel.c
@@ -31,5 +31,5 @@ ENTRY_FUNCTION(start_globalscale_guruplug, r0, r1, r2)
 	fdt = __dtb_kirkwood_guruplug_server_plus_bb_start -
 		get_runtime_offset();
 
-	mvebu_barebox_entry(fdt);
+	mvebu_barebox_entry(fdt, SZ_64M);
 }
diff --git a/arch/arm/boards/globalscale-mirabox/lowlevel.c b/arch/arm/boards/globalscale-mirabox/lowlevel.c
index 4f55d1acb9d3..1915671db727 100644
--- a/arch/arm/boards/globalscale-mirabox/lowlevel.c
+++ b/arch/arm/boards/globalscale-mirabox/lowlevel.c
@@ -31,5 +31,5 @@ ENTRY_FUNCTION(start_globalscale_mirabox, r0, r1, r2)
 	fdt = __dtb_armada_370_mirabox_bb_start -
 		get_runtime_offset();
 
-	mvebu_barebox_entry(fdt);
+	mvebu_barebox_entry(fdt, SZ_64M);
 }
diff --git a/arch/arm/boards/lenovo-ix4-300d/lowlevel.c b/arch/arm/boards/lenovo-ix4-300d/lowlevel.c
index 8cb8bd40791c..1c346fc1cff5 100644
--- a/arch/arm/boards/lenovo-ix4-300d/lowlevel.c
+++ b/arch/arm/boards/lenovo-ix4-300d/lowlevel.c
@@ -31,5 +31,5 @@ ENTRY_FUNCTION(start_lenovo_ix4_300d, r0, r1, r2)
 	fdt = __dtb_armada_xp_lenovo_ix4_300d_bb_start -
 		get_runtime_offset();
 
-	mvebu_barebox_entry(fdt);
+	mvebu_barebox_entry(fdt, SZ_64M);
 }
diff --git a/arch/arm/boards/marvell-armada-xp-gp/lowlevel.c b/arch/arm/boards/marvell-armada-xp-gp/lowlevel.c
index 59eaa29a5028..428f41429478 100644
--- a/arch/arm/boards/marvell-armada-xp-gp/lowlevel.c
+++ b/arch/arm/boards/marvell-armada-xp-gp/lowlevel.c
@@ -30,5 +30,5 @@ ENTRY_FUNCTION(start_marvell_armada_xp_gp, r0, r1, r2)
 
 	fdt = __dtb_armada_xp_gp_bb_start - get_runtime_offset();
 
-	mvebu_barebox_entry(fdt);
+	mvebu_barebox_entry(fdt, SZ_64M);
 }
diff --git a/arch/arm/boards/netgear-rn104/lowlevel.c b/arch/arm/boards/netgear-rn104/lowlevel.c
index f0d6df0da645..bdb860f3d2dc 100644
--- a/arch/arm/boards/netgear-rn104/lowlevel.c
+++ b/arch/arm/boards/netgear-rn104/lowlevel.c
@@ -18,5 +18,5 @@ ENTRY_FUNCTION(start_netgear_rn104, r0, r1, r2)
 	fdt = __dtb_armada_370_rn104_bb_start -
 		get_runtime_offset();
 
-	mvebu_barebox_entry(fdt);
+	mvebu_barebox_entry(fdt, SZ_64M);
 }
diff --git a/arch/arm/boards/netgear-rn2120/lowlevel.c b/arch/arm/boards/netgear-rn2120/lowlevel.c
index 29c8b43c4467..6df5235a2229 100644
--- a/arch/arm/boards/netgear-rn2120/lowlevel.c
+++ b/arch/arm/boards/netgear-rn2120/lowlevel.c
@@ -37,5 +37,5 @@ ENTRY_FUNCTION(start_netgear_rn2120, r0, r1, r2)
 	fdt = __dtb_armada_xp_rn2120_bb_start -
 		get_runtime_offset();
 
-	mvebu_barebox_entry(fdt);
+	mvebu_barebox_entry(fdt, SZ_64M);
 }
diff --git a/arch/arm/boards/plathome-openblocks-a6/lowlevel.c b/arch/arm/boards/plathome-openblocks-a6/lowlevel.c
index 71bf7aa2ee7c..fa62136705a5 100644
--- a/arch/arm/boards/plathome-openblocks-a6/lowlevel.c
+++ b/arch/arm/boards/plathome-openblocks-a6/lowlevel.c
@@ -28,5 +28,5 @@ ENTRY_FUNCTION(start_plathome_openblocks_a6, r0, r1, r2)
 	fdt = __dtb_kirkwood_openblocks_a6_bb_start -
 		get_runtime_offset();
 
-	mvebu_barebox_entry(fdt);
+	mvebu_barebox_entry(fdt, SZ_64M);
 }
diff --git a/arch/arm/boards/plathome-openblocks-ax3/lowlevel.c b/arch/arm/boards/plathome-openblocks-ax3/lowlevel.c
index 9030a5d0c8cb..c47c2cf1e5bb 100644
--- a/arch/arm/boards/plathome-openblocks-ax3/lowlevel.c
+++ b/arch/arm/boards/plathome-openblocks-ax3/lowlevel.c
@@ -31,5 +31,5 @@ ENTRY_FUNCTION(start_plathome_openblocks_ax3, r0, r1, r2)
 	fdt = __dtb_armada_xp_openblocks_ax3_4_bb_start -
 		get_runtime_offset();
 
-	mvebu_barebox_entry(fdt);
+	mvebu_barebox_entry(fdt, SZ_64M);
 }
diff --git a/arch/arm/boards/solidrun-cubox/lowlevel.c b/arch/arm/boards/solidrun-cubox/lowlevel.c
index 08e31e83507d..6130c64893ca 100644
--- a/arch/arm/boards/solidrun-cubox/lowlevel.c
+++ b/arch/arm/boards/solidrun-cubox/lowlevel.c
@@ -31,5 +31,5 @@ ENTRY_FUNCTION(start_solidrun_cubox, r0, r1, r2)
 
 	fdt = __dtb_dove_cubox_bb_start - get_runtime_offset();
 
-	mvebu_barebox_entry(fdt);
+	mvebu_barebox_entry(fdt, SZ_64M);
 }
diff --git a/arch/arm/boards/usi-topkick/lowlevel.c b/arch/arm/boards/usi-topkick/lowlevel.c
index ed94ee673679..6d6692b79818 100644
--- a/arch/arm/boards/usi-topkick/lowlevel.c
+++ b/arch/arm/boards/usi-topkick/lowlevel.c
@@ -30,5 +30,5 @@ ENTRY_FUNCTION(start_usi_topkick, r0, r1, r2)
 
 	fdt = __dtb_kirkwood_topkick_bb_start - get_runtime_offset();
 
-	mvebu_barebox_entry(fdt);
+	mvebu_barebox_entry(fdt, SZ_64M);
 }
diff --git a/arch/arm/mach-mvebu/include/mach/lowlevel.h b/arch/arm/mach-mvebu/include/mach/lowlevel.h
index c922a27a7c62..572ad4c688f8 100644
--- a/arch/arm/mach-mvebu/include/mach/lowlevel.h
+++ b/arch/arm/mach-mvebu/include/mach/lowlevel.h
@@ -18,6 +18,6 @@
 #ifndef __MACH_LOWLEVEL_H__
 #define __MACH_LOWLEVEL_H__
 
-void mvebu_barebox_entry(void *boarddata);
+void mvebu_barebox_entry(void *boarddata, unsigned long memsize);
 
 #endif
diff --git a/arch/arm/mach-mvebu/lowlevel.c b/arch/arm/mach-mvebu/lowlevel.c
index 8d0ac8453ea3..e4c2131076ba 100644
--- a/arch/arm/mach-mvebu/lowlevel.c
+++ b/arch/arm/mach-mvebu/lowlevel.c
@@ -26,7 +26,7 @@
 void __naked barebox_arm_reset_vector(void)
 {
 	arm_cpu_lowlevel_init();
-	mvebu_barebox_entry(NULL);
+	mvebu_barebox_entry(NULL, SZ_64M);
 }
 
 /*
@@ -50,16 +50,15 @@ static void mvebu_remap_registers(void)
 
 /*
  * Determining the actual memory size is highly SoC dependent,
- * but for all SoCs RAM starts at 0x00000000. Therefore, we start
- * with a minimal memory setup of 64M and probe correct memory size
- * later.
+ * but for all SoCs RAM starts at 0x00000000. If the available RAM isn't known
+ * at the call-site of mvebu_barebox_entry, using a value that is not too big is
+ * safe. The correct memory size will be probed later.
  */
 #define MVEBU_BOOTUP_MEMORY_BASE	0x00000000
-#define MVEBU_BOOTUP_MEMORY_SIZE	SZ_64M
 
-void __naked __noreturn mvebu_barebox_entry(void *boarddata)
+void __naked __noreturn mvebu_barebox_entry(void *boarddata,
+					    unsigned long memsize)
 {
 	mvebu_remap_registers();
-	barebox_arm_entry(MVEBU_BOOTUP_MEMORY_BASE,
-			  MVEBU_BOOTUP_MEMORY_SIZE, boarddata);
+	barebox_arm_entry(MVEBU_BOOTUP_MEMORY_BASE, memsize, boarddata);
 }
-- 
2.11.0


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* [PATCH 2/2] netgear-rn2120: use complete memory from the start
  2017-02-10 15:50 [PATCH 0/2] mvebu: make more RAM available from malloc Uwe Kleine-König
  2017-02-10 15:50 ` [PATCH 1/2] mvebu: make boards pass initial memory size Uwe Kleine-König
@ 2017-02-10 15:51 ` Uwe Kleine-König
  1 sibling, 0 replies; 4+ messages in thread
From: Uwe Kleine-König @ 2017-02-10 15:51 UTC (permalink / raw)
  To: barebox

This changes

	malloc space: 0x01f7dce0 -> 0x03efb9bf (size 31.5 MiB)

to

	malloc space: 0x0ff7dce0 -> 0x1fefb9bf (size 255.5 MiB)

.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 arch/arm/boards/netgear-rn2120/lowlevel.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/boards/netgear-rn2120/lowlevel.c b/arch/arm/boards/netgear-rn2120/lowlevel.c
index 6df5235a2229..a05618be0bca 100644
--- a/arch/arm/boards/netgear-rn2120/lowlevel.c
+++ b/arch/arm/boards/netgear-rn2120/lowlevel.c
@@ -37,5 +37,5 @@ ENTRY_FUNCTION(start_netgear_rn2120, r0, r1, r2)
 	fdt = __dtb_armada_xp_rn2120_bb_start -
 		get_runtime_offset();
 
-	mvebu_barebox_entry(fdt, SZ_64M);
+	mvebu_barebox_entry(fdt, SZ_512M);
 }
-- 
2.11.0


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* Re: [PATCH 1/2] mvebu: make boards pass initial memory size
  2017-02-10 15:50 ` [PATCH 1/2] mvebu: make boards pass initial memory size Uwe Kleine-König
@ 2017-02-13  8:06   ` Sascha Hauer
  0 siblings, 0 replies; 4+ messages in thread
From: Sascha Hauer @ 2017-02-13  8:06 UTC (permalink / raw)
  To: Uwe Kleine-König; +Cc: barebox

Hi Uwe,

On Fri, Feb 10, 2017 at 04:50:59PM +0100, Uwe Kleine-König wrote:
> While assuming SZ_64M initially is save and fixed up later, the size of the
> malloc area is determined from this value. So it might make sense for some
> boards to pass the correct version from the start to have more RAM available
> for example to write big images into an FPGA.
> 
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> ---
>  arch/arm/boards/globalscale-guruplug/lowlevel.c    |  2 +-
>  arch/arm/boards/globalscale-mirabox/lowlevel.c     |  2 +-
>  arch/arm/boards/lenovo-ix4-300d/lowlevel.c         |  2 +-
>  arch/arm/boards/marvell-armada-xp-gp/lowlevel.c    |  2 +-
>  arch/arm/boards/netgear-rn104/lowlevel.c           |  2 +-
>  arch/arm/boards/netgear-rn2120/lowlevel.c          |  2 +-
>  arch/arm/boards/plathome-openblocks-a6/lowlevel.c  |  2 +-
>  arch/arm/boards/plathome-openblocks-ax3/lowlevel.c |  2 +-
>  arch/arm/boards/solidrun-cubox/lowlevel.c          |  2 +-
>  arch/arm/boards/usi-topkick/lowlevel.c             |  2 +-
>  arch/arm/mach-mvebu/include/mach/lowlevel.h        |  2 +-
>  arch/arm/mach-mvebu/lowlevel.c                     | 15 +++++++--------
>  12 files changed, 18 insertions(+), 19 deletions(-)
> 
>  /*
>   * Determining the actual memory size is highly SoC dependent,
> - * but for all SoCs RAM starts at 0x00000000. Therefore, we start
> - * with a minimal memory setup of 64M and probe correct memory size
> - * later.
> + * but for all SoCs RAM starts at 0x00000000. If the available RAM isn't known
> + * at the call-site of mvebu_barebox_entry, using a value that is not too big is
> + * safe. The correct memory size will be probed later.
>   */
>  #define MVEBU_BOOTUP_MEMORY_BASE	0x00000000
> -#define MVEBU_BOOTUP_MEMORY_SIZE	SZ_64M
>  
> -void __naked __noreturn mvebu_barebox_entry(void *boarddata)
> +void __naked __noreturn mvebu_barebox_entry(void *boarddata,
> +					    unsigned long memsize)
>  {
>  	mvebu_remap_registers();
> -	barebox_arm_entry(MVEBU_BOOTUP_MEMORY_BASE,
> -			  MVEBU_BOOTUP_MEMORY_SIZE, boarddata);
> +	barebox_arm_entry(MVEBU_BOOTUP_MEMORY_BASE, memsize, boarddata);
>  }

I would prefer if you could split mvebu_barebox_entry into
armada_370_xp_barebox_entry, dove_barebox_entry and
kirkwood_barebox_entry. Then you could call the SoC specific SDRAM
detection functions and call barebox with the correct amount of SDRAM
from the start.

Sascha

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

end of thread, other threads:[~2017-02-13  8:06 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-02-10 15:50 [PATCH 0/2] mvebu: make more RAM available from malloc Uwe Kleine-König
2017-02-10 15:50 ` [PATCH 1/2] mvebu: make boards pass initial memory size Uwe Kleine-König
2017-02-13  8:06   ` Sascha Hauer
2017-02-10 15:51 ` [PATCH 2/2] netgear-rn2120: use complete memory from the start Uwe Kleine-König

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox