Re: [PATCH v2 2/4] target/nios2: Exteral Interrupt Controller (EIC)

2022-03-03 Thread Peter Maydell
On Thu, 3 Mar 2022 at 09:54, Amir Gonnen wrote: > > > This looks wrong. Of course, so does nios2_cpu_set_irq, from which you've > > cribbed this. > > > For our purposes, I think simply re-using env->regs[CR_IPENDING] as the > > external hw > > request word is the right thing to do. But we

RE: [PATCH v2 2/4] target/nios2: Exteral Interrupt Controller (EIC)

2022-03-03 Thread Amir Gonnen
> This looks wrong. Of course, so does nios2_cpu_set_irq, from which you've > cribbed this. > For our purposes, I think simply re-using env->regs[CR_IPENDING] as the > external hw > request word is the right thing to do. But we need to update RDCTL to > compute the > correct value from

Re: [PATCH v2 2/4] target/nios2: Exteral Interrupt Controller (EIC)

2022-02-25 Thread Peter Maydell
On Thu, 24 Feb 2022 at 23:56, Richard Henderson wrote: > > On 2/24/22 03:48, Amir Gonnen wrote: > > +static void nios2_cpu_set_eic_irq(Nios2CPU *cpu, int level) > > +{ > > +CPUNios2State *env = >env; > > +CPUState *cs = CPU(cpu); > > + > > +env->irq_pending = level; > > + > > +if

Re: [PATCH v2 2/4] target/nios2: Exteral Interrupt Controller (EIC)

2022-02-24 Thread Richard Henderson
On 2/24/22 03:48, Amir Gonnen wrote: +static void nios2_cpu_set_eic_irq(Nios2CPU *cpu, int level) +{ +CPUNios2State *env = >env; +CPUState *cs = CPU(cpu); + +env->irq_pending = level; + +if (env->irq_pending && nios2_take_eic_irq(cpu)) { +env->irq_pending = 0; +

[PATCH v2 2/4] target/nios2: Exteral Interrupt Controller (EIC)

2022-02-24 Thread Amir Gonnen
Implement Exteral Interrupt Controller interface (EIC). Added intc_present property, true by default. When set to false, nios2 uses the EIC interface when handling IRQ. When set to true (default) it uses the internal interrupt controller. When nios2 recieves irq, it first checks intc_present to