Hi, Daniel.

> On 11/12/2026 6:48 PM, Christian S. Lima wrote:
> > According to the Zicfilp specification the bit SPELP in the mstatus
> > register should be 0 (read-only) when s-mode is not present.
> >
> > Resolves: 
> > https://gitlab.com/qemu-project/qemu/-/work_items/4456#note_4181630619
> 
> The code LGTM but this tag doesn't do much as is.  Gitlab uses the tag to 
> automatically
> close the issue when the patch lands upstream.  It can't do much with a 
> comment.
> 
> Reading the bug I believe the reporter intention was to add this SPELP comment
> as a follow-up of what you've done in 4456, i.e. this should be done in that 
> same
> scope.  If we upstream them separately there's a risk of Gitlab closing 4456 
> and,
> if this patch is left behind, the reporter can notice that the bug wasn't 
> fully
> resolved and reopen it.
> 
> My suggestion is to either squash this change into the 4456 patch or send it 
> together
> as a 2 patch series.  Both are fine, as long as we upstream both changes at 
> the
> same time.

I'll resend as a patch series.

Thanks,
Christian

> 
> Thanks,
> Daniel
> 
> >
> > Signed-off-by: Christian S. Lima <[email protected]>
> > ---
> >   target/riscv/tcg/csr.c | 5 ++++-
> >   1 file changed, 4 insertions(+), 1 deletion(-)
> >
> > diff --git a/target/riscv/tcg/csr.c b/target/riscv/tcg/csr.c
> > index af444e3e6f..340c61a1c4 100644
> > --- a/target/riscv/tcg/csr.c
> > +++ b/target/riscv/tcg/csr.c
> > @@ -2124,7 +2124,10 @@ static RISCVException write_mstatus(CPURISCVState 
> > *env, int csrno,
> >
> >       /* If cfi lp extension is available, then apply cfi lp mask */
> >       if (env_archcpu(env)->cfg.ext_zicfilp) {
> > -        mask |= (MSTATUS_MPELP | MSTATUS_SPELP);
> > +        mask |= MSTATUS_MPELP;
> > +        if (riscv_has_ext(env, RVS)) {
> > +            mask |= MSTATUS_SPELP;
> > +        }
> >       }
> >
> >       mstatus = (mstatus & ~mask) | (val & mask);
> 
>

Reply via email to