qemu-arm
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 30/71] target/arm: Implement SMSTART, SMSTOP


From: Peter Maydell
Subject: Re: [PATCH 30/71] target/arm: Implement SMSTART, SMSTOP
Date: Mon, 6 Jun 2022 17:50:13 +0100

On Thu, 2 Jun 2022 at 23:09, Richard Henderson
<richard.henderson@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.henderson@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.maydell@linaro.org>

thanks
-- PMM



reply via email to

[Prev in Thread] Current Thread [Next in Thread]