[PATCH 2/3] include: sbi: Remove platform specific IPI init
Samuel Holland
samuel.holland at sifive.com
Tue Sep 2 16:44:18 PDT 2025
Hi Anup,
On 2025-09-02 7:17 AM, Anup Patel wrote:
> The platform specfic IPI init is not need anymore because using
> IPI device rating multiple IPI devices can be registered in any
> order as part of the platform specific early init.
>
> Signed-off-by: Anup Patel <apatel at ventanamicro.com>
> ---
> include/sbi/sbi_platform.h | 17 -----------------
> lib/sbi/sbi_ipi.c | 5 -----
> platform/fpga/ariane/platform.c | 15 ++++++---------
> platform/generic/openhwgroup/openpiton.c | 13 ++++---------
> platform/generic/platform.c | 5 ++++-
> platform/kendryte/k210/platform.c | 13 ++++++-------
> platform/nuclei/ux600/platform.c | 11 +++++------
> platform/template/platform.c | 16 ++++++----------
> 8 files changed, 31 insertions(+), 64 deletions(-)
>
> diff --git a/include/sbi/sbi_platform.h b/include/sbi/sbi_platform.h
> index c6d30080..d75c12de 100644
> --- a/include/sbi/sbi_platform.h
> +++ b/include/sbi/sbi_platform.h
> @@ -116,9 +116,6 @@ struct sbi_platform_operations {
> /** Initialize the platform interrupt controller during cold boot */
> int (*irqchip_init)(void);
>
> - /** Initialize IPI during cold boot */
> - int (*ipi_init)(void);
> -
> /** Get tlb flush limit value **/
> u64 (*get_tlbr_flush_limit)(void);
>
> @@ -528,20 +525,6 @@ static inline int sbi_platform_irqchip_init(const struct sbi_platform *plat)
> return 0;
> }
>
> -/**
> - * Initialize the platform IPI support during cold boot
> - *
> - * @param plat pointer to struct sbi_platform
> - *
> - * @return 0 on success and negative error code on failure
> - */
> -static inline int sbi_platform_ipi_init(const struct sbi_platform *plat)
> -{
> - if (plat && sbi_platform_ops(plat)->ipi_init)
> - return sbi_platform_ops(plat)->ipi_init();
> - return 0;
> -}
> -
> /**
> * Initialize the platform timer during cold boot
> *
> diff --git a/lib/sbi/sbi_ipi.c b/lib/sbi/sbi_ipi.c
> index b57ec652..c9f5d1d1 100644
> --- a/lib/sbi/sbi_ipi.c
> +++ b/lib/sbi/sbi_ipi.c
> @@ -342,11 +342,6 @@ int sbi_ipi_init(struct sbi_scratch *scratch, bool cold_boot)
> if (ret < 0)
> return ret;
> ipi_halt_event = ret;
> -
> - /* Initialize platform IPI support */
> - ret = sbi_platform_ipi_init(sbi_platform_ptr(scratch));
> - if (ret)
> - return ret;
> } else {
> if (!ipi_data_off)
> return SBI_ENOMEM;
> diff --git a/platform/fpga/ariane/platform.c b/platform/fpga/ariane/platform.c
> index 4bc1c5be..4ca9ca94 100644
> --- a/platform/fpga/ariane/platform.c
> +++ b/platform/fpga/ariane/platform.c
> @@ -71,9 +71,15 @@ static struct aclint_mtimer_data mtimer = {
> */
> static int ariane_early_init(bool cold_boot)
> {
> + int rc;
> +
> if (!cold_boot)
> return 0;
>
> + rc = aclint_mswi_cold_init(&mswi);
> + if (rc)
> + return rc;
> +
> return uart8250_init(ARIANE_UART_ADDR,
> ARIANE_UART_FREQ,
> ARIANE_UART_BAUDRATE,
I would recommend to keep the serial device initialization first in these
functions to help with any future debugging.
Regards,
Samuel
> @@ -107,14 +113,6 @@ static int ariane_irqchip_init(void)
> return plic_cold_irqchip_init(&plic);
> }
>
> -/*
> - * Initialize IPI during cold boot.
> - */
> -static int ariane_ipi_init(void)
> -{
> - return aclint_mswi_cold_init(&mswi);
> -}
> -
> /*
> * Initialize ariane timer during cold boot.
> */
> @@ -130,7 +128,6 @@ const struct sbi_platform_operations platform_ops = {
> .early_init = ariane_early_init,
> .final_init = ariane_final_init,
> .irqchip_init = ariane_irqchip_init,
> - .ipi_init = ariane_ipi_init,
> .timer_init = ariane_timer_init,
> };
>
> diff --git a/platform/generic/openhwgroup/openpiton.c b/platform/generic/openhwgroup/openpiton.c
> index 9be7f9a4..e4d7a8b0 100644
> --- a/platform/generic/openhwgroup/openpiton.c
> +++ b/platform/generic/openhwgroup/openpiton.c
> @@ -104,6 +104,10 @@ static int openpiton_early_init(bool cold_boot)
> ACLINT_DEFAULT_MTIMECMP_OFFSET;
> }
>
> + rc = aclint_mswi_cold_init(&mswi);
> + if (rc)
> + return rc;
> +
> return uart8250_init(uart.addr, uart.freq, uart.baud,
> OPENPITON_DEFAULT_UART_REG_SHIFT,
> OPENPITON_DEFAULT_UART_REG_WIDTH,
> @@ -135,14 +139,6 @@ static int openpiton_irqchip_init(void)
> return plic_cold_irqchip_init(&plic);
> }
>
> -/*
> - * Initialize IPI during cold boot.
> - */
> -static int openpiton_ipi_init(void)
> -{
> - return aclint_mswi_cold_init(&mswi);
> -}
> -
> /*
> * Initialize openpiton timer during cold boot.
> */
> @@ -155,7 +151,6 @@ static int openhwgroup_openpiton_platform_init(const void *fdt, int nodeoff, con
> {
> generic_platform_ops.early_init = openpiton_early_init;
> generic_platform_ops.timer_init = openpiton_timer_init;
> - generic_platform_ops.ipi_init = openpiton_ipi_init;
> generic_platform_ops.irqchip_init = openpiton_irqchip_init;
> generic_platform_ops.final_init = openpiton_final_init;
>
> diff --git a/platform/generic/platform.c b/platform/generic/platform.c
> index 889d6905..8ba6bc11 100644
> --- a/platform/generic/platform.c
> +++ b/platform/generic/platform.c
> @@ -229,6 +229,10 @@ int generic_early_init(bool cold_boot)
> return rc;
>
> fdt_driver_init_all(fdt, fdt_early_drivers);
> +
> + rc = fdt_ipi_init();
> + if (rc)
> + return rc;
> }
>
> return 0;
> @@ -337,7 +341,6 @@ struct sbi_platform_operations generic_platform_ops = {
> .extensions_init = generic_extensions_init,
> .domains_init = generic_domains_init,
> .irqchip_init = fdt_irqchip_init,
> - .ipi_init = fdt_ipi_init,
> .pmu_init = generic_pmu_init,
> .pmu_xlate_to_mhpmevent = generic_pmu_xlate_to_mhpmevent,
> .get_tlbr_flush_limit = generic_tlbr_flush_limit,
> diff --git a/platform/kendryte/k210/platform.c b/platform/kendryte/k210/platform.c
> index aff133c6..cd71c795 100644
> --- a/platform/kendryte/k210/platform.c
> +++ b/platform/kendryte/k210/platform.c
> @@ -112,9 +112,15 @@ static struct sbi_system_reset_device k210_reset = {
>
> static int k210_early_init(bool cold_boot)
> {
> + int rc;
> +
> if (!cold_boot)
> return 0;
>
> + rc = aclint_mswi_cold_init(&mswi);
> + if (rc)
> + return rc;
> +
> sbi_system_reset_add_device(&k210_reset);
>
> return sifive_uart_init(K210_UART_BASE_ADDR, k210_get_clk_freq(),
> @@ -141,11 +147,6 @@ static int k210_irqchip_init(void)
> return plic_cold_irqchip_init(&plic);
> }
>
> -static int k210_ipi_init(void)
> -{
> - return aclint_mswi_cold_init(&mswi);
> -}
> -
> static int k210_timer_init(void)
> {
> return aclint_mtimer_cold_init(&mtimer, NULL);
> @@ -158,8 +159,6 @@ const struct sbi_platform_operations platform_ops = {
>
> .irqchip_init = k210_irqchip_init,
>
> - .ipi_init = k210_ipi_init,
> -
> .timer_init = k210_timer_init,
> };
>
> diff --git a/platform/nuclei/ux600/platform.c b/platform/nuclei/ux600/platform.c
> index 1b67b644..ccaf87a4 100644
> --- a/platform/nuclei/ux600/platform.c
> +++ b/platform/nuclei/ux600/platform.c
> @@ -151,10 +151,15 @@ static struct sbi_system_reset_device ux600_reset = {
> static int ux600_early_init(bool cold_boot)
> {
> u32 regval;
> + int rc;
>
> if (!cold_boot)
> return 0;
>
> + rc = aclint_mswi_cold_init(&mswi);
> + if (rc)
> + return rc;
> +
> sbi_system_reset_add_device(&ux600_reset);
>
> /* Measure CPU Frequency using Timer */
> @@ -195,11 +200,6 @@ static int ux600_irqchip_init(void)
> return plic_cold_irqchip_init(&plic);
> }
>
> -static int ux600_ipi_init(void)
> -{
> - return aclint_mswi_cold_init(&mswi);
> -}
> -
> static int ux600_timer_init(void)
> {
> return aclint_mtimer_cold_init(&mtimer, NULL);
> @@ -209,7 +209,6 @@ const struct sbi_platform_operations platform_ops = {
> .early_init = ux600_early_init,
> .final_init = ux600_final_init,
> .irqchip_init = ux600_irqchip_init,
> - .ipi_init = ux600_ipi_init,
> .timer_init = ux600_timer_init,
> };
>
> diff --git a/platform/template/platform.c b/platform/template/platform.c
> index 292889d2..4ba3e59a 100644
> --- a/platform/template/platform.c
> +++ b/platform/template/platform.c
> @@ -70,9 +70,15 @@ static struct aclint_mtimer_data mtimer = {
> */
> static int platform_early_init(bool cold_boot)
> {
> + int rc;
> +
> if (!cold_boot)
> return 0;
>
> + rc = aclint_mswi_cold_init(&mswi);
> + if (rc)
> + return rc;
> +
> /* Example if the generic UART8250 driver is used */
> return uart8250_init(PLATFORM_UART_ADDR, PLATFORM_UART_INPUT_FREQ,
> PLATFORM_UART_BAUDRATE, 0, 1, 0, 0);
> @@ -95,15 +101,6 @@ static int platform_irqchip_init(void)
> return plic_cold_irqchip_init(&plic);
> }
>
> -/*
> - * Initialize IPI during cold boot.
> - */
> -static int platform_ipi_init(void)
> -{
> - /* Example if the generic ACLINT driver is used */
> - return aclint_mswi_cold_init(&mswi);
> -}
> -
> /*
> * Initialize platform timer during cold boot.
> */
> @@ -120,7 +117,6 @@ const struct sbi_platform_operations platform_ops = {
> .early_init = platform_early_init,
> .final_init = platform_final_init,
> .irqchip_init = platform_irqchip_init,
> - .ipi_init = platform_ipi_init,
> .timer_init = platform_timer_init
> };
> const struct sbi_platform platform = {
More information about the opensbi
mailing list