hw/intc/ibex_plic: Clear the claim register when read
authorAlistair Francis <alistair.francis@wdc.com>
Fri, 6 Nov 2020 02:32:19 +0000 (18:32 -0800)
committerAlistair Francis <alistair.francis@wdc.com>
Mon, 9 Nov 2020 23:09:53 +0000 (15:09 -0800)
After claiming the interrupt by reading the claim register we want to
clear the register to make sure the interrupt doesn't appear at the next
read.

This matches the documentation for the claim register as when an interrupt
is claimed by a target the relevant bit of IP is cleared (which we already
do): https://docs.opentitan.org/hw/ip/rv_plic/doc/index.html

This also matches the current hardware.

Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Message-id: 68d4575deef2559b7a747f3bda193fcf43af4558.1604629928.git.alistair.francis@wdc.com

hw/intc/ibex_plic.c

index f49fa67c9100ebd47fd93b77518a4f80fb4c8f86..235e6b88ff9fc82884fb84dbe01e9df1109c0fd5 100644 (file)
@@ -139,6 +139,9 @@ static uint64_t ibex_plic_read(void *opaque, hwaddr addr,
         /* Return the current claimed interrupt */
         ret = s->claim;
 
+        /* Clear the claimed interrupt */
+        s->claim = 0x00000000;
+
         /* Update the interrupt status after the claim */
         ibex_plic_update(s);
     }