Message ID | 20241018135112.3978130-2-caleb.connolly@linaro.org |
---|---|
State | New |
Headers | show |
Series | lmb: notify when adjacent regions are added | expand |
On Fri, 18 Oct 2024 at 19:23, Caleb Connolly <caleb.connolly@linaro.org> wrote: > > lmb_add_region() returns a positive integer if the added regions causes > existing regions to be coalesced. We still want to notify the EFI > subsystem about these added regions though, so adjust lmb_add() to only > bail on errors. > > This fixes EFI memory allocation on boards with adjacent memory banks as is the > case on several Qualcomm boards like the RB3 Gen 2. > > Fixes: 2f6191526a13 (lmb: notify of any changes to the LMB memory map) > Signed-off-by: Caleb Connolly <caleb.connolly@linaro.org> > --- Reviewed-by: Sughosh Ganu <sughosh.ganu@linaro.org> -sughosh > Cc: u-boot-qcom@groups.io > --- > lib/lmb.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/lib/lmb.c b/lib/lmb.c > index 78fe2d4de7c6..7e90f178763b 100644 > --- a/lib/lmb.c > +++ b/lib/lmb.c > @@ -486,9 +486,9 @@ long lmb_add(phys_addr_t base, phys_size_t size) > long ret; > struct alist *lmb_rgn_lst = &lmb.free_mem; > > ret = lmb_add_region(lmb_rgn_lst, base, size); > - if (ret) > + if (ret < 0) > return ret; > > if (lmb_should_notify(LMB_NONE)) > return lmb_map_update_notify(base, size, MAP_OP_ADD); > -- > 2.46.2 >
On 18/10/2024 15:51, Caleb Connolly via groups.io wrote: > lmb_add_region() returns a positive integer if the added regions causes > existing regions to be coalesced. We still want to notify the EFI > subsystem about these added regions though, so adjust lmb_add() to only > bail on errors. > > This fixes EFI memory allocation on boards with adjacent memory banks as is the > case on several Qualcomm boards like the RB3 Gen 2. > > Fixes: 2f6191526a13 (lmb: notify of any changes to the LMB memory map) > Signed-off-by: Caleb Connolly <caleb.connolly@linaro.org> > --- > Cc: u-boot-qcom@groups.io > --- > lib/lmb.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/lib/lmb.c b/lib/lmb.c > index 78fe2d4de7c6..7e90f178763b 100644 > --- a/lib/lmb.c > +++ b/lib/lmb.c > @@ -486,9 +486,9 @@ long lmb_add(phys_addr_t base, phys_size_t size) > long ret; > struct alist *lmb_rgn_lst = &lmb.free_mem; > > ret = lmb_add_region(lmb_rgn_lst, base, size); > - if (ret) > + if (ret < 0) > return ret; > > if (lmb_should_notify(LMB_NONE)) > return lmb_map_update_notify(base, size, MAP_OP_ADD); Tested-by: Neil Armstrong <neil.armstrong@linaro.org> Thanks ! Neil
Thanks Caleb, On Fri, 18 Oct 2024 at 16:53, Caleb Connolly <caleb.connolly@linaro.org> wrote: > > lmb_add_region() returns a positive integer if the added regions causes > existing regions to be coalesced. We still want to notify the EFI > subsystem about these added regions though, so adjust lmb_add() to only > bail on errors. > > This fixes EFI memory allocation on boards with adjacent memory banks as is the > case on several Qualcomm boards like the RB3 Gen 2. > > Fixes: 2f6191526a13 (lmb: notify of any changes to the LMB memory map) > Signed-off-by: Caleb Connolly <caleb.connolly@linaro.org> > --- > Cc: u-boot-qcom@groups.io > --- > lib/lmb.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/lib/lmb.c b/lib/lmb.c > index 78fe2d4de7c6..7e90f178763b 100644 > --- a/lib/lmb.c > +++ b/lib/lmb.c > @@ -486,9 +486,9 @@ long lmb_add(phys_addr_t base, phys_size_t size) > long ret; > struct alist *lmb_rgn_lst = &lmb.free_mem; > > ret = lmb_add_region(lmb_rgn_lst, base, size); > - if (ret) > + if (ret < 0) > return ret; > > if (lmb_should_notify(LMB_NONE)) > return lmb_map_update_notify(base, size, MAP_OP_ADD); > -- > 2.46.2 > Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Hi Caleb, On Fri, 18 Oct 2024 at 08:08, Ilias Apalodimas <ilias.apalodimas@linaro.org> wrote: > > Thanks Caleb, > > On Fri, 18 Oct 2024 at 16:53, Caleb Connolly <caleb.connolly@linaro.org> wrote: > > > > lmb_add_region() returns a positive integer if the added regions causes > > existing regions to be coalesced. We still want to notify the EFI > > subsystem about these added regions though, so adjust lmb_add() to only > > bail on errors. > > > > This fixes EFI memory allocation on boards with adjacent memory banks as is the > > case on several Qualcomm boards like the RB3 Gen 2. > > > > Fixes: 2f6191526a13 (lmb: notify of any changes to the LMB memory map) > > Signed-off-by: Caleb Connolly <caleb.connolly@linaro.org> > > --- > > Cc: u-boot-qcom@groups.io > > --- > > lib/lmb.c | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/lib/lmb.c b/lib/lmb.c > > index 78fe2d4de7c6..7e90f178763b 100644 > > --- a/lib/lmb.c > > +++ b/lib/lmb.c > > @@ -486,9 +486,9 @@ long lmb_add(phys_addr_t base, phys_size_t size) > > long ret; > > struct alist *lmb_rgn_lst = &lmb.free_mem; > > > > ret = lmb_add_region(lmb_rgn_lst, base, size); > > - if (ret) > > + if (ret < 0) > > return ret; > > > > if (lmb_should_notify(LMB_NONE)) > > return lmb_map_update_notify(base, size, MAP_OP_ADD); > > -- > > 2.46.2 > > > > Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org> Is it possible to add a test for this case? It is a good idea to plug a testing gap when fixing a bug. Regards, Simon
On Fri, 18 Oct 2024 15:51:07 +0200, Caleb Connolly wrote: > lmb_add_region() returns a positive integer if the added regions causes > existing regions to be coalesced. We still want to notify the EFI > subsystem about these added regions though, so adjust lmb_add() to only > bail on errors. > > This fixes EFI memory allocation on boards with adjacent memory banks as is the > case on several Qualcomm boards like the RB3 Gen 2. > > [...] Applied to u-boot/master, thanks!
diff --git a/lib/lmb.c b/lib/lmb.c index 78fe2d4de7c6..7e90f178763b 100644 --- a/lib/lmb.c +++ b/lib/lmb.c @@ -486,9 +486,9 @@ long lmb_add(phys_addr_t base, phys_size_t size) long ret; struct alist *lmb_rgn_lst = &lmb.free_mem; ret = lmb_add_region(lmb_rgn_lst, base, size); - if (ret) + if (ret < 0) return ret; if (lmb_should_notify(LMB_NONE)) return lmb_map_update_notify(base, size, MAP_OP_ADD);
lmb_add_region() returns a positive integer if the added regions causes existing regions to be coalesced. We still want to notify the EFI subsystem about these added regions though, so adjust lmb_add() to only bail on errors. This fixes EFI memory allocation on boards with adjacent memory banks as is the case on several Qualcomm boards like the RB3 Gen 2. Fixes: 2f6191526a13 (lmb: notify of any changes to the LMB memory map) Signed-off-by: Caleb Connolly <caleb.connolly@linaro.org> --- Cc: u-boot-qcom@groups.io --- lib/lmb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)