Skip to contentSkip to conversation

riscv: plic: Clear the associated bit of irq_claimed when writing CLAIM

PATCH New Vincent Chen 2 participants 2 messages Sep 15, 2021 – Sep 27, 2021

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 riscv: plic: Clear the associated bit of irq_claimed when writing CLAIM

When an IRQ number is written to the claim register, it means this IRQ has been addressed. If this interrupt is still pending, PLIC should clear the associated bit of irq_claimed to allow this interrupt to be claimed again.

---
 riscv/plic.c | 3 +++
 1 file changed, 3 insertions(+)
riscv/plic.c +3 -0
index 07cadc7..d677bbf 100644
@@ -394,6 +394,9 @@ static void plic__context_write(struct plic_state *s,
 			irq_update = true;
 		break;
 	case CONTEXT_CLAIM:
+		val = ioport__read32(data);
+		if (val < plic.num_irq)
+			c->irq_claimed[val / 32] &= ~(1 << (val % 32));
 		break;
 	default:
 		irq_update = true;
Signature · 1 line
2.32.0
maintainer
#1 lore raw

PATCH 1/1 riscv: plic: Clear the associated bit of irq_claimed when writing CLAIM

Quoted 7 lines · Vincent Chen

When an IRQ number is written to the claim register, it means this IRQ has been addressed. If this interrupt is still pending, PLIC should clear the associated bit of irq_claimed to allow this interrupt to be claimed again.

Thanks Vincent, I have folded your change in PATCH5 of the v9 KVMTOOl RISC-V series along with your SoB.

Regards,
Anup

Quoted 26 lines
---
 riscv/plic.c | 3 +++
 1 file changed, 3 insertions(+)
riscv/plic.c +3 -1
index 07cadc7..d677bbf 100644
@@ -394,6 +394,9 @@ static void plic__context_write(struct plic_state *s,
                        irq_update = true;
                break;
        case CONTEXT_CLAIM:
+               val = ioport__read32(data);
+               if (val < plic.num_irq)
+                       c->irq_claimed[val / 32] &= ~(1 << (val % 32));
                break;
        default:
                irq_update = true;
--

2.32.0

--
kvm-riscv mailing list
kvm-riscv at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kvm-riscv