* trigger the interrupt
*/
atomic_raw_set_bit(event, &ipi_data->ipi_type);
- smp_wmb();
- if (ipi_dev && ipi_dev->ipi_send)
- ipi_dev->ipi_send(remote_hartindex);
+ ret = sbi_ipi_raw_send(remote_hartindex);
sbi_pmu_ctr_incr_fw(SBI_PMU_FW_IPI_SENT);
- return 0;
+ return ret;
}
static int sbi_ipi_sync(struct sbi_scratch *scratch, u32 event)
if (!ipi_dev || !ipi_dev->ipi_send)
return SBI_EINVAL;
+ /*
+ * Ensure that memory or MMIO writes done before
+ * this function are not observed after the memory
+ * or MMIO writes done by the ipi_send() device
+ * callback. This also allows the ipi_send() device
+ * callback to use relaxed MMIO writes.
+ */
+ wmb();
+
ipi_dev->ipi_send(hartindex);
return 0;
}
/* 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]);
}
}
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 = {