Message ID | 20200626214410.3613258-3-alistair.francis@wdc.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | [PULL,01/63] riscv: plic: Honour source priorities | expand |
On Fri, Jun 26, 2020 at 3:01 PM Jessica Clarke <jrtc27@jrtc27.com> wrote: > > On 26 Jun 2020, at 22:43, Alistair Francis <alistair.francis@wdc.com> wrote: > > > > From: Jessica Clarke <jrtc27@jrtc27.com> > > > > Claiming an interrupt and changing the source priority both potentially > > affect whether an interrupt is pending, thus we must re-compute xEIP. > > Note that we don't put the sifive_plic_update inside sifive_plic_claim > > so that the logging of a claim (and the resulting IRQ) happens before > > the state update, making the causal effect clear, and that we drop the > > explicit call to sifive_plic_print_state when claiming since > > sifive_plic_update already does that automatically at the end for us. > > > > This can result in both spurious interrupt storms if you fail to > > complete an IRQ before enabling interrupts (and no other actions occur > > that result in a call to sifive_plic_update), but also more importantly > > lost interrupts if a disabled interrupt is pending and then becomes > > enabled. > > > > Signed-off-by: Jessica Clarke <jrtc27@jrtc27.com> > > Reviewed-by: Alistair Francis <alistair.francis@wdc.com> > > Message-id: 20200618210649.22451-1-jrtc27@jrtc27.com > > Message-Id: <20200618210649.22451-1-jrtc27@jrtc27.com> > > Something went a bit weird here. Argh! Patches seems to apply two Message-id tags and I forgot to remove them from these two. I don't think this is a blocker though. Let me know if you or Peter thinks it is and I can send a v2. Alistair > > Jess >
On 26 Jun 2020, at 22:43, Alistair Francis <alistair.francis@wdc.com> wrote: > > From: Jessica Clarke <jrtc27@jrtc27.com> > > Claiming an interrupt and changing the source priority both potentially > affect whether an interrupt is pending, thus we must re-compute xEIP. > Note that we don't put the sifive_plic_update inside sifive_plic_claim > so that the logging of a claim (and the resulting IRQ) happens before > the state update, making the causal effect clear, and that we drop the > explicit call to sifive_plic_print_state when claiming since > sifive_plic_update already does that automatically at the end for us. > > This can result in both spurious interrupt storms if you fail to > complete an IRQ before enabling interrupts (and no other actions occur > that result in a call to sifive_plic_update), but also more importantly > lost interrupts if a disabled interrupt is pending and then becomes > enabled. > > Signed-off-by: Jessica Clarke <jrtc27@jrtc27.com> > Reviewed-by: Alistair Francis <alistair.francis@wdc.com> > Message-id: 20200618210649.22451-1-jrtc27@jrtc27.com > Message-Id: <20200618210649.22451-1-jrtc27@jrtc27.com> Something went a bit weird here. Jess
diff --git a/hw/riscv/sifive_plic.c b/hw/riscv/sifive_plic.c index d91e82b8ab..c20c192034 100644 --- a/hw/riscv/sifive_plic.c +++ b/hw/riscv/sifive_plic.c @@ -255,8 +255,8 @@ static uint64_t sifive_plic_read(void *opaque, hwaddr addr, unsigned size) plic->addr_config[addrid].hartid, mode_to_char(plic->addr_config[addrid].mode), value); - sifive_plic_print_state(plic); } + sifive_plic_update(plic); return value; } } @@ -287,6 +287,7 @@ static void sifive_plic_write(void *opaque, hwaddr addr, uint64_t value, qemu_log("plic: write priority: irq=%d priority=%d\n", irq, plic->source_priority[irq]); } + sifive_plic_update(plic); return; } else if (addr >= plic->pending_base && /* 1 bit per source */ addr < plic->pending_base + (plic->num_sources >> 3))