summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrédéric Pétrot <frederic.petrot@univ-grenoble-alpes.fr>2026-08-19 12:56:55 +0200
committerMichael Tokarev <mjt@tls.msk.ru>2026-08-24 22:01:49 +0300
commit486ce35b39b6e8efaff7946cdd7ffd7ec7001553 (patch)
tree9b84f0cec829417a52801c6fc2f43f01b9a1af6d
parent2c0db8a985e7ee2740b16fc7b373da16a41b7d97 (diff)
downloadqemu-486ce35b39b6e8efaff7946cdd7ffd7ec7001553.tar.gz
qemu-486ce35b39b6e8efaff7946cdd7ffd7ec7001553.zip
target/riscv: Allow UXL to be 3 in mstatus on rv128
Valid UXL field values for mstatus were restricted to fix a reported issue, but this inadvertently broke the experimental rv128 support where a value of 3 validly represents 128-bit execution. Update the mstatus write logic to permit UXL=3 when running on an rv128 CPU. Fixes: dcd028517749 ("target/riscv: Apply UXL WARL handling to vsstatus") Signed-off-by: Frédéric Pétrot <frederic.petrot@univ-grenoble-alpes.fr> Reviewed-by: Daniel Henrique Barboza <daniel.barboza@oss.qualcomm.com> Reviewed-by: Chao Liu <chao.liu@processmission.com> Message-ID: <20260819105655.33391-3-frederic.petrot@univ-grenoble-alpes.fr> Signed-off-by: Alistair Francis <alistair.francis@wdc.com> (cherry picked from commit a9779d24be31338d90aa19a560e69cc4c9660627) Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
-rw-r--r--target/riscv/tcg/csr.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/target/riscv/tcg/csr.c b/target/riscv/tcg/csr.c
index ffd751caa5..23fc77e310 100644
--- a/target/riscv/tcg/csr.c
+++ b/target/riscv/tcg/csr.c
@@ -2014,8 +2014,8 @@ static uint64_t riscv_write_uxl(CPURISCVState *env, uint64_t val,
RISCVMXL xl = riscv_cpu_mxl(env);
uint64_t uxl = get_field(val, field);
- if (uxl == MXL_RV128) {
- uxl = xl == MXL_RV128 ? MXL_RV64 : xl;
+ if (xl != MXL_RV128 && uxl == MXL_RV128) {
+ uxl = xl;
val = set_field(val, field, uxl);
}