Message ID | 20210520155912.1336836-2-anup.patel@wdc.com |
---|---|
State | Accepted |
Headers | show |
Series | Few misc fixes | expand |
On Thu, May 20, 2021 at 9:01 AM Anup Patel <anup.patel@wdc.com> wrote: > > We can merge region B onto region A only if base of region A is > aligned to region A order + 1. > > Signed-off-by: Anup Patel <anup.patel@wdc.com> > --- > lib/sbi/sbi_domain.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/lib/sbi/sbi_domain.c b/lib/sbi/sbi_domain.c > index 84f30b9..3096af0 100644 > --- a/lib/sbi/sbi_domain.c > +++ b/lib/sbi/sbi_domain.c > @@ -511,7 +511,8 @@ int sbi_domain_root_add_memregion(const struct sbi_domain_memregion *reg) > if (!nreg1->order) > continue; > > - if ((nreg->base + BIT(nreg->order)) == nreg1->base && > + if (!(nreg->base & (BIT(nreg->order + 1) - 1)) && > + (nreg->base + BIT(nreg->order)) == nreg1->base && > nreg->order == nreg1->order && > nreg->flags == nreg1->flags) { > nreg->order++; > -- > 2.25.1 > > > -- > opensbi mailing list > opensbi@lists.infradead.org > http://lists.infradead.org/mailman/listinfo/opensbi Reviewed-by: Atish Patra <atish.patra@wdc.com>
在 2021-05-20四的 21:29 +0530,Anup Patel写道: > We can merge region B onto region A only if base of region A is > aligned to region A order + 1. > > Signed-off-by: Anup Patel <anup.patel@wdc.com> Reviewed-by: Xiang W <wxjstz@126.com> > --- > lib/sbi/sbi_domain.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/lib/sbi/sbi_domain.c b/lib/sbi/sbi_domain.c > index 84f30b9..3096af0 100644 > --- a/lib/sbi/sbi_domain.c > +++ b/lib/sbi/sbi_domain.c > @@ -511,7 +511,8 @@ int sbi_domain_root_add_memregion(const struct > sbi_domain_memregion *reg) > if (!nreg1->order) > continue; > > - if ((nreg->base + BIT(nreg->order)) == nreg1- > >base && > + if (!(nreg->base & (BIT(nreg->order + 1) - 1)) > && > + (nreg->base + BIT(nreg->order)) == nreg1- > >base && > nreg->order == nreg1->order && > nreg->flags == nreg1->flags) { > nreg->order++; > -- > 2.25.1 > >
> -----Original Message----- > From: Xiang W <wxjstz@126.com> > Sent: 21 May 2021 12:09 > To: Anup Patel <Anup.Patel@wdc.com>; Atish Patra <Atish.Patra@wdc.com>; > Alistair Francis <Alistair.Francis@wdc.com> > Cc: Anup Patel <anup@brainfault.org>; opensbi@lists.infradead.org > Subject: Re: [PATCH 1/2] lib: Check region base for merging in > sbi_domain_root_add_memregion() > > 在 2021-05-20四的 21:29 +0530,Anup Patel写道: > > We can merge region B onto region A only if base of region A is > > aligned to region A order + 1. > > > > Signed-off-by: Anup Patel <anup.patel@wdc.com> > > Reviewed-by: Xiang W <wxjstz@126.com> Applied this patch to the riscv/opensbi repo Regards, Anup > > > --- > > lib/sbi/sbi_domain.c | 3 ++- > > 1 file changed, 2 insertions(+), 1 deletion(-) > > > > diff --git a/lib/sbi/sbi_domain.c b/lib/sbi/sbi_domain.c index > > 84f30b9..3096af0 100644 > > --- a/lib/sbi/sbi_domain.c > > +++ b/lib/sbi/sbi_domain.c > > @@ -511,7 +511,8 @@ int sbi_domain_root_add_memregion(const struct > > sbi_domain_memregion *reg) > > if (!nreg1->order) > > continue; > > > > - if ((nreg->base + BIT(nreg->order)) == nreg1- > > >base && > > + if (!(nreg->base & (BIT(nreg->order + 1) - 1)) > > && > > + (nreg->base + BIT(nreg->order)) == nreg1- > > >base && > > nreg->order == nreg1->order && > > nreg->flags == nreg1->flags) { > > nreg->order++; > > -- > > 2.25.1 > > > >
diff --git a/lib/sbi/sbi_domain.c b/lib/sbi/sbi_domain.c index 84f30b9..3096af0 100644 --- a/lib/sbi/sbi_domain.c +++ b/lib/sbi/sbi_domain.c @@ -511,7 +511,8 @@ int sbi_domain_root_add_memregion(const struct sbi_domain_memregion *reg) if (!nreg1->order) continue; - if ((nreg->base + BIT(nreg->order)) == nreg1->base && + if (!(nreg->base & (BIT(nreg->order + 1) - 1)) && + (nreg->base + BIT(nreg->order)) == nreg1->base && nreg->order == nreg1->order && nreg->flags == nreg1->flags) { nreg->order++;
We can merge region B onto region A only if base of region A is aligned to region A order + 1. Signed-off-by: Anup Patel <anup.patel@wdc.com> --- lib/sbi/sbi_domain.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)