diff options
| author | Anup Patel <[email protected]> | 2025-09-04 10:54:08 +0530 |
|---|---|---|
| committer | Anup Patel <[email protected]> | 2025-09-16 09:56:31 +0530 |
| commit | ee92afa63892cd6c536b623570d8ddde14760c0b (patch) | |
| tree | c1eef4d7e6cdeeb80a842fb0cb9b05f3673af7a5 /lib/utils | |
| parent | 17b8d1900d56df1e14edd8829acf22686fa08eac (diff) | |
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 <[email protected]>
Tested-by: Nick Hu <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Anup Patel <[email protected]>
Diffstat (limited to 'lib/utils')
| -rw-r--r-- | lib/utils/ipi/aclint_mswi.c | 3 | ||||
| -rw-r--r-- | lib/utils/ipi/andes_plicsw.c | 3 | ||||
| -rw-r--r-- | lib/utils/irqchip/imsic.c | 3 |
3 files changed, 6 insertions, 3 deletions
diff --git a/lib/utils/ipi/aclint_mswi.c b/lib/utils/ipi/aclint_mswi.c index 9e55078a..d4acacf0 100644 --- a/lib/utils/ipi/aclint_mswi.c +++ b/lib/utils/ipi/aclint_mswi.c @@ -62,6 +62,7 @@ static void mswi_ipi_clear(void) static struct sbi_ipi_device aclint_mswi = { .name = "aclint-mswi", + .rating = 100, .ipi_send = mswi_ipi_send, .ipi_clear = mswi_ipi_clear }; @@ -106,7 +107,7 @@ int aclint_mswi_cold_init(struct aclint_mswi_data *mswi) if (rc) return rc; - sbi_ipi_set_device(&aclint_mswi); + sbi_ipi_add_device(&aclint_mswi); return 0; } diff --git a/lib/utils/ipi/andes_plicsw.c b/lib/utils/ipi/andes_plicsw.c index 5d085d85..3621e3cb 100644 --- a/lib/utils/ipi/andes_plicsw.c +++ b/lib/utils/ipi/andes_plicsw.c @@ -61,6 +61,7 @@ static void plicsw_ipi_clear(void) static struct sbi_ipi_device plicsw_ipi = { .name = "andes_plicsw", + .rating = 200, .ipi_send = plicsw_ipi_send, .ipi_clear = plicsw_ipi_clear }; @@ -99,7 +100,7 @@ int plicsw_cold_ipi_init(struct plicsw_data *plicsw) if (rc) return rc; - sbi_ipi_set_device(&plicsw_ipi); + sbi_ipi_add_device(&plicsw_ipi); return 0; } diff --git a/lib/utils/irqchip/imsic.c b/lib/utils/irqchip/imsic.c index 057b9fa7..d72ef794 100644 --- a/lib/utils/irqchip/imsic.c +++ b/lib/utils/irqchip/imsic.c @@ -199,6 +199,7 @@ static void imsic_ipi_send(u32 hart_index) static struct sbi_ipi_device imsic_ipi_device = { .name = "aia-imsic", + .rating = 300, .ipi_send = imsic_ipi_send }; @@ -393,7 +394,7 @@ int imsic_cold_irqchip_init(struct imsic_data *imsic) sbi_irqchip_add_device(&imsic_device); /* Register IPI device */ - sbi_ipi_set_device(&imsic_ipi_device); + sbi_ipi_add_device(&imsic_ipi_device); return 0; } |
