forked from Mirrors/opensbi
lib: save/restore MIE CSR in sbi_hart_wait_for_coldboot()
Currently, sbi_hart_wait_for_coldboot() leaves MIE.MSIP bit set when it returns which is not correct because MIE.MSIP should be left enabled only by sbi_ipi_init(). This patch does save/restore of MIE CSR to ensure that MIE CSR is in original state after sbi_hart_wait_for_coldboot() returns. Signed-off-by: Anup Patel <anup.patel@wdc.com> Reviewed-by: Atish Patra <atish.patra@wdc.com>
This commit is contained in:
@@ -354,12 +354,16 @@ static unsigned long coldboot_wait_bitmap = 0;
|
|||||||
|
|
||||||
void sbi_hart_wait_for_coldboot(struct sbi_scratch *scratch, u32 hartid)
|
void sbi_hart_wait_for_coldboot(struct sbi_scratch *scratch, u32 hartid)
|
||||||
{
|
{
|
||||||
|
unsigned long saved_mie;
|
||||||
const struct sbi_platform *plat = sbi_platform_ptr(scratch);
|
const struct sbi_platform *plat = sbi_platform_ptr(scratch);
|
||||||
|
|
||||||
if ((sbi_platform_hart_count(plat) <= hartid) ||
|
if ((sbi_platform_hart_count(plat) <= hartid) ||
|
||||||
(COLDBOOT_WAIT_BITMAP_SIZE <= hartid))
|
(COLDBOOT_WAIT_BITMAP_SIZE <= hartid))
|
||||||
sbi_hart_hang();
|
sbi_hart_hang();
|
||||||
|
|
||||||
|
/* Save MIE CSR */
|
||||||
|
saved_mie = csr_read(CSR_MIE);
|
||||||
|
|
||||||
/* Set MSIE bit to receive IPI */
|
/* Set MSIE bit to receive IPI */
|
||||||
csr_set(CSR_MIE, MIP_MSIP);
|
csr_set(CSR_MIE, MIP_MSIP);
|
||||||
|
|
||||||
@@ -382,6 +386,9 @@ void sbi_hart_wait_for_coldboot(struct sbi_scratch *scratch, u32 hartid)
|
|||||||
/* Release coldboot lock */
|
/* Release coldboot lock */
|
||||||
spin_unlock(&coldboot_lock);
|
spin_unlock(&coldboot_lock);
|
||||||
|
|
||||||
|
/* Restore MIE CSR */
|
||||||
|
csr_write(CSR_MIE, saved_mie);
|
||||||
|
|
||||||
/* Clear current HART IPI */
|
/* Clear current HART IPI */
|
||||||
sbi_platform_ipi_clear(plat, hartid);
|
sbi_platform_ipi_clear(plat, hartid);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user