diff options
| author | Daniel Henrique Barboza <daniel.barboza@oss.qualcomm.com> | 2026-05-27 18:30:34 -0300 |
|---|---|---|
| committer | Michael Tokarev <mjt@tls.msk.ru> | 2026-06-17 08:31:57 +0300 |
| commit | 38f9b1ab7e6e0bd40770503df6a7926dba9d41ec (patch) | |
| tree | c67e80dc22a0d5e162c726db7eaaf758dba16629 | |
| parent | 7ff877d4a5e7d36b9b113764187fb42c495ea73a (diff) | |
| download | qemu-38f9b1ab7e6e0bd40770503df6a7926dba9d41ec.tar.gz qemu-38f9b1ab7e6e0bd40770503df6a7926dba9d41ec.zip | |
target/riscv/tcg: disable svnapot if satp_mode < sv39
We did a recent change to disable svpbmt if satp_mode < sv39 that was
discovered via a gitlab report.
This time we don't have an opened bug but the problem is similar: RISC-V
privileged ISA, chapter '"Svnapot" Extension for NAPOT Translation
Contiguity, Version 1.0' states:
"The Svnapot extension depends on the Sv39 extension."
Do the same thing with svnapot, including the user warning in case we
try to enable it without the required satp_mode:
$ ./build/qemu-system-riscv64 -M virt,dumpdtb=fdt.dtb \
-cpu max,sv39=off,sv48=off,sv57=off,sv64=off,svnapot=on
qemu-system-riscv64: warning: svnapot requires at least satp sv39, current satp mode: none
Signed-off-by: Daniel Henrique Barboza <daniel.barboza@oss.qualcomm.com>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Message-ID: <20260527213034.2094103-1-daniel.barboza@oss.qualcomm.com>
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
(cherry picked from commit 601c8494c6c7e73f5b3f30b5823de2c13c003990)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
| -rw-r--r-- | target/riscv/tcg/tcg-cpu.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/target/riscv/tcg/tcg-cpu.c b/target/riscv/tcg/tcg-cpu.c index c4dfa4ac09..8f8da3e612 100644 --- a/target/riscv/tcg/tcg-cpu.c +++ b/target/riscv/tcg/tcg-cpu.c @@ -871,6 +871,16 @@ void riscv_cpu_validate_set_extensions(RISCVCPU *cpu, Error **errp) riscv_cpu_is_32bit(cpu))); } } + + if (cpu->cfg.ext_svnapot && cpu->cfg.max_satp_mode < VM_1_10_SV39) { + cpu->cfg.ext_svnapot = false; + if (cpu_cfg_ext_is_user_set(CPU_CFG_OFFSET(ext_svnapot))) { + warn_report("svnapot requires at least satp sv39, " + "current satp mode: %s", + satp_mode_str(cpu->cfg.max_satp_mode, + riscv_cpu_is_32bit(cpu))); + } + } #endif /* * Disable isa extensions based on priv spec after we |
