static void sbi_hsm_hart_wait(struct sbi_scratch *scratch, u32 hartid)
{
unsigned long saved_mie;
- const struct sbi_platform *plat = sbi_platform_ptr(scratch);
struct sbi_hsm_data *hdata = sbi_scratch_offset_ptr(scratch,
hart_data_offset);
/* Save MIE CSR */
/* Restore MIE CSR */
csr_write(CSR_MIE, saved_mie);
- /* Clear current HART IPI */
- sbi_platform_ipi_clear(plat, hartid);
+ /*
+ * No need to clear IPI here because the sbi_ipi_init() will
+ * clear it for current HART via sbi_platform_ipi_init().
+ */
}
int sbi_hsm_init(struct sbi_scratch *scratch, u32 hartid, bool cold_boot)
static void wait_for_coldboot(struct sbi_scratch *scratch, u32 hartid)
{
unsigned long saved_mie, cmip;
- const struct sbi_platform *plat = sbi_platform_ptr(scratch);
/* Save MIE CSR */
saved_mie = csr_read(CSR_MIE);
/* Restore MIE CSR */
csr_write(CSR_MIE, saved_mie);
- /* Clear current HART IPI */
- sbi_platform_ipi_clear(plat, hartid);
+ /*
+ * The wait for coldboot is common for both warm startup and
+ * warm resume path so clearing IPI here would result in losing
+ * an IPI in warm resume path.
+ *
+ * Also, the sbi_platform_ipi_init() called from sbi_ipi_init()
+ * will automatically clear IPI for current HART.
+ */
}
static void wake_coldboot_harts(struct sbi_scratch *scratch, u32 hartid)
ipi_data = sbi_scratch_offset_ptr(scratch, ipi_data_off);
ipi_data->ipi_type = 0x00;
- /* Platform init */
+ /*
+ * Initialize platform IPI support. This will also clear any
+ * pending IPIs for current/calling HART.
+ */
ret = sbi_platform_ipi_init(sbi_platform_ptr(scratch), cold_boot);
if (ret)
return ret;