Skip to content

Commit 3ee9256

Browse files
avpatelMarc Zyngier
authored andcommitted
RISC-V: Clear SIP bit only when using SBI IPI operations
The software interrupt pending (i.e. [M|S]SIP) bit is writeable for S-mode but read-only for M-mode so we clear this bit only when using SBI IPI operations. Signed-off-by: Anup Patel <apatel@ventanamicro.com> Reviewed-by: Bin Meng <bmeng.cn@gmail.com> Reviewed-by: Atish Patra <atishp@rivosinc.com> Acked-by: Palmer Dabbelt <palmer@rivosinc.com> Signed-off-by: Marc Zyngier <maz@kernel.org> Link: https://lore.kernel.org/r/20230328035223.1480939-2-apatel@ventanamicro.com
1 parent 197b6b6 commit 3ee9256

2 files changed

Lines changed: 7 additions & 3 deletions

File tree

arch/riscv/kernel/sbi.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -646,8 +646,14 @@ static void sbi_send_cpumask_ipi(const struct cpumask *target)
646646
sbi_send_ipi(target);
647647
}
648648

649+
static void sbi_ipi_clear(void)
650+
{
651+
csr_clear(CSR_IP, IE_SIE);
652+
}
653+
649654
static const struct riscv_ipi_ops sbi_ipi_ops = {
650-
.ipi_inject = sbi_send_cpumask_ipi
655+
.ipi_inject = sbi_send_cpumask_ipi,
656+
.ipi_clear = sbi_ipi_clear
651657
};
652658

653659
void __init sbi_init(void)

arch/riscv/kernel/smp.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,8 +112,6 @@ void riscv_clear_ipi(void)
112112
{
113113
if (ipi_ops && ipi_ops->ipi_clear)
114114
ipi_ops->ipi_clear();
115-
116-
csr_clear(CSR_IP, IE_SIE);
117115
}
118116
EXPORT_SYMBOL_GPL(riscv_clear_ipi);
119117

0 commit comments

Comments
 (0)