On Thu, 2 Jun 2022 at 23:09, Richard Henderson <richard.hender...@linaro.org> wrote: > > These two instructions are aliases of MSR (immediate). > Use the two helpers to properly implement svcr_write. > > Signed-off-by: Richard Henderson <richard.hender...@linaro.org>
> +/* ResetSVEState */ > +void arm_reset_sve_state(CPUARMState *env) > +{ > + memset(env->vfp.zregs, 0, sizeof(env->vfp.zregs)); > + memset(env->vfp.pregs, 0, sizeof(env->vfp.pregs)); > + vfp_set_fpcr(env, 0x0800009f); > +} Would be helpful to have a brief comment reminding the reader that this includes clearing FFR because QEMU keeps that in pregs[16]. > + > +void helper_set_pstate_sm(CPUARMState *env, uint32_t i) > +{ > + if (i == FIELD_EX64(env->svcr, SVCR, SM)) { > + return; > + } > + env->svcr ^= R_SVCR_SM_MASK; > + arm_reset_sve_state(env); > +} > + > +void helper_set_pstate_za(CPUARMState *env, uint32_t i) > +{ > + if (i == FIELD_EX64(env->svcr, SVCR, ZA)) { > + return; > + } > + env->svcr ^= R_SVCR_ZA_MASK; > + > + /* > + * ResetSMEState. > + * > + * SetPSTATE_ZA zeros on enable and disable. It would appear that we > + * can zero this only on enable: while disabled, the storage is > + * inaccessible and the value does not matter. We're not saving the > + * storage in vmstate when disabled either. > + */ Correct. You can drop the "It would appear" :-) > + if (i) { > + memset(env->zarray, 0, sizeof(env->zarray)); > + } > +} Otherwise Reviewed-by: Peter Maydell <peter.mayd...@linaro.org> thanks -- PMM