]> git.proxmox.com Git - mirror_qemu.git/commit
target/riscv/cpu.c: add priv_spec validate/disable_exts helpers
authorDaniel Henrique Barboza <dbarboza@ventanamicro.com>
Wed, 17 May 2023 13:57:10 +0000 (10:57 -0300)
committerAlistair Francis <alistair.francis@wdc.com>
Tue, 13 Jun 2023 07:02:19 +0000 (17:02 +1000)
commitbd30559568607324f467bff66d8644fc08cb4729
tree66104a54ef127de552f275205a89a34509f6d5cf
parentd33e39f995c377fee61281ddf44cd793e1a45625
target/riscv/cpu.c: add priv_spec validate/disable_exts helpers

We're doing env->priv_spec validation and assignment at the start of
riscv_cpu_realize(), which is fine, but then we're doing a force disable
on extensions that aren't compatible with the priv version.

This second step is being done too early. The disabled extensions might be
re-enabled again in riscv_cpu_validate_set_extensions() by accident. A
better place to put this code is at the end of
riscv_cpu_validate_set_extensions() after all the validations are
completed.

Add a new helper, riscv_cpu_disable_priv_spec_isa_exts(), to disable the
extesions after the validation is done. While we're at it, create a
riscv_cpu_validate_priv_spec() helper to host all env->priv_spec related
validation to unclog riscv_cpu_realize a bit.

Signed-off-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
Reviewed-by: LIU Zhiwei <zhiwei_liu@linux.alibaba.com>
Reviewed-by: Weiwei Li <liweiwei@iscas.ac.cn>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Message-Id: <20230517135714.211809-8-dbarboza@ventanamicro.com>
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
target/riscv/cpu.c