On 2023/3/23 6:19, Daniel Henrique Barboza wrote:
> set_misa() will be tuned up to do more than it's already doing and it
> will be redundant to what riscv_cpu_validate_set_extensions() does.
>
> Note that we don't ever change env->misa_mlx
typo.
> in this function, so
> set_misa() can be replaced by just assigning env->misa_ext and
> env->misa_ext_mask to 'ext'.
>
> Signed-off-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
> ---
> target/riscv/cpu.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c
> index c7b6e7b84b..36c55abda0 100644
> --- a/target/riscv/cpu.c
> +++ b/target/riscv/cpu.c
> @@ -949,7 +949,8 @@ static void riscv_cpu_validate_misa_mxl(RISCVCPU *cpu, Error **errp)
>
> /*
> * Check consistency between chosen extensions while setting
> - * cpu->cfg accordingly, doing a set_misa() in the end.
> + * cpu->cfg accordingly, setting env->misa_ext and
> + * misa_ext_mask in the end.
> */
> static void riscv_cpu_validate_set_extensions(RISCVCPU *cpu, Error **errp)
> {
> @@ -1168,7 +1169,7 @@ static void riscv_cpu_validate_set_extensions(RISCVCPU *cpu, Error **errp)
> ext |= RVJ;
> }
>
> - set_misa(env, env->misa_mxl, ext);
> + env->misa_ext_mask = env->misa_ext = ext;
Reviewed-by: LIU Zhiwei <zhiwei_liu@linux.alibaba.com>
Zhiwei
> }
>
> #ifndef CONFIG_USER_ONLY