Message ID | 20241013105522.391414-11-sughosh.ganu@linaro.org |
---|---|
State | Superseded |
Headers | show |
Series | Make EFI memory allocations synchronous with LMB | expand |
Hi Sughosh, On Sun, 13 Oct 2024 at 04:56, Sughosh Ganu <sughosh.ganu@linaro.org> wrote: > > Some architectures have special or unique aspects which need > consideration when adding memory ranges to the list of available > memory map. Enable this config in such scenarios which allow > architectures and boards to define their own memory map. > > Signed-off-by: Sughosh Ganu <sughosh.ganu@linaro.org> > --- > Changes since V2: None > > include/lmb.h | 2 ++ > lib/Kconfig | 18 ++++++++++++++++++ > lib/lmb.c | 3 +++ > 3 files changed, 23 insertions(+) Since this is in addition to the existing LMB (which protects U-Boot's memory-region) I suggest emitting an event in initr_lmb() to add things to the LMB. But for SPL, this doesn't work, since we are trying not to add events for SPL. Perhaps I will discover this further on in this series, but which boards need to do something special in SPL? Regards, SImon
On Mon, 14 Oct 2024 at 21:21, Simon Glass <sjg@chromium.org> wrote: > > Hi Sughosh, > > On Sun, 13 Oct 2024 at 04:56, Sughosh Ganu <sughosh.ganu@linaro.org> wrote: > > > > Some architectures have special or unique aspects which need > > consideration when adding memory ranges to the list of available > > memory map. Enable this config in such scenarios which allow > > architectures and boards to define their own memory map. > > > > Signed-off-by: Sughosh Ganu <sughosh.ganu@linaro.org> > > --- > > Changes since V2: None > > > > include/lmb.h | 2 ++ > > lib/Kconfig | 18 ++++++++++++++++++ > > lib/lmb.c | 3 +++ > > 3 files changed, 23 insertions(+) > > Since this is in addition to the existing LMB (which protects U-Boot's > memory-region) I suggest emitting an event in initr_lmb() to add > things to the LMB. But I thought this approach had been agreed upon by you. I had shared a branch with you earlier [1] which had this commit for your feedback, and you got back saying that this approach is fine with you [2]. -sughosh [1] - https://lists.denx.de/pipermail/u-boot/2024-August/562690.html [2] - https://lists.denx.de/pipermail/u-boot/2024-August/563498.html > > But for SPL, this doesn't work, since we are trying not to add events > for SPL. Perhaps I will discover this further on in this series, but > which boards need to do something special in SPL? > > Regards, > SImon
Hi Sughosh, On Tue, 15 Oct 2024 at 03:31, Sughosh Ganu <sughosh.ganu@linaro.org> wrote: > > On Mon, 14 Oct 2024 at 21:21, Simon Glass <sjg@chromium.org> wrote: > > > > Hi Sughosh, > > > > On Sun, 13 Oct 2024 at 04:56, Sughosh Ganu <sughosh.ganu@linaro.org> wrote: > > > > > > Some architectures have special or unique aspects which need > > > consideration when adding memory ranges to the list of available > > > memory map. Enable this config in such scenarios which allow > > > architectures and boards to define their own memory map. > > > > > > Signed-off-by: Sughosh Ganu <sughosh.ganu@linaro.org> > > > --- > > > Changes since V2: None > > > > > > include/lmb.h | 2 ++ > > > lib/Kconfig | 18 ++++++++++++++++++ > > > lib/lmb.c | 3 +++ > > > 3 files changed, 23 insertions(+) > > > > Since this is in addition to the existing LMB (which protects U-Boot's > > memory-region) I suggest emitting an event in initr_lmb() to add > > things to the LMB. > > But I thought this approach had been agreed upon by you. I had shared > a branch with you earlier [1] which had this commit for your feedback, > and you got back saying that this approach is fine with you [2]. If this is just for x86, then sure we can sort this out after this series. The x86 thing is strange as there are sometimes several tables involved. > > -sughosh > > [1] - https://lists.denx.de/pipermail/u-boot/2024-August/562690.html > [2] - https://lists.denx.de/pipermail/u-boot/2024-August/563498.html > > > > > But for SPL, this doesn't work, since we are trying not to add events > > for SPL. Perhaps I will discover this further on in this series, but > > which boards need to do something special in SPL? > > Regards, Simon
diff --git a/include/lmb.h b/include/lmb.h index 92e9aead76..a63c75eda8 100644 --- a/include/lmb.h +++ b/include/lmb.h @@ -166,6 +166,8 @@ long lmb_free(phys_addr_t base, phys_size_t size); void lmb_dump_all(void); void lmb_dump_all_force(void); +void lmb_arch_add_memory(void); + struct lmb *lmb_get(void); int lmb_push(struct lmb *store); void lmb_pop(struct lmb *store); diff --git a/lib/Kconfig b/lib/Kconfig index 61452f7ac9..100c4e5c25 100644 --- a/lib/Kconfig +++ b/lib/Kconfig @@ -1132,6 +1132,24 @@ config SPL_LMB SPL. This will require a malloc() implementation for defining the data structures needed for maintaining the LMB memory map. +config LMB_ARCH_MEM_MAP + bool "Add an architecture specific memory map" + depends on LMB + help + Some architectures have special or unique aspects which need + consideration when adding memory ranges to the list of available + memory map. Enable this config in such scenarios which allow + architectures and boards to define their own memory map. + +config SPL_LMB_ARCH_MEM_MAP + bool "Add an architecture specific memory map" + depends on SPL_LMB + help + Some architectures have special or unique scenarios which need + consideration when adding memory ranges to the list of available + memory map. Enable this config in such scenarios which allow + architectures and boards to define their own memory map. + config PHANDLE_CHECK_SEQ bool "Enable phandle check while getting sequence number" help diff --git a/lib/lmb.c b/lib/lmb.c index a567c02784..c08ab2223a 100644 --- a/lib/lmb.c +++ b/lib/lmb.c @@ -331,6 +331,9 @@ void lmb_add_memory(void) u64 ram_top = gd->ram_top; struct bd_info *bd = gd->bd; + if (CONFIG_IS_ENABLED(LMB_ARCH_MEM_MAP)) + return lmb_arch_add_memory(); + /* Assume a 4GB ram_top if not defined */ if (!ram_top) ram_top = 0x100000000ULL;
Some architectures have special or unique aspects which need consideration when adding memory ranges to the list of available memory map. Enable this config in such scenarios which allow architectures and boards to define their own memory map. Signed-off-by: Sughosh Ganu <sughosh.ganu@linaro.org> --- Changes since V2: None include/lmb.h | 2 ++ lib/Kconfig | 18 ++++++++++++++++++ lib/lmb.c | 3 +++ 3 files changed, 23 insertions(+)