qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v2 03/24] target/riscv: save and restore elp state on priv tr


From: Deepak Gupta
Subject: Re: [PATCH v2 03/24] target/riscv: save and restore elp state on priv transitions
Date: Mon, 29 Jul 2024 16:33:39 -0700

Thanks Richard.

On Tue, Jul 30, 2024 at 09:04:29AM +1000, Richard Henderson wrote:
On 7/30/24 03:53, Deepak Gupta wrote:
elp state is recorded in *status on trap entry (less privilege to higher
privilege) and restored in elp from *status on trap exit (higher to less
privilege).

Additionally this patch introduces a forward cfi helper function to
determine if current privilege has forward cfi is enabled or not based on
*envcfg (for U, VU, S, VU, HS) or mseccfg csr (for M). For qemu-user, a
new field `ufcfien` is introduced which is by default set to false and
helper function returns value deposited in `ufcfien` for qemu-user.

Why are you using a different field for qemu-user?
Much better to simply configure menvcfg the same as for system mode.


I am assuming `CONFIG_USER_ONLY` is set for qemu-user builds and unset
for `not qemu-user` builds. Let me know if I got that right?

`menvcfg` (and a lot of other system related fields CPUArchstate for riscv)
are wrapped under `#ifndef CONFIG_USER_ONLY`. So `menvcfg` field is not
available for qemu-user compile.




+        return (env->menvcfg & MENVCFG_LPE) ? true : false;

Never use ?: with true/false. Use the correct boolean expression in the first place, which in this case is just the & expression.

Noted.
Will fix this and other instances in patch series.



r~



reply via email to

[Prev in Thread] Current Thread [Next in Thread]