On Thu, 24 Feb 2022 at 23:56, Richard Henderson <richard.hender...@linaro.org> wrote: > > On 2/24/22 03:48, Amir Gonnen wrote: > > +static void nios2_cpu_set_eic_irq(Nios2CPU *cpu, int level) > > +{ > > + CPUNios2State *env = &cpu->env; > > + CPUState *cs = CPU(cpu); > > + > > + env->irq_pending = level; > > + > > + if (env->irq_pending && nios2_take_eic_irq(cpu)) { > > + env->irq_pending = 0; > > + cpu_interrupt(cs, CPU_INTERRUPT_HARD); > > + } else if (!env->irq_pending) { > > + cpu_reset_interrupt(cs, CPU_INTERRUPT_HARD); > > + } > > +} > > This looks wrong. Of course, so does nios2_cpu_set_irq, from which you've > cribbed this.
Bit of a thread from 2020 on nios2's odd interrupt handling; https://lore.kernel.org/qemu-devel/3260735e-05ab-2d42-f7e4-914ad804f...@linaro.org/ though it's mostly just you saying the same things you're saying now :-) xtensa's also weird in a similar way. -- PMM