From ee92afa63892cd6c536b623570d8ddde14760c0b Mon Sep 17 00:00:00 2001 From: Anup Patel Date: Thu, 4 Sep 2025 10:54:08 +0530 Subject: lib: sbi: Introduce IPI device rating A platform can have multiple IPI devices (such as ACLINT MSWI, AIA IMSIC, etc). Currently, OpenSBI rely on platform calling the sbi_ipi_set_device() function in correct order and prefer the first avaiable IPI device which is fragile. Instead of the above, introduce IPI device rating and prefer the highest rated IPI device. This further allows extending the sbi_ipi_raw_clear() to clear all available IPI devices. Signed-off-by: Anup Patel Tested-by: Nick Hu Link: https://lore.kernel.org/r/20250904052410.546818-2-apatel@ventanamicro.com Signed-off-by: Anup Patel --- include/sbi/sbi_ipi.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'include') diff --git a/include/sbi/sbi_ipi.h b/include/sbi/sbi_ipi.h index 62d61304..26d1b66b 100644 --- a/include/sbi/sbi_ipi.h +++ b/include/sbi/sbi_ipi.h @@ -23,6 +23,9 @@ struct sbi_ipi_device { /** Name of the IPI device */ char name[32]; + /** Ratings of the IPI device (higher is better) */ + unsigned long rating; + /** Send IPI to a target HART index */ void (*ipi_send)(u32 hart_index); @@ -87,11 +90,11 @@ void sbi_ipi_process(void); int sbi_ipi_raw_send(u32 hartindex); -void sbi_ipi_raw_clear(void); +void sbi_ipi_raw_clear(bool all_devices); const struct sbi_ipi_device *sbi_ipi_get_device(void); -void sbi_ipi_set_device(const struct sbi_ipi_device *dev); +void sbi_ipi_add_device(const struct sbi_ipi_device *dev); int sbi_ipi_init(struct sbi_scratch *scratch, bool cold_boot); -- cgit v1.3.1