ARM: bootm: take into account gd->ram_top
diff mbox series

Message ID 20200213182950.10744-1-patrick.delaunay@st.com
State New
Delegated to: Tom Rini
Headers show
Series
  • ARM: bootm: take into account gd->ram_top
Related show

Commit Message

Patrick DELAUNAY Feb. 13, 2020, 6:29 p.m. UTC
From: Patrice Chotard <patrice.chotard@st.com>

If gd->ram_top has been tuned using board_get_usable_ram_top(),
it must be taken into account when reserving arch lmb.

Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
Reviewed-by: Patrick DELAUNAY <patrick.delaunay@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
---

 arch/arm/lib/bootm.c | 3 +++
 1 file changed, 3 insertions(+)

Comments

Simon Glass Feb. 14, 2020, 7:16 p.m. UTC | #1
Hi Patrick,

On Thu, 13 Feb 2020 at 11:30, Patrick Delaunay <patrick.delaunay@st.com> wrote:
>
> From: Patrice Chotard <patrice.chotard@st.com>
>
> If gd->ram_top has been tuned using board_get_usable_ram_top(),
> it must be taken into account when reserving arch lmb.
>
> Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
> Reviewed-by: Patrick DELAUNAY <patrick.delaunay@st.com>
> Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
> ---
>
>  arch/arm/lib/bootm.c | 3 +++
>  1 file changed, 3 insertions(+)

Is this something we can test in test/lib/lmb.c ?

Regards,
Simon
Patrick DELAUNAY Feb. 18, 2020, 10:32 a.m. UTC | #2
Hi Simon,

> From: Simon Glass <sjg@chromium.org>
> Sent: vendredi 14 février 2020 20:17
> 
> Hi Patrick,
> 
> On Thu, 13 Feb 2020 at 11:30, Patrick Delaunay <patrick.delaunay@st.com>
> wrote:
> >
> > From: Patrice Chotard <patrice.chotard@st.com>
> >
> > If gd->ram_top has been tuned using board_get_usable_ram_top(), it
> > must be taken into account when reserving arch lmb.
> >
> > Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
> > Reviewed-by: Patrick DELAUNAY <patrick.delaunay@st.com>
> > Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
> > ---
> >
> >  arch/arm/lib/bootm.c | 3 +++
> >  1 file changed, 3 insertions(+)
> 
> Is this something we can test in test/lib/lmb.c ?

I check these tests, and for me it is not possible, as I change the ARM part for bootm lib 
(limit the reserved size by u-boot to avoid conflict wxith other reserved memory) 
and not the lmb generic code...

I don't see how to test it in sandbox.

 
> Regards,
> Simon

Regards
Patrick

Patch
diff mbox series

diff --git a/arch/arm/lib/bootm.c b/arch/arm/lib/bootm.c
index a135bcfc7b..f4b5ca6de0 100644
--- a/arch/arm/lib/bootm.c
+++ b/arch/arm/lib/bootm.c
@@ -75,6 +75,9 @@  void arch_lmb_reserve(struct lmb *lmb)
 			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;
 	}