[PATCH v4 4/5] platform: generic: add extensions_init handler and platform-override

Guo Ren guoren at kernel.org
Mon Sep 26 16:13:47 PDT 2022


Acked-by: Guo Ren <guoren at kernel.org>

On Mon, Sep 26, 2022 at 6:16 PM Heiko Stuebner <heiko at sntech.de> wrote:
>
> Init of non-standard extensions is a platform-specific thing,
> so allow generic platforms to do this via a platform-override.
>
> Signed-off-by: Heiko Stuebner <heiko at sntech.de>
> ---
>  platform/generic/include/platform_override.h | 1 +
>  platform/generic/platform.c                  | 9 +++++++++
>  2 files changed, 10 insertions(+)
>
> diff --git a/platform/generic/include/platform_override.h b/platform/generic/include/platform_override.h
> index e55da25..06a26dd 100644
> --- a/platform/generic/include/platform_override.h
> +++ b/platform/generic/include/platform_override.h
> @@ -22,6 +22,7 @@ struct platform_override {
>         void (*early_exit)(const struct fdt_match *match);
>         void (*final_exit)(const struct fdt_match *match);
>         int (*fdt_fixup)(void *fdt, const struct fdt_match *match);
> +       int (*extensions_init)(const struct fdt_match *match);
>         int (*vendor_ext_check)(long extid, const struct fdt_match *match);
>         int (*vendor_ext_provider)(long extid, long funcid,
>                                    const struct sbi_trap_regs *regs,
> diff --git a/platform/generic/platform.c b/platform/generic/platform.c
> index bf51aba..35545fb 100644
> --- a/platform/generic/platform.c
> +++ b/platform/generic/platform.c
> @@ -204,6 +204,14 @@ static void generic_final_exit(void)
>                 generic_plat->final_exit(generic_plat_match);
>  }
>
> +static int generic_extensions_init(void)
> +{
> +       if (generic_plat && generic_plat->extensions_init)
> +               return generic_plat->extensions_init(generic_plat_match);
> +
> +       return 0;
> +}
> +
>  static int generic_domains_init(void)
>  {
>         return fdt_domains_populate(fdt_get_address());
> @@ -257,6 +265,7 @@ const struct sbi_platform_operations platform_ops = {
>         .final_init             = generic_final_init,
>         .early_exit             = generic_early_exit,
>         .final_exit             = generic_final_exit,
> +       .extensions_init        = generic_extensions_init,
>         .domains_init           = generic_domains_init,
>         .console_init           = generic_console_init,
>         .irqchip_init           = fdt_irqchip_init,
> --
> 2.35.1
>


-- 
Best Regards
 Guo Ren



More information about the opensbi mailing list