mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-09 10:34:58 -06:00
target/riscv: Move misa_mxl_max to class
misa_mxl_max is common for all instances of a RISC-V CPU class so they are better put into class. Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com> Reviewed-by: Alistair Francis <alistair.francis@wdc.com> Message-ID: <20240203-riscv-v11-2-a23f4848a628@daynix.com> Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
This commit is contained in:
parent
0e350c1ada
commit
742cc269c7
8 changed files with 112 additions and 99 deletions
|
@ -272,10 +272,9 @@ static void riscv_cpu_validate_misa_mxl(RISCVCPU *cpu)
|
|||
{
|
||||
RISCVCPUClass *mcc = RISCV_CPU_GET_CLASS(cpu);
|
||||
CPUClass *cc = CPU_CLASS(mcc);
|
||||
CPURISCVState *env = &cpu->env;
|
||||
|
||||
/* Validate that MISA_MXL is set properly. */
|
||||
switch (env->misa_mxl_max) {
|
||||
switch (mcc->misa_mxl_max) {
|
||||
#ifdef TARGET_RISCV64
|
||||
case MXL_RV64:
|
||||
case MXL_RV128:
|
||||
|
@ -426,6 +425,7 @@ static void riscv_cpu_validate_b(RISCVCPU *cpu)
|
|||
*/
|
||||
void riscv_cpu_validate_set_extensions(RISCVCPU *cpu, Error **errp)
|
||||
{
|
||||
RISCVCPUClass *mcc = RISCV_CPU_GET_CLASS(cpu);
|
||||
CPURISCVState *env = &cpu->env;
|
||||
Error *local_err = NULL;
|
||||
|
||||
|
@ -592,7 +592,7 @@ void riscv_cpu_validate_set_extensions(RISCVCPU *cpu, Error **errp)
|
|||
cpu_cfg_ext_auto_update(cpu, CPU_CFG_OFFSET(ext_zcb), true);
|
||||
cpu_cfg_ext_auto_update(cpu, CPU_CFG_OFFSET(ext_zcmp), true);
|
||||
cpu_cfg_ext_auto_update(cpu, CPU_CFG_OFFSET(ext_zcmt), true);
|
||||
if (riscv_has_ext(env, RVF) && env->misa_mxl_max == MXL_RV32) {
|
||||
if (riscv_has_ext(env, RVF) && mcc->misa_mxl_max == MXL_RV32) {
|
||||
cpu_cfg_ext_auto_update(cpu, CPU_CFG_OFFSET(ext_zcf), true);
|
||||
}
|
||||
}
|
||||
|
@ -600,7 +600,7 @@ void riscv_cpu_validate_set_extensions(RISCVCPU *cpu, Error **errp)
|
|||
/* zca, zcd and zcf has a PRIV 1.12.0 restriction */
|
||||
if (riscv_has_ext(env, RVC) && env->priv_ver >= PRIV_VERSION_1_12_0) {
|
||||
cpu_cfg_ext_auto_update(cpu, CPU_CFG_OFFSET(ext_zca), true);
|
||||
if (riscv_has_ext(env, RVF) && env->misa_mxl_max == MXL_RV32) {
|
||||
if (riscv_has_ext(env, RVF) && mcc->misa_mxl_max == MXL_RV32) {
|
||||
cpu_cfg_ext_auto_update(cpu, CPU_CFG_OFFSET(ext_zcf), true);
|
||||
}
|
||||
if (riscv_has_ext(env, RVD)) {
|
||||
|
@ -608,7 +608,7 @@ void riscv_cpu_validate_set_extensions(RISCVCPU *cpu, Error **errp)
|
|||
}
|
||||
}
|
||||
|
||||
if (env->misa_mxl_max != MXL_RV32 && cpu->cfg.ext_zcf) {
|
||||
if (mcc->misa_mxl_max != MXL_RV32 && cpu->cfg.ext_zcf) {
|
||||
error_setg(errp, "Zcf extension is only relevant to RV32");
|
||||
return;
|
||||
}
|
||||
|
@ -1307,7 +1307,7 @@ static void riscv_init_max_cpu_extensions(Object *obj)
|
|||
const RISCVCPUMultiExtConfig *prop;
|
||||
|
||||
/* Enable RVG, RVJ and RVV that are disabled by default */
|
||||
riscv_cpu_set_misa(env, env->misa_mxl, env->misa_ext | RVG | RVJ | RVV);
|
||||
riscv_cpu_set_misa_ext(env, env->misa_ext | RVG | RVJ | RVV);
|
||||
|
||||
for (prop = riscv_cpu_extensions; prop && prop->name; prop++) {
|
||||
isa_ext_update_enabled(cpu, prop->offset, true);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue