@@ -494,8 +494,24 @@ static void mips_cpu_realizefn(DeviceState *dev, Error **errp)
mcc->parent_realize(dev, errp);
}
+static bool mips_get_msa_on(Object *obj, Error **errp)
+{
+ MIPSCPU *cpu = MIPS_CPU(obj);
+ CPUMIPSState *env = &cpu->env;
+ return env->msa_on;
+}
+
+static void mips_set_msa_on(Object *obj, bool value, Error **errp)
+{
+ MIPSCPU *cpu = MIPS_CPU(obj);
+ CPUMIPSState *env = &cpu->env;
+ env->msa_on = value;
+}
+
static void mips_cpu_initfn(Object *obj)
{
+ object_property_add_bool(obj, "msa", mips_get_msa_on, mips_set_msa_on);
+ object_property_set_bool(obj, "msa", false, NULL);
MIPSCPU *cpu = MIPS_CPU(obj);
CPUMIPSState *env = &cpu->env;
MIPSCPUClass *mcc = MIPS_CPU_GET_CLASS(obj);
@@ -1191,6 +1191,7 @@ typedef struct CPUArchState {
QEMUTimer *timer; /* Internal timer */
Clock *count_clock; /* CP0_Count clock */
target_ulong exception_base; /* ExceptionBase input to the core */
+ bool msa_on; /* Enable MSA using a CLI flag -cpu ...,msa=on/off */
} CPUMIPSState;
/**
@@ -399,7 +399,7 @@ static inline void compute_hflags(CPUMIPSState *env)
}
}
if (ase_msa_available(env)) {
- if (env->CP0_Config5 & (1 << CP0C5_MSAEn)) {
+ if ((env->CP0_Config5 & (1 << CP0C5_MSAEn)) || (env->msa_on)) {
env->hflags |= MIPS_HFLAG_MSA;
}
}
Enable MSA ASE using a CLI flag -cpu <cpu>,msa=on. Signed-off-by: Aleksandar Rakic <aleksandar.rakic@htecgroup.com> --- target/mips/cpu.c | 16 ++++++++++++++++ target/mips/cpu.h | 1 + target/mips/internal.h | 2 +- 3 files changed, 18 insertions(+), 1 deletion(-)