Hi Alistair, On 12/8/21 07:42, Alistair Francis wrote: > From: Alistair Francis <alistair.fran...@wdc.com> > > Signed-off-by: Alistair Francis <alistair.fran...@wdc.com> > --- > hw/intc/sifive_plic.c | 12 ++++++++++++ > 1 file changed, 12 insertions(+) > > diff --git a/hw/intc/sifive_plic.c b/hw/intc/sifive_plic.c > index 877e76877c..35f097799a 100644 > --- a/hw/intc/sifive_plic.c > +++ b/hw/intc/sifive_plic.c > @@ -355,6 +355,17 @@ static const MemoryRegionOps sifive_plic_ops = { > } > }; > > +static void sifive_plic_reset(DeviceState *dev) > +{ > + SiFivePLICState *s = SIFIVE_PLIC(dev); > + > + memset(s->source_priority, 0, sizeof(uint32_t) * s->num_sources); > + memset(s->target_priority, 0, sizeof(uint32_t) * s->num_addrs); > + memset(s->pending, 0, sizeof(uint32_t) * s->bitfield_words); > + memset(s->claimed, 0, sizeof(uint32_t) * s->bitfield_words); > + memset(s->enable, 0, sizeof(uint32_t) * s->num_enables);
Looking at sifive_plic_realize(): - Should we reset the external IRQs in a default state? - Shouldn't riscv_cpu_claim_interrupts() be called at reset? Note: parse_hart_config() name is slightly confusing since beside parsing, it also allocates addr_config. Maybe consider renaming?