[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 13/26] target/arm/sme: Reorg SME access handling in handle_msr_i()
From: |
Peter Maydell |
Subject: |
[PULL 13/26] target/arm/sme: Reorg SME access handling in handle_msr_i() |
Date: |
Mon, 23 Jan 2023 13:35:40 +0000 |
From: Richard Henderson <richard.henderson@linaro.org>
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-2-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>
---
target/arm/translate-a64.c | 24 +++++++++++++-----------
1 file changed, 13 insertions(+), 11 deletions(-)
diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c
index 2ee171f249c..35cc851246f 100644
--- a/target/arm/translate-a64.c
+++ b/target/arm/translate-a64.c
@@ -1841,18 +1841,20 @@ static void handle_msr_i(DisasContext *s, uint32_t insn,
goto do_unallocated;
}
if (sme_access_check(s)) {
- bool i = crm & 1;
- bool changed = false;
+ int old = s->pstate_sm | (s->pstate_za << 1);
+ int new = (crm & 1) * 3;
+ int msk = (crm >> 1) & 3;
- if ((crm & 2) && i != s->pstate_sm) {
- gen_helper_set_pstate_sm(cpu_env, tcg_constant_i32(i));
- changed = true;
- }
- if ((crm & 4) && i != s->pstate_za) {
- gen_helper_set_pstate_za(cpu_env, tcg_constant_i32(i));
- changed = true;
- }
- if (changed) {
+ if ((old ^ new) & msk) {
+ /* At least one bit changes. */
+ bool i = crm & 1;
+
+ if ((crm & 2) && i != s->pstate_sm) {
+ gen_helper_set_pstate_sm(cpu_env, tcg_constant_i32(i));
+ }
+ if ((crm & 4) && i != s->pstate_za) {
+ gen_helper_set_pstate_za(cpu_env, tcg_constant_i32(i));
+ }
gen_rebuild_hflags(s);
} else {
s->base.is_jmp = DISAS_NEXT;
--
2.34.1
- [PULL 08/26] hw/i2c/versatile_i2c: Drop useless casts from void * to pointer, (continued)
- [PULL 08/26] hw/i2c/versatile_i2c: Drop useless casts from void * to pointer, Peter Maydell, 2023/01/23
- [PULL 06/26] hw/i2c/bitbang_i2c: Trace state changes, Peter Maydell, 2023/01/23
- [PULL 10/26] hw/i2c/versatile_i2c: Replace TYPE_VERSATILE_I2C -> TYPE_ARM_SBCON_I2C, Peter Maydell, 2023/01/23
- [PULL 05/26] hw/i2c/bitbang_i2c: Change state calling bitbang_i2c_set_state() helper, Peter Maydell, 2023/01/23
- [PULL 12/26] hw/i2c/versatile_i2c: Rename versatile_i2c -> arm_sbcon_i2c, Peter Maydell, 2023/01/23
- [PULL 17/26] target/arm/sme: Reset ZA state in aarch64_set_svcr(), Peter Maydell, 2023/01/23
- [PULL 23/26] target/arm: implement DBGCLAIM registers, Peter Maydell, 2023/01/23
- [PULL 20/26] target/arm: Fix physical address resolution for MTE, Peter Maydell, 2023/01/23
- [PULL 25/26] target/arm: Reorg do_coproc_insn, Peter Maydell, 2023/01/23
- [PULL 14/26] target/arm/sme: Rebuild hflags in set_pstate() helpers, Peter Maydell, 2023/01/23
- [PULL 13/26] target/arm/sme: Reorg SME access handling in handle_msr_i(),
Peter Maydell <=
- [PULL 24/26] target/arm: provide stubs for more external debug registers, Peter Maydell, 2023/01/23
- [PULL 26/26] target/arm: Look up ARMCPRegInfo at runtime, Peter Maydell, 2023/01/23
- Re: [PULL 00/26] target-arm queue, Peter Maydell, 2023/01/23