Message ID | 20250124162836.2332150-4-peter.maydell@linaro.org (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | target/arm: Implement FEAT_AFP and FEAT_RPRES | expand |
On 1/24/25 08:27, Peter Maydell wrote: > The pseudocode ResetSVEState() does: > FPSR = ZeroExtend(0x0800009f<31:0>, 64); > but QEMU's arm_reset_sve_state() called vfp_set_fpcr() by accident. > > Before the advent of FEAT_AFP, this was only setting a collection of > RES0 bits, which vfp_set_fpsr() would then ignore, so the only effect > was that we didn't actually set the FPSR the way we are supposed to > do. Once FEAT_AFP is implemented, setting the bottom bits of FPSR > will change the floating point behaviour. > > Call vfp_set_fpsr(), as we ought to. > > (Note for stable backports: commit 7f2a01e7368f9 moved this function > from sme_helper.c to helper.c, but it had the same bug before the > move too.) > > Cc: qemu-stable@nongnu.org > Fixes: f84734b87461 ("target/arm: Implement SMSTART, SMSTOP") > Signed-off-by: Peter Maydell <peter.maydell@linaro.org> > --- > target/arm/helper.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/target/arm/helper.c b/target/arm/helper.c > index 63997678513..40bdfc851a5 100644 > --- a/target/arm/helper.c > +++ b/target/arm/helper.c > @@ -6413,7 +6413,7 @@ static void arm_reset_sve_state(CPUARMState *env) > memset(env->vfp.zregs, 0, sizeof(env->vfp.zregs)); > /* Recall that FFR is stored as pregs[16]. */ > memset(env->vfp.pregs, 0, sizeof(env->vfp.pregs)); > - vfp_set_fpcr(env, 0x0800009f); > + vfp_set_fpsr(env, 0x0800009f); > } > > void aarch64_set_svcr(CPUARMState *env, uint64_t new, uint64_t mask) Oops. Reviewed-by: Richard Henderson <richard.henderson@linaro.org> r~
diff --git a/target/arm/helper.c b/target/arm/helper.c index 63997678513..40bdfc851a5 100644 --- a/target/arm/helper.c +++ b/target/arm/helper.c @@ -6413,7 +6413,7 @@ static void arm_reset_sve_state(CPUARMState *env) memset(env->vfp.zregs, 0, sizeof(env->vfp.zregs)); /* Recall that FFR is stored as pregs[16]. */ memset(env->vfp.pregs, 0, sizeof(env->vfp.pregs)); - vfp_set_fpcr(env, 0x0800009f); + vfp_set_fpsr(env, 0x0800009f); } void aarch64_set_svcr(CPUARMState *env, uint64_t new, uint64_t mask)
The pseudocode ResetSVEState() does: FPSR = ZeroExtend(0x0800009f<31:0>, 64); but QEMU's arm_reset_sve_state() called vfp_set_fpcr() by accident. Before the advent of FEAT_AFP, this was only setting a collection of RES0 bits, which vfp_set_fpsr() would then ignore, so the only effect was that we didn't actually set the FPSR the way we are supposed to do. Once FEAT_AFP is implemented, setting the bottom bits of FPSR will change the floating point behaviour. Call vfp_set_fpsr(), as we ought to. (Note for stable backports: commit 7f2a01e7368f9 moved this function from sme_helper.c to helper.c, but it had the same bug before the move too.) Cc: qemu-stable@nongnu.org Fixes: f84734b87461 ("target/arm: Implement SMSTART, SMSTOP") Signed-off-by: Peter Maydell <peter.maydell@linaro.org> --- target/arm/helper.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)