All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] riscv: Fix local irq restore when flags indicates irq disabled
@ 2023-07-25  7:05 ` Xu Lu
  0 siblings, 0 replies; 20+ messages in thread
From: Xu Lu @ 2023-07-25  7:05 UTC (permalink / raw)
  To: paul.walmsley, palmer, aou; +Cc: linux-riscv, linux-kernel, Xu Lu

When arch_local_irq_restore() is called with flags indicating irqs
disabled, we need to clear SR_IE bit in CSR_STATUS, whereas current
implementation based on csr_set() function only sets SR_IE bit of
CSR_STATUS when SR_IE bit of flags is high and does nothing when
SR_IE bit of flags is low.

This commit supplies csr clear operation when calling irq restore
function with flags indicating irq disabled.

Fixes: 6d60b6ee0c97 ("RISC-V: Device, timer, IRQs, and the SBI")
Signed-off-by: Xu Lu <luxu.kernel@bytedance.com>
---
 arch/riscv/include/asm/irqflags.h | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/arch/riscv/include/asm/irqflags.h b/arch/riscv/include/asm/irqflags.h
index 08d4d6a5b7e9..7c31fc3c3559 100644
--- a/arch/riscv/include/asm/irqflags.h
+++ b/arch/riscv/include/asm/irqflags.h
@@ -49,7 +49,10 @@ static inline int arch_irqs_disabled(void)
 /* set interrupt enabled status */
 static inline void arch_local_irq_restore(unsigned long flags)
 {
-	csr_set(CSR_STATUS, flags & SR_IE);
+	if (flags & SR_IE)
+		csr_set(CSR_STATUS, SR_IE);
+	else
+		csr_clear(CSR_STATUS, SR_IE);
 }
 
 #endif /* _ASM_RISCV_IRQFLAGS_H */
-- 
2.39.2 (Apple Git-143)


_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

^ permalink raw reply related	[flat|nested] 20+ messages in thread

end of thread, other threads:[~2024-06-19  3:53 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-07-25  7:05 [PATCH] riscv: Fix local irq restore when flags indicates irq disabled Xu Lu
2023-07-25  7:05 ` Xu Lu
2023-08-09  6:05 ` Palmer Dabbelt
2023-08-09  6:05   ` Palmer Dabbelt
2023-08-09  6:58   ` [External] " 旭路
2023-08-09  6:58     ` 旭路
2023-08-24 12:08     ` Xu Lu
2023-08-24 12:08       ` Xu Lu
2024-06-18  9:45       ` Alexandre Ghiti
2024-06-18  9:45         ` Alexandre Ghiti
2024-06-18 10:00         ` Xu Lu
2024-06-18 10:00           ` Xu Lu
2024-06-18 10:02           ` Alexandre Ghiti
2024-06-18 10:02             ` Alexandre Ghiti
2024-06-18 11:05         ` Andrea Parri
2024-06-18 11:05           ` Andrea Parri
2024-06-18 11:52           ` Alexandre Ghiti
2024-06-18 11:52             ` Alexandre Ghiti
2024-06-19  3:53             ` Xu Lu
2024-06-19  3:53               ` Xu Lu

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.