Skip to contentSkip to conversation

riscv: Fix local irq restore when flags indicates irq disabled

PATCH RESEND In review Xu Lu 2 participants 5 messages Aug 3, 2023 RISC-V

lore
Share & tools
lore

Xu Lu

author
#0 lore raw

PATCH RESEND 1/1 riscv: Fix local irq restore when flags indicates irq disabled

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")
---
 arch/riscv/include/asm/irqflags.h | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
arch/riscv/include/asm/irqflags.h +4 -1
index 08d4d6a5b7e9..7c31fc3c3559 100644
@@ -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 */
Signature · 7 lines
2.20.1


_______________________________________________
linux-riscv mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-riscv
#1 lore raw

Hey,

Quoted 6 lines · 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.

Quoted 6 lines

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")

---

There's no changelog or explanation, so what is the reason for the resend?

Cheers,
Conor.

Quoted 27 lines
 arch/riscv/include/asm/irqflags.h | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
arch/riscv/include/asm/irqflags.h +4 -1
index 08d4d6a5b7e9..7c31fc3c3559 100644
@@ -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 */
Signature · 7 lines
2.20.1


_______________________________________________
linux-riscv mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-riscv

_______________________________________________
linux-riscv mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-riscv

author
#2 lore raw
Quoted 17 lines · Conor Dooley

Hey,

Quoted 6 lines · 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.

Quoted 6 lines

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")

---

Quoted 5 lines

There's no changelog or explanation, so what is the reason for the resend?

Cheers,
Conor.

Sorry for disturbing you.

I haven't received any response since the patch was sent last week. I think maintainers are busy and thus I want to have a ping. This patch was resent because I found it is said that resending patch is one of the methods to ping maintainers in this kernel doc:
https://www.kernel.org/doc/html/latest/process/submitting-patches.html.

Quoted 23 lines
Quoted 23 lines
 arch/riscv/include/asm/irqflags.h | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
arch/riscv/include/asm/irqflags.h +4 -2
index 08d4d6a5b7e9..7c31fc3c3559 100644
@@ -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.20.1

Quoted 4 lines
Quoted 4 lines

_______________________________________________
linux-riscv mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-riscv

_______________________________________________
linux-riscv mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-riscv

#3 lore raw
Quoted 18 lines · 旭路
Quoted 17 lines · Conor Dooley

Hey,

Quoted 12 lines · 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")

---

Quoted 7 lines
Quoted 5 lines

There's no changelog or explanation, so what is the reason for the resend?

Cheers,
Conor.

Sorry for disturbing you.

Nah, tis fine.

Quoted 5 lines

I haven't received any response since the patch was sent last week. I think maintainers are busy and thus I want to have a ping. This patch was resent because I found it is said that resending patch is one of the methods to ping maintainers in this kernel doc:
https://www.kernel.org/doc/html/latest/process/submitting-patches.html.

Right, resending is a valid way to do that - but leaving a comment about why you are resending under the --- line is advised so that people know why it is that you are resending.

Thanks,
Conor.

author
#4 lore raw
Quoted 36 lines · Conor Dooley
Quoted 18 lines · 旭路
Quoted 17 lines · Conor Dooley

Hey,

Quoted 12 lines · 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")

---

Quoted 7 lines
Quoted 5 lines

There's no changelog or explanation, so what is the reason for the resend?

Cheers,
Conor.

Sorry for disturbing you.

Nah, tis fine.

Quoted 5 lines

I haven't received any response since the patch was sent last week. I think maintainers are busy and thus I want to have a ping. This patch was resent because I found it is said that resending patch is one of the methods to ping maintainers in this kernel doc:
https://www.kernel.org/doc/html/latest/process/submitting-patches.html.

Quoted 6 lines

Right, resending is a valid way to do that - but leaving a comment about why you are resending under the --- line is advised so that people know why it is that you are resending.

Thanks,
Conor.

Got that. Thanks very much.

_______________________________________________
linux-riscv mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-riscv