All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/5] lmb: Add config for the number of memory and reserved regions
@ 2021-02-02 12:59 Patrick Delaunay
  2021-02-02 12:59 ` [PATCH 1/5] lmb: move CONFIG_LMB in Kconfig Patrick Delaunay
                   ` (5 more replies)
  0 siblings, 6 replies; 8+ messages in thread
From: Patrick Delaunay @ 2021-02-02 12:59 UTC (permalink / raw)
  To: u-boot


Hi,

I propose a update of the lmb library to allow the configuration
with Kconfig of the number of memory and reserved regions in lmb
libary:
- CONFIG_LMB_RESERVED_REGIONS
- CONFIG_LMB_MEMORY_REGIONS

By default, I keep the default value of 8 regions.

This serie avoids issue on stm32mp15 platform,
as the kernel device tree defines many and non contiguous reserved
regions.



Patrick Delaunay (5):
  lmb: move CONFIG_LMB in Kconfig
  lmb: remove lmb_region.size
  lmb: Move lmb property arrays in struct lmb
  lmb: Add 2 config to define the max number of regions
  configs: stm32mp15: increase the number of reserved memory region in
    lmb

 arch/arc/include/asm/config.h        |  2 --
 arch/arm/include/asm/config.h        |  1 -
 arch/m68k/include/asm/config.h       |  1 -
 arch/microblaze/include/asm/config.h |  2 --
 arch/mips/include/asm/config.h       |  1 -
 arch/nds32/include/asm/config.h      |  1 -
 arch/powerpc/include/asm/config.h    |  1 -
 arch/riscv/include/asm/config.h      |  1 -
 arch/sh/include/asm/config.h         |  2 --
 arch/x86/include/asm/config.h        |  1 -
 arch/xtensa/include/asm/config.h     |  2 --
 configs/stm32mp15_basic_defconfig    |  1 +
 configs/stm32mp15_trusted_defconfig  |  1 +
 include/configs/10m50_devboard.h     |  5 ----
 include/configs/3c120_devboard.h     |  5 ----
 include/configs/sandbox.h            |  2 --
 include/configs/x86-common.h         |  2 --
 include/image.h                      |  2 +-
 include/lmb.h                        | 34 ++++++++++++++++++++++++----
 lib/Kconfig                          | 23 +++++++++++++++++++
 lib/lmb.c                            | 14 ++++++------
 scripts/config_whitelist.txt         |  1 -
 22 files changed, 63 insertions(+), 42 deletions(-)

-- 
2.17.1

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

* [PATCH 1/5] lmb: move CONFIG_LMB in Kconfig
  2021-02-02 12:59 [PATCH 0/5] lmb: Add config for the number of memory and reserved regions Patrick Delaunay
@ 2021-02-02 12:59 ` Patrick Delaunay
  2021-02-02 12:59 ` [PATCH 2/5] lmb: remove lmb_region.size Patrick Delaunay
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 8+ messages in thread
From: Patrick Delaunay @ 2021-02-02 12:59 UTC (permalink / raw)
  To: u-boot

Migrate CONFIG_LMB in Kconfig.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
---

 arch/arc/include/asm/config.h        | 2 --
 arch/arm/include/asm/config.h        | 1 -
 arch/m68k/include/asm/config.h       | 1 -
 arch/microblaze/include/asm/config.h | 2 --
 arch/mips/include/asm/config.h       | 1 -
 arch/nds32/include/asm/config.h      | 1 -
 arch/powerpc/include/asm/config.h    | 1 -
 arch/riscv/include/asm/config.h      | 1 -
 arch/sh/include/asm/config.h         | 2 --
 arch/x86/include/asm/config.h        | 1 -
 arch/xtensa/include/asm/config.h     | 2 --
 include/configs/10m50_devboard.h     | 5 -----
 include/configs/3c120_devboard.h     | 5 -----
 include/configs/sandbox.h            | 2 --
 include/configs/x86-common.h         | 2 --
 include/image.h                      | 2 +-
 lib/Kconfig                          | 7 +++++++
 scripts/config_whitelist.txt         | 1 -
 18 files changed, 8 insertions(+), 31 deletions(-)

diff --git a/arch/arc/include/asm/config.h b/arch/arc/include/asm/config.h
index d88c361488..46e94be141 100644
--- a/arch/arc/include/asm/config.h
+++ b/arch/arc/include/asm/config.h
@@ -8,6 +8,4 @@
 
 #define CONFIG_SYS_BOOT_RAMDISK_HIGH
 
-#define CONFIG_LMB
-
 #endif /*__ASM_ARC_CONFIG_H_ */
diff --git a/arch/arm/include/asm/config.h b/arch/arm/include/asm/config.h
index bf692ce279..14860d89b6 100644
--- a/arch/arm/include/asm/config.h
+++ b/arch/arm/include/asm/config.h
@@ -6,7 +6,6 @@
 #ifndef _ASM_CONFIG_H_
 #define _ASM_CONFIG_H_
 
-#define CONFIG_LMB
 #define CONFIG_SYS_BOOT_RAMDISK_HIGH
 
 #if defined(CONFIG_ARCH_LS1021A) || \
diff --git a/arch/m68k/include/asm/config.h b/arch/m68k/include/asm/config.h
index 7ea443673a..221eb93d58 100644
--- a/arch/m68k/include/asm/config.h
+++ b/arch/m68k/include/asm/config.h
@@ -6,7 +6,6 @@
 #ifndef _ASM_CONFIG_H_
 #define _ASM_CONFIG_H_
 
-#define CONFIG_LMB
 #define CONFIG_SYS_BOOT_RAMDISK_HIGH
 
 #endif
diff --git a/arch/microblaze/include/asm/config.h b/arch/microblaze/include/asm/config.h
index 3ae71b3e01..221eb93d58 100644
--- a/arch/microblaze/include/asm/config.h
+++ b/arch/microblaze/include/asm/config.h
@@ -6,8 +6,6 @@
 #ifndef _ASM_CONFIG_H_
 #define _ASM_CONFIG_H_
 
-#define CONFIG_LMB
-
 #define CONFIG_SYS_BOOT_RAMDISK_HIGH
 
 #endif
diff --git a/arch/mips/include/asm/config.h b/arch/mips/include/asm/config.h
index 7ea443673a..221eb93d58 100644
--- a/arch/mips/include/asm/config.h
+++ b/arch/mips/include/asm/config.h
@@ -6,7 +6,6 @@
 #ifndef _ASM_CONFIG_H_
 #define _ASM_CONFIG_H_
 
-#define CONFIG_LMB
 #define CONFIG_SYS_BOOT_RAMDISK_HIGH
 
 #endif
diff --git a/arch/nds32/include/asm/config.h b/arch/nds32/include/asm/config.h
index 8964a58f27..6c1cbce7ef 100644
--- a/arch/nds32/include/asm/config.h
+++ b/arch/nds32/include/asm/config.h
@@ -7,6 +7,5 @@
 
 #ifndef _ASM_CONFIG_H_
 #define _ASM_CONFIG_H_
-#define CONFIG_LMB
 
 #endif
diff --git a/arch/powerpc/include/asm/config.h b/arch/powerpc/include/asm/config.h
index c9c9964630..99b410dc9b 100644
--- a/arch/powerpc/include/asm/config.h
+++ b/arch/powerpc/include/asm/config.h
@@ -18,7 +18,6 @@
   #define HWCONFIG_BUFFER_SIZE 256
 #endif
 
-#define CONFIG_LMB
 #define CONFIG_SYS_BOOT_RAMDISK_HIGH
 
 #ifndef CONFIG_MAX_MEM_MAPPED
diff --git a/arch/riscv/include/asm/config.h b/arch/riscv/include/asm/config.h
index 156cb94dc0..d911007537 100644
--- a/arch/riscv/include/asm/config.h
+++ b/arch/riscv/include/asm/config.h
@@ -7,7 +7,6 @@
 #ifndef _ASM_CONFIG_H_
 #define _ASM_CONFIG_H_
 
-#define CONFIG_LMB
 #define CONFIG_SYS_BOOT_RAMDISK_HIGH
 
 #endif
diff --git a/arch/sh/include/asm/config.h b/arch/sh/include/asm/config.h
index e1cd322152..406156dff5 100644
--- a/arch/sh/include/asm/config.h
+++ b/arch/sh/include/asm/config.h
@@ -8,8 +8,6 @@
 
 #include <asm/processor.h>
 
-#define CONFIG_LMB
-
 /* Timer */
 #define CONFIG_SYS_TIMER_COUNTS_DOWN
 #define CONFIG_SYS_TIMER_COUNTER	(TMU_BASE + 0xc)	/* TCNT0 */
diff --git a/arch/x86/include/asm/config.h b/arch/x86/include/asm/config.h
index 7ea443673a..221eb93d58 100644
--- a/arch/x86/include/asm/config.h
+++ b/arch/x86/include/asm/config.h
@@ -6,7 +6,6 @@
 #ifndef _ASM_CONFIG_H_
 #define _ASM_CONFIG_H_
 
-#define CONFIG_LMB
 #define CONFIG_SYS_BOOT_RAMDISK_HIGH
 
 #endif
diff --git a/arch/xtensa/include/asm/config.h b/arch/xtensa/include/asm/config.h
index 5a95fc93f7..a1096ab196 100644
--- a/arch/xtensa/include/asm/config.h
+++ b/arch/xtensa/include/asm/config.h
@@ -9,8 +9,6 @@
 
 #include <asm/arch/core.h>
 
-#define CONFIG_LMB
-
 /*
  * Make boot parameters available in the MMUv2 virtual memory layout by
  * restricting used physical memory to the first 128MB.
diff --git a/include/configs/10m50_devboard.h b/include/configs/10m50_devboard.h
index 768b4a6dfc..3ffc744928 100644
--- a/include/configs/10m50_devboard.h
+++ b/include/configs/10m50_devboard.h
@@ -34,11 +34,6 @@
  */
 #define CONFIG_BOOTP_BOOTFILESIZE
 
-/*
- * FDT options
- */
-#define CONFIG_LMB
-
 /*
  * MEMORY ORGANIZATION
  * -Monitor at top of sdram.
diff --git a/include/configs/3c120_devboard.h b/include/configs/3c120_devboard.h
index 30bbd716b2..3f065ff315 100644
--- a/include/configs/3c120_devboard.h
+++ b/include/configs/3c120_devboard.h
@@ -34,11 +34,6 @@
  */
 #define CONFIG_BOOTP_BOOTFILESIZE
 
-/*
- * FDT options
- */
-#define CONFIG_LMB
-
 /*
  * MEMORY ORGANIZATION
  * -Monitor at top of sdram.
diff --git a/include/configs/sandbox.h b/include/configs/sandbox.h
index e0708fe573..6abb78611a 100644
--- a/include/configs/sandbox.h
+++ b/include/configs/sandbox.h
@@ -22,8 +22,6 @@
 #define CONFIG_SYS_TIMER_RATE		1000000
 #endif
 
-#define CONFIG_LMB
-
 #define CONFIG_HOST_MAX_DEVICES 4
 
 /*
diff --git a/include/configs/x86-common.h b/include/configs/x86-common.h
index 641ed2c5ec..f186dd6b82 100644
--- a/include/configs/x86-common.h
+++ b/include/configs/x86-common.h
@@ -16,8 +16,6 @@
  */
 #define CONFIG_PHYSMEM
 
-#define CONFIG_LMB
-
 #define CONFIG_SYS_BOOTM_LEN		(16 << 20)
 
 /* SATA AHCI storage */
diff --git a/include/image.h b/include/image.h
index 856bc3e1b2..b15ab309c3 100644
--- a/include/image.h
+++ b/include/image.h
@@ -431,7 +431,7 @@ typedef struct bootm_headers {
 #define	BOOTM_STATE_OS_GO	(0x00000400)
 	int		state;
 
-#ifdef CONFIG_LMB
+#if defined(CONFIG_LMB) && !defined(USE_HOSTCC)
 	struct lmb	lmb;		/* for memory mgmt */
 #endif
 } bootm_headers_t;
diff --git a/lib/Kconfig b/lib/Kconfig
index b35a71ac36..43bd7190b9 100644
--- a/lib/Kconfig
+++ b/lib/Kconfig
@@ -699,6 +699,13 @@ config LIB_ELF
 	  Support basic elf loading/validating functions.
 	  This supports for 32 bit and 64 bit versions.
 
+config LMB
+	bool "Enable the logical memory blocks library (lmb)"
+	default y if ARC || ARM || M68K || MICROBLAZE || MIPS || NDS32 || \
+		     NIOS2 || PPC || RISCV || SANDBOX || SH || X86 || XTENSA
+	help
+	  Support the library logical memory blocks.
+
 endmenu
 
 config PHANDLE_CHECK_SEQ
diff --git a/scripts/config_whitelist.txt b/scripts/config_whitelist.txt
index c6a8312495..0b46256016 100644
--- a/scripts/config_whitelist.txt
+++ b/scripts/config_whitelist.txt
@@ -964,7 +964,6 @@ CONFIG_LEGACY_BOOTCMD_ENV
 CONFIG_LINUX
 CONFIG_LINUX_RESET_VEC
 CONFIG_LITTLETON_LCD
-CONFIG_LMB
 CONFIG_LMS283GF05
 CONFIG_LOADADDR
 CONFIG_LOADCMD
-- 
2.17.1

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

* [PATCH 2/5] lmb: remove lmb_region.size
  2021-02-02 12:59 [PATCH 0/5] lmb: Add config for the number of memory and reserved regions Patrick Delaunay
  2021-02-02 12:59 ` [PATCH 1/5] lmb: move CONFIG_LMB in Kconfig Patrick Delaunay
@ 2021-02-02 12:59 ` Patrick Delaunay
  2021-02-02 12:59 ` [PATCH 3/5] lmb: Move lmb property arrays in struct lmb Patrick Delaunay
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 8+ messages in thread
From: Patrick Delaunay @ 2021-02-02 12:59 UTC (permalink / raw)
  To: u-boot

Remove the unused field size of struct lmb_region as it is initialized to 0
and never used after in lmb library.

See Linux kernel commit 4734b594c6ca ("memblock: Remove memblock_type.size
and add memblock.memory_size instead")

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
---

 include/lmb.h | 1 -
 lib/lmb.c     | 6 ------
 2 files changed, 7 deletions(-)

diff --git a/include/lmb.h b/include/lmb.h
index e9f19b16ea..a3247544c1 100644
--- a/include/lmb.h
+++ b/include/lmb.h
@@ -21,7 +21,6 @@ struct lmb_property {
 
 struct lmb_region {
 	unsigned long cnt;
-	phys_size_t size;
 	struct lmb_property region[MAX_LMB_REGIONS+1];
 };
 
diff --git a/lib/lmb.c b/lib/lmb.c
index d126f8dc04..5cf419f439 100644
--- a/lib/lmb.c
+++ b/lib/lmb.c
@@ -20,8 +20,6 @@ void lmb_dump_all_force(struct lmb *lmb)
 
 	printf("lmb_dump_all:\n");
 	printf("    memory.cnt		   = 0x%lx\n", lmb->memory.cnt);
-	printf("    memory.size		   = 0x%llx\n",
-	       (unsigned long long)lmb->memory.size);
 	for (i = 0; i < lmb->memory.cnt; i++) {
 		printf("    memory.reg[0x%lx].base   = 0x%llx\n", i,
 		       (unsigned long long)lmb->memory.region[i].base);
@@ -30,8 +28,6 @@ void lmb_dump_all_force(struct lmb *lmb)
 	}
 
 	printf("\n    reserved.cnt	   = 0x%lx\n", lmb->reserved.cnt);
-	printf("    reserved.size	   = 0x%llx\n",
-	       (unsigned long long)lmb->reserved.size);
 	for (i = 0; i < lmb->reserved.cnt; i++) {
 		printf("    reserved.reg[0x%lx].base = 0x%llx\n", i,
 		       (unsigned long long)lmb->reserved.region[i].base);
@@ -100,9 +96,7 @@ static void lmb_coalesce_regions(struct lmb_region *rgn, unsigned long r1,
 void lmb_init(struct lmb *lmb)
 {
 	lmb->memory.cnt = 0;
-	lmb->memory.size = 0;
 	lmb->reserved.cnt = 0;
-	lmb->reserved.size = 0;
 }
 
 static void lmb_reserve_common(struct lmb *lmb, void *fdt_blob)
-- 
2.17.1

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

* [PATCH 3/5] lmb: Move lmb property arrays in struct lmb
  2021-02-02 12:59 [PATCH 0/5] lmb: Add config for the number of memory and reserved regions Patrick Delaunay
  2021-02-02 12:59 ` [PATCH 1/5] lmb: move CONFIG_LMB in Kconfig Patrick Delaunay
  2021-02-02 12:59 ` [PATCH 2/5] lmb: remove lmb_region.size Patrick Delaunay
@ 2021-02-02 12:59 ` Patrick Delaunay
  2021-02-02 12:59 ` [PATCH 4/5] lmb: Add 2 config to define the max number of regions Patrick Delaunay
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 8+ messages in thread
From: Patrick Delaunay @ 2021-02-02 12:59 UTC (permalink / raw)
  To: u-boot

Move lmb property arrays to struct lmb and manage the array size in
a the new element 'max' of struct lmb_region. This modification allows
to update its size independently in the next patch.

see Linux kernel commit bf23c51f1f49 ("memblock: Move memblock arrays
to static storage in memblock.c and make their size a variable")

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
---

 include/lmb.h | 31 ++++++++++++++++++++++++++++++-
 lib/lmb.c     |  8 +++++++-
 2 files changed, 37 insertions(+), 2 deletions(-)

diff --git a/include/lmb.h b/include/lmb.h
index a3247544c1..df543028d5 100644
--- a/include/lmb.h
+++ b/include/lmb.h
@@ -14,19 +14,48 @@
 
 #define MAX_LMB_REGIONS 8
 
+/**
+ * struct lmb_property - Description of one region.
+ *
+ * @base: Base address of the region.
+ * @size: Size of the region
+ */
 struct lmb_property {
 	phys_addr_t base;
 	phys_size_t size;
 };
 
+/**
+ * struct lmb_region - Description of a set of region.
+ *
+ * @cnt: Number of regions.
+ * @max: Size of the region array, max value of cnt.
+ * @region: Address of the region properties array
+ */
 struct lmb_region {
 	unsigned long cnt;
-	struct lmb_property region[MAX_LMB_REGIONS+1];
+	unsigned long max;
+	struct lmb_property *region;
 };
 
+/**
+ * struct lmb - Logical memory block handle.
+ *
+ * Clients provide storage for Logical memory block (lmb) handles.
+ * The content of the structure is managed by the lmb library.
+ * A lmb struct is  initialized by lmb_init() functions.
+ * The lmb struct is passed to all other lmb APIs.
+ *
+ * @memory: Description of memory regions.
+ * @reserved: Description of reserved regions.
+ * @memory_regions: Array of the memory regions (statically allocated)
+ * @reserved_regions: Array of the reserved regions (statically allocated)
+ */
 struct lmb {
 	struct lmb_region memory;
 	struct lmb_region reserved;
+	struct lmb_property memory_regions[MAX_LMB_REGIONS + 1];
+	struct lmb_property reserved_regions[MAX_LMB_REGIONS + 1];
 };
 
 extern void lmb_init(struct lmb *lmb);
diff --git a/lib/lmb.c b/lib/lmb.c
index 5cf419f439..c97be0a064 100644
--- a/lib/lmb.c
+++ b/lib/lmb.c
@@ -95,7 +95,13 @@ static void lmb_coalesce_regions(struct lmb_region *rgn, unsigned long r1,
 
 void lmb_init(struct lmb *lmb)
 {
+	/* Hookup the initial arrays */
+	lmb->memory.region = lmb->memory_regions;
+	lmb->memory.max = ARRAY_SIZE(lmb->memory_regions) - 1;
 	lmb->memory.cnt = 0;
+
+	lmb->reserved.region = lmb->reserved_regions;
+	lmb->reserved.max = ARRAY_SIZE(lmb->reserved_regions) - 1;
 	lmb->reserved.cnt = 0;
 }
 
@@ -179,7 +185,7 @@ static long lmb_add_region(struct lmb_region *rgn, phys_addr_t base, phys_size_t
 
 	if (coalesced)
 		return coalesced;
-	if (rgn->cnt >= MAX_LMB_REGIONS)
+	if (rgn->cnt >= rgn->max)
 		return -1;
 
 	/* Couldn't coalesce the LMB, so add it to the sorted table. */
-- 
2.17.1

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

* [PATCH 4/5] lmb: Add 2 config to define the max number of regions
  2021-02-02 12:59 [PATCH 0/5] lmb: Add config for the number of memory and reserved regions Patrick Delaunay
                   ` (2 preceding siblings ...)
  2021-02-02 12:59 ` [PATCH 3/5] lmb: Move lmb property arrays in struct lmb Patrick Delaunay
@ 2021-02-02 12:59 ` Patrick Delaunay
  2021-02-02 12:59 ` [PATCH 5/5] configs: stm32mp15: increase the number of reserved memory region in lmb Patrick Delaunay
  2021-03-02 20:50 ` [PATCH 0/5] lmb: Add config for the number of memory and reserved regions Tom Rini
  5 siblings, 0 replies; 8+ messages in thread
From: Patrick Delaunay @ 2021-02-02 12:59 UTC (permalink / raw)
  To: u-boot

Add 2 configs CONFIG_LMB_MEMORY_REGIONS and CONFIG_LMB_RESERVED_REGIONS
to change independently the max number of the regions in lmb
library.

Increase CONFIG_LMB_RESERVED_REGIONS is useful to avoid lmb errors in
bootm when the number of reserved regions (not adjacent) is reached:
+ 1 region for relocated U-Boot
+ 1 region for initrd
+ 1 region for relocated linux device tree
+ reserved memory regions present in Linux device tree.

The current limit of 8 regions is reached with only 5 reserved regions
in DT.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
---

 include/lmb.h |  6 ++----
 lib/Kconfig   | 16 ++++++++++++++++
 2 files changed, 18 insertions(+), 4 deletions(-)

diff --git a/include/lmb.h b/include/lmb.h
index df543028d5..97be24ed66 100644
--- a/include/lmb.h
+++ b/include/lmb.h
@@ -12,8 +12,6 @@
  * Copyright (C) 2001 Peter Bergner, IBM Corp.
  */
 
-#define MAX_LMB_REGIONS 8
-
 /**
  * struct lmb_property - Description of one region.
  *
@@ -54,8 +52,8 @@ struct lmb_region {
 struct lmb {
 	struct lmb_region memory;
 	struct lmb_region reserved;
-	struct lmb_property memory_regions[MAX_LMB_REGIONS + 1];
-	struct lmb_property reserved_regions[MAX_LMB_REGIONS + 1];
+	struct lmb_property memory_regions[CONFIG_LMB_MEMORY_REGIONS + 1];
+	struct lmb_property reserved_regions[CONFIG_LMB_RESERVED_REGIONS + 1];
 };
 
 extern void lmb_init(struct lmb *lmb);
diff --git a/lib/Kconfig b/lib/Kconfig
index 43bd7190b9..4249399b6f 100644
--- a/lib/Kconfig
+++ b/lib/Kconfig
@@ -706,6 +706,22 @@ config LMB
 	help
 	  Support the library logical memory blocks.
 
+config LMB_MEMORY_REGIONS
+	int "Number of memory regions in lmb lib"
+	depends on LMB
+	default 8
+	help
+	  Define the number of supported memory regions in the library logical
+	  memory blocks.
+
+config LMB_RESERVED_REGIONS
+	int "Number of reserved regions in lmb lib"
+	depends on LMB
+	default 8
+	help
+	  Define the number of supported reserved regions in the library logical
+	  memory blocks.
+
 endmenu
 
 config PHANDLE_CHECK_SEQ
-- 
2.17.1

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

* [PATCH 5/5] configs: stm32mp15: increase the number of reserved memory region in lmb
  2021-02-02 12:59 [PATCH 0/5] lmb: Add config for the number of memory and reserved regions Patrick Delaunay
                   ` (3 preceding siblings ...)
  2021-02-02 12:59 ` [PATCH 4/5] lmb: Add 2 config to define the max number of regions Patrick Delaunay
@ 2021-02-02 12:59 ` Patrick Delaunay
  2021-03-02 20:50 ` [PATCH 0/5] lmb: Add config for the number of memory and reserved regions Tom Rini
  5 siblings, 0 replies; 8+ messages in thread
From: Patrick Delaunay @ 2021-02-02 12:59 UTC (permalink / raw)
  To: u-boot

For the latest kernel device tree the max number of reserved regions
in lmb library is reached: 8 with 5 reserved regions in device tree.

When a new region is added, the lmb allocation for the device tree
relocation failed and boot with ramdisk failed.

This patch avoid this issue by increasing the max number of
supported reserved memory in lmb library.


Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
---

 configs/stm32mp15_basic_defconfig   | 1 +
 configs/stm32mp15_trusted_defconfig | 1 +
 2 files changed, 2 insertions(+)

diff --git a/configs/stm32mp15_basic_defconfig b/configs/stm32mp15_basic_defconfig
index d3e5775a5a..df59ef70b1 100644
--- a/configs/stm32mp15_basic_defconfig
+++ b/configs/stm32mp15_basic_defconfig
@@ -157,3 +157,4 @@ CONFIG_WDT=y
 CONFIG_WDT_STM32MP=y
 CONFIG_ERRNO_STR=y
 CONFIG_FDT_FIXUP_PARTITIONS=y
+CONFIG_LMB_RESERVED_REGIONS=16
diff --git a/configs/stm32mp15_trusted_defconfig b/configs/stm32mp15_trusted_defconfig
index d392b0ff2a..0078dccf66 100644
--- a/configs/stm32mp15_trusted_defconfig
+++ b/configs/stm32mp15_trusted_defconfig
@@ -137,3 +137,4 @@ CONFIG_WDT=y
 CONFIG_WDT_STM32MP=y
 CONFIG_ERRNO_STR=y
 CONFIG_FDT_FIXUP_PARTITIONS=y
+CONFIG_LMB_RESERVED_REGIONS=16
-- 
2.17.1

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

* [PATCH 0/5] lmb: Add config for the number of memory and reserved regions
  2021-02-02 12:59 [PATCH 0/5] lmb: Add config for the number of memory and reserved regions Patrick Delaunay
                   ` (4 preceding siblings ...)
  2021-02-02 12:59 ` [PATCH 5/5] configs: stm32mp15: increase the number of reserved memory region in lmb Patrick Delaunay
@ 2021-03-02 20:50 ` Tom Rini
  2021-03-03  9:57   ` Patrick DELAUNAY
  5 siblings, 1 reply; 8+ messages in thread
From: Tom Rini @ 2021-03-02 20:50 UTC (permalink / raw)
  To: u-boot

On Tue, Feb 02, 2021 at 01:59:07PM +0100, Patrick Delaunay wrote:

> Hi,
> 
> I propose a update of the lmb library to allow the configuration
> with Kconfig of the number of memory and reserved regions in lmb
> libary:
> - CONFIG_LMB_RESERVED_REGIONS
> - CONFIG_LMB_MEMORY_REGIONS
> 
> By default, I keep the default value of 8 regions.
> 
> This serie avoids issue on stm32mp15 platform,
> as the kernel device tree defines many and non contiguous reserved
> regions.
> 
> 
> 
> Patrick Delaunay (5):
>   lmb: move CONFIG_LMB in Kconfig
>   lmb: remove lmb_region.size
>   lmb: Move lmb property arrays in struct lmb
>   lmb: Add 2 config to define the max number of regions
>   configs: stm32mp15: increase the number of reserved memory region in
>     lmb
> 
>  arch/arc/include/asm/config.h        |  2 --
>  arch/arm/include/asm/config.h        |  1 -
>  arch/m68k/include/asm/config.h       |  1 -
>  arch/microblaze/include/asm/config.h |  2 --
>  arch/mips/include/asm/config.h       |  1 -
>  arch/nds32/include/asm/config.h      |  1 -
>  arch/powerpc/include/asm/config.h    |  1 -
>  arch/riscv/include/asm/config.h      |  1 -
>  arch/sh/include/asm/config.h         |  2 --
>  arch/x86/include/asm/config.h        |  1 -
>  arch/xtensa/include/asm/config.h     |  2 --
>  configs/stm32mp15_basic_defconfig    |  1 +
>  configs/stm32mp15_trusted_defconfig  |  1 +
>  include/configs/10m50_devboard.h     |  5 ----
>  include/configs/3c120_devboard.h     |  5 ----
>  include/configs/sandbox.h            |  2 --
>  include/configs/x86-common.h         |  2 --
>  include/image.h                      |  2 +-
>  include/lmb.h                        | 34 ++++++++++++++++++++++++----
>  lib/Kconfig                          | 23 +++++++++++++++++++
>  lib/lmb.c                            | 14 ++++++------
>  scripts/config_whitelist.txt         |  1 -
>  22 files changed, 63 insertions(+), 42 deletions(-)

This series causes a little bit of size growth everywhere.  It's fatal
on nokia_rx51 (and caught via the test script).  We can bring nokia_rx51
back under size by disabling the optimized memcpy/memset functions, but
that's not ideal.  Can we do your changes here in a more size-concious
way?  Thanks!

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20210302/7edb7d8c/attachment.sig>

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

* [PATCH 0/5] lmb: Add config for the number of memory and reserved regions
  2021-03-02 20:50 ` [PATCH 0/5] lmb: Add config for the number of memory and reserved regions Tom Rini
@ 2021-03-03  9:57   ` Patrick DELAUNAY
  0 siblings, 0 replies; 8+ messages in thread
From: Patrick DELAUNAY @ 2021-03-03  9:57 UTC (permalink / raw)
  To: u-boot

Hi Tom,

On 3/2/21 9:50 PM, Tom Rini wrote:
> On Tue, Feb 02, 2021 at 01:59:07PM +0100, Patrick Delaunay wrote:
>
>> Hi,
>>
>> I propose a update of the lmb library to allow the configuration
>> with Kconfig of the number of memory and reserved regions in lmb
>> libary:
>> - CONFIG_LMB_RESERVED_REGIONS
>> - CONFIG_LMB_MEMORY_REGIONS
>>
>> By default, I keep the default value of 8 regions.
>>
>> This serie avoids issue on stm32mp15 platform,
>> as the kernel device tree defines many and non contiguous reserved
>> regions.
>>
>>
>>
>> Patrick Delaunay (5):
>>    lmb: move CONFIG_LMB in Kconfig
>>    lmb: remove lmb_region.size
>>    lmb: Move lmb property arrays in struct lmb
>>    lmb: Add 2 config to define the max number of regions
>>    configs: stm32mp15: increase the number of reserved memory region in
>>      lmb
>>
>>   arch/arc/include/asm/config.h        |  2 --
>>   arch/arm/include/asm/config.h        |  1 -
>>   arch/m68k/include/asm/config.h       |  1 -
>>   arch/microblaze/include/asm/config.h |  2 --
>>   arch/mips/include/asm/config.h       |  1 -
>>   arch/nds32/include/asm/config.h      |  1 -
>>   arch/powerpc/include/asm/config.h    |  1 -
>>   arch/riscv/include/asm/config.h      |  1 -
>>   arch/sh/include/asm/config.h         |  2 --
>>   arch/x86/include/asm/config.h        |  1 -
>>   arch/xtensa/include/asm/config.h     |  2 --
>>   configs/stm32mp15_basic_defconfig    |  1 +
>>   configs/stm32mp15_trusted_defconfig  |  1 +
>>   include/configs/10m50_devboard.h     |  5 ----
>>   include/configs/3c120_devboard.h     |  5 ----
>>   include/configs/sandbox.h            |  2 --
>>   include/configs/x86-common.h         |  2 --
>>   include/image.h                      |  2 +-
>>   include/lmb.h                        | 34 ++++++++++++++++++++++++----
>>   lib/Kconfig                          | 23 +++++++++++++++++++
>>   lib/lmb.c                            | 14 ++++++------
>>   scripts/config_whitelist.txt         |  1 -
>>   22 files changed, 63 insertions(+), 42 deletions(-)
> This series causes a little bit of size growth everywhere.  It's fatal
> on nokia_rx51 (and caught via the test script).  We can bring nokia_rx51
> back under size by disabling the optimized memcpy/memset functions, but
> that's not ideal.  Can we do your changes here in a more size-concious
> way?  Thanks!
>

Sure, I will check and correct this issue.


Patrick

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

end of thread, other threads:[~2021-03-03  9:57 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-02 12:59 [PATCH 0/5] lmb: Add config for the number of memory and reserved regions Patrick Delaunay
2021-02-02 12:59 ` [PATCH 1/5] lmb: move CONFIG_LMB in Kconfig Patrick Delaunay
2021-02-02 12:59 ` [PATCH 2/5] lmb: remove lmb_region.size Patrick Delaunay
2021-02-02 12:59 ` [PATCH 3/5] lmb: Move lmb property arrays in struct lmb Patrick Delaunay
2021-02-02 12:59 ` [PATCH 4/5] lmb: Add 2 config to define the max number of regions Patrick Delaunay
2021-02-02 12:59 ` [PATCH 5/5] configs: stm32mp15: increase the number of reserved memory region in lmb Patrick Delaunay
2021-03-02 20:50 ` [PATCH 0/5] lmb: Add config for the number of memory and reserved regions Tom Rini
2021-03-03  9:57   ` Patrick DELAUNAY

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.