From: Yu-Chien Peter Lin <peterlin@andestech.com>
To: opensbi@lists.infradead.org
Subject: [PATCH v2 10/12] lib: utils/ipi: Add PLICSW mmio region to root domain
Date: Thu, 13 Oct 2022 09:40:48 +0000 [thread overview]
Message-ID: <Y0fdIH8ADF54uVS1@APC323> (raw)
In-Reply-To: <CAAhSdy0WXhv3h_sXC3vjR9qLzJf+fD5QYVbOhJJN_ZVFshYXiQ@mail.gmail.com>
On Tue, Oct 11, 2022 at 10:27:23PM +0530, Anup Patel wrote:
> On Mon, Oct 3, 2022 at 5:24 PM Yu Chien Peter Lin
> <peterlin@andestech.com> wrote:
> >
> > Add PLICSW as mmio memregion in root domain at boot-time.
> >
> > Signed-off-by: Yu Chien Peter Lin <peterlin@andestech.com>
> > Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>
> > ---
> > lib/utils/ipi/fdt_ipi_plicsw.c | 34 ++++++++++++++++++++++++++++++++++
> > 1 file changed, 34 insertions(+)
> >
> > diff --git a/lib/utils/ipi/fdt_ipi_plicsw.c b/lib/utils/ipi/fdt_ipi_plicsw.c
> > index 8788f74..3af92bd 100644
> > --- a/lib/utils/ipi/fdt_ipi_plicsw.c
> > +++ b/lib/utils/ipi/fdt_ipi_plicsw.c
> > @@ -10,6 +10,7 @@
> > * Yu Chien Peter Lin <peterlin@andestech.com>
> > */
> >
> > +#include <sbi/sbi_domain.h>
> > #include <sbi/sbi_error.h>
> > #include <sbi/sbi_ipi.h>
> > #include <sbi_utils/fdt/fdt_helper.h>
> > @@ -34,6 +35,34 @@ static int plicsw_warm_ipi_init(void)
> > return 0;
> > }
> >
> > +static int andes_plicsw_add_regions(unsigned long addr, unsigned long size)
> > +{
> > +#define PLICSW_ADD_REGION_ALIGN 0x1000
> > + int rc;
> > + unsigned long pos, end, region_size;
> > + struct sbi_domain_memregion reg;
> > +
> > + pos = addr;
> > + end = addr + size;
> > + while (pos < end) {
> > + if (pos & (PLICSW_ADD_REGION_ALIGN - 1))
> > + region_size = 1UL << sbi_ffs(pos);
> > + else
> > + region_size = ((end - pos) < PLICSW_ADD_REGION_ALIGN)
> > + ? (end - pos)
> > + : PLICSW_ADD_REGION_ALIGN;
> > +
> > + sbi_domain_memregion_init(pos, region_size,
> > + SBI_DOMAIN_MEMREGION_MMIO, ®);
> > + rc = sbi_domain_root_add_memregion(®);
> > + if (rc)
> > + return rc;
> > + pos += region_size;
> > + }
> > +
> > + return 0;
> > +}
> > +
>
> This is exactly same as your PATCH5 and aclint_mtimer_add_regions()
> defined in lib/utils/timer/aclint_mtimer.c
>
> I suggest adding a common function in sbi_domain.c and sbi_domain.h
> with following function prototype:
> int sbi_domain_root_add_memrange(unsigned long addr,
> unsigned long size,
> unsigned long align,
> unsigned
> long region_flags);
>
> You can have one patch at the beginning of the series which adds
> above function in sbi_domain.c and remove it from aclint_mtimer.c
>
> Your PATCH4 and PATCH9 can directly use this new function
> which will allow you to drop your PATCH5 and PATCH10
>
> Regards,
> Anup
Hi Anup,
Thanks for your suggestion, I'll resend patches with this function
factored out into sbi_domain.c.
Best Regards,
Peter Lin
next prev parent reply other threads:[~2022-10-13 9:40 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-03 11:52 [PATCH v2 00/12] Add Andes AE350 fdt driver support Yu Chien Peter Lin
2022-10-03 11:52 ` [PATCH v2 01/12] platform: andes/ae350: Remove enabling cache from an350_final_init Yu Chien Peter Lin
2022-10-11 16:27 ` Anup Patel
2022-10-03 11:52 ` [PATCH v2 02/12] platform: andes/ae350: Use kconfig to set platform version and default name Yu Chien Peter Lin
2022-10-11 16:28 ` Anup Patel
2022-10-03 11:52 ` [PATCH v2 03/12] platform: andes/ae350: Use fdt serial driver Yu Chien Peter Lin
2022-10-11 16:29 ` Anup Patel
2022-10-03 11:52 ` [PATCH v2 04/12] lib: utils/timer: Add Andes fdt timer support Yu Chien Peter Lin
2022-10-11 16:32 ` Anup Patel
2022-10-03 11:52 ` [PATCH v2 05/12] lib: utils/timer: Add PLMT mmio region to root domain Yu Chien Peter Lin
2022-10-03 11:52 ` [PATCH v2 06/12] lib: utils/reset: Add Andes fdt reset driver support Yu Chien Peter Lin
2022-10-11 16:35 ` Anup Patel
2022-10-03 11:52 ` [PATCH v2 07/12] platform: andes/ae350: Use fdt irqchip driver Yu Chien Peter Lin
2022-10-11 16:35 ` Anup Patel
2022-10-03 11:52 ` [PATCH v2 08/12] platform: andes/ae350: Add fw_platform_init for platform initialization Yu Chien Peter Lin
2022-10-11 16:37 ` Anup Patel
2022-10-03 11:52 ` [PATCH v2 09/12] lib: utils/ipi: Add Andes fdt ipi driver support Yu Chien Peter Lin
2022-10-11 16:42 ` Anup Patel
2022-10-03 11:52 ` [PATCH v2 10/12] lib: utils/ipi: Add PLICSW mmio region to root domain Yu Chien Peter Lin
2022-10-11 16:57 ` Anup Patel
2022-10-13 9:40 ` Yu-Chien Peter Lin [this message]
2022-10-03 11:52 ` [PATCH v2 11/12] platform: andes/ae350: Add AE350 domain support Yu Chien Peter Lin
2022-10-11 16:43 ` Anup Patel
2022-10-03 11:52 ` [PATCH v2 12/12] docs: andes-ae350.md: Update ae350 documentation for fdt driver support Yu Chien Peter Lin
2022-10-11 16:45 ` Anup Patel
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Y0fdIH8ADF54uVS1@APC323 \
--to=peterlin@andestech.com \
--cc=opensbi@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox