From f520256d03da84e7ff8bddd084ef873192f46304 Mon Sep 17 00:00:00 2001 From: Anup Patel Date: Tue, 21 Nov 2023 14:49:42 +0530 Subject: lib: sbi: Allow relaxed MMIO writes in device ipi_send() callback Currently, we have a smp_wmb() between atomic_raw_set_bit() and ipi_send() device callback whereas the MMIO writes done by the device ipi_send() callback will also include a barrier. We can avoid unnecessary/redundant barriers described above by allowing relaxed MMIO writes in device ipi_send() callback. To achieve this, we simply use wmb() instead of smp_wmb() before calling device ipi_send(). Signed-off-by: Anup Patel Reported-by: Bo Gan --- lib/utils/ipi/aclint_mswi.c | 2 +- lib/utils/irqchip/imsic.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'lib/utils') diff --git a/lib/utils/ipi/aclint_mswi.c b/lib/utils/ipi/aclint_mswi.c index a3bfb4a9..bfd6a45b 100644 --- a/lib/utils/ipi/aclint_mswi.c +++ b/lib/utils/ipi/aclint_mswi.c @@ -41,7 +41,7 @@ static void mswi_ipi_send(u32 hart_index) /* Set ACLINT IPI */ msip = (void *)mswi->addr; - writel(1, &msip[sbi_hartindex_to_hartid(hart_index) - + writel_relaxed(1, &msip[sbi_hartindex_to_hartid(hart_index) - mswi->first_hartid]); } diff --git a/lib/utils/irqchip/imsic.c b/lib/utils/irqchip/imsic.c index 78f5895a..36ef66cf 100644 --- a/lib/utils/irqchip/imsic.c +++ b/lib/utils/irqchip/imsic.c @@ -186,8 +186,8 @@ static void imsic_ipi_send(u32 hart_index) } if (regs->size && (reloff < regs->size)) - writel(IMSIC_IPI_ID, - (void *)(regs->addr + reloff + IMSIC_MMIO_PAGE_LE)); + writel_relaxed(IMSIC_IPI_ID, + (void *)(regs->addr + reloff + IMSIC_MMIO_PAGE_LE)); } static struct sbi_ipi_device imsic_ipi_device = { -- cgit v1.2.3