qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Mayuresh Chitale <mchitale@ventanamicro.com>
To: Weiwei Li <liweiwei@iscas.ac.cn>
Cc: Alistair Francis <alistair.francis@wdc.com>,
	qemu-riscv@nongnu.org, qemu-devel@nongnu.org
Subject: Re: [RFC PATCH v2 2/4] target/riscv: smstateen check for h/senvcfg
Date: Thu, 24 Mar 2022 13:56:57 +0530	[thread overview]
Message-ID: <CAN37VV7wwwTWH+OiuR0n-Sp17R0MMjQAAEpyEz5fW6t=3EFBaA@mail.gmail.com> (raw)
In-Reply-To: <472dfd4e-099f-97e0-ba16-561df8ddeef1@iscas.ac.cn>

On Wed, Mar 23, 2022 at 6:22 PM Weiwei Li <liweiwei@iscas.ac.cn> wrote:
>
>
> 在 2022/3/23 下午7:13, Mayuresh Chitale 写道:
> > Accesses to henvcfg, henvcfgh and senvcfg are allowed
> > only if corresponding bit in mstateen0/hstateen0 is
> > enabled. Otherwise an illegal instruction trap is
> > generated.
> >
> > Signed-off-by: Mayuresh Chitale <mchitale@ventanamicro.com>
> > ---
> >   target/riscv/csr.c | 82 ++++++++++++++++++++++++++++++++++++++++++----
> >   1 file changed, 76 insertions(+), 6 deletions(-)
> >
> > diff --git a/target/riscv/csr.c b/target/riscv/csr.c
> > index 215c8ecef1..2388f0226f 100644
> > --- a/target/riscv/csr.c
> > +++ b/target/riscv/csr.c
> > @@ -39,6 +39,35 @@ void riscv_set_csr_ops(int csrno, riscv_csr_operations *ops)
> >   }
> >
> >   /* Predicates */
> > +static RISCVException smstateen_acc_ok(CPURISCVState *env, int mode, int bit)
> > +{
> > +    CPUState *cs = env_cpu(env);
> > +    RISCVCPU *cpu = RISCV_CPU(cs);
> > +    bool virt = riscv_cpu_virt_enabled(env);
> > +
> > +    if (!cpu->cfg.ext_smstateen) {
> > +        return RISCV_EXCP_NONE;
> > +    }
> > +
> > +    if (!(env->mstateen[0] & 1UL << bit)) {
> > +        return RISCV_EXCP_ILLEGAL_INST;
> > +    }
>
> I think here should be " & (1UL << bit) " . The same for following
> similar cases.

Ok. Will fix it in the next version.
>
> Regards,
>
> Weiwei Li
>


  reply	other threads:[~2022-03-24  8:50 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-23 11:13 [RFC PATCH v2 0/4] RISC-V Smstateen support Mayuresh Chitale
2022-03-23 11:13 ` [RFC PATCH v2 1/4] target/riscv: Add smstateen support Mayuresh Chitale
2022-03-23 13:01   ` Weiwei Li
2022-03-24  8:46     ` Mayuresh Chitale
2022-03-23 11:13 ` [RFC PATCH v2 2/4] target/riscv: smstateen check for h/senvcfg Mayuresh Chitale
2022-03-23 12:51   ` Weiwei Li
2022-03-24  8:26     ` Mayuresh Chitale [this message]
2022-03-23 11:13 ` [RFC PATCH v2 3/4] target/riscv: smstateen check for fcsr Mayuresh Chitale
2022-03-23 11:13 ` [RFC PATCH v2 4/4] target/riscv: smstateen check for AIA/IMSIC Mayuresh Chitale
2022-03-23 13:13   ` Weiwei Li
2022-03-24  8:28     ` Mayuresh Chitale

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAN37VV7wwwTWH+OiuR0n-Sp17R0MMjQAAEpyEz5fW6t=3EFBaA@mail.gmail.com' \
    --to=mchitale@ventanamicro.com \
    --cc=alistair.francis@wdc.com \
    --cc=liweiwei@iscas.ac.cn \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-riscv@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).