summary refs log tree commit diff stats
path: root/target/arm/helper.c
diff options
context:
space:
mode:
authorRichard Henderson <richard.henderson@linaro.org>2023-01-12 11:24:34 +0100
committerPeter Maydell <peter.maydell@linaro.org>2023-01-23 13:32:38 +0000
commitfccb49182e23bd359092f7ab09bc7e60a0fff71a (patch)
tree0c9c6a2e02f27a5472f03224146474e9475f6d7d /target/arm/helper.c
parent7f2a01e7368f960fadea38f437d0f6de7f249686 (diff)
downloadfocaccia-qemu-fccb49182e23bd359092f7ab09bc7e60a0fff71a.tar.gz
focaccia-qemu-fccb49182e23bd359092f7ab09bc7e60a0fff71a.zip
target/arm/sme: Reset ZA state in aarch64_set_svcr()
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Fabiano Rosas <farosas@suse.de>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-id: 20230112102436.1913-6-philmd@linaro.org
Message-Id: <20230112004322.161330-1-richard.henderson@linaro.org>
[PMD: Split patch in multiple tiny steps]
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'target/arm/helper.c')
-rw-r--r--target/arm/helper.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/target/arm/helper.c b/target/arm/helper.c
index 0ac867c411..564c5d9332 100644
--- a/target/arm/helper.c
+++ b/target/arm/helper.c
@@ -6743,6 +6743,18 @@ void aarch64_set_svcr(CPUARMState *env, uint64_t new, uint64_t mask)
     if (change & R_SVCR_SM_MASK) {
         arm_reset_sve_state(env);
     }
+
+    /*
+     * ResetSMEState.
+     *
+     * SetPSTATE_ZA zeros on enable and disable.  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.
+     */
+    if (change & new & R_SVCR_ZA_MASK) {
+        memset(env->zarray, 0, sizeof(env->zarray));
+    }
 }
 
 static void svcr_write(CPUARMState *env, const ARMCPRegInfo *ri,