Re: [PATCH] target/riscv: fix wfi exception behavior

2021-04-16 Thread Jose Martins
> > -if ((env->priv == PRV_S && > > -get_field(env->mstatus, MSTATUS_TW)) || > > -riscv_cpu_virt_enabled(env)) { > > +if ((!riscv_cpu_virt_enabled(env) && env->priv == PRV_U) || > > > +(env->priv == PRV_S && get_field(env->mstatus, MSTATUS_TW))) { > > Shouldn't we ch

Re: [PATCH] target/riscv: fix wfi exception behavior

2021-04-15 Thread Alistair Francis
On Sun, Apr 11, 2021 at 5:41 AM Jose Martins wrote: > > The wfi exception trigger behavior was not taking into account the fact > that user mode is not allowed to execute wfi instructions or the effect > of the hstatus.vtw bit. It was also always generating virtual instruction > exceptions when th