qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Richard Henderson <richard.henderson@linaro.org>
To: baturo.alexey@gmail.com
Cc: zhiwei_liu@linux.alibaba.com, dbarboza@ventanamicro.com,
	liwei1518@gmail.com, alistair23@gmail.com,
	frank.chang@sifive.com, palmer@dabbelt.com,
	Alistair.Francis@wdc.com, sagark@eecs.berkeley.edu,
	kbastian@mail.uni-paderborn.de, qemu-devel@nongnu.org,
	qemu-riscv@nongnu.org
Subject: Re: [PATCH 2/7] target/riscv: Add new CSR fields for S{sn,mn,m}pm extensions as part of Zjpm v1.0
Date: Mon, 11 Nov 2024 07:27:15 -0800	[thread overview]
Message-ID: <e67eeffa-ce03-46cc-a413-cd6803d54632@linaro.org> (raw)
In-Reply-To: <20241108060116.37397-3-baturo.alexey@gmail.com>

On 11/7/24 22:01, baturo.alexey@gmail.com wrote:
> @@ -2424,6 +2433,12 @@ static RISCVException write_senvcfg(CPURISCVState *env, int csrno,
>                                       target_ulong val)
>   {
>       uint64_t mask = SENVCFG_FIOM | SENVCFG_CBIE | SENVCFG_CBCFE | SENVCFG_CBZE;
> +    /* Update PMM field only if the value is valid according to Zjpm v1.0 */
> +    if (env_archcpu(env)->cfg.ext_ssnpm &&
> +        riscv_cpu_mxl(env) == MXL_RV64 &&
> +        (get_field(val, SENVCFG_PMM) != PMM_FIELD_RESERVED)) {
> +        mask |= SENVCFG_PMM;
> +    }
>       RISCVException ret;
>   
>       ret = smstateen_acc_ok(env, 0, SMSTATEEN0_HSENVCFG);

Do not insert statements into the declarations at the start of the block.
Drop the unnecessary () around != (multiple instances).

> @@ -3525,6 +3546,15 @@ static RISCVException read_hstatus(CPURISCVState *env, int csrno,
>   static RISCVException write_hstatus(CPURISCVState *env, int csrno,
>                                       target_ulong val)
>   {
> +    uint64_t mask = (target_ulong)-1;
> +    /* Update PMM field only if the value is valid according to Zjpm v1.0 */
> +    if (env_archcpu(env)->cfg.ext_ssnpm &&
> +        (riscv_cpu_mxl(env) == MXL_RV64) &&
> +        (get_field(val, HSTATUS_HUPMM) == PMM_FIELD_RESERVED)) {
> +        mask &= ~HSTATUS_HUPMM;
> +    }

Surely you'd not install HUPMM if ext_ssnpm is false?
Is this missing other extension checks?


> +    env->hstatus = (env->hstatus & ~mask) | (val & mask);
> +
>       env->hstatus = val;

Failure to remove previous assignment.


r~


  reply	other threads:[~2024-11-11 15:28 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-08  6:01 [PATCH 0/7] Pointer Masking update for Zjpm v1.0 baturo.alexey
2024-11-08  6:01 ` [PATCH 1/7] target/riscv: Remove obsolete pointer masking extension code baturo.alexey
2024-11-08  6:01 ` [PATCH 2/7] target/riscv: Add new CSR fields for S{sn, mn, m}pm extensions as part of Zjpm v1.0 baturo.alexey
2024-11-11 15:27   ` Richard Henderson [this message]
2024-11-08  6:01 ` [PATCH 3/7] target/riscv: Add helper functions to calculate current number of masked bits for pointer masking baturo.alexey
2024-11-08  6:01 ` [PATCH 4/7] target/riscv: Add pointer masking tb flags baturo.alexey
2024-11-08  6:01 ` [PATCH 5/7] target/riscv: Update address modify functions to take into account pointer masking baturo.alexey
2024-11-08  6:01 ` [PATCH 6/7] target/riscv: Apply pointer masking for virtualized memory accesses baturo.alexey
2024-11-08  6:01 ` [PATCH 7/7] target/riscv: Enable updates for pointer masking variables and thus enable pointer masking extension baturo.alexey
2024-11-11 17:14   ` Daniel Henrique Barboza

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=e67eeffa-ce03-46cc-a413-cd6803d54632@linaro.org \
    --to=richard.henderson@linaro.org \
    --cc=Alistair.Francis@wdc.com \
    --cc=alistair23@gmail.com \
    --cc=baturo.alexey@gmail.com \
    --cc=dbarboza@ventanamicro.com \
    --cc=frank.chang@sifive.com \
    --cc=kbastian@mail.uni-paderborn.de \
    --cc=liwei1518@gmail.com \
    --cc=palmer@dabbelt.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-riscv@nongnu.org \
    --cc=sagark@eecs.berkeley.edu \
    --cc=zhiwei_liu@linux.alibaba.com \
    /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).