diff options
| author | Samuel Holland <samuel.holland@sifive.com> | 2023-12-09 00:22:58 +0300 |
|---|---|---|
| committer | Anup Patel <anup@brainfault.org> | 2023-12-18 16:56:33 +0300 |
| commit | 446fa65eb57947481583df043bc613a164172131 (patch) | |
| tree | 5c7df7dd16575fe1bf78e0d6c1d9a5f79494983b | |
| parent | a894187e28895ab8e1196dea838fdef4cc4d32b3 (diff) | |
| download | opensbi-446fa65eb57947481583df043bc613a164172131.tar.xz | |
lib: sbi_ipi: Process self-IPIs in sbi_ipi_send()
An IPI sent to the local hart can be processed directly instead of
triggering the IPI device. This is more efficient, and it avoids a
deadlock when the .sync callback is defined. Since interrupts are
disabled while handling an ecall, the IPI would not get delivered
until the next mret, but sbi_ipi_sync() is called before then.
Signed-off-by: Samuel Holland <samuel.holland@sifive.com>
Reviewed-by: Anup Patel <anup@brainfault.org>
Reviewed-by: Xiang W <wxjstz@126.com>
| -rw-r--r-- | lib/sbi/sbi_ipi.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/sbi/sbi_ipi.c b/lib/sbi/sbi_ipi.c index 56ba743..bbc97f7 100644 --- a/lib/sbi/sbi_ipi.c +++ b/lib/sbi/sbi_ipi.c @@ -60,6 +60,14 @@ static int sbi_ipi_send(struct sbi_scratch *scratch, u32 remote_hartindex, remote_hartindex, data); if (ret != SBI_IPI_UPDATE_SUCCESS) return ret; + } else if (scratch == remote_scratch) { + /* + * IPI events with an update() callback are expected to return + * SBI_IPI_UPDATE_BREAK for self-IPIs. For other events, check + * for self-IPI and execute the callback directly here. + */ + ipi_ops->process(scratch); + return 0; } /* |
